gecos-team/gecoscc-ui

View on GitHub

Showing 1,621 of 1,621 total issues

File ad_import.py has 638 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

#
# Copyright 2013, Junta de Andalucia
# http://www.juntadeandalucia.es/
Severity: Major
Found in gecoscc/api/ad_import.py - About 1 day to fix

    Function convert has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

        def convert(self, xmlgpo):
            if self.policy is None:
                return None
    
            result = [{
    Severity: Minor
    Found in gecoscc/api/gpoconversors/file_browser.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

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

        try:
    
            settings = get_current_registry().settings
    
            if is_cli_request():
    Severity: Major
    Found in gecoscc/utils.py and 1 other location - About 1 day to fix
    gecoscc/utils.py on lines 2661..2679

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

    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:
     
            settings = get_current_registry().settings
    
            if is_cli_request():
    Severity: Major
    Found in gecoscc/utils.py and 1 other location - About 1 day to fix
    gecoscc/utils.py on lines 2702..2720

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

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

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

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

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

    Refactorings

    Further Reading

    Function move_in_inheritance has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

    def move_in_inheritance(logger, db, obj, inheritanceTree):
        """Move an object to another position in the inheritance Tree.
    
        Args:
            logger (object): Logger.
    Severity: Minor
    Found in gecoscc/utils.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

    File tree.js has 612 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*jslint browser: true, nomen: true, unparam: true */
    /*global App, TreeModel, gettext */
    
    /*
    * Copyright 2013, Junta de Andalucia
    Severity: Major
    Found in gecoscc/static/js/tree.js - About 1 day to fix

      File computer.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*jslint browser: true, nomen: true, unparam: true, vars: false */
      /*global App, gettext */
      
      /*
      * Copyright 2013, Junta de Andalucia
      Severity: Major
      Found in gecoscc/static/js/computer.js - About 1 day to fix

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

            @mock.patch('gecoscc.tasks.get_cookbook')
            @mock.patch('gecoscc.utils.get_cookbook')
            def test_08_OU(self, get_cookbook_method, get_cookbook_method_tasks):
                '''
                Test 8: Create, update and delete a OU
        Severity: Major
        Found in gecoscc/tests.py and 4 other locations - About 1 day to fix
        gecoscc/tests.py on lines 1409..1444
        gecoscc/tests.py on lines 1446..1480
        gecoscc/tests.py on lines 1482..1516
        gecoscc/tests.py on lines 1518..1550

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 153.

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

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

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

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

        Refactorings

        Further Reading

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

            @mock.patch('gecoscc.tasks.get_cookbook')
            @mock.patch('gecoscc.utils.get_cookbook')
            def test_02_printers(self, get_cookbook_method, get_cookbook_method_tasks):
                '''
                Test 2: Create, update and delete a printer
        Severity: Major
        Found in gecoscc/tests.py and 4 other locations - About 1 day to fix
        gecoscc/tests.py on lines 1446..1480
        gecoscc/tests.py on lines 1482..1516
        gecoscc/tests.py on lines 1518..1550
        gecoscc/tests.py on lines 1627..1661

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 153.

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

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

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

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

        Refactorings

        Further Reading

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

            @mock.patch('gecoscc.tasks.get_cookbook')
            @mock.patch('gecoscc.utils.get_cookbook')
            def test_03_shared_folder(self, get_cookbook_method,
                    get_cookbook_method_tasks):
                '''
        Severity: Major
        Found in gecoscc/tests.py and 4 other locations - About 1 day to fix
        gecoscc/tests.py on lines 1409..1444
        gecoscc/tests.py on lines 1482..1516
        gecoscc/tests.py on lines 1518..1550
        gecoscc/tests.py on lines 1627..1661

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 153.

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

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

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

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

        Refactorings

        Further Reading

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

            @mock.patch('gecoscc.tasks.get_cookbook')
            @mock.patch('gecoscc.utils.get_cookbook')
            def test_05_user(self, get_cookbook_method, get_cookbook_method_tasks):
                '''
                Test 5: Create, update and delete an user
        Severity: Major
        Found in gecoscc/tests.py and 4 other locations - About 1 day to fix
        gecoscc/tests.py on lines 1409..1444
        gecoscc/tests.py on lines 1446..1480
        gecoscc/tests.py on lines 1482..1516
        gecoscc/tests.py on lines 1627..1661

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 153.

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

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

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

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

        Refactorings

        Further Reading

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

            @mock.patch('gecoscc.tasks.get_cookbook')
            @mock.patch('gecoscc.utils.get_cookbook')
            def test_04_repository(self, get_cookbook_method,
                get_cookbook_method_tasks):
                '''
        Severity: Major
        Found in gecoscc/tests.py and 4 other locations - About 1 day to fix
        gecoscc/tests.py on lines 1409..1444
        gecoscc/tests.py on lines 1446..1480
        gecoscc/tests.py on lines 1518..1550
        gecoscc/tests.py on lines 1627..1661

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 153.

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

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

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

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

        Refactorings

        Further Reading

        Function checkValidity has 261 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var checkValidity = function (env, schema_stack, object_stack, options) {
            var i, len, count, hasProp, hasPattern;
            var p, v, malformed = false, objerrs = {}, objerr, props, matched;
            var sl = schema_stack.length-1, schema = schema_stack[sl], new_stack;
            var ol = object_stack.length-1, object = object_stack[ol].object, name = object_stack[ol].key, prop = object[name];
        Severity: Major
        Found in gecoscc/static/js/libs/jjv.js - About 1 day to fix

          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

              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

          Function _convertADObjectToMongoObject has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
          Open

              def _convertADObjectToMongoObject(self, domain, mongoObjects, objSchema, adObj, is_ad_master, report, objects_apply_policy):
          
                  def update_object(self, objSchema, mongoObj, adObj):
                      """
                      Update an object from a collection with a GUID in common.
          Severity: Minor
          Found in gecoscc/api/ad_import.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 calculate_initial_inheritance_for_node has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
          Open

          def calculate_initial_inheritance_for_node(logger, db, node):
              """Function that calculates the initial "inheritance" field of a node.
          
              Args:
                  logger (object): Logger.
          Severity: Minor
          Found in gecoscc/utils.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 command has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
          Open

              def command(self):
                  api = _get_chef_api(self.settings.get('chef.url'),
                                      toChefUsername(self.options.chef_username),
                                      self.options.chef_pem,
                                      self.settings.get('chef.ssl.verify'),
          Severity: Minor
          Found in gecoscc/commands/import_policies.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

          File admins.py has 532 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #
          # Copyright 2013, Junta de Andalucia
          # http://www.juntadeandalucia.es/
          #
          # Authors:
          Severity: Major
          Found in gecoscc/views/admins.py - About 1 day to fix

            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

            Severity
            Category
            Status
            Source
            Language