fixate/pw-mvc-boilerplate

View on GitHub

Showing 27 of 27 total issues

Function clickToggler has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export default function clickToggler(selector, opts = {}) {
  const elementPairs = [...document.querySelectorAll(selector)].map(elem => (
    {
      target: document.querySelector(elem.getAttribute('data-target')),
      trigger: elem,
Severity: Minor
Found in assets/js/lib/click-toggler.js - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function call has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  public function call()
  {
    $req = $this->request = f8\HttpRequest::instance();
    $this->response = new f8\HttpResponse();
    $method = strtolower($req->method());
Severity: Minor
Found in core/ApiController.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function clickToggler has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function clickToggler(selector, opts = {}) {
  const elementPairs = [...document.querySelectorAll(selector)].map(elem => (
    {
      target: document.querySelector(elem.getAttribute('data-target')),
      trigger: elem,
Severity: Major
Found in assets/js/lib/click-toggler.js - About 3 hrs to fix

    Function __call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __call($method, $args)
        {
            if (property_exists(__CLASS__, $method) && is_callable($method)) {
                return call_user_func_array(array($this, $method), $args);
            } else {
    Severity: Minor
    Found in core/View.php - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method call has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function call()
      {
        $req = $this->request = f8\HttpRequest::instance();
        $this->response = new f8\HttpResponse();
        $method = strtolower($req->method());
    Severity: Major
    Found in core/ApiController.php - About 2 hrs to fix

      Function ls has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function ls($path, $extension = null)
          {
              $result = array();
              if ($handle = opendir($path)) {
                  while (($file = readdir($handle)) !== false) {
      Severity: Minor
      Found in core/Utils.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function get_page_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        protected function get_page_data($page, array $fields = [])
        {
          $outputFormatting = $page->outputFormatting;
          $page->setOutputFormatting(false);
      
      
      Severity: Minor
      Found in core/ApiController.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method init has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function init($config, $fields, $input, $page, $pages, $permissions, $roles, $sanitizer, $session, $templates, $user, $users)
      Severity: Major
      Found in core/Application.php - About 1 hr to fix

        Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function __construct(&$config, &$fields, &$input, &$page, &$pages, &$permissions, &$roles, &$sanitizer, &$session, &$templates, &$user, &$users)
        Severity: Major
        Found in core/Controller.php - About 1 hr to fix

          Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            public function __construct(&$config, &$fields, &$input, &$page, &$pages, &$permissions, &$roles, &$sanitizer, &$session, &$templates, &$user, &$users)
          Severity: Major
          Found in core/ApiController.php - About 1 hr to fix

            Method get_page_data has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              protected function get_page_data($page, array $fields = [])
              {
                $outputFormatting = $page->outputFormatting;
                $page->setOutputFormatting(false);
            
            
            Severity: Minor
            Found in core/ApiController.php - About 1 hr to fix

              Method render_file has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function render_file($file, $_data = array(), $fallback = null)
                  {
                      if (!isset($this->data)) {
                          $this->data = array();
                      }
              Severity: Minor
              Found in core/View.php - About 1 hr to fix

                Method dynamic_load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function dynamic_load($app)
                    {
                        $config = $app->config;
                        $fields = $app->fields;
                        $input = $app->input;
                Severity: Minor
                Found in core/Controller.php - About 1 hr to fix

                  Function assets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assets($path, $use_min = true)
                      {
                          $is_production = Environment::is_production();
                          if ($is_production) {
                              // If use MD5# manifest in use get proper path
                  Severity: Minor
                  Found in core/View.php - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function __og_render_tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function __og_render_tags($tags)
                      {
                          $html = '';
                          foreach ($tags as $name => $value) {
                              if ($value !== null) {
                  Severity: Minor
                  Found in controllers/traits/open_graph.php - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method get_contact_form has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    protected function get_contact_form()
                    {
                      $can_send = false;
                      $form_has_errors = false;
                      $input = $this->input;
                  Severity: Minor
                  Found in controllers/ContactController.php - About 1 hr to fix

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function __callStatic($method, $args)
                        {
                            if (method_exists(__CLASS__, $method)) {
                                return call_user_func_array(array(self, $method), $args);
                            }
                    Severity: Minor
                    Found in core/Environment.php and 1 other location - About 55 mins to fix
                    core/Manifest.php on lines 56..69

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 99.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function __callStatic($method, $args)
                        {
                            if (method_exists(__CLASS__, $method)) {
                                return call_user_func_array(array(self, $method), $args);
                            }
                    Severity: Minor
                    Found in core/Manifest.php and 1 other location - About 55 mins to fix
                    core/Environment.php on lines 47..60

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 99.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = array(), $code = 0)
                    Severity: Minor
                    Found in core/Exceptions.php - About 35 mins to fix

                      Function render_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function render_file($file, $_data = array(), $fallback = null)
                          {
                              if (!isset($this->data)) {
                                  $this->data = array();
                              }
                      Severity: Minor
                      Found in core/View.php - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language