Showing 2,859 of 2,859 total issues

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

    if lower_bound is not None and upper_bound is not None:
      sh = ("%s in the range [%s, %s]" % (sh, lower_bound, upper_bound))
    elif lower_bound == 0:
      sh = "a non-negative %s" % self.number_name
    elif upper_bound == 0:
Severity: Major
Found in tools/closure_linter/gflags.py and 1 other location - About 6 hrs to fix
tools/closure_linter/gflags.py on lines 2179..2188

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

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 runBlock9 has 153 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function runBlock9() {
    for (var i = 0; i < 5; i++) {
      s94[i].split(re32);
      s95[i].split(re32);
      'svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf'.split(re20);
Severity: Major
Found in deps/v8/benchmarks/regexp.js - About 6 hrs to fix

    Function checkServerIdentity has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.checkServerIdentity = function checkServerIdentity(host, cert) {
      // Create regexp to much hostnames
      function regexpify(host, wildcards) {
        // Add trailing dot (make hostnames uniform)
        if (!/\.$/.test(host)) host += '.';
    Severity: Minor
    Found in lib/tls.js - About 6 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 40 (exceeds 5 allowed). Consider refactoring.
    Open

      def Write(self, qualified_target, base_path, output_filename, spec, configs,
                part_of_all):
        """The main entry point: writes a .mk file for a single target.
    
        Arguments:
    Severity: Minor
    Found in tools/gyp/pylib/gyp/generator/make.py - About 6 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 AdjustStaticLibraryDependencies has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    def AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes,
                                        sort_dependencies):
      # Recompute target "dependencies" properties.  For each static library
      # target, remove "dependencies" entries referring to other static libraries,
      # unless the dependency has the "hard_dependency" attribute set.  For each
    Severity: Minor
    Found in tools/gyp/pylib/gyp/input.py - About 6 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

    def ParseOperatorExpression(scan):
      left = ParseAtomicExpression(scan)
      if not left: return None
      while scan.HasMore() and (scan.Current() in BINARIES):
        op = scan.Current()
    Severity: Major
    Found in tools/test.py and 1 other location - About 6 hrs to fix
    tools/test.py on lines 1047..1057

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

    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 ParseLogicalExpression(scan):
      left = ParseConditionalExpression(scan)
      if not left: return None
      while scan.HasMore() and (scan.Current() in LOGICALS):
        op = scan.Current()
    Severity: Major
    Found in tools/test.py and 1 other location - About 6 hrs to fix
    tools/test.py on lines 1021..1031

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

    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

    File sh_main.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
    SHJS - Syntax Highlighting in JavaScript
    Copyright (C) 2007, 2008 gnombat@users.sourceforge.net
    License: http://shjs.sourceforge.net/doc/gplv3.html
    */
    Severity: Minor
    Found in doc/sh_main.js - About 5 hrs to fix

      Function runBlock10 has 148 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function runBlock10() {
          for (var i = 0; i < 3; i++) {
            '%3Szxg=ra-HF'.replace(re39, '');
            '-8'.replace(re40, '');
            '-8'.replace(re10, '');
      Severity: Major
      Found in deps/v8/benchmarks/regexp.js - About 5 hrs to fix

        Function CustomSearch has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

        def CustomSearch(start_token, func, end_func=None, distance=None,
                         reverse=False):
          """Returns the first token where func is True within distance of this token.
        
          Args:
        Severity: Minor
        Found in tools/closure_linter/closure_linter/tokenutil.py - About 5 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

        FlagValues has 43 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class FlagValues:
          """Registry of 'Flag' objects.
        
          A 'FlagValues' can then scan command line arguments, passing flag
          arguments through to the 'Flag' objects that it owns.  It also
        Severity: Minor
        Found in tools/closure_linter/gflags.py - About 5 hrs to fix

          File path.js has 408 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright Joyent, Inc. and other Node contributors.
          //
          // Permission is hereby granted, free of charge, to any person obtaining a
          // copy of this software and associated documentation files (the
          // "Software"), to deal in the Software without restriction, including
          Severity: Minor
          Found in lib/path.js - About 5 hrs to fix

            Function emitKeys has 144 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function emitKeys(stream, s) {
              if (util.isBuffer(s)) {
                if (s[0] > 127 && util.isUndefined(s[1])) {
                  s[0] -= 128;
                  s = '\x1b' + s.toString(stream.encoding || 'utf-8');
            Severity: Major
            Found in lib/readline.js - About 5 hrs to fix

              Function changeBreakpointCommandToJSONRequest_ has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

                  function(args, command) {
              
                var request;
              
                // Check for exception breaks first:
              Severity: Minor
              Found in deps/v8/src/d8.js - About 5 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 makeArchy_ has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
              Open

              function makeArchy_ (data, long, dir, depth, parent, d) {
                if (typeof data === "string") {
                  if (depth -1 <= npm.config.get("depth")) {
                    // just missing
                    var unmet = "UNMET DEPENDENCY"
              Severity: Minor
              Found in deps/npm/lib/ls.js - About 5 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

              File js2c.py has 405 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #!/usr/bin/env python
              #
              # Copyright 2012 the V8 project authors. All rights reserved.
              # Redistribution and use in source and binary forms, with or without
              # modification, are permitted provided that the following conditions are
              Severity: Minor
              Found in deps/v8/tools/js2c.py - About 5 hrs to fix

                Function setupChannel has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setupChannel(target, channel) {
                  target._channel = channel;
                  target._handleQueue = null;
                
                  var decoder = new StringDecoder('utf8');
                Severity: Major
                Found in lib/child_process.js - About 5 hrs to fix

                  Function ParagraphParser has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function ParagraphParser() {
                    var self = this,
                        block_is_license_block = false,
                        block_has_c_style_comment,
                        is_first_line_in_paragraph,
                  Severity: Minor
                  Found in tools/license2rtf.js - About 5 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 bnModPow has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function bnModPow(e,m) {
                    var e_array = e.array;
                    var i = e.bitLength(), k, r = nbv(1), z;
                    if(i <= 0) return r;
                    else if(i < 18) k = 1;
                  Severity: Minor
                  Found in deps/v8/benchmarks/crypto.js - About 5 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 WriteSpec has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def WriteSpec(self, spec, config_name, generator_flags):
                      """The main entry point for NinjaWriter: write the build rules for a spec.
                  
                      Returns a Target object, which represents the output paths for this spec.
                      Returns None if there are no outputs (e.g. a settings-only 'none' type
                  Severity: Minor
                  Found in tools/gyp/pylib/gyp/generator/ninja.py - About 5 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

                  Severity
                  Category
                  Status
                  Source
                  Language