jish/pre-commit

View on GitHub

Showing 259 of 259 total issues

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

                while (tokenStream.peek() == Tokens.NAMESPACE_SYM){
                    this._namespace();
                    this._skipCruft();
                }
Severity: Minor
Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 35 mins to fix
lib/pre-commit/support/csslint/csslint.js on lines 1345..1348

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

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

                while (tokenStream.peek() == Tokens.IMPORT_SYM){
                    this._import();
                    this._skipCruft();
                }
Severity: Minor
Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 35 mins to fix
lib/pre-commit/support/csslint/csslint.js on lines 1351..1354

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

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

                    if (left.value !== 'Number' && left.value !== 'String' &&
                            left.value !== 'Boolean' &&
                            left.value !== 'Date') {
                        if (left.value === 'Math') {
                            warning("Math is not a function.", left);
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 2935..2938

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

Avoid too many return statements within this function.
Open

                            return it('(number)', t);
Severity: Major
Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                                return it('(punctuator)', t);
    Severity: Major
    Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                                  return it('(punctuator)', t);
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return match;
        Severity: Major
        Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                                  return;
          Severity: Major
          Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                        return it('(punctuator)', t);
            Severity: Major
            Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                              return it('(regexp)', c);
              Severity: Major
              Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

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

                                    this.fire({
                                        type:   "import",
                                        uri:    uri,
                                        media:  mediaList,
                                        line:   importToken.startLine,
                Severity: Minor
                Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 30 mins to fix
                lib/pre-commit/support/csslint/csslint.js on lines 3114..3120
                lib/pre-commit/support/csslint/csslint.js on lines 3132..3138

                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 45.

                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 too many return statements within this function.
                Open

                                                        return it('(regexp)', c);
                Severity: Major
                Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                                  return it('(color)', t);
                  Severity: Major
                  Found in lib/pre-commit/support/jslint/lint.js - About 30 mins to fix

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

                                    this.fire({
                                        type:   "startkeyframes",
                                        name:   name,
                                        prefix: prefix,
                                        line:   token.startLine,
                    Severity: Minor
                    Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 30 mins to fix
                    lib/pre-commit/support/csslint/csslint.js on lines 1528..1534
                    lib/pre-commit/support/csslint/csslint.js on lines 3132..3138

                    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 45.

                    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 3 locations. Consider refactoring.
                    Open

                                    this.fire({
                                        type:   "endkeyframes",
                                        name:   name,
                                        prefix: prefix,
                                        line:   token.startLine,
                    Severity: Minor
                    Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 30 mins to fix
                    lib/pre-commit/support/csslint/csslint.js on lines 1528..1534
                    lib/pre-commit/support/csslint/csslint.js on lines 3114..3120

                    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 45.

                    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

                    Method [] has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def [](name)
                              value = super(name)
                              if
                                name == :checks && value && ! value.kind_of?(Array)
                              then
                    Severity: Minor
                    Found in lib/plugins/pre_commit/configuration/providers/git_old.rb - 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

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

                          def call(staged_files)
                            require 'rubocop'
                          rescue LoadError => e
                            $stderr.puts "Could not find rubocop: #{e}"
                          else
                    Severity: Minor
                    Found in lib/plugins/pre_commit/checks/rubocop.rb - 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

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

                          def call(staged_files)
                            staged_files = staged_files.grep(/\.json$/)
                            return if staged_files.empty?
                    
                            errors = staged_files.map {|file| load_file(file)}.compact
                    Severity: Minor
                    Found in lib/plugins/pre_commit/checks/json.rb and 1 other location - About 15 mins to fix
                    lib/plugins/pre_commit/checks/yaml.rb on lines 17..23

                    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 26.

                    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

                          def call(staged_files)
                            staged_files = staged_files.grep(/\.(yml|yaml)$/)
                            return if staged_files.empty?
                    
                            errors = staged_files.map {|file| load_file(file)}.compact
                    Severity: Minor
                    Found in lib/plugins/pre_commit/checks/yaml.rb and 1 other location - About 15 mins to fix
                    lib/plugins/pre_commit/checks/json.rb on lines 7..13

                    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 26.

                    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