deps/v8/tools/run-tests.py

Summary

Maintainability
F
5 days
Test Coverage

File run-tests.py has 480 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/run-tests.py - About 7 hrs to fix

    Function ProcessOptions has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def ProcessOptions(options):
      global VARIANT_FLAGS
      global VARIANTS
    
      # Architecture and mode related stuff.
    Severity: Minor
    Found in deps/v8/tools/run-tests.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

    Function Execute has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    def Execute(arch, mode, args, options, suites, workspace):
      print(">>> Running tests for %s.%s" % (arch, mode))
    
      shell_dir = options.shell_dir
      if not shell_dir:
    Severity: Minor
    Found in deps/v8/tools/run-tests.py - 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 Main has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def Main():
      parser = BuildOptions()
      (options, args) = parser.parse_args()
      if not ProcessOptions(options):
        parser.print_help()
    Severity: Minor
    Found in deps/v8/tools/run-tests.py - 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 BuildOptions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def BuildOptions():
      result = optparse.OptionParser()
      result.add_option("--arch",
                        help=("The architecture to run tests for, "
                              "'auto' or 'native' for auto-detect"),
    Severity: Minor
    Found in deps/v8/tools/run-tests.py - About 1 hr to fix

      Function ProcessOptions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def ProcessOptions(options):
        global VARIANT_FLAGS
        global VARIANTS
      
        # Architecture and mode related stuff.
      Severity: Minor
      Found in deps/v8/tools/run-tests.py - About 1 hr to fix

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

        def Execute(arch, mode, args, options, suites, workspace):
          print(">>> Running tests for %s.%s" % (arch, mode))
        
          shell_dir = options.shell_dir
          if not shell_dir:
        Severity: Minor
        Found in deps/v8/tools/run-tests.py - About 1 hr to fix

          Function Execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def Execute(arch, mode, args, options, suites, workspace):
          Severity: Minor
          Found in deps/v8/tools/run-tests.py - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                return False
            Severity: Major
            Found in deps/v8/tools/run-tests.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return True
              Severity: Major
              Found in deps/v8/tools/run-tests.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return False
                Severity: Major
                Found in deps/v8/tools/run-tests.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return False
                  Severity: Major
                  Found in deps/v8/tools/run-tests.py - About 30 mins to fix

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

                    def ShardTests(tests, shard_count, shard_run):
                      if shard_count < 2:
                        return tests
                      if shard_run < 1 or shard_run > shard_count:
                        print "shard-run not a valid number, should be in [1:shard-count]"
                    Severity: Minor
                    Found in deps/v8/tools/run-tests.py - 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

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

                    def ShardTests(tests, shard_count, shard_run):
                      if shard_count < 2:
                        return tests
                      if shard_run < 1 or shard_run > shard_count:
                        print "shard-run not a valid number, should be in [1:shard-count]"
                    Severity: Major
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 6 hrs to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 271..284

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

                    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

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

                      if not shell_dir:
                        if options.buildbot:
                          shell_dir = os.path.join(workspace, options.outdir, mode)
                          mode = mode.lower()
                        else:
                    Severity: Major
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 3 hrs to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 347..353

                    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

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

                      def CheckTestMode(name, option):
                        if not option in ["run", "skip", "dontcare"]:
                          print "Unknown %s mode %s" % (name, option)
                          return False
                        return True
                    Severity: Major
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 1 hr to fix
                    tools/test.py on lines 1284..1288

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

                    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

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

                      for root in suite_paths:
                        suite = testsuite.TestSuite.LoadTestSuite(
                            os.path.join(workspace, "test", root))
                        if suite:
                          suites.append(suite)
                    Severity: Major
                    Found in deps/v8/tools/run-tests.py and 2 other locations - About 1 hr to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 310..314
                    deps/v8/tools/testrunner/network/endpoint.py on lines 92..96

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

                    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

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

                      if timeout == -1:
                        # Simulators are slow, therefore allow a longer default timeout.
                        if arch in SLOW_ARCHS:
                          timeout = 2 * TIMEOUT_DEFAULT;
                        else:
                    Severity: Minor
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 55 mins to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 359..364

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

                    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

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

                      for arch in options.arch:
                        if not arch in SUPPORTED_ARCHS:
                          print "Unknown architecture %s" % arch
                          return False
                    Severity: Minor
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 40 mins to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 237..240

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

                    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

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

                      workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), ".."))
                    Severity: Minor
                    Found in deps/v8/tools/run-tests.py and 1 other location - About 40 mins to fix
                    deps/v8/tools/run-deopt-fuzzer.py on lines 295..295

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

                    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