conversant/ad-libs.js

View on GitHub
lib/detect/browser.js

Summary

Maintainability
F
1 wk
Test Coverage

Function detect has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
Open

var detect = function (win, userAgent) {

    var detectedBrowser = new Browser(),
        browserType = '',
        w = win || window,
Severity: Minor
Found in lib/detect/browser.js - About 2 days 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

File browser.js has 782 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
 * @module Browser
 * @desc Browser Detection - Gets Data Pertaining to User's Browser and OS
Severity: Major
Found in lib/detect/browser.js - About 1 day to fix

    Function detect has 232 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var detect = function (win, userAgent) {
    
        var detectedBrowser = new Browser(),
            browserType = '',
            w = win || window,
    Severity: Major
    Found in lib/detect/browser.js - About 1 day to fix

      Function getChromiumVersion has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      var getChromiumVersion = function (win, uaVersion) {
      
          var chromiumVersion = DEFAULT_VERSION;
          // no session history management - version 4 - api
          // geolocation - version 5 - api
      Severity: Minor
      Found in lib/detect/browser.js - About 4 hrs 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 getGeckoVersion has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      var getGeckoVersion = function (win, uaVersion) {
      
          var geckoVersion = DEFAULT_VERSION,
              d = win.document,
              nav = win.navigator;
      Severity: Minor
      Found in lib/detect/browser.js - About 3 hrs 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 getMicrosoftOS has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var getMicrosoftOS = function (win, ua) {
      
          var microsoftBrowser = new Browser();
      
          if (looksLike(/XBox One/i, ua)) {
      Severity: Major
      Found in lib/detect/browser.js - About 3 hrs to fix

        Function getChromiumVersion has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var getChromiumVersion = function (win, uaVersion) {
        
            var chromiumVersion = DEFAULT_VERSION;
            // no session history management - version 4 - api
            // geolocation - version 5 - api
        Severity: Major
        Found in lib/detect/browser.js - About 2 hrs to fix

          Function getMicrosoftOS has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          var getMicrosoftOS = function (win, ua) {
          
              var microsoftBrowser = new Browser();
          
              if (looksLike(/XBox One/i, ua)) {
          Severity: Minor
          Found in lib/detect/browser.js - About 2 hrs 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 getGeckoVersion has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var getGeckoVersion = function (win, uaVersion) {
          
              var geckoVersion = DEFAULT_VERSION,
                  d = win.document,
                  nav = win.navigator;
          Severity: Major
          Found in lib/detect/browser.js - About 2 hrs to fix

            Function getSafariVersion has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            var getSafariVersion = function (win, uaVersion) {
            
                var safariVersion = DEFAULT_VERSION,
                    d = win.document,
                    nav = win.navigator;
            Severity: Minor
            Found in lib/detect/browser.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 getOtherOS has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var getOtherOS = function (win, ua) {
            
                var otherBrowser = new Browser();
            
                if (has('wiiu', win)) {
            Severity: Minor
            Found in lib/detect/browser.js - About 1 hr to fix

              Function getAppleOS has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              var getAppleOS = function (win, ua) {
              
                  var mac = /Mac/i,
                      iOS = /iPhone|iPad|iPod/i,
                      appleBrowser = new Browser(),
              Severity: Minor
              Found in lib/detect/browser.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 getSafariVersion has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var getSafariVersion = function (win, uaVersion) {
              
                  var safariVersion = DEFAULT_VERSION,
                      d = win.document,
                      nav = win.navigator;
              Severity: Minor
              Found in lib/detect/browser.js - About 1 hr to fix

                Function getAppleOS has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var getAppleOS = function (win, ua) {
                
                    var mac = /Mac/i,
                        iOS = /iPhone|iPad|iPod/i,
                        appleBrowser = new Browser(),
                Severity: Minor
                Found in lib/detect/browser.js - About 1 hr to fix

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

                  var getTridentVersion = function (win, uaVersion) {
                  
                      var tridentVersion = DEFAULT_VERSION,
                          d = win.document;
                      // Detect all IE versions possible by feature detection
                  Severity: Minor
                  Found in lib/detect/browser.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 getOtherOS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var getOtherOS = function (win, ua) {
                  
                      var otherBrowser = new Browser();
                  
                      if (has('wiiu', win)) {
                  Severity: Minor
                  Found in lib/detect/browser.js - 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

                  Avoid deeply nested control flow statements.
                  Open

                          if (!looksLike(/Opera/i, ua)) { detectedBrowser.trustworthy = false; }
                  Severity: Major
                  Found in lib/detect/browser.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                        } else if (browserType === TYPE.SAFARI) {
                            detectedBrowser = getOsFromUa(w, ua);
                            detectedBrowser.engine.version = parseIntIfMatch(ua, /AppleWebKit\/(\d+)/, 10);
                            // all versions:                        0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 2.0, 3.0, 3.1, 3.2, 4.0, 4.1, 5.0, 5.1, 6.0, 6.1, 7.0, 8.0
                            // optimal version coverage:            6.1, 7.0, 8.0
                    Severity: Major
                    Found in lib/detect/browser.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              if (looksLike(/Nintendo/i, ua)) {
                                  detectedBrowser.engine.name = 'presto';
                                  detectedBrowser.version = '9.0';
                                  detectedBrowser.console = true;
                              } else {
                      Severity: Major
                      Found in lib/detect/browser.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                if (looksLike(/Presto\/(\d+\.\d+)/i, ua)) {
                                    detectedBrowser.engine.version = parseFloatIfMatch(ua, /Presto\/(\d+\.\d+)/i);
                                } else if (looksLike(/AppleWebKit\/(\d+)/i, ua)) {
                                    detectedBrowser.engine.version = parseIntIfMatch(ua, /AppleWebKit\/(\d+)/i, 10);
                                }
                        Severity: Major
                        Found in lib/detect/browser.js - About 45 mins to fix

                          Function getVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var getVersion = function (uaVersion, minVersion, maxVersion) {
                              var actualVersion = minVersion;
                              if (uaVersion >= minVersion) {
                                  if (!maxVersion || uaVersion <= maxVersion) {
                                      actualVersion = uaVersion;
                          Severity: Minor
                          Found in lib/detect/browser.js - 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 5 locations. Consider refactoring.
                          Open

                              } else if (browserType === TYPE.FIREFOX_MOBILE) {
                                  detectedBrowser = getOsFromUa(w, ua);
                                  detectedBrowser.name = 'Firefox Android';
                                  detectedBrowser.ua.version = parseIntIfMatch(ua, /Firefox\/(\d+)/i, 10); // we trust the UA for now
                                  detectedBrowser.version = detectedBrowser.ua.version;
                          Severity: Major
                          Found in lib/detect/browser.js and 4 other locations - About 3 hrs to fix
                          lib/detect/browser.js on lines 1191..1246
                          lib/detect/browser.js on lines 1205..1246
                          lib/detect/browser.js on lines 1216..1246
                          lib/detect/browser.js on lines 1223..1246

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

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

                              } else if (browserType === TYPE.OPERA_ANDROID) {
                                  detectedBrowser = getOsFromUa(w, ua);
                                  detectedBrowser.name = 'Opera Android';
                                  detectedBrowser.ua.version = parseIntIfMatch(ua, /Opera\/(\d+)/i, 10); // we trust the UA for now
                                  detectedBrowser.version = detectedBrowser.ua.version;
                          Severity: Major
                          Found in lib/detect/browser.js and 4 other locations - About 3 hrs to fix
                          lib/detect/browser.js on lines 1191..1246
                          lib/detect/browser.js on lines 1198..1246
                          lib/detect/browser.js on lines 1205..1246
                          lib/detect/browser.js on lines 1216..1246

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

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

                              } else if (browserType === TYPE.CHROME_MOBILE) {
                                  detectedBrowser = getOsFromUa(w, ua);
                                  detectedBrowser.name = 'Chrome Android';
                                  detectedBrowser.ua.version = parseIntIfMatch(ua, /Chrome\/(\d+)/i, 10); // we trust the UA for now
                                  detectedBrowser.version = detectedBrowser.ua.version;
                          Severity: Major
                          Found in lib/detect/browser.js and 4 other locations - About 3 hrs to fix
                          lib/detect/browser.js on lines 1198..1246
                          lib/detect/browser.js on lines 1205..1246
                          lib/detect/browser.js on lines 1216..1246
                          lib/detect/browser.js on lines 1223..1246

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

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

                              } else if (browserType === TYPE.MICROSOFT_MOBILE) {
                                  detectedBrowser = getMicrosoftOS(w, ua);
                                  detectedBrowser.name = 'Mobile IE';
                                  detectedBrowser.ua.version = parseIntIfMatch(ua, /IEMobile\/(\d+)/i, 10); // we trust the UA for now
                                  detectedBrowser.version = detectedBrowser.ua.version;
                          Severity: Major
                          Found in lib/detect/browser.js and 4 other locations - About 3 hrs to fix
                          lib/detect/browser.js on lines 1191..1246
                          lib/detect/browser.js on lines 1198..1246
                          lib/detect/browser.js on lines 1216..1246
                          lib/detect/browser.js on lines 1223..1246

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

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

                              } else if (browserType === TYPE.OPERA_MINI) {
                                  detectedBrowser = getOsFromUa(w, ua);
                                  detectedBrowser.name = 'Opera Mini';
                                  detectedBrowser.ua.version = parseIntIfMatch(ua, /Opera Mini\/(\d+)/i, 10); // we trust the UA for now
                                  detectedBrowser.version = detectedBrowser.ua.version;
                          Severity: Major
                          Found in lib/detect/browser.js and 4 other locations - About 3 hrs to fix
                          lib/detect/browser.js on lines 1191..1246
                          lib/detect/browser.js on lines 1198..1246
                          lib/detect/browser.js on lines 1205..1246
                          lib/detect/browser.js on lines 1223..1246

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

                          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

                              } else if (looksLike(/Xbox/i, ua)) {
                                  microsoftBrowser.os.name = 'Xbox';
                                  microsoftBrowser.os.version = '360';
                                  microsoftBrowser.name = 'Internet Explorer';
                                  microsoftBrowser.version = '7.0';
                          Severity: Major
                          Found in lib/detect/browser.js and 1 other location - About 1 hr to fix
                          lib/detect/browser.js on lines 782..852

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

                          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 (looksLike(/XBox One/i, ua)) {
                                  microsoftBrowser.os.name = 'Xbox';
                                  microsoftBrowser.os.version = 'One';
                                  microsoftBrowser.name = 'Internet Explorer';
                                  microsoftBrowser.version = '10.0';
                          Severity: Major
                          Found in lib/detect/browser.js and 1 other location - About 1 hr to fix
                          lib/detect/browser.js on lines 788..852

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

                          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 (has('wiiu', win)) {
                                  otherBrowser.os.name = 'Wii';
                                  otherBrowser.os.version = 'U';
                                  otherBrowser.name = 'NetFront';
                                  otherBrowser.console = true;
                          Severity: Major
                          Found in lib/detect/browser.js and 1 other location - About 1 hr to fix
                          lib/detect/browser.js on lines 704..724

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

                          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

                              } else if (looksLike(/PlayStation.4/i, ua)) {
                                  otherBrowser.os.name = 'PlayStation';
                                  otherBrowser.os.version = '4';
                                  otherBrowser.name = 'NetFront';
                                  otherBrowser.console = true;
                          Severity: Major
                          Found in lib/detect/browser.js and 1 other location - About 1 hr to fix
                          lib/detect/browser.js on lines 695..724

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status