hackedteam/core-android-market

View on GitHub
src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py

Summary

Maintainability
F
1 wk
Test Coverage

File regression.py has 748 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python

# Copyright MetaCommunications, Inc. 2003-2007
# Copyright Redshift Software, Inc. 2007
#
Severity: Major
Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py - About 1 day to fix

    runner has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class runner:
        
        def __init__(self,root):
            commands = map(
                lambda m: m[8:].replace('_','-'),
    Severity: Minor
    Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py - About 5 hrs to fix

      Function unpack_tarball has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def unpack_tarball( self, tarball_path, target_path ):
              self.log( 'Looking for old unpacked archives...' )
              old_boost_dirs = self.find_boost_dirs( )
      
              for old_boost_dir in old_boost_dirs:
      Severity: Minor
      Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py - About 3 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 command_regression has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def command_regression(self):
              import socket
              import string
              try:
                  mail_subject = 'Boost regression for %s on %s' % ( self.tag,
      Severity: Minor
      Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 __init__ has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self,root):
              commands = map(
                  lambda m: m[8:].replace('_','-'),
                  filter(
                      lambda m: m.startswith('command_'),
      Severity: Major
      Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py - About 2 hrs to fix

        Function command_collect_logs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def command_collect_logs(self):
                self.import_utils()
                comment_path = os.path.join( self.regression_root, self.comment )
                if not os.path.exists( comment_path ):
                    self.log( 'Comment file "%s" not found; creating default comment.' % comment_path )
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self,root):
                commands = map(
                    lambda m: m[8:].replace('_','-'),
                    filter(
                        lambda m: m.startswith('command_'),
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 build_if_needed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_if_needed( self, tool, toolset ):
                self.import_utils()
                if os.path.exists( tool[ 'path' ] ):
                    self.log( 'Found preinstalled "%s"; will use it.' % tool[ 'path' ] )
                    return
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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_tarball has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_tarball( self, *args ):
                if not args or args == []:
                    args = [ 'download', 'unpack' ]
        
                tarball_path = None
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 command_get_tools has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def command_get_tools(self):
                #~ Get Boost.Build v2...
                self.log( 'Getting Boost.Build v2...' )
                if self.user and self.user != '':
                    os.chdir( os.path.dirname(self.tools_bb_root) )
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 compress_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def compress_file( self, file_path, archive_path ):
                self.import_utils()
                utils.log( 'Compressing "%s"...' % file_path )
        
                try:
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 retry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def retry( self, f, max_attempts=5, sleep_secs=10 ):
                for attempts in range( max_attempts, -1, -1 ):
                    try:
                        return f()
                    except Exception, msg:
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 command_test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def command_test(self, *args):
                if not args or args == None or args == []: args = [ "test", "process" ]
                self.import_utils()
        
                self.log( 'Making "%s" directory...' % self.regression_results )
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 tool_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def tool_path( self, name_or_spec ):
                if isinstance( name_or_spec, basestring ):
                    return os.path.join( self.regression_root, name_or_spec )
        
                if os.path.exists( name_or_spec[ 'path' ] ):
        Severity: Minor
        Found in src/libbson/boost/boost_1_53_0/tools/regression/src/regression.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 3 locations. Consider refactoring.
        Open

                if self.user and self.user != '':
                    os.chdir( os.path.dirname(self.tools_bb_root) )
                    self.svn_command( 'co %s %s' % (
                        self.svn_repository_url(repo_path['build']),
                        os.path.basename(self.tools_bb_root) ) )
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 245..256
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 259..270

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

        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

                if self.user and self.user != '':
                    os.chdir( os.path.dirname(self.tools_regression_root) )
                    self.svn_command( 'co %s %s' % (
                        self.svn_repository_url(repo_path['regression']),
                        os.path.basename(self.tools_regression_root) ) )
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 231..242
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 245..256

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

        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

                if self.user and self.user != '':
                    os.chdir( os.path.dirname(self.tools_bjam_root) )
                    self.svn_command( 'co %s %s' % (
                        self.svn_repository_url(repo_path['jam']),
                        os.path.basename(self.tools_bjam_root) ) )
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 231..242
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 259..270

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

        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

                try:
                    import zipfile
                    z = zipfile.ZipFile( archive_path, 'w', zipfile.ZIP_DEFLATED )
                    z.write( file_path, os.path.basename( file_path ) )
                    z.close()
        src/libbson/boost/boost_1_53_0/tools/regression/src/collect_and_upload_logs.py on lines 266..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 153.

        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

                    try:
                        return f()
                    except Exception, msg:
                        self.log( '%s failed with message "%s"' % ( f.__name__, msg ) )
                        if attempts == 0:
        src/libbson/boost/boost_1_53_0/tools/regression/xsl_reports/make_snapshot.py on lines 19..28

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

        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

                cmd = '"%(bjam)s"' +\
                    ' "-sBOOST_BUILD_PATH=%(bbpath)s"' +\
                    ' "-sBOOST_ROOT=%(boost)s"' +\
                    ' "--boost=%(boost)s"' +\
                    ' "--boost-build=%(bb)s"' +\
        src/libbson/boost/boost_1_53_0/tools/build/v2/tools/gcc.py on lines 654..659

        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

                if not args or args == None or args == []: args = [ "test", "process" ]
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 210..210

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

                if not args or args == None or args == []: args = [ 'source', 'bin' ]
        src/libbson/boost/boost_1_53_0/tools/regression/src/regression.py on lines 315..315

        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