hackedteam/vector-edk

View on GitHub
BaseTools/gcc/mingw-gcc-build.py

Summary

Maintainability
D
2 days
Test Coverage

Function GetAll has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def GetAll(self):

        def progress(received, blockSize, fileSize):
            if fileSize < 0: return
            wDots = (100 * received * blockSize) / fileSize / 10
Severity: Minor
Found in BaseTools/gcc/mingw-gcc-build.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

File mingw-gcc-build.py has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

## @file
#
# Automation of instructions from:
Severity: Minor
Found in BaseTools/gcc/mingw-gcc-build.py - About 6 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                        if fdata['filename'].endswith(ext):
                            fdata['extract-dir'] = fdata['filename'][:-len(ext)]
                            break
                replaceables = ('extract-dir', 'filename', 'url')
    Severity: Major
    Found in BaseTools/gcc/mingw-gcc-build.py - About 45 mins to fix

      Function MakeSymLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def MakeSymLinks(self):
              links_dir = os.path.join(self.config.symlinks, self.config.arch)
              if not os.path.exists(links_dir):
                  os.makedirs(links_dir)
              startPrinted = False
      Severity: Minor
      Found in BaseTools/gcc/mingw-gcc-build.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                          if type(fdata[replaceable]) != str: continue
                          if replaceable in fdata:
      Severity: Major
      Found in BaseTools/gcc/mingw-gcc-build.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if replaceable in fdata:
                                fdata[replaceable] = \
                                    fdata[replaceable].replace(
                                        '$' + replaceItem,
                                        fdata[replaceItem]
        Severity: Major
        Found in BaseTools/gcc/mingw-gcc-build.py - About 45 mins to fix

          Function IsConfigOk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def IsConfigOk(self):
          
                  building = []
                  if not self.options.skip_binutils:
                      building.append('binutils')
          Severity: Minor
          Found in BaseTools/gcc/mingw-gcc-build.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 BuildModule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def BuildModule(self, module):
                  base_dir = os.getcwd()
                  build_dir = os.path.join(self.config.build_dir, self.config.arch, module)
                  module_dir = self.source_files.GetExtractDirOf(module)
                  module_dir = os.path.realpath(os.path.join('src', self.config.arch, module_dir))
          Severity: Minor
          Found in BaseTools/gcc/mingw-gcc-build.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

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

              def RunCommand(self, cmd, module, stage, skipable=False):
                  if skipable:
                      if self.IsBuildStepComplete('%s.%s' % (module, stage)):
                          return
          
          
          Severity: Minor
          Found in BaseTools/gcc/mingw-gcc-build.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

                              if os.path.exists(local_file):
                                  md5_pass = self.checkHash(fdata)
                                  if md5_pass:
                                      print '[md5 match]',
                                  else:
          Severity: Minor
          Found in BaseTools/gcc/mingw-gcc-build.py and 1 other location - About 55 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 313..320

          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 completed and os.path.exists(local_file):
                                  md5_pass = self.checkHash(fdata)
                                  if md5_pass:
                                      print '[md5 match]',
                                  else:
          Severity: Minor
          Found in BaseTools/gcc/mingw-gcc-build.py and 1 other location - About 55 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 295..302

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

                  Parser.add_option(
                      "--build-dir",
                      action = "store", type = "string", dest = "build_dir",
                      default = os.path.join(self.base_dir, 'build'),
          Severity: Major
          Found in BaseTools/gcc/mingw-gcc-build.py and 3 other locations - About 50 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 77..80
          BaseTools/gcc/mingw-gcc-build.py on lines 89..92
          BaseTools/gcc/mingw-gcc-build.py on lines 107..110

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

                  Parser.add_option(
                      "--src-dir",
                      action = "store", type = "string", dest = "src_dir",
                      default = os.path.join(self.base_dir, 'src'),
          Severity: Major
          Found in BaseTools/gcc/mingw-gcc-build.py and 3 other locations - About 50 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 83..86
          BaseTools/gcc/mingw-gcc-build.py on lines 89..92
          BaseTools/gcc/mingw-gcc-build.py on lines 107..110

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

                  Parser.add_option(
                      "--symlinks",
                      action = "store", type = "string", dest = "symlinks",
                      default = os.path.join(self.base_dir, 'symlinks'),
          Severity: Major
          Found in BaseTools/gcc/mingw-gcc-build.py and 3 other locations - About 50 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 77..80
          BaseTools/gcc/mingw-gcc-build.py on lines 83..86
          BaseTools/gcc/mingw-gcc-build.py on lines 89..92

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

                  Parser.add_option(
                      "--prefix",
                      action = "store", type = "string", dest = "prefix",
                      default = os.path.join(self.base_dir, 'install'),
          Severity: Major
          Found in BaseTools/gcc/mingw-gcc-build.py and 3 other locations - About 50 mins to fix
          BaseTools/gcc/mingw-gcc-build.py on lines 77..80
          BaseTools/gcc/mingw-gcc-build.py on lines 83..86
          BaseTools/gcc/mingw-gcc-build.py on lines 107..110

          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

          There are no issues that match your filters.

          Category
          Status