hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py

Summary

Maintainability
F
1 mo
Test Coverage

File ccompiler.py has 816 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""distutils.ccompiler

Contains CCompiler, an abstract base class that defines the interface
for the Distutils compiler abstraction model."""
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 day to fix

    CCompiler has 48 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CCompiler:
        """Abstract base class to define the interface that must be implemented
        by real compiler classes.  Also has some utility methods used by
        several compiler classes.
    
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 6 hrs to fix

      Function customize_compiler has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def customize_compiler(compiler):
          """Do any platform-specific customization of a CCompiler instance.
      
          Mainly needed on Unix, so we can plug in the information that
          varies across Unices and is stored in Python's Makefile.
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 link has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def link(self, target_desc, objects, output_filename, output_dir=None,
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 hr to fix

        Function gen_lib_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries):
            """Generate linker options for searching library directories and
            linking with specific libraries.
        
            'libraries' and 'library_dirs' are, respectively, lists of library names
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 link_shared_lib has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def link_shared_lib(self, objects, output_libname, output_dir=None,
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 hr to fix

          Function link_shared_object has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def link_shared_object(self, objects, output_filename, output_dir=None,
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 hr to fix

            Function gen_preprocess_options has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def gen_preprocess_options(macros, include_dirs):
                """Generate C pre-processor options (-D, -U, -I) as used by at least
                two types of compilers: the typical Unix compiler and Visual C++.
                'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
                means undefine (-U) macro 'name', and (name,value) means define (-D)
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 _fix_lib_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
                    """Typecheck and fix up some of the arguments supplied to the
                    'link_*' methods.  Specifically: ensure that all arguments are
                    lists, and augment them with their permanent versions
                    (eg. 'self.libraries' augments 'libraries').  Return a tuple with
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 _setup_compile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _setup_compile(self, outdir, macros, incdirs, sources, depends,
                                   extra):
                    """Process arguments and decide which source files to compile."""
                    if outdir is None:
                        outdir = self.output_dir
            Severity: Minor
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 link_executable has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def link_executable(self, objects, output_progname, output_dir=None,
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 hr to fix

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

                  def _fix_compile_args(self, output_dir, macros, include_dirs):
                      """Typecheck and fix-up some of the arguments to the 'compile()'
                      method, and return fixed-up values.  Specifically: if 'output_dir'
                      is None, replaces it with 'self.output_dir'; ensures that 'macros'
                      is a list, and augments it with 'self.macros'; ensures that
              Severity: Minor
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 compile has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def compile(self, sources, output_dir=None, macros=None,
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 1 hr to fix

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

                    def preprocess(self, source, output_file=None, macros=None,
                Severity: Minor
                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 45 mins to fix

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

                      def _setup_compile(self, outdir, macros, incdirs, sources, depends,
                  Severity: Minor
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 45 mins to fix

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

                        def _check_macro_definitions(self, definitions):
                            """Ensures that every element of 'definitions' is a valid macro
                            definition, ie. either (name,value) 2-tuple or a (name,) tuple.  Do
                            nothing if all definitions are OK, raise TypeError otherwise.
                            """
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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

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

                        def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 45 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                  if not (isinstance(defn, tuple) and
                                          (len (defn) == 1 or
                                           (len (defn) == 2 and
                                            (isinstance(defn[1], str) or defn[1] is None))) and
                                          isinstance(defn[0], str)):
                      Severity: Major
                      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 40 mins to fix

                        Function new_compiler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
                        Severity: Minor
                        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 35 mins to fix

                          Function create_static_lib has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def create_static_lib(self, objects, output_libname, output_dir=None,
                          Severity: Minor
                          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 35 mins to fix

                            Function library_filename has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def library_filename(self, libname, lib_type='static',     # or 'shared'
                            Severity: Minor
                            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 35 mins to fix

                              Function has_function has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def has_function(self, funcname, includes=None, include_dirs=None,
                              Severity: Minor
                              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.py - About 35 mins to fix

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

                                    def has_function(self, funcname, includes=None, include_dirs=None,
                                                     libraries=None, library_dirs=None):
                                        """Return a boolean indicating whether funcname is supported on
                                        the current platform.  The optional arguments can be used to
                                        augment the compilation environment.
                                Severity: Minor
                                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 new_compiler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
                                    """Generate an instance of some CCompiler subclass for the supplied
                                    platform/compiler combination.  'plat' defaults to 'os.name'
                                    (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler
                                    for that platform.  Currently only 'posix' and 'nt' are supported, and
                                Severity: Minor
                                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 detect_language has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def detect_language(self, sources):
                                        """Detect the language of a given file, or list of files. Uses
                                        language_map, and language_order to do the job.
                                        """
                                        if not isinstance(sources, list):
                                Severity: Minor
                                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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 object_filenames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
                                        if output_dir is None:
                                            output_dir = ''
                                        obj_names = []
                                        for src_name in source_filenames:
                                Severity: Minor
                                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/ccompiler.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

                                vector-uefi/fd/efi/StdLib/lib/python.27/distutils/ccompiler.py on lines 0..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 4408.

                                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