wadmiraal/rtfm

View on GitHub

Showing 10 of 24 total issues

Function register has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    register: function( string ) {
        var parts = [],
            stride = '',
            open = false,
            part;
Severity: Minor
Found in lib/rtfm-code.js - About 5 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 register has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    register: function( string ) {
        var parts = [],
            stride = '',
            open = false,
            part;
Severity: Major
Found in lib/rtfm-code.js - About 2 hrs to fix

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

        register: function( string ) {
            if ( this.pattern === undefined ) {
                return false;
            }
    
    
    Severity: Minor
    Found in lib/rtfm.js - 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 register has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        register: function( string ) {
            if ( this.regEx === undefined ) {
                this.regEx = new RegExp( /\[([^:]*)?:?([^\]]*)\]/g );
            }
            
    Severity: Minor
    Found in lib/rtfm-image.js - About 1 hr to fix

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

      rtfm.findInlinePlugins = function( string ) {
          var parts = [],
              result, merge;
      
          // Iterate through all registered inline plugins.
      Severity: Minor
      Found in lib/rtfm.js - 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 register has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          register: function( string ) {
              if ( this.pattern === undefined ) {
                  return false;
              }
      
      
      Severity: Minor
      Found in lib/rtfm.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            switch ( type ) {
                                case 'inline':
                                    rtfm.registerInlinePlugin( plugins[ type ][ i ], definition );
                                    break;
        
        
        Severity: Major
        Found in bin/cli.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if ( /^\}\}/.test( part ) ) {
                                  // Skip 1 character ahead, because the tag was at the
                                  // start of the string.
                                  i += 1;
                                  continue;
          Severity: Major
          Found in lib/rtfm-code.js - About 45 mins to fix

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

                register: function( string ) {
                    if ( this.regEx === undefined ) {
                        this.regEx = new RegExp( /\[([^:]*)?:?([^\]]*)\]/g );
                    }
                    
            Severity: Minor
            Found in lib/rtfm-image.js - 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 extend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            rtfm.extend = function( object ) {
                var inheritFrom = Array.prototype.slice.call( arguments, 1 );
                for ( var i = 0, len = inheritFrom.length; i < len; ++i ) {
                  if ( inheritFrom[ i ] ) {
                    for ( var prop in inheritFrom[ i ] ) {
            Severity: Minor
            Found in lib/rtfm.js - 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