soderlind/lorem-shortcode

View on GitHub

Showing 5 of 21 total issues

Function exports has 192 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 lorem has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function lorem( $atts, $content = null ) {
            $atts = shortcode_atts( array(// default values
                'w'     => 5,
                'p'     => 5,
                'l'     => 3,
    Severity: Major
    Found in lorem-shortcode.php - About 2 hrs to fix

      Method __construct has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function __construct() {
              add_shortcode( 'lorem', array( $this, 'lorem' ) );
              add_shortcode( 'loremimage', array( $this, 'loremimage' ) );
      
              /**
      Severity: Minor
      Found in lorem-shortcode.php - About 1 hr to fix

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

            function lorem( $atts, $content = null ) {
                $atts = shortcode_atts( array(// default values
                    'w'     => 5,
                    'p'     => 5,
                    'l'     => 3,
        Severity: Minor
        Found in lorem-shortcode.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 loremimage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function loremimage( $atts ) {
                $atts = shortcode_atts( array(// default values
                    'size'    => '300x200', // alternative sizes, see http://dummyimage.com/
                    'text'    => '',
                    'bgcolor' => 'eee',
        Severity: Minor
        Found in lorem-shortcode.php - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language