gecos-team/gecoscc-ui

View on GitHub
gecoscc/tasks.py

Summary

Maintainability
F
1 mo
Test Coverage

File tasks.py has 2089 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#
# Copyright 2013, Junta de Andalucia
# http://www.juntadeandalucia.es/
#
# Authors:
Severity: Major
Found in gecoscc/tasks.py - About 5 days to fix

    Function object_action has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
    Open

        def object_action(self, user, obj, objold=None, action=None, computers=None,
                          api=None, cookbook=None, calculate_inheritance=True,
                          validator=None):
            '''
            This method try to get the node to make changes in it.
    Severity: Minor
    Found in gecoscc/tasks.py - About 2 days 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 update_node_from_rules has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_node_from_rules(self, rules, user, computer, obj_ui, obj, objold, action, node, policy, rule_type, parent_id, job_ids_by_computer):
            '''
            This function update a node from rules.
            Rules are the different fields in a policy.
            We have different cases:
    Severity: Minor
    Found in gecoscc/tasks.py - About 1 day 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

    ChefTask has 86 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ChefTask(Task):
        abstract = True
        # Since Celery 4 the default serializer is "json", but we need "pickle"
        serializer = 'pickle'
        
    Severity: Major
    Found in gecoscc/tasks.py - About 1 day to fix

      Function computer_refresh_policies has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
      Open

          def computer_refresh_policies(self, user, obj, computers=None):
              # Refresh policies of a computer
              self.log_action('refresh_policies BEGIN', 'Computer', obj)
              settings = get_current_registry().settings
      
      
      Severity: Minor
      Found in gecoscc/tasks.py - About 1 day 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 chef_status_sync has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
      Open

      def chef_status_sync(node_id, auth_user):
          self = chef_status_sync
          settings = get_current_registry().settings
          api = get_chef_api(settings, auth_user)   
          node = Node(node_id, api)    
      Severity: Minor
      Found in gecoscc/tasks.py - About 1 day 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 update_node has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_node(self, user, computer, obj, objold, node, action, parent_id, job_ids_by_computer, force_update):
              '''
              This method update the node with changed or created actions.
              Have two different cases:
                  1 - object type is ou, user, computer or group.
      Severity: Minor
      Found in gecoscc/tasks.py - About 7 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 update_user_mergeable_policy has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_user_mergeable_policy(self, node, action, field_chef, field_ui, policy, priority_obj, priority_obj_ui, update_by_path, obj_ui, objold_ui):
              '''
              This method updates the policy field on the chef node, with the resulting merge value of the policy for the current object.
      
              Args:
      Severity: Minor
      Found in gecoscc/tasks.py - About 6 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function update_node_updated_by has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_node_updated_by(self, node, field_chef, obj, action, attr, attributes_updated):
              '''
              Updates the updated_by field of a node
              '''
              updated = False
      Severity: Minor
      Found in gecoscc/tasks.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 has_changed_ws_emitter_policy has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def has_changed_ws_emitter_policy(self, node, obj_ui, objold_ui, field_chef):
              '''
              Checks if the workstation emitter policy has changed or is equal to the policy stored in the node chef.
              This policy is emitter, that is that the policy contains related objects (printers and repositories)
              '''
      Severity: Minor
      Found in gecoscc/tasks.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 has_changed_user_policy has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def has_changed_user_policy(self, node, obj_ui, objold_ui, field_chef, priority_obj):
              '''
              This method checks whether the "field_chef" policy field changed for the current object.
      
              Args:
      Severity: Minor
      Found in gecoscc/tasks.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 update_ws_mergeable_policy has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_ws_mergeable_policy(self, node, action, field_chef, field_ui, policy, update_by_path, obj_ui_field, objold_ui_field):
              '''
              This method updates the policy field on the chef node, with the resulting merge value of the policy for the current object.
      
              Args:
      Severity: Minor
      Found in gecoscc/tasks.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 get_object_ui has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_object_ui(self, rule_type, obj, node, policy):
              '''
              Get the object
              '''
              if obj == {}:
      Severity: Minor
      Found in gecoscc/tasks.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 has_changed_user_emitter_policy has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def has_changed_user_emitter_policy(self, node, obj_ui, objold_ui, field_chef, priority_obj):
              '''
              Checks if the user emitter policy has changed or is equal to the policy stored in the node chef.
              This policy is emitter, that is that the policy contains related objects (storage)
              '''
      Severity: Minor
      Found in gecoscc/tasks.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 priority_object has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def priority_object(self, node, updated_by_fieldname, obj, action):
              '''
              Get the priority from an object
              '''
              if obj['type'] in ['computer', 'user'] and action != DELETED_POLICY_ACTION:
      Severity: Minor
      Found in gecoscc/tasks.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 validate_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_data(self, node, cookbook, api, validator=None):
              '''
              Useful method, validate the DATABASES
              '''
              try:
      Severity: Minor
      Found in gecoscc/tasks.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 update_node_from_rules has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def update_node_from_rules(self, rules, user, computer, obj_ui, obj, objold, action, node, policy, rule_type, parent_id, job_ids_by_computer):
      Severity: Major
      Found in gecoscc/tasks.py - About 1 hr to fix

        Function update_user_emitter_policy has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def update_user_emitter_policy(self, node, action, policy, obj_ui_field, field_chef, obj_ui, objold_ui, priority_obj, priority_obj_ui, field_ui, update_by_path):
        Severity: Major
        Found in gecoscc/tasks.py - About 1 hr to fix

          Function chef_status_sync has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def chef_status_sync(node_id, auth_user):
              self = chef_status_sync
              settings = get_current_registry().settings
              api = get_chef_api(settings, auth_user)   
              node = Node(node_id, api)    
          Severity: Minor
          Found in gecoscc/tasks.py - About 1 hr to fix

            Function object_changed has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def object_changed(user, objtype, objnew, objold, action='changed',
            Severity: Major
            Found in gecoscc/tasks.py - About 1 hr to fix

              Function update_user_mergeable_policy has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def update_user_mergeable_policy(self, node, action, field_chef, field_ui, policy, priority_obj, priority_obj_ui, update_by_path, obj_ui, objold_ui):
              Severity: Major
              Found in gecoscc/tasks.py - About 1 hr to fix

                Function update_node_job_id has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def update_node_job_id(self, user, obj, action, computer, node, policy, attr, attributes_updated, parent_id, job_ids_by_computer):
                Severity: Major
                Found in gecoscc/tasks.py - About 1 hr to fix

                  Function update_node has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def update_node(self, user, computer, obj, objold, node, action, parent_id, job_ids_by_computer, force_update):
                  Severity: Major
                  Found in gecoscc/tasks.py - About 1 hr to fix

                    Function object_action has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def object_action(self, user, obj, objold=None, action=None, computers=None,
                    Severity: Major
                    Found in gecoscc/tasks.py - About 1 hr to fix

                      Function group_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def group_changed(self, user, objnew, objold, action='changed',
                      Severity: Major
                      Found in gecoscc/tasks.py - About 1 hr to fix

                        Function computer_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def computer_changed(self, user, objnew, objold, action='changed',
                        Severity: Major
                        Found in gecoscc/tasks.py - About 1 hr to fix

                          Function user_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def user_changed(self, user, objnew, objold, action='changed',
                          Severity: Major
                          Found in gecoscc/tasks.py - About 1 hr to fix

                            Function object_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def object_changed(self, user, objnew, objold, action, computers=None,
                            Severity: Major
                            Found in gecoscc/tasks.py - About 1 hr to fix

                              Function printer_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def printer_changed(self, user, objnew, objold, action='changed',
                              Severity: Major
                              Found in gecoscc/tasks.py - About 1 hr to fix

                                Function repository_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def repository_changed(self, user, objnew, objold, action='changed',
                                Severity: Major
                                Found in gecoscc/tasks.py - About 1 hr to fix

                                  Function storage_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def storage_changed(self, user, objnew, objold, action='changed',
                                  Severity: Major
                                  Found in gecoscc/tasks.py - About 1 hr to fix

                                    Function ou_changed has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def ou_changed(self, user, objnew, objold, action='changed', computers=None,
                                    Severity: Major
                                    Found in gecoscc/tasks.py - About 1 hr to fix

                                      Function update_ws_mergeable_policy has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          def update_ws_mergeable_policy(self, node, action, field_chef, field_ui, policy, update_by_path, obj_ui_field, objold_ui_field):
                                      Severity: Major
                                      Found in gecoscc/tasks.py - About 1 hr to fix

                                        Function update_ws_emitter_policy has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            def update_ws_emitter_policy(self, node, action, policy, obj_ui_field, field_chef, obj_ui, objold_ui, update_by_path):
                                        Severity: Major
                                        Found in gecoscc/tasks.py - About 1 hr to fix

                                          Function object_created has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          def object_created(user, objtype, obj, computers=None, api=None, cookbook=None,
                                          Severity: Major
                                          Found in gecoscc/tasks.py - About 1 hr to fix

                                            Function group_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                def group_created(self, user, objnew, computers=None,
                                            Severity: Major
                                            Found in gecoscc/tasks.py - About 50 mins to fix

                                              Function user_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  def user_created(self, user, objnew, computers=None,
                                              Severity: Major
                                              Found in gecoscc/tasks.py - About 50 mins to fix

                                                Function computer_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    def computer_created(self, user, objnew, computers=None,
                                                Severity: Major
                                                Found in gecoscc/tasks.py - About 50 mins to fix

                                                  Function repository_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      def repository_created(self, user, objnew, computers=None,
                                                  Severity: Major
                                                  Found in gecoscc/tasks.py - About 50 mins to fix

                                                    Function ou_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        def ou_created(self, user, objnew, computers=None, api=None, cookbook=None,
                                                    Severity: Major
                                                    Found in gecoscc/tasks.py - About 50 mins to fix

                                                      Function object_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                          def object_created(self, user, objnew, computers=None,
                                                      Severity: Major
                                                      Found in gecoscc/tasks.py - About 50 mins to fix

                                                        Function printer_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            def printer_created(self, user, objnew, computers=None,
                                                        Severity: Major
                                                        Found in gecoscc/tasks.py - About 50 mins to fix

                                                          Function storage_created has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                              def storage_created(self, user, objnew, computers=None,
                                                          Severity: Major
                                                          Found in gecoscc/tasks.py - About 50 mins to fix

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

                                                                def report_generic_error(self, user, obj, action, message, computer=None, status='errors'):
                                                            Severity: Minor
                                                            Found in gecoscc/tasks.py - About 45 mins to fix

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

                                                                  def update_node_updated_by(self, node, field_chef, obj, action, attr, attributes_updated):
                                                              Severity: Minor
                                                              Found in gecoscc/tasks.py - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                        if policy_field not in new_field_chef_value:
                                                                                            new_field_chef_value[policy_field] = []
                                                                                        new_field_chef_value[policy_field] += node_policy[policy_field]
                                                                Severity: Major
                                                                Found in gecoscc/tasks.py - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                          if related_objs['name'] != field_value[attribute]:
                                                                                              return True
                                                                                      elif related_objs[attribute] != field_value[attribute]:
                                                                  Severity: Major
                                                                  Found in gecoscc/tasks.py - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                            if obj not in field_chef_value.get(username,{}).get(policy_type):
                                                                                                # There is a new value added in the policy
                                                                                                updated = True
                                                                                                break
                                                                                        
                                                                    Severity: Major
                                                                    Found in gecoscc/tasks.py - About 45 mins to fix

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                                  if policy_field not in new_field_chef_value:
                                                                                                      # Initializing 
                                                                                                      new_field_chef_value[policy_field] = []
                                                                                                 
                                                                                                  # Accumulator
                                                                      Severity: Major
                                                                      Found in gecoscc/tasks.py - About 45 mins to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                if group_action == 'add':
                                                                                                    group = self.db.nodes.find_one({'_id': group_id})
                                                                                                    if not group:
                                                                                                        self.log("error","object_action - Group not found  %s (%s,%s)" %(str(group_id), sys._getframe().f_code.co_filename, sys._getframe().f_lineno))
                                                                                                        continue            
                                                                        Severity: Major
                                                                        Found in gecoscc/tasks.py - About 45 mins to fix

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                  if obj_ui_field != value_field_chef:
                                                                                                      self.log("debug","tasks.py ::: update_node_from_rules - not is_mergeable - obj_ui_field != value_field_chef")
                                                                                                      node.attributes.set_dotted(field_chef, obj_ui_field)
                                                                                                      updated = True
                                                                          
                                                                          
                                                                          Severity: Major
                                                                          Found in gecoscc/tasks.py - About 45 mins to fix

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

                                                                                def has_changed_user_policy(self, node, obj_ui, objold_ui, field_chef, priority_obj):
                                                                            Severity: Minor
                                                                            Found in gecoscc/tasks.py - About 35 mins to fix

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

                                                                                  def has_changed_user_emitter_policy(self, node, obj_ui, objold_ui, field_chef, priority_obj):
                                                                              Severity: Minor
                                                                              Found in gecoscc/tasks.py - About 35 mins to fix

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

                                                                                    def on_failure(self, exc, task_id, args, kwargs, einfo):
                                                                                Severity: Minor
                                                                                Found in gecoscc/tasks.py - About 35 mins to fix

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

                                                                                      def report_unknown_error(self, exception, user, obj, action, computer=None):
                                                                                  Severity: Minor
                                                                                  Found in gecoscc/tasks.py - About 35 mins to fix

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

                                                                                        def object_emiter_deleted(self, user, obj, computers=None):
                                                                                            name = "%s deleted" % obj['type']
                                                                                            name_es = self._("deleted") + " " + self._(obj['type'])
                                                                                            macrojob_storage = JobStorage(self.db.jobs, user)
                                                                                            macrojob_storage.create(obj=obj,
                                                                                    Severity: Minor
                                                                                    Found in gecoscc/tasks.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

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                            return ValueError("The rule type should be save or policy")
                                                                                    Severity: Major
                                                                                    Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                              return False
                                                                                      Severity: Major
                                                                                      Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                                return True
                                                                                        Severity: Major
                                                                                        Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                                      return True
                                                                                          Severity: Major
                                                                                          Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                                    return True
                                                                                            Severity: Major
                                                                                            Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                                  return
                                                                                              Severity: Major
                                                                                              Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                                        return False  
                                                                                                Severity: Major
                                                                                                Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                          return False
                                                                                                  Severity: Major
                                                                                                  Found in gecoscc/tasks.py - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                                        return {}
                                                                                                    Severity: Major
                                                                                                    Found in gecoscc/tasks.py - About 30 mins to fix

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

                                                                                                          def get_first_exists_node(self, ids, obj, action):
                                                                                                              '''
                                                                                                              Get the first exising node from a ids list
                                                                                                              '''
                                                                                                              for mongo_id in ids:
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.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 group_by_multiple_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          def group_by_multiple_keys(self, input_data, mergeIdField, mergeActionField, opposite=False):
                                                                                                              '''
                                                                                                              This method groups by key the values of a list of dictionaries and eliminates the duplicates 
                                                                                                              or those that are opposed.
                                                                                                              
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.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 script_runner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                      def script_runner(user, sequence, rollback=False):
                                                                                                          ''' Launches scripts from an update
                                                                                                          
                                                                                                          Args:
                                                                                                            user(object):         user doing update
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.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 search_mergefields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          def search_mergefields(self, field_chef, field_ui, policy):
                                                                                                              '''    
                                                                                                              This method search merge indexes (mergeIdField, mergeActionField) for "field_chef" policy field.
                                                                                                       
                                                                                                              Args:
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.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 update_user_emitter_policy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          def update_user_emitter_policy(self, node, action, policy, obj_ui_field, field_chef, obj_ui, objold_ui, priority_obj, priority_obj_ui, field_ui, update_by_path):
                                                                                                              '''
                                                                                                              Update node chef with a mergeable user emitter policy
                                                                                                              This policy is emitter, that is that the policy contains related objects (storage)
                                                                                                              '''
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.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 2 locations. Consider refactoring.
                                                                                                      Open

                                                                                                          def get_members(self, obj, objold):
                                                                                                              """Method that get the members to add and to delete from a group.
                                                                                                      
                                                                                                              Args:
                                                                                                                  self (object): self pointer.
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 day to fix
                                                                                                      gecoscc/tasks.py on lines 1231..1261

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

                                                                                                      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

                                                                                                          def get_groups(self, obj, objold):
                                                                                                              """Method that get the groups to add and to delete from an object.
                                                                                                      
                                                                                                              Args:
                                                                                                                  self (object): self pointer.
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 day to fix
                                                                                                      gecoscc/tasks.py on lines 1263..1293

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

                                                                                                      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 action == 'recalculate policies':
                                                                                                                      # When recalculating policies only the node policies information must be updated
                                                                                                                      recalculate_policies_for_computers(self.logger, self.db, obj, computers)
                                                                                                                      
                                                                                                                      # The inheritance field may have been updated
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 day to fix
                                                                                                      gecoscc/tasks.py on lines 1620..1632

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

                                                                                                      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 action == 'created':
                                                                                                                      # When creating or moving an object we must change the inheritance of the node
                                                                                                                      # event when it has no policies applied
                                                                                                                      move_in_inheritance_and_recalculate_policies(self.logger, self.db, obj, obj)
                                                                                                                      
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 day to fix
                                                                                                      gecoscc/tasks.py on lines 1607..1618

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

                                                                                                      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

                                                                                                      @task(base=ChefTask)
                                                                                                      def object_deleted(user, objtype, obj, computers=None):
                                                                                                          self = object_deleted
                                                                                                          func = getattr(self, '{0}_deleted'.format(objtype), None)
                                                                                                          if func is not None:
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 7 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2307..2319

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

                                                                                                      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

                                                                                                      @task(base=ChefTask)
                                                                                                      def object_refresh_policies(user, objtype, obj, computers=None):
                                                                                                          self = object_created
                                                                                                      
                                                                                                          func = getattr(self, '{0}_refresh_policies'.format(objtype), None)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 7 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2358..2369

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

                                                                                                      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

                                                                                                                  for group in groups:
                                                                                                                      if group.get('policies', {}) and group['_id'] not in refreshed_groups:
                                                                                                                          self.log('debug', 'tasks.py ::: computer_refresh_policies - Recaculate policies for group: {0} in user: {1}'.format(group['name'], u['name']))
                                                                                                                          self.object_refresh_policies(user, group, computers=[obj])
                                                                                                                          refreshed_groups.append(group['_id'])
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 5 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2061..2065

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

                                                                                                      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

                                                                                                                  for ou in ous:
                                                                                                                      if ou.get('policies', {}) and ou['_id'] not in refreshed_ous:
                                                                                                                          self.log('debug', 'tasks.py ::: computer_refresh_policies - Recaculate policies for OU: {0} in user: {1}'.format(ou['name'], u['name']))
                                                                                                                          self.object_refresh_policies(user, ou, computers=[obj])
                                                                                                                          refreshed_ous.append(ou['_id'])
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 5 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2069..2073

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

                                                                                                      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

                                                                                                                          self.db.jobs.update_one({'_id': macrojob['_id']},                                                                
                                                                                                                                              {'$set': {'counter': macrojob['counter'],
                                                                                                                                                        'message': self._("Pending: %d") % macrojob['counter'],
                                                                                                                                                        'status': 'finished' if macrojob['counter'] == 0 else macrojob['status']}})                
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 4 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2428..2432

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

                                                                                                      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 macrojob:
                                                                                                                      self.db.jobs.update_one({'_id': macrojob['_id']},                                                                
                                                                                                                                          {'$set': {'counter': macrojob['counter'],
                                                                                                                                                    'message': self._("Pending: %d") % macrojob['counter'],
                                                                                                                                                    'status': 'finished' if macrojob['counter'] == 0 else macrojob['status']}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 4 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1989..1992

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

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

                                                                                                          def user_changed(self, user, objnew, objold, action='changed',
                                                                                                                           computers=None, api=None, cookbook=None,
                                                                                                                           calculate_inheritance=True,
                                                                                                                           validator=None):
                                                                                                              self.log_action('changed BEGIN', 'User', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2221..2230
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

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

                                                                                                          def repository_changed(self, user, objnew, objold, action='changed',
                                                                                                                                 computers=None, api=None, cookbook=None,
                                                                                                                                 calculate_inheritance=True,
                                                                                                                                 validator=None):
                                                                                                              self.log_action('changed BEGIN', 'Repository', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2221..2230

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

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

                                                                                                          def group_changed(self, user, objnew, objold, action='changed',
                                                                                                                            computers=None, api=None, cookbook=None,
                                                                                                                            calculate_inheritance=True,
                                                                                                                            validator=None):
                                                                                                              self.log_action('changed BEGIN', 'Group', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2221..2230
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

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

                                                                                                          def ou_changed(self, user, objnew, objold, action='changed', computers=None,
                                                                                                                         api=None, cookbook=None, calculate_inheritance=True,
                                                                                                                         validator=None):
                                                                                                              self.log_action('changed BEGIN', 'OU', objnew)
                                                                                                              self.object_changed(user, objnew, objold, action, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2221..2230
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

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

                                                                                                          def printer_changed(self, user, objnew, objold, action='changed',
                                                                                                                              computers=None, api=None, cookbook=None,
                                                                                                                              calculate_inheritance=True,
                                                                                                                              validator=None):
                                                                                                              self.log_action('changed BEGIN', 'Printer', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2221..2230
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

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

                                                                                                          def computer_changed(self, user, objnew, objold, action='changed',
                                                                                                                               computers=None, api=None, cookbook=None,
                                                                                                                               calculate_inheritance=True,
                                                                                                                               validator=None):
                                                                                                              self.log_action('changed BEGIN', 'Computer', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2221..2230
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

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

                                                                                                          def storage_changed(self, user, objnew, objold, action='changed',
                                                                                                                              computers=None, api=None, cookbook=None,
                                                                                                                              calculate_inheritance=True,
                                                                                                                              validator=None):
                                                                                                              self.log_action('changed BEGIN', 'Storage', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1811..1820
                                                                                                      gecoscc/tasks.py on lines 1853..1862
                                                                                                      gecoscc/tasks.py on lines 2082..2091
                                                                                                      gecoscc/tasks.py on lines 2136..2144
                                                                                                      gecoscc/tasks.py on lines 2190..2199
                                                                                                      gecoscc/tasks.py on lines 2251..2260

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

                                                                                                      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:
                                                                                                                          node_policy = updater_node['policies'][text_type(policy['_id'])]
                                                                                                                      except KeyError:
                                                                                                                          # Bugfix: updated_by contains mongo nodes in which the policy (policy_id) has been removed 
                                                                                                                          # but this attribute was not updated correctly in chef. In this case, node_policy = {}
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 628..634

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

                                                                                                      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:
                                                                                                                          updater_node_ui = updater_node['policies'][text_type(policy['_id'])]
                                                                                                                      except KeyError:
                                                                                                                          # Bugfix: updated_by contains mongo nodes in which the policy (policy_id) has been removed
                                                                                                                          # but this attribute was not updated correctly in chef. In this case, node_policy = {}
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 709..715

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

                                                                                                      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

                                                                                                              for ou in ous:
                                                                                                                  if ou.get('policies', {}):
                                                                                                                      self.log('debug', 'tasks.py ::: computer_refresh_policies - Recaculate policies for OU: {0}'.format(ou['name']))
                                                                                                                      self.object_refresh_policies(user, ou, computers=computers)
                                                                                                                      refreshed_ous.append(ou['_id'])
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2042..2046

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

                                                                                                      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

                                                                                                              for group in groups:
                                                                                                                  if group.get('policies', {}):
                                                                                                                      self.log('debug', 'tasks.py ::: computer_refresh_policies - Recaculate policies for group: {0}'.format(group['name']))
                                                                                                                      self.object_refresh_policies(user, group, computers=computers)   
                                                                                                                      refreshed_groups.append(group['_id'])
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 2033..2037

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

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

                                                                                                          def storage_created(self, user, objnew, computers=None,
                                                                                                                              api=None, cookbook=None, calculate_inheritance=True,
                                                                                                                              validator=None):
                                                                                                              self.log_action('created BEGIN', 'Storage', objnew)
                                                                                                              self.object_created(user, objnew, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1801..1809
                                                                                                      gecoscc/tasks.py on lines 1876..1884
                                                                                                      gecoscc/tasks.py on lines 2126..2134
                                                                                                      gecoscc/tasks.py on lines 2180..2188

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

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

                                                                                                          def printer_created(self, user, objnew, computers=None,
                                                                                                                              api=None, cookbook=None, calculate_inheritance=True,
                                                                                                                              validator=None):
                                                                                                              self.log_action('created BEGIN', 'Printer', objnew)
                                                                                                              self.object_created(user, objnew, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1801..1809
                                                                                                      gecoscc/tasks.py on lines 1876..1884
                                                                                                      gecoscc/tasks.py on lines 2126..2134
                                                                                                      gecoscc/tasks.py on lines 2211..2219

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

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

                                                                                                          def computer_created(self, user, objnew, computers=None,
                                                                                                                               api=None, cookbook=None, calculate_inheritance=True,
                                                                                                                               validator=None):
                                                                                                              self.log_action('created BEGIN', 'Computer', objnew)
                                                                                                              self.object_created(user, objnew, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1801..1809
                                                                                                      gecoscc/tasks.py on lines 2126..2134
                                                                                                      gecoscc/tasks.py on lines 2180..2188
                                                                                                      gecoscc/tasks.py on lines 2211..2219

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

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

                                                                                                          def ou_created(self, user, objnew, computers=None, api=None, cookbook=None,
                                                                                                                         calculate_inheritance=True,
                                                                                                                         validator=None):
                                                                                                              self.log_action('created BEGIN', 'OU', objnew)
                                                                                                              self.object_created(user, objnew, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1801..1809
                                                                                                      gecoscc/tasks.py on lines 1876..1884
                                                                                                      gecoscc/tasks.py on lines 2180..2188
                                                                                                      gecoscc/tasks.py on lines 2211..2219

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

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

                                                                                                          def group_created(self, user, objnew, computers=None,
                                                                                                                            api=None, cookbook=None, calculate_inheritance=True,
                                                                                                                            validator=None):
                                                                                                              self.log_action('created BEGIN', 'Group', objnew)
                                                                                                              self.object_created(user, objnew, computers=computers,
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1876..1884
                                                                                                      gecoscc/tasks.py on lines 2126..2134
                                                                                                      gecoscc/tasks.py on lines 2180..2188
                                                                                                      gecoscc/tasks.py on lines 2211..2219

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

                                                                                                      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 updated_by.get('computer', None):
                                                                                                                  if action != DELETED_POLICY_ACTION or text_type(obj.get('_id')) != updated_by['computer']:
                                                                                                                      priority_object = self.db.nodes.find_one({'_id': ObjectId(updated_by['computer'])})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1119..1121

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

                                                                                                      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 priority_object and updated_by.get('user', None):
                                                                                                                  if action != DELETED_POLICY_ACTION or text_type(obj.get('_id')) != updated_by['user']:
                                                                                                                      priority_object = self.db.nodes.find_one({'_id': ObjectId(updated_by['user'])})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 3 hrs to fix
                                                                                                      gecoscc/tasks.py on lines 1116..1118

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                          def storage_deleted(self, user, obj, computers=None, direct_deleted=True):
                                                                                                              self.log_action('deleted BEGIN', 'Storage', obj)
                                                                                                              self.object_emiter_deleted(user, obj, computers=computers)
                                                                                                              self.log_action('deleted END', 'Storage', obj)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1827..1830
                                                                                                      gecoscc/tasks.py on lines 2206..2209
                                                                                                      gecoscc/tasks.py on lines 2267..2270

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

                                                                                                      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

                                                                                                                      self.db.jobs.update_one({'_id': job['_id']},
                                                                                                                                          {'$set': {'status': 'warnings',
                                                                                                                                                    'message': job_status.get('message', 'Warning'),
                                                                                                                                                    'last_update': datetime.datetime.utcnow()}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2421..2424

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                          def printer_deleted(self, user, obj, computers=None, direct_deleted=True):
                                                                                                              self.log_action('deleted BEGIN', 'Printer', obj)
                                                                                                              self.object_emiter_deleted(user, obj, computers=computers)
                                                                                                              self.log_action('deleted END', 'Printer', obj)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1827..1830
                                                                                                      gecoscc/tasks.py on lines 2237..2240
                                                                                                      gecoscc/tasks.py on lines 2267..2270

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                          def repository_deleted(self, user, obj, computers=None, direct_deleted=True):
                                                                                                              self.log_action('deleted BEGIN', 'Repository', obj)
                                                                                                              self.object_emiter_deleted(user, obj, computers=computers)
                                                                                                              self.log_action('deleted END', 'Repository', obj)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1827..1830
                                                                                                      gecoscc/tasks.py on lines 2206..2209
                                                                                                      gecoscc/tasks.py on lines 2237..2240

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                          def group_deleted(self, user, obj, computers=None, direct_deleted=True):
                                                                                                              self.log_action('deleted BEGIN', 'Group', obj)
                                                                                                              self.object_deleted(user, obj, computers=computers)
                                                                                                              self.log_action('deleted END', 'Group', obj)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2206..2209
                                                                                                      gecoscc/tasks.py on lines 2237..2240
                                                                                                      gecoscc/tasks.py on lines 2267..2270

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

                                                                                                      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

                                                                                                                      self.db.jobs.update_one({'_id': job['_id']},
                                                                                                                                          {'$set': {'status': 'errors',
                                                                                                                                                    'message': job_status.get('message', 'Error'),
                                                                                                                                                    'last_update': datetime.datetime.utcnow()}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2413..2416

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

                                                                                                      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

                                                                                                              macrojob_storage.create(obj=obj,
                                                                                                                                      op='deleted',
                                                                                                                                      computer=None,
                                                                                                                                      status='finished',
                                                                                                                                      policy={'name':name,'name_es':name_es},
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2168..2176

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

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

                                                                                                                                  if not group:
                                                                                                                                      self.log("error","object_action - Group not found  %s (%s,%s)" %(str(group_id), sys._getframe().f_code.co_filename, sys._getframe().f_lineno))
                                                                                                                                      continue            
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1665..1667

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

                                                                                                      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

                                                                                                              macrojob_storage.create(obj=obj,
                                                                                                                                      op='deleted',
                                                                                                                                      computer=None,
                                                                                                                                      status='finished',
                                                                                                                                      policy={'name':name,'name_es':name_es},
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1768..1776

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

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

                                                                                                                          if not group:
                                                                                                                              self.log("error","object_action - Group not found  %s (%s,%s)" %(str(group_id), sys._getframe().f_code.co_filename, sys._getframe().f_lineno))
                                                                                                                              continue            
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1687..1689

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

                                                                                                      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

                                                                                                                      user = user_model.serialize({'name': add,
                                                                                                                                                   'path': computer.get('path', ''),
                                                                                                                                                   'type': 'user',
                                                                                                                                                   'lock': computer.get('lock', ''),
                                                                                                                                                   'source': computer.get('source', '')})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1927..1931

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

                                                                                                      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

                                                                                                                          usr = user_model.serialize({'name': username,
                                                                                                                                                       'path': obj.get('path', ''),
                                                                                                                                                       'type': 'user',
                                                                                                                                                       'lock': obj.get('lock', ''),
                                                                                                                                                       'source': obj.get('source', '')})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2484..2488

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

                                                                                                      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

                                                                                                              for g in groups:
                                                                                                                  self.db.nodes.update_one({
                                                                                                                      '_id': g['_id']
                                                                                                                  }, {
                                                                                                                      '$pull': {
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2114..2119

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

                                                                                                      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

                                                                                                                  for u in users:
                                                                                                                      self.db.nodes.update_one({
                                                                                                                          '_id': u['_id']
                                                                                                                      }, {
                                                                                                                          '$pull': {
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1211..1216

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

                                                                                                      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 group_action == 'add':
                                                                                                                              group_added = add_group_to_inheritance_tree(self.logger, self.db, group, obj['inheritance'])
                                                                                                                              groups_changed = (groups_changed or group_added)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1673..1675

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

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

                                                                                                          def storage_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'Storage', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'Storage', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

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

                                                                                                          def user_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'User', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'User', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2232..2235
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

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

                                                                                                          def ou_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'OU', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'OU', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2232..2235
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

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

                                                                                                          def printer_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'Printer', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'Printer', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2232..2235
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

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

                                                                                                          def group_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'Group', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'Group', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2232..2235
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

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

                                                                                                          def repository_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'Repository', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'Repository', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2093..2096
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2232..2235

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

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

                                                                                                          def computer_moved(self, user, objnew, objold):
                                                                                                              self.log_action('moved BEGIN', 'Computer', objnew)
                                                                                                              self.object_moved(user, objnew, objold)
                                                                                                              self.log_action('moved END', 'Computer', objnew)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 6 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1822..1825
                                                                                                      gecoscc/tasks.py on lines 1864..1867
                                                                                                      gecoscc/tasks.py on lines 2146..2149
                                                                                                      gecoscc/tasks.py on lines 2201..2204
                                                                                                      gecoscc/tasks.py on lines 2232..2235
                                                                                                      gecoscc/tasks.py on lines 2262..2265

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

                                                                                                      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 group_action == 'delete':
                                                                                                                              group_deleted = remove_group_from_inheritance_tree(self.logger, self.db, group, obj['inheritance'])
                                                                                                                              groups_changed = (groups_changed or group_deleted)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1669..1671

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

                                                                                                      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

                                                                                                                      macrojob = self.db.jobs.find_one({'_id': ObjectId(job['parent'])}) if 'parent' in job else None
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2404..2404

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

                                                                                                      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 obj_ui['type'] == 'repository':
                                                                                                                          if not any(d['repo_name'] == related_obj['name'] for d in field_chef_value):
                                                                                                                              return True
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 2 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 436..441
                                                                                                      gecoscc/tasks.py on lines 480..483

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

                                                                                                      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

                                                                                                                  macrojob = self.db.jobs.find_one({'_id': ObjectId(job['parent'])}) if 'parent' in job else None
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1980..1980

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

                                                                                                      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

                                                                                                                  for obj in related_objects:
                                                                                                                      # Find a new related object added for current obj
                                                                                                                      if not any(d['name'] == obj['name'] for d in field_chef_value_storage):
                                                                                                                          return True
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 2 other locations - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 436..438
                                                                                                      gecoscc/tasks.py on lines 436..441

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

                                                                                                      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 priority_object and updated_by.get('ou', None):
                                                                                                                  priority_object = self.get_first_exists_node(updated_by.get('ou', None), obj, action)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1122..1123

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                                  if not node.normal.has_dotted('gecos_info.users.%s'%(username)):
                                                                                                                      node.normal.set_dotted('gecos_info.users.%s'%(username), {})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/commands/check_node_policies.py on lines 688..691
                                                                                                      gecoscc/tasks.py on lines 1340..1341
                                                                                                      gecoscc/tasks.py on lines 1962..1963

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

                                                                                                      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 priority_object and updated_by.get('group', None):
                                                                                                                  priority_object = self.get_first_exists_node(updated_by.get('group', None), obj, action)
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1124..1125

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

                                                                                                      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

                                                                                                                      self.db.jobs.update_one({'_id': job['_id']},
                                                                                                                                          {'$set': {'status': 'finished',
                                                                                                                                                    'last_update': datetime.datetime.utcnow()}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 2406..2408

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                                          if not node.normal.has_dotted('gecos_info.users.%s'%(usrname)):
                                                                                                                              node.normal.set_dotted('gecos_info.users.%s'%(usrname), {})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/commands/check_node_policies.py on lines 688..691
                                                                                                      gecoscc/tasks.py on lines 1340..1341
                                                                                                      gecoscc/tasks.py on lines 2522..2523

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

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

                                                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                      Open

                                                                                                                          if not node.normal.has_dotted('gecos_info.users.%s'%(username)):
                                                                                                                              node.normal.set_dotted('gecos_info.users.%s'%(username), {})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 3 other locations - About 1 hr to fix
                                                                                                      gecoscc/commands/check_node_policies.py on lines 688..691
                                                                                                      gecoscc/tasks.py on lines 1962..1963
                                                                                                      gecoscc/tasks.py on lines 2522..2523

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

                                                                                                      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

                                                                                                                      self.db.jobs.update_one({'_id': job['_id']},
                                                                                                                                          {'$set': {'status': 'finished',
                                                                                                                                                    'last_update': datetime.datetime.utcnow()}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 1 hr to fix
                                                                                                      gecoscc/tasks.py on lines 1982..1984

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

                                                                                                      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

                                                                                                                  self.db.nodes.update_one({'_id': obj['_id']}, {'$set': {'sudoers': list(gcc_sudoers)}})
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 50 mins to fix
                                                                                                      gecoscc/tasks.py on lines 2577..2578

                                                                                                      Duplicated Code

                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                      Tuning

                                                                                                      This issue has a mass of 36.

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

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

                                                                                                          self.db.nodes.update_one({'_id': computer['_id']},
                                                                                                              {'$set': {'sudoers': list(gcc_sudoers)}})
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 50 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1971..1971

                                                                                                      Duplicated Code

                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                      Tuning

                                                                                                      This issue has a mass of 36.

                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                      Refactorings

                                                                                                      Further Reading

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

                                                                                                              name_es = self._("deleted") + " " + self._(obj['type'])
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 45 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1766..1766

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

                                                                                                      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

                                                                                                              name_es = self._("deleted") + " " + self._(obj['type'])
                                                                                                      Severity: Minor
                                                                                                      Found in gecoscc/tasks.py and 1 other location - About 45 mins to fix
                                                                                                      gecoscc/tasks.py on lines 2166..2166

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

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

                                                                                                                              self.db.nodes.update_one({'_id': usr['_id']}, {'$set': {'computers': comptrs}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 30 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1457..1459
                                                                                                      gecoscc/tasks.py on lines 1553..1555
                                                                                                      gecoscc/tasks.py on lines 2501..2502
                                                                                                      gecoscc/tasks.py on lines 2541..2542

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

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

                                                                                                                      if error_last_saved:
                                                                                                                          self.db.nodes.update_one({'_id': computer['_id']},
                                                                                                                                               {'$set': {'error_last_saved': False}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 30 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1457..1459
                                                                                                      gecoscc/tasks.py on lines 1944..1944
                                                                                                      gecoscc/tasks.py on lines 2501..2502
                                                                                                      gecoscc/tasks.py on lines 2541..2542

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

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

                                                                                                                          self.db.nodes.update_one({'_id': user['_id']},
                                                                                                                              {'$set': {'computers': computers}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 30 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1457..1459
                                                                                                      gecoscc/tasks.py on lines 1553..1555
                                                                                                      gecoscc/tasks.py on lines 1944..1944
                                                                                                      gecoscc/tasks.py on lines 2541..2542

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

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

                                                                                                                      self.db.nodes.update_one({'_id': user['_id']},
                                                                                                                          {'$set': {'computers': computers}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 30 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1457..1459
                                                                                                      gecoscc/tasks.py on lines 1553..1555
                                                                                                      gecoscc/tasks.py on lines 1944..1944
                                                                                                      gecoscc/tasks.py on lines 2501..2502

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

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

                                                                                                              if not computer.get('error_last_saved', False):
                                                                                                                  self.db.nodes.update_one({'_id': computer['_id']},
                                                                                                                                       {'$set': {'error_last_saved': True}})
                                                                                                      Severity: Major
                                                                                                      Found in gecoscc/tasks.py and 4 other locations - About 30 mins to fix
                                                                                                      gecoscc/tasks.py on lines 1553..1555
                                                                                                      gecoscc/tasks.py on lines 1944..1944
                                                                                                      gecoscc/tasks.py on lines 2501..2502
                                                                                                      gecoscc/tasks.py on lines 2541..2542

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

                                                                                                      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