Modernizr/Modernizr

View on GitHub

Showing 27 of 99 total issues

Function exports has 202 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  'use strict';

  // load grunt dependencies
  require('load-grunt-tasks')(grunt);
Severity: Major
Found in legacy/Gruntfile.js - About 1 day to fix

    Function runHyphenTest has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function runHyphenTest() {
          if (!document.body && !document.getElementsByTagName('body')[0]) {
            setTimeout(runHyphenTest, waitTime);
            return;
          }
    Severity: Major
    Found in feature-detects/css/hyphens.js - About 5 hrs to fix

      Function metadata has 109 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function metadata(cb) {
        var tests = [];
        var md = new MarkdownIt();
        file.walkSync(viewRoot, function(start, dirs, files) {
          files.forEach(function(file) {
      Severity: Major
      Found in lib/metadata.js - About 4 hrs to fix

        Consider simplifying this complex logical expression.
        Open

          if (!isSVG) {
            /**
             * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
             */
            ;(function(window, document) {
        Severity: Critical
        Found in src/html5printshiv.js - About 4 hrs to fix

          File html5printshiv.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          define(['isSVG'], function(isSVG) {
            /**
             * @optionName html5printshiv
             * @optionProp html5printshiv
             */
          Severity: Minor
          Found in src/html5printshiv.js - About 2 hrs to fix

            Function options has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function options(cb, allMetadata) {
              var opts;
            
              file.walkSync(srcRoot, function(start, dirs, files) {
                opts = _.chain(files)
            Severity: Major
            Found in lib/options.js - About 2 hrs to fix

              Function shivPrint has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    function shivPrint(ownerDocument) {
                      var shivedSheet,
                        wrappers,
                        data = getExpandoData(ownerDocument),
                        namespaces = ownerDocument.namespaces,
              Severity: Major
              Found in src/html5printshiv.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                  if (!isSVG) {
                    /**
                     * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
                     */
                    ;(function(window, document) {
                Severity: Critical
                Found in src/html5shiv.js - About 2 hrs to fix

                  Function build has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function build(generate, generateBanner, pkg) {
                    return function build(config, cb) {
                      var requireConfig = {};
                      var banner;
                      config = config || {};
                  Severity: Minor
                  Found in lib/build.js - About 1 hr to fix

                    Function build has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      return function build(config, cb) {
                        var requireConfig = {};
                        var banner;
                        config = config || {};
                        cb = cb || function noop() {};
                    Severity: Minor
                    Found in lib/build.js - About 1 hr to fix

                      Function testProps has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function testProps(props, prefixed, value, skipValueTest) {
                          skipValueTest = is(skipValueTest, 'undefined') ? false : skipValueTest;
                      
                          // Try native detect first
                          if (!is(value, 'undefined')) {
                      Severity: Minor
                      Found in src/testProps.js - About 1 hr to fix

                        Function generate has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          return function generate(config) {
                            // Set some defaults
                            if (!config) {
                              config = {};
                            }
                        Severity: Minor
                        Found in src/generate.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (Modernizr._config.usePrefix) {
                                  BlobBuilder = BlobBuilder || window.MozBlobBuilder || window.WebKitBlobBuilder || window.MSBlobBuilder || window.OBlobBuilder;
                                  URL = URL || window.MozURL || window.webkitURL || window.MSURL || window.OURL;
                                }
                          Severity: Critical
                          Found in feature-detects/workers/blobworkers.js - About 1 hr to fix

                            Function injectElementWithStyles has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function injectElementWithStyles(rule, callback, nodes, testnames) {
                                var mod = 'modernizr';
                                var style;
                                var ret;
                                var node;
                            Severity: Minor
                            Found in src/injectElementWithStyles.js - About 1 hr to fix

                              Function test_hyphens_find has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    function test_hyphens_find(delimiter) {
                                      try {
                                        /* create a sample input for resetting selection location, and a div container
                                         * these have to be appended to document.body, otherwise some browsers can give false negative
                                         * div container gets the doubled testword, separated by the delimiter
                              Severity: Minor
                              Found in feature-detects/css/hyphens.js - About 1 hr to fix

                                Function testRunner has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function testRunner() {
                                    var featureNames;
                                    var feature;
                                    var aliasIdx;
                                    var result;
                                Severity: Minor
                                Found in src/testRunner.js - About 1 hr to fix

                                  Function test_hyphens has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        function test_hyphens(delimiter, testWidth) {
                                          try {
                                            /* create a div container and a span within that
                                             * these have to be appended to document.body, otherwise some browsers can give false negative */
                                            var div = createElement('div');
                                  Severity: Minor
                                  Found in feature-detects/css/hyphens.js - About 1 hr to fix

                                    Function addTest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function addTest(feature, test) {
                                    
                                        if (typeof feature === 'object') {
                                          for (var key in feature) {
                                            if (hasOwnProp(feature, key)) {
                                    Severity: Minor
                                    Found in src/addTest.js - About 1 hr to fix

                                      Function exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      module.exports = function(grunt) {
                                        'use strict';
                                      
                                        // load grunt dependencies
                                        require('load-grunt-tasks')(grunt);
                                      Severity: Minor
                                      Found in legacy/Gruntfile.js - About 1 hr 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 generateBuildQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        return function generateBuildQuery(config) {
                                          // Format:
                                          // ?-<prop1>-<prop2>-…-<propN>-<option1>-<option2>-…<optionN>[-dontmin][-cssclassprefix:<prefix>]
                                          // where prop1…N and option1…N are sorted alphabetically (for consistency)
                                          var dontmin = !config.minify;
                                      Severity: Minor
                                      Found in lib/build-query.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language