kpumuk/codecolorer

View on GitHub

Showing 21 of 289 total issues

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

    protected static function populateDefaultValues($options)
    {
        if (!$options) {
            $options = array();
        }
Severity: Minor
Found in codecolorer-options.php - 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

Method show has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show()
    {
        ?>

        <div class="wrap">
Severity: Major
Found in codecolorer-admin.php - About 4 hrs to fix

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

      parseOptions: function(f, code) {
        var matches = code.match(/(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[\/cc\2\](\s*)/);
        if (matches) {
          var options = matches[3].split(/\s+/);
          for (var i = options.length; i--; ) {
    Severity: Minor
    Found in js/tinymce_dialog.js - 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 performHighlightGeshi has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        private function performHighlightGeshi($content, $options)
        {
            /* Geshi configuration */
            if (!$this->geshi) {
                $this->geshi = new GeSHi();
    Severity: Minor
    Found in codecolorer-core.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

    File codecolorer-core.php has 319 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
    CodeColorer plugin core part
    https://kpumuk.info/projects/wordpress-plugins/codecolorer
    */
    Severity: Minor
    Found in codecolorer-core.php - About 3 hrs to fix

      Method populateDefaultValues has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected static function populateDefaultValues($options)
          {
              if (!$options) {
                  $options = array();
              }
      Severity: Major
      Found in codecolorer-options.php - About 3 hrs to fix

        Method performHighlightGeshi has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function performHighlightGeshi($content, $options)
            {
                /* Geshi configuration */
                if (!$this->geshi) {
                    $this->geshi = new GeSHi();
        Severity: Major
        Found in codecolorer-core.php - About 2 hrs to fix

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

              private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
              {
                  // Parse options
                  $options = CodeColorerOptions::parseOptions($opts, $suffix);
          
          
          Severity: Major
          Found in codecolorer-core.php - About 2 hrs to fix

            Function insert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              insert: function() {
                var ed = tinyMCEPopup.editor, t, h, f = document.forms[0], st = '';
            
                t = 'cce'
                
            Severity: Minor
            Found in js/tinymce_dialog.js - 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

            Function insert has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              insert: function() {
                var ed = tinyMCEPopup.editor, t, h, f = document.forms[0], st = '';
            
                t = 'cce'
                
            Severity: Minor
            Found in js/tinymce_dialog.js - About 1 hr to fix

              Method enable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function enable()
                  {
                      $path = dirname(__FILE__);
                      if (!file_exists("$path/codecolorer-core.php")) {
                          return false;
              Severity: Minor
              Found in codecolorer.php - About 1 hr to fix

                Function getInstance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function &getInstance()
                    {
                        static $instance = null;
                
                        if (null === $instance) {
                Severity: Minor
                Found in codecolorer-core.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 performHighlightCodeBlock has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
                    {
                        // Parse options
                        $options = CodeColorerOptions::parseOptions($opts, $suffix);
                
                
                Severity: Minor
                Found in codecolorer-core.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 parseOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function parseOptions($opts, $suffix = '')
                    {
                        $opts = str_replace(array("\\\"", "\\\'"), array ("\"", "\'"), $opts);
                        preg_match_all('#([a-z_-]*?)\s*=\s*(["\'])(.*?)\2#i', $opts, $matches, PREG_SET_ORDER);
                        $options = array();
                Severity: Minor
                Found in codecolorer-options.php - About 1 hr to fix

                  Function parseOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    parseOptions: function(f, code) {
                      var matches = code.match(/(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[\/cc\2\](\s*)/);
                      if (matches) {
                        var options = matches[3].split(/\s+/);
                        for (var i = options.length; i--; ) {
                  Severity: Minor
                  Found in js/tinymce_dialog.js - About 1 hr to fix

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

                        private function addContainer($html, $options, $numLines)
                        {
                            $customCSSClass = empty($options['class']) ? '' : ' ' . $options['class'];
                            if ($options['inline']) {
                                $theme = empty($options['inline_theme']) ? 'default' : $options['inline_theme'];
                    Severity: Minor
                    Found in codecolorer-core.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 beforeHighlightCodeBlock has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function beforeHighlightCodeBlock($content)
                        {
                            $helper = $this;
                    
                            $content = preg_replace_callback(
                    Severity: Minor
                    Found in codecolorer-core.php - About 1 hr to fix

                      Method addContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function addContainer($html, $options, $numLines)
                          {
                              $customCSSClass = empty($options['class']) ? '' : ' ' . $options['class'];
                              if ($options['inline']) {
                                  $theme = empty($options['inline_theme']) ? 'default' : $options['inline_theme'];
                      Severity: Minor
                      Found in codecolorer-core.php - About 1 hr to fix

                        Function parseOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function parseOptions($opts, $suffix = '')
                            {
                                $opts = str_replace(array("\\\"", "\\\'"), array ("\"", "\'"), $opts);
                                preg_match_all('#([a-z_-]*?)\s*=\s*(["\'])(.*?)\2#i', $opts, $matches, PREG_SET_ORDER);
                                $options = array();
                        Severity: Minor
                        Found in codecolorer-options.php - About 55 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 performHighlightCodeBlock has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
                        Severity: Minor
                        Found in codecolorer-core.php - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language