xebialabs-community/xlr-xldeploy-plugin

View on GitHub

Showing 57 of 57 total issues

File XLDeployClient.py has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# Copyright 2019 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
Severity: Minor
Found in src/main/resources/xlr_xldeploy/XLDeployClient.py - About 6 hrs to fix

    XLDeployClient has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class XLDeployClient(object):
        def __init__(self, http_connection, username=None, password=None):
            self.http_request = HttpRequest(http_connection, username, password)
    
        @staticmethod
    Severity: Minor
    Found in src/main/resources/xlr_xldeploy/XLDeployClient.py - About 5 hrs to fix

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

      cliScript = Localcliscript(cli['cliHome'], cli['xldHost'], cli['xldPort'], cli['xldSecure'], cli['xldContext'], cli['xldProxyHost'], cli['xldProxyPort'], cli['xldSocketTimeout'], cli['xldUserName'], cli['xldPassword'], script, cli['cliExecutable'], options)
      Severity: Major
      Found in src/main/resources/xlr_xldeploy/cli.py and 2 other locations - About 5 hrs to fix
      src/main/resources/xlr_xldeploy/cliFile.py on lines 16..16
      src/main/resources/xlr_xldeploy/cliUrl.py on lines 40..40

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

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

      cliScript = Localcliscript(cli['cliHome'], cli['xldHost'], cli['xldPort'], cli['xldSecure'], cli['xldContext'], cli['xldProxyHost'], cli['xldProxyPort'], cli['xldSocketTimeout'], cli['xldUserName'], cli['xldPassword'], script, cli['cliExecutable'], options)
      Severity: Major
      Found in src/main/resources/xlr_xldeploy/cliFile.py and 2 other locations - About 5 hrs to fix
      src/main/resources/xlr_xldeploy/cli.py on lines 14..14
      src/main/resources/xlr_xldeploy/cliUrl.py on lines 40..40

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

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

         cliScript = Localcliscript(cli['cliHome'], cli['xldHost'], cli['xldPort'], cli['xldSecure'], cli['xldContext'], cli['xldProxyHost'], cli['xldProxyPort'], cli['xldSocketTimeout'], cli['xldUserName'], cli['xldPassword'], script, cli['cliExecutable'], options)
      Severity: Major
      Found in src/main/resources/xlr_xldeploy/cliUrl.py and 2 other locations - About 5 hrs to fix
      src/main/resources/xlr_xldeploy/cli.py on lines 14..14
      src/main/resources/xlr_xldeploy/cliFile.py on lines 16..16

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

      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

      Function XLDVersionsTileViewController has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var XLDVersionsTileViewController = function ($scope, XLDVersionsService, XlrTileHelper) {
              var vm = this;
              var tile;
      
              if ($scope.xlrTile) {

        Function delete has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def delete(self, ci_id):
                infrastructure_list = self.xldClient.get_ci_tree(ci_id)
                environment_list = self.xldClient.get_ci_tree('Environments')
                for env in environment_list:
                    env_ci = self.xldClient.get_ci(env, 'xml')
        Severity: Minor
        Found in src/main/resources/xlr_xldeploy/deleteInfrastructureTask.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 display_step_logs has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def display_step_logs(self, task_id):
                get_task_steps = '/deployit/task/' + task_id + '/step'
                get_task_steps_response = self.http_request.get(get_task_steps, contentType='application/xml')
                task_steps_root = ET.fromstring(get_task_steps_response.getResponse())
                for child in task_steps_root:
        Severity: Minor
        Found in src/main/resources/xlr_xldeploy/XLDeployClient.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 set_deployed_properties has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def set_deployed_properties(deployment_xml, deployed_properties):
            root = ET.fromstring(deployment_xml)
            if deployed_properties:
                deployeds_properties_dict = dict(ast.literal_eval(deployed_properties))
                for key in deployeds_properties_dict:
        Severity: Minor
        Found in src/main/resources/xlr_xldeploy/XLDeployClient.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

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

                 if ( len( self.options ) > 1 ):
                    self.cmdLine.addArgument( '--' )
                    optionsList = self.options.split(' ')
                    for opt in optionsList:
                        self.cmdLine.addArgument( opt )
        Severity: Major
        Found in src/main/resources/xlr_xldeploy/LocalCLI.py and 1 other location - About 2 hrs to fix
        src/main/resources/xlr_xldeploy/LocalCLI.py on lines 78..82

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

        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 len(self.options) > 1:
                    self.cmdLine.addArgument( '--' )
                    optionsList = self.options.split(' ')
                    for opt in optionsList:
                        self.cmdLine.addArgument( opt )
        Severity: Major
        Found in src/main/resources/xlr_xldeploy/LocalCLI.py and 1 other location - About 2 hrs to fix
        src/main/resources/xlr_xldeploy/LocalCLI.py on lines 107..111

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

        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

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

            def invoke_task_and_wait_for_result(self, task_id, polling_interval=10, number_of_trials=None,
                                                continue_if_step_fails=False, number_of_continue_retrials=0,
                                                fail_on_pause=True, display_step_logs = False):
                start_task_url = "/deployit/task/%s/start" % task_id
                self.http_request.post(start_task_url, '', contentType='application/xml')
        Severity: Minor
        Found in src/main/resources/xlr_xldeploy/XLDeployClient.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

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

              try:
                 connection = LocalConnection.getLocalConnection()
                 scriptFile = connection.getTempFile('xlrScript', '.py')
                 OverthereUtils.write( String( self.script ).getBytes(), scriptFile )
                 scriptFile.setExecutable(True)
        Severity: Major
        Found in src/main/resources/xlr_xldeploy/LocalCLI.py and 1 other location - About 2 hrs to fix
        src/main/resources/xlr_xldeploy/LocalCLI.py on lines 100..120

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

        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:
                 connection = LocalConnection.getLocalConnection()
                 scriptFile = self.script 
                 print "using script %s" % ( scriptFile )
                 #scriptFile.setExecutable(True)
        Severity: Major
        Found in src/main/resources/xlr_xldeploy/LocalCLI.py and 1 other location - About 2 hrs to fix
        src/main/resources/xlr_xldeploy/LocalCLI.py on lines 71..91

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

        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

        Function get_deployed_applications_for_environment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_deployed_applications_for_environment(self, environment, date=None):
                archived_tasks = self.query_archived_tasks(date)
                deployed_apps = {}
                if archived_tasks:
                    tasks = json.loads(archived_tasks)
        Severity: Minor
        Found in src/main/resources/xlr_xldeploy/XLDeployClient.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

        Error: invalid syntax (<unknown>, line 35)</unknown>
        Open

                                    print "Need to un-deploy %s from %s." % (app, deployed_env_ref)

        We encountered an error attempting to analyze this line.

        Error: Missing parentheses in call to 'print'. Did you mean print(int "Upgrading deployment \n")? (<unknown>, line 19)</unknown>
        Open

            print "Upgrading deployment \n"

        We encountered an error attempting to analyze this line.

        Error: Missing parentheses in call to 'print'. Did you mean print(nt output)? (<unknown>, line 23)</unknown>
        Open

           print output

        We encountered an error attempting to analyze this line.

        Error: invalid syntax (<unknown>, line 86)</unknown>
        Open

              except Exception, e:

        We encountered an error attempting to analyze this line.

        Error: invalid syntax (<unknown>, line 163)</unknown>
        Open

                    print 'Task [%s] now in state [%s] \n' % (task_id, status)

        We encountered an error attempting to analyze this line.

        Severity
        Category
        Status
        Source
        Language