Showing 2,859 of 2,859 total issues

File outdated.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*

npm outdated [pkg]

Does the following:
Severity: Minor
Found in deps/npm/lib/outdated.js - About 3 hrs to fix

    Function resolve has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    win32.resolve = function() {
      var resolvedDevice = '',
          resolvedTail = '',
          resolvedAbsolute = false;
    
    
    Severity: Minor
    Found in lib/path.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 write has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    CryptoStream.prototype._write = function write(data, encoding, cb) {
      assert(util.isNull(this._pending));
    
      // Black-hole data
      if (!this.pair.ssl) return cb(null);
    Severity: Minor
    Found in lib/_tls_legacy.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 bnToByteArray has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    function bnToByteArray() {
      var this_array = this.array;
      var i = this.t, r = new Array();
      r[0] = this.s;
      var p = BI_DB-(i*BI_DB)%8, d, k = 0;
    Severity: Minor
    Found in deps/v8/benchmarks/crypto.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 getLite has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    function getLite (data, noname) {
      var lite = {}
        , maxDepth = npm.config.get("depth")
    
      if (!noname && data.name) lite.name = data.name
    Severity: Minor
    Found in deps/npm/lib/ls.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 save has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    Conf.prototype.save = function (where, cb) {
      var target = this.sources[where]
      if (!target || !(target.path || target.source) || !target.data) {
        if (where !== "builtin")
          var er = new Error("bad save target: " + where)
    Severity: Minor
    Found in deps/npm/lib/config/core.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 _HandlePreCompiledHeaders has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def _HandlePreCompiledHeaders(p, sources, spec):
      # Pre-compiled header source stubs need a different compiler flag
      # (generate precompiled header) and any source file not of the same
      # kind (i.e. C vs. C++) as the precompiled header source stub needs
      # to have use of precompiled headers disabled.
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/msvs.py - 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 WriteCopies has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
      """Write CMake for the 'copies' in the target.
    
      Args:
        target_name: the name of the CMake target being generated.
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/cmake.py - 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 ProcessConditionsInDict has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def ProcessConditionsInDict(the_dict, phase, variables, build_file):
      # Process a 'conditions' or 'target_conditions' section in the_dict,
      # depending on phase.
      # early -> conditions
      # late -> target_conditions
    Severity: Minor
    Found in tools/gyp/pylib/gyp/input.py - 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 _XCPrintableValue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def _XCPrintableValue(self, tabs, value, flatten_list=False):
        """Returns a representation of value that may be printed in a project file,
        mimicing Xcode's behavior.
    
        _XCPrintableValue can handle str and int values, XCObjects (which are
    Severity: Minor
    Found in tools/gyp/pylib/gyp/xcodeproj_file.py - 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 CheckStyle has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def CheckStyle(filename, clean_lines, linenum, file_extension, error):
      """Checks rules from the 'C++ style rules' section of cppguide.html.
    
      Most of these rules are hard to test (naming, comment style), but we
      do what we can.  In particular we check for 2-space indents, line lengths,
    Severity: Minor
    Found in tools/cpplint.py - 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 RunSingle has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def RunSingle(self):
        while not self.terminate:
          try:
            test = self.queue.get_nowait()
          except Empty:
    Severity: Minor
    Found in tools/test.py - 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 FindJSBuiltins has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def FindJSBuiltins():
      PATH = "src"
      fileslist = []
      for (root, dirs, files) in os.walk(PATH):
        for f in files:
    Severity: Minor
    Found in deps/v8/tools/generate-runtime-tests.py - 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

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

      if (!options) {
        options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'w' };
      } else if (util.isString(options)) {
        options = { encoding: options, mode: 438, flag: 'w' };
      } else if (!util.isObject(options)) {
    Severity: Major
    Found in lib/fs.js and 1 other location - About 3 hrs to fix
    lib/fs.js on lines 1139..1145

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

    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 (!options) {
        options = { encoding: 'utf8', mode: 438 /*=0666*/, flag: 'a' };
      } else if (util.isString(options)) {
        options = { encoding: options, mode: 438, flag: 'a' };
      } else if (!util.isObject(options)) {
    Severity: Major
    Found in lib/fs.js and 1 other location - About 3 hrs to fix
    lib/fs.js on lines 1094..1100

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

          if extra_requires:
            self._HandleError(
                errors.EXTRA_GOOG_REQUIRE,
                'The following goog.require statements appear unnecessary:\n' +
                '\n'.join(map(lambda x: 'goog.require(\'%s\');' % x,
    Severity: Major
    Found in tools/closure_linter/closure_linter/javascriptlintrules.py and 2 other locations - About 3 hrs to fix
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 340..346
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 363..369

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

          if missing_provides:
            self._HandleError(
                errors.MISSING_GOOG_PROVIDE,
                'Missing the following goog.provide statements:\n' +
                '\n'.join(map(lambda x: 'goog.provide(\'%s\');' % x,
    Severity: Major
    Found in tools/closure_linter/closure_linter/javascriptlintrules.py and 2 other locations - About 3 hrs to fix
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 363..369
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 387..393

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

          if missing_requires:
            self._HandleError(
                errors.MISSING_GOOG_REQUIRE,
                'Missing the following goog.require statements:\n' +
                '\n'.join(map(lambda x: 'goog.require(\'%s\');' % x,
    Severity: Major
    Found in tools/closure_linter/closure_linter/javascriptlintrules.py and 2 other locations - About 3 hrs to fix
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 340..346
    tools/closure_linter/closure_linter/javascriptlintrules.py on lines 387..393

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      def ExceptionIP(self):
        if self.arch == MD_CPU_ARCHITECTURE_AMD64:
          return self.exception_context.rip
        elif self.arch == MD_CPU_ARCHITECTURE_ARM:
          return self.exception_context.pc
    Severity: Major
    Found in deps/v8/tools/grokdump.py and 1 other location - About 3 hrs to fix
    deps/v8/tools/grokdump.py on lines 776..782

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      def ExceptionSP(self):
        if self.arch == MD_CPU_ARCHITECTURE_AMD64:
          return self.exception_context.rsp
        elif self.arch == MD_CPU_ARCHITECTURE_ARM:
          return self.exception_context.sp
    Severity: Major
    Found in deps/v8/tools/grokdump.py and 1 other location - About 3 hrs to fix
    deps/v8/tools/grokdump.py on lines 768..774

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

    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