hackedteam/core-android-market

View on GitHub
src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py

Summary

Maintainability
F
4 days
Test Coverage

File common.py has 575 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#  Status: being ported by Steven Watanabe
#  Base revision: 47174
#
#  Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
Severity: Major
Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 1 day to fix

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

    def format_name(format, name, target_type, prop_set):
        """ Given a target, as given to a custom tag rule, returns a string formatted
            according to the passed format. Format is a list of properties that is
            represented in the result. For each element of format the corresponding target
            information is obtained and added to the result string. For all, but the
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 check_init_parameters has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_init_parameters(toolset, requirement, *args):
        """ The rule for checking toolset parameters. Trailing parameters should all be
            parameter name/value pairs. The rule will check that each parameter either has
            a value in each invocation or has no value in each invocation. Also, the rule
            will check that the combination of all parameter values is unique in all
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 toolset_tag has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def toolset_tag(name, target_type, prop_set):
        tag = ''
    
        properties = prop_set.raw()
        tools = prop_set.get('<toolset>')
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 mkdir has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def mkdir(engine, target):
        # If dir exists, do not update it. Do this even for $(DOT).
        bjam.call('NOUPDATE', target)
    
        global __mkdir_set
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 find_tool has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def find_tool(name, additional_paths = [], path_last = False):
        """ Attempts to find tool (binary) named 'name' in PATH and in
            'additional-paths'.  If found in path, returns 'name'.  If
            found in additional paths, returns full name.  If the tool
            is found in several directories, returns the first path found.
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 check_tool_aux has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_tool_aux(command):
        """ Checks if 'command' can be found either in path
            or is a full name to an existing file.
        """
        assert(isinstance(command, str))
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 55 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 runtime_tag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def runtime_tag(name, target_type, prop_set ):
        tag = ''
    
        properties = prop_set.raw()
        if '<runtime-link>static' in properties: tag += 's'
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 55 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 get_invocation_command_nodefault has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_invocation_command_nodefault(
        toolset, tool, user_provided_command=[], additional_paths=[], path_last=False):
        """
            A helper rule to get the command to invoke some tool. If
            'user-provided-command' is not given, tries to find binary named 'tool' in
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 55 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 p:
                            assert(len(p) == 1)
                            result += join_tag(ungrist(f), p)
                else:
    Severity: Major
    Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if match:
                              p0 = match[1]
                              break
                      if p0:
      Severity: Major
      Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 45 mins to fix

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

        def get_invocation_command_nodefault(
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 35 mins to fix

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

          def get_invocation_command(toolset, tool, user_provided_command = [],
          Severity: Minor
          Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py - About 35 mins to fix

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

            def reset ():
                """ Clear the module state. This is mainly for testing purposes.
                    Note that this must be called _after_ resetting the module 'feature'.
                """    
                global __had_unspecified_value, __had_value, __declared_subfeature
            Severity: Minor
            Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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 get_absolute_tool_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_absolute_tool_path(command):
                """
                    Given an invocation command,
                    return the absolute path to the command. This works even if commnad
                    has not path element and is present in PATH.
            Severity: Minor
            Found in src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.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

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

                if additional_paths is not None:
                    assert(isinstance(additional_paths, list))
                    assert(all([isinstance(path, str) for path in additional_paths]))
            src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py on lines 319..321

            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 additional_paths is not None:
                    assert(isinstance(additional_paths, list))
                    assert(all([isinstance(path, str) for path in additional_paths]))
            src/libbson/boost/boost_1_53_0/tools/build/v2/tools/common.py on lines 283..285

            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

            There are no issues that match your filters.

            Category
            Status