PressLabs/toplytics

View on GitHub

Showing 56 of 56 total issues

Function serviceDisconnect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function serviceDisconnect($programatic = false, $silent = false)
    {
        if (empty($_POST['ToplyticsSubmitAccountDisconnect']) && !$programatic) {
            return;
        }
Severity: Minor
Found in src/components/Backend.php - About 45 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

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

    public function notifyAdmins($type, $message, $dismiss = true, $style = '', $lateLoad = false)
Severity: Minor
Found in src/components/Window.php - About 35 mins to fix

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

        public function addAction($hook, $component, $callback, $priority = 10, $accepted_args = 1)
    Severity: Minor
    Found in src/components/Loader.php - About 35 mins to fix

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

          public function addFilter($hook, $component, $callback, $priority = 10, $accepted_args = 1)
      Severity: Minor
      Found in src/components/Loader.php - About 35 mins to fix

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

            public function checkAuthorization()
            {
                if (isset($_GET['code']) && $_GET['page'] === 'toplytics') {
                    if (isset($_GET['status']) && $_GET['status'] && $_GET['status'] == 'error') {
                        $get_error = filter_input(INPUT_GET, 'code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        Severity: Minor
        Found in src/components/Backend.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

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

            public function notifyAdmins($type, $message, $dismiss = true, $style = '', $lateLoad = false)
            {
                if (!$type || !$message) {
                    return false;
                }
        Severity: Minor
        Found in src/components/Window.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

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

            public function profileSelect()
            {
                if (empty($_POST['ToplyticsProfileSelect']) || (empty($_POST['profile_id']) && empty($_POST['property_id']))) {
                    return false;
                }
        Severity: Minor
        Found in src/components/Backend.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

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

            private function validateArgs($args)
            {
                if ( ! empty( $args['showviews'] ) ) { // showviews (true/false - default=false)
                    $args['showviews'] = true;
                } else {
        Severity: Minor
        Found in src/components/Shortcode.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

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

            public function validateGoogleConfig($googleconfig, $skipUriCheck = false)
            {
                if (!is_object($googleconfig)) {
                    return false;
                }
        Severity: Minor
        Found in src/components/Backend.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

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

            public function pluginUpgradeComplete( $upgraderObject, $options ) {
                // If an update has taken place and the updated type is plugins and the plugins element exists
                if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
                    // Iterate through the plugins being updated and check if ours is there
                    foreach( $options['plugins'] as $plugin ) {
        Severity: Minor
        Found in src/components/Backend.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

        Avoid too many return statements within this method.
        Open

                    return true;
        Severity: Major
        Found in src/components/Backend.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return false;
          Severity: Major
          Found in src/components/Backend.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in src/components/Backend.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $googleconfig;
              Severity: Major
              Found in src/components/Backend.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return true;
                Severity: Major
                Found in src/components/Backend.php - About 30 mins to fix

                  Function update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function update($new_instance, $old_instance)
                      {
                          $instance = $old_instance;
                          $instance['title'] = strip_tags($new_instance['title']);
                  
                  
                  Severity: Minor
                  Found in src/components/Widget.php - About 25 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