jish/pre-commit

View on GitHub

Showing 259 of 259 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    rollupError: function(message, rule){
        this.messages.push({
            type    : "error",
            rollup  : true,
            message : message,
Severity: Minor
Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 45 mins to fix
lib/pre-commit/support/csslint/csslint.js on lines 6810..6817

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid deeply nested control flow statements.
Open

                        if (v === 'unused') {
                            unused.push({
                                name: n,
                                line: f['(line)'],
                                'function': f['(name)']
Severity: Major
Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                        if (unary === null){
                            line = tokenStream.token().startLine;
                            col = tokenStream.token().startCol;
                        }
    Severity: Minor
    Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 40 mins to fix
    lib/pre-commit/support/csslint/csslint.js on lines 2874..2877

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    if (unary !== null){
                        line = tokenStream.token().startLine;
                        col = tokenStream.token().startCol;
                    }
    Severity: Minor
    Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 40 mins to fix
    lib/pre-commit/support/csslint/csslint.js on lines 2883..2886

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Consider simplifying this complex logical expression.
    Open

            } else if (a === 'href' || a === 'background' ||
                    a === 'content' || a === 'data' ||
                    a.indexOf('src') >= 0 || a.indexOf('url') >= 0) {
                if (option.safe && ux.test(v)) {
                    error("ADsafe URL violation.");
    Severity: Major
    Found in lib/pre-commit/support/jslint/lint.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                                          if ((c < '0' || c > '9') &&
                                                  (c < 'a' || c > 'f') &&
                                                  (c < 'A' || c > 'F')) {
                                              break;
                                          }
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                        if (nexttoken.id === '=' || nexttoken.value === '~=' ||
                                nexttoken.value === '$=' ||
                                nexttoken.value === '|=' ||
                                nexttoken.id === '*=' ||
                                nexttoken.id === '^=') {
        Severity: Major
        Found in lib/pre-commit/support/jslint/lint.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                                      if (!nexttoken.identifier &&
                                              nexttoken.id !== '"' &&
                                              nexttoken.id !== '\'' &&
                                              nexttoken.type !== '(string)' &&
                                              nexttoken.type !== '(number)' &&
          Severity: Major
          Found in lib/pre-commit/support/jslint/lint.js - About 40 mins to fix

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                                this.fire({
                                    type:       "endrule",
                                    selectors:  selectors,
                                    line:       selectors[0].line,
                                    col:        selectors[0].col
            Severity: Major
            Found in lib/pre-commit/support/csslint/csslint.js and 3 other locations - About 40 mins to fix
            lib/pre-commit/support/csslint/csslint.js on lines 2160..2165
            lib/pre-commit/support/csslint/csslint.js on lines 3172..3177
            lib/pre-commit/support/csslint/csslint.js on lines 3181..3186

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                                this.fire({
                                    type:       "startrule",
                                    selectors:  selectors,
                                    line:       selectors[0].line,
                                    col:        selectors[0].col
            Severity: Major
            Found in lib/pre-commit/support/csslint/csslint.js and 3 other locations - About 40 mins to fix
            lib/pre-commit/support/csslint/csslint.js on lines 2169..2174
            lib/pre-commit/support/csslint/csslint.js on lines 3172..3177
            lib/pre-commit/support/csslint/csslint.js on lines 3181..3186

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if (left.line === right.line && left.character === right.from) {
                            warning("Missing space after '{a}'.",
                                    nexttoken, left.value);
                        }
            Severity: Minor
            Found in lib/pre-commit/support/jslint/lint.js and 1 other location - About 40 mins to fix
            lib/pre-commit/support/jslint/lint.js on lines 2055..2057

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                            this.fire({
                                type:   "startkeyframerule",
                                keys:   keyList,
                                line:   keyList[0].line,
                                col:    keyList[0].col
            Severity: Major
            Found in lib/pre-commit/support/csslint/csslint.js and 3 other locations - About 40 mins to fix
            lib/pre-commit/support/csslint/csslint.js on lines 2160..2165
            lib/pre-commit/support/csslint/csslint.js on lines 2169..2174
            lib/pre-commit/support/csslint/csslint.js on lines 3181..3186

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if (left.character !== right.from && left.line === right.line) {
                            warning("Unexpected space after '{a}'.", right, left.value);
                        }
            Severity: Minor
            Found in lib/pre-commit/support/jslint/lint.js and 1 other location - About 40 mins to fix
            lib/pre-commit/support/jslint/lint.js on lines 2076..2079

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                            this.fire({
                                type:   "endkeyframerule",
                                keys:   keyList,
                                line:   keyList[0].line,
                                col:    keyList[0].col
            Severity: Major
            Found in lib/pre-commit/support/csslint/csslint.js and 3 other locations - About 40 mins to fix
            lib/pre-commit/support/csslint/csslint.js on lines 2160..2165
            lib/pre-commit/support/csslint/csslint.js on lines 2169..2174
            lib/pre-commit/support/csslint/csslint.js on lines 3172..3177

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function SelectorPart has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function SelectorPart(elementName, modifiers, text, line, col){
            Severity: Minor
            Found in lib/pre-commit/support/csslint/csslint.js - About 35 mins to fix

              Function createToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  createToken: function(tt, value, startLine, startCol, options){
              Severity: Minor
              Found in lib/pre-commit/support/csslint/csslint.js - About 35 mins to fix

                Function MediaQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function MediaQuery(modifier, mediaType, features, line, col){
                Severity: Minor
                Found in lib/pre-commit/support/csslint/csslint.js - About 35 mins to fix

                  Method call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def call(staged_files)
                          migration_files = versioned_migration_files(staged_files)
                          schema_files = versioned_schema_files(staged_files)
                  
                          if migration_files.any? && schema_files.none?
                  Severity: Minor
                  Found in lib/plugins/pre_commit/checks/migration.rb - 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

                  Method validate_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def validate_params
                        raise ArgumentError, "Missing name"               if name.nil?        || name.empty?
                        raise ArgumentError, "Missing author"             if author.nil?      || author.empty?
                        raise ArgumentError, "Missing email"              if email.nil?       || email.empty?
                        raise ArgumentError, "Missing description"        if description.nil? || description.empty?
                  Severity: Minor
                  Found in lib/pre-commit/template.rb - 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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  if (nexttoken.id === ';' || nexttoken.id === '!'  ||
                                          nexttoken.id === '(end)' || nexttoken.id === '}') {
                                      return true;
                                  }
                  Severity: Minor
                  Found in lib/pre-commit/support/jslint/lint.js and 1 other location - About 35 mins to fix
                  lib/pre-commit/support/jslint/lint.js on lines 4303..4312

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 46.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language