jish/pre-commit

View on GitHub

Showing 259 of 259 total issues

Function cssUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function cssUrl() {
        var c, url;
        if (nexttoken.identifier && nexttoken.value === 'url') {
            nexttoken = lex.range('(', ')');
            url = nexttoken.value;
Severity: Minor
Found in lib/pre-commit/support/jslint/lint.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                if (!left.identifier && left.id !== '.' && left.id !== '[' &&
                        left.id !== '(' && left.id !== '&&' && left.id !== '||' &&
                        left.id !== '?') {
                    warning("Bad invocation.", left);
                }
    Severity: Major
    Found in lib/pre-commit/support/jslint/lint.js - About 1 hr to fix

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

                  if (nexttoken.id === ',') {
                      comma();
                      if (nexttoken.type !== '(string)') {
                          warning("Expected a string and instead saw '{a}'.",
                              nexttoken, nexttoken.value);
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js and 2 other locations - About 1 hr to fix
      lib/pre-commit/support/jslint/lint.js on lines 2830..2837
      lib/pre-commit/support/jslint/lint.js on lines 2849..2856

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

      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

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

                  if (nexttoken.id === ',') {
                      comma();
                      if (nexttoken.type !== '(string)') {
                          warning("Expected a string and instead saw '{a}'.",
                              nexttoken, nexttoken.value);
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js and 2 other locations - About 1 hr to fix
      lib/pre-commit/support/jslint/lint.js on lines 2830..2837
      lib/pre-commit/support/jslint/lint.js on lines 2857..2864

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

      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

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

                  if (nexttoken.id === ',') {
                      comma();
                      if (nexttoken.type !== '(string)') {
                          warning("Expected a string and instead saw '{a}'.",
                              nexttoken, nexttoken.value);
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js and 2 other locations - About 1 hr to fix
      lib/pre-commit/support/jslint/lint.js on lines 2849..2856
      lib/pre-commit/support/jslint/lint.js on lines 2857..2864

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

      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

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

              if (!result) {
                  if (partial && expression.hasNext()) {
                          part = expression.peek();
                          throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
                  } else {
      Severity: Major
      Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 5900..5910
      lib/pre-commit/support/csslint/csslint.js on lines 5941..5957

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

      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

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

              if (!result) {
                  if (expression.hasNext() && !expression.isFirst()) {
                      part = expression.peek();
                      throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
                  } else {
      Severity: Major
      Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 5900..5910
      lib/pre-commit/support/csslint/csslint.js on lines 5992..6002

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

      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

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

              if (!result) {
                  if (expression.hasNext() && !expression.isFirst()) {
                      part = expression.peek();
                      throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
                  } else {
      Severity: Major
      Found in lib/pre-commit/support/csslint/csslint.js and 2 other locations - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 5941..5957
      lib/pre-commit/support/csslint/csslint.js on lines 5992..6002

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

      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

                  var generateSource = function(rule) {
                      if (!rule || !('name' in rule)) {
                          return "";
                      }
                      return 'net.csslint.' + rule.name.replace(/\s/g,'');
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 9065..9070

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

      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

              var generateSource = function(rule) {
                  if (!rule || !('name' in rule)) {
                      return "";
                  }
                  return 'net.csslint.' + rule.name.replace(/\s/g,'');
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 8867..8872

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

      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 call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def call(staged_files)
              staged_files = files_filter(staged_files)
              return if staged_files.empty?
      
              result =
      Severity: Minor
      Found in lib/pre-commit/checks/grep.rb - 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

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

              while (expression.hasNext() && count < max) {
                  valid = ValidationTypes.isAny(expression, numeric);
                  if (!valid) {
                      break;
                  }
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 5892..5898

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

      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

                              this.fire({
                                  type:       "error",
                                  error:      ex,
                                  message:    ex.message,
                                  line:       ex.line,
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 2131..2137

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

      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

                              this.fire({
                                  type:       "error",
                                  error:      ex,
                                  message:    ex.message,
                                  line:       ex.line,
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 3323..3329

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

      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 (expression.hasNext() && count < max) {
                  result = ValidationTypes.isAny(expression, types);
                  if (!result) {
                      break;
                  }
      Severity: Minor
      Found in lib/pre-commit/support/csslint/csslint.js and 1 other location - About 55 mins to fix
      lib/pre-commit/support/csslint/csslint.js on lines 3654..3660

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

      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

      module PreCommit
        module Checks
          class GoFmt < Plugin
      
            def call(staged_files)
      Severity: Minor
      Found in lib/plugins/pre_commit/checks/go_fmt.rb and 1 other location - About 55 mins to fix
      lib/plugins/pre_commit/checks/go_build.rb on lines 3..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 44.

      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

      module PreCommit
        module Checks
          class GoBuild < Plugin
      
            def call(staged_files)
      Severity: Minor
      Found in lib/plugins/pre_commit/checks/go_build.rb and 1 other location - About 55 mins to fix
      lib/plugins/pre_commit/checks/go_fmt.rb on lines 3..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 44.

      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 errorAt has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function errorAt(m, l, ch, a, b, c, d) {
      Severity: Major
      Found in lib/pre-commit/support/jslint/lint.js - About 50 mins to fix

        Function warningAt has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function warningAt(m, l, ch, a, b, c, d) {
        Severity: Major
        Found in lib/pre-commit/support/jslint/lint.js - About 50 mins to fix

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

                      if (b) {
                          indent += option.indent;
                          if (nexttoken.from === indent + option.indent) {
                              indent += option.indent;
                          }
          Severity: Minor
          Found in lib/pre-commit/support/jslint/lint.js and 1 other location - About 50 mins to fix
          lib/pre-commit/support/jslint/lint.js on lines 4416..4421

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

          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