brianfunk/capstring

View on GitHub

Showing 49 of 49 total issues

Function cap has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

var cap = function(str,c) {

    var nstr = '';
    
    if (c === 'same') {        
Severity: Minor
Found in index.js - 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

Function cap has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var cap = function(str,c) {

    var nstr = '';
    
    if (c === 'same') {        
Severity: Major
Found in index.js - About 2 hrs to fix

    Avoid too many return statements within this function.
    Open

            return str.toLowerCase();
    Severity: Major
    Found in index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return nstr;
      Severity: Major
      Found in index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return str.toUpperCase();
        Severity: Major
        Found in index.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return str.toLowerCase().replace(/i/g, '1').replace(/e/g, '3').replace(/o/g, '0').replace(/l/g, '£').replace(/f/g, 'ƒ').replace(/s/g, '$').replace(/n/g, 'И');
          Severity: Major
          Found in index.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return str.charAt(0).toLowerCase() + cap(str, 'pascal').substr(1);
            Severity: Major
            Found in index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return str.replace(/ /g, '_');
              Severity: Major
              Found in index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();
                Severity: Major
                Found in index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return cap(str, 'title').replace(/ /g, '');
                  Severity: Major
                  Found in index.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return str.split('').reverse().join('');
                    Severity: Major
                    Found in index.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return nstr;
                      Severity: Major
                      Found in index.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return str.toUpperCase().replace(/ /g, '_');
                        Severity: Major
                        Found in index.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return str;
                          Severity: Major
                          Found in index.js - About 30 mins to fix

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

                            var string = function(s, opt) {
                                
                                if (!s) {
                                    console.log('s false : ' + s);
                                    return false;
                            Severity: Minor
                            Found in index.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

                            Line length
                            Open

                            Please note we have a code of conduct, please follow it in all your interactions with the project.
                            Severity: Info
                            Found in CONTRIBUTING.md by markdownlint

                            MD013 - Line length

                            Tags: line_length

                            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                            Line length
                            Open

                            When contributing to this repository, please first discuss the change you wish to make via issue,
                            Severity: Info
                            Found in CONTRIBUTING.md by markdownlint

                            MD013 - Line length

                            Tags: line_length

                            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                            Line length
                            Open

                            4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 
                            Severity: Info
                            Found in CONTRIBUTING.md by markdownlint

                            MD013 - Line length

                            Tags: line_length

                            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                            Trailing spaces
                            Open

                                
                            Severity: Info
                            Found in README.md by markdownlint

                            MD009 - Trailing spaces

                            Tags: whitespace

                            Aliases: no-trailing-spaces

                            Parameters: br_spaces (number; default: 0)

                            This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

                            The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

                            Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

                            Line length
                            Open

                            This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
                            Severity: Info
                            Found in CONTRIBUTING.md by markdownlint

                            MD013 - Line length

                            Tags: line_length

                            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                            Severity
                            Category
                            Status
                            Source
                            Language