deps/v8/tools/push-to-trunk/test_scripts.py

Summary

Maintainability
F
6 days
Test Coverage

File test_scripts.py has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# Copyright 2013 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
# met:
Severity: Major
Found in deps/v8/tools/push-to-trunk/test_scripts.py - About 3 days to fix

    ScriptTest has 57 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ScriptTest(unittest.TestCase):
      def MakeEmptyTempFile(self):
        handle, name = tempfile.mkstemp()
        os.close(handle)
        self._tmp_files.append(name)
    Severity: Major
    Found in deps/v8/tools/push-to-trunk/test_scripts.py - About 1 day to fix

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

        def Call(self, name, *args):  # pragma: no cover
          self._index += 1
          try:
            expected_call = self._recipe[self._index]
          except IndexError:
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py - 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 _ChromiumRoll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def _ChromiumRoll(self, force=False, manual=False):
          googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME]
          with open(googlers_mapping_py, "w") as f:
            f.write("""
      def list_to_dict(entries):
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py - About 35 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

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

        def _PushToTrunk(self, force=False, manual=False):
          TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
      
          # The version file on bleeding edge has build level 5, while the version
          # file from trunk has build level 4.
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.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

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

        def testBumpUpVersionBailout2(self):
          TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
          self._state["lkgr"] = "lkgr_hash"
      
          self.ExpectGit([
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 4 hrs to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 1430..1440

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

      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 testBumpUpVersionBailout1(self):
          TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
          self._state["latest"] = "latest_hash"
      
          self.ExpectGit([
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 4 hrs to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 1443..1452

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

      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 URL(*args, **kwargs):
        """Convenience function returning a readurl test expectation."""
        return {
          "name": "readurl",
          "args": args[:-1],
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 1 hr to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 255..261

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

      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 Git(*args, **kwargs):
        """Convenience function returning a git test expectation."""
        return {
          "name": "git",
          "args": args[:-1],
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 1 hr to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 270..276

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

      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 os.path.exists(TEST_CONFIG[CHROMIUM]):
            os.makedirs(TEST_CONFIG[CHROMIUM])
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 55 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 1203..1204

      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

          if not os.path.exists(TEST_CONFIG[CHROMIUM]):
            os.makedirs(TEST_CONFIG[CHROMIUM])
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 55 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 833..834

      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

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

          self.assertEquals([["98", "9"], ["100", "10"]],
                            F([["100", "10"], ["99", "9"], ["98", "9"]]))
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 50 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 100..101

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

      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

          self.assertEquals([["98", "9"], ["99", "10"]],
                            F([["100", "10"], ["99", "10"], ["98", "9"]]))
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 50 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 98..99

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

      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

        def testMakeChangeLogBugReferenceSimple(self):
          self.assertEquals("(issue 987654)",
                            MakeChangeLogBugReference("BUG = v8:987654"))
          self.assertEquals("(Chromium issue 987654)",
                            MakeChangeLogBugReference("BUG=987654 "))
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 2 other locations - About 40 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 118..122
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 124..128

      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

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

        def testMakeComment(self):
          self.assertEquals("#   Line 1\n#   Line 2\n#",
                            MakeComment("    Line 1\n    Line 2\n"))
          self.assertEquals("#Line 1\n#Line 2",
                            MakeComment("Line 1\n Line 2"))
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 2 other locations - About 40 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 124..128
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 184..188

      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

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

        def testStripComments(self):
          self.assertEquals("    Line 1\n    Line 3\n",
              StripComments("    Line 1\n#   Line 2\n    Line 3\n#\n"))
          self.assertEquals("\nLine 2 ### Test\n #",
              StripComments("###\n# \n\n#  Line 1\nLine 2 ### Test\n #"))
      Severity: Major
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 2 other locations - About 40 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 118..122
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 184..188

      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

          result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
              AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 35 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 1017..1018

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

      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

          result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
              AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
      Severity: Minor
      Found in deps/v8/tools/push-to-trunk/test_scripts.py and 1 other location - About 35 mins to fix
      deps/v8/tools/push-to-trunk/test_scripts.py on lines 985..986

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

      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