jish/pre-commit

View on GitHub

Showing 171 of 259 total issues

Avoid deeply nested control flow statements.
Open

                        if (nexttoken.id === '(end)' || nexttoken.id === '(error)') {
                            error("Missing '>'.", nexttoken);
                        }
Severity: Major
Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if (ValidationTypes.isAny(expression, xDir + " | " + yDir)) {
                            result = true;
                            ValidationTypes.isAny(expression, numeric);
                        }
    Severity: Major
    Found in lib/pre-commit/support/csslint/csslint.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (!(prop == "padding" && value.parts.length === 2 && value.parts[0].value === 0)){
                                      reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
                                  }
      Severity: Major
      Found in lib/pre-commit/support/csslint/csslint.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (CSSLint.Util.indexOf(actual, item) === -1) {
                                        propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length == 2) ? actual.join(" and ") : actual.join(", ");
                                        reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule);
                                    }
        Severity: Major
        Found in lib/pre-commit/support/csslint/csslint.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  switch (s[v]) {
                                  case 'function':
                                  case 'var':
                                  case 'unused':
                                      s[v] = 'closure';
          Severity: Major
          Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (data.member[k] === 1) {
                                        n = '<i>' + n + '</i>';
                                    }
            Severity: Major
            Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

              Method location_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def location_from(location, show_usage = false)
                        if location && !location.empty?
                          if File.exist?(location)
                            location
                          else
              Severity: Minor
              Found in lib/pre-commit/checks/plugin/config_file.rb - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                      if (i < a.length - 1) {
                                          n += ', ';
                                      }
              Severity: Major
              Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (nexttoken.id !== ',') {
                                            break;
                                        }
                Severity: Major
                Found in lib/pre-commit/support/jslint/lint.js - About 45 mins to fix

                  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

                    Avoid deeply nested control flow statements.
                    Open

                                            if (l + n.length > 72) {
                                                o.push(m + '<br>');
                                                m = '    ';
                                                l = 1;
                                            }
                    Severity: Major
                    Found in lib/pre-commit/support/jslint/lint.js - About 45 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

                                } 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 (!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

                            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

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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language