soderlind/css-flags

View on GitHub

Showing 4 of 284 total issues

Function exports has 186 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

    /**
     * Files added to WordPress SVN, don't include 'assets/**' here.
     * @type {Array}
Severity: Major
Found in Gruntfile.js - About 7 hrs to fix

    Method get_css has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function get_css() {
    
            $this->timer( 'start' );
    
            $cachetime = filter_var( apply_filters( 'css_flags_cachetime', 7200 ) , FILTER_VALIDATE_INT, array( 'default' => 7200 ) );
    Severity: Major
    Found in class-css-flags.php - About 2 hrs to fix

      Function get_css has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          private function get_css() {
      
              $this->timer( 'start' );
      
              $cachetime = filter_var( apply_filters( 'css_flags_cachetime', 7200 ) , FILTER_VALIDATE_INT, array( 'default' => 7200 ) );
      Severity: Minor
      Found in class-css-flags.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 cssflag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          function cssflag( $atts ) {
      
              $atr = shortcode_atts( array(
                  'countries' => 'all',
              ), $atts,'cssflag');
      Severity: Minor
      Found in sample-theme-functions.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