florath/rmtoo

View on GitHub
rmtoo/lib/RequirementSet.py

Summary

Maintainability
F
4 days
Test Coverage

File RequirementSet.py has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
 rmtoo
   Free and Open Source Requirements Management Tool

  Collection of topics.
Severity: Minor
Found in rmtoo/lib/RequirementSet.py - About 7 hrs to fix

    RequirementSet has 44 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RequirementSet(Digraph, UsableFlag):
        '''A RequirementSet holds one DAG (directed acyclic graph)
           of requirements.'''
    
        def __init__(self, config):
    Severity: Minor
    Found in rmtoo/lib/RequirementSet.py - About 6 hrs to fix

      Function __create_local_ce3s has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __create_local_ce3s(self):
              '''Create the local Constraint Execution Environments
                 and evaluate the given statements.
                 This method does two things:
                 - evaluating the constraints in the CE3
      Severity: Minor
      Found in rmtoo/lib/RequirementSet.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 __read_one_element has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __read_one_element(self, fileinfo, input_mods, object_cache,
      Severity: Minor
      Found in rmtoo/lib/RequirementSet.py - About 35 mins to fix

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

            def __restrict_to_topics_one_req(self, restricted_reqs, req):
                tracer.debug("Restricting requirement [%s]", req.get_id())
                # Add to the internal map
                restricted_reqs.add_requirement(req)
                # Add to the common digraph structure
        Severity: Minor
        Found in rmtoo/lib/RequirementSet.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 __resolve_depends_on_one_req_impl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __resolve_depends_on_one_req_impl(self, req):
                tag_content = req.brmo["Depends on"]
        
                # If available, it must not empty
                if not tag_content.get_content():
        Severity: Minor
        Found in rmtoo/lib/RequirementSet.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 __resolve_solved_by_one_req_deps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __resolve_solved_by_one_req_deps(self, req):
                content = req.brmo["Solved by"].get_content()
                # If available, it must not empty
                if not content:
                    logger.error(LogFormatter.format(
        Severity: Minor
        Found in rmtoo/lib/RequirementSet.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 execute(self, executor, func_prefix):
                '''Execute the parts which are needed for RequirementSet.'''
                tracer.debug("calling pre")
                FuncCall.pcall(executor, func_prefix + "requirement_set_pre", self)
                tracer.debug("calling sub requirement set")
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 1 other location - About 6 hrs to fix
        rmtoo/lib/TopicContinuumSet.py on lines 59..70

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

        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

            def __read_all_testcases(self, input_handler, commit, input_mods,
                                     object_cache):
                '''Read in all the testcases from the input handler.'''
                tracer.debug("Called.")
                fileinfos = input_handler.get_file_infos(commit, "testcases")
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 2 hrs to fix
        rmtoo/lib/RequirementSet.py on lines 98..105
        rmtoo/lib/RequirementSet.py on lines 203..210

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 60.

        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

            def __read_all_constraints(self, input_handler, commit, input_mods,
                                       object_cache):
                '''Read in all the constraints from the input handler.'''
                tracer.debug("Called.")
                fileinfos = input_handler.get_file_infos(commit, "constraints")
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 2 hrs to fix
        rmtoo/lib/RequirementSet.py on lines 98..105
        rmtoo/lib/RequirementSet.py on lines 231..238

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

        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

            def __read_all_requirements(self, input_handler, commit, input_mods,
                                        object_cache):
                '''Read in all the requirements from the input handler.'''
                tracer.debug("Called.")
                fileinfos = input_handler.get_file_infos(commit, "requirements")
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 2 hrs to fix
        rmtoo/lib/RequirementSet.py on lines 203..210
        rmtoo/lib/RequirementSet.py on lines 231..238

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

        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

            def add_requirement(self, req):
                '''Add requirement to the internal container.'''
                tracer.debug("Add requirement [%s]", req.get_id())
                self.__requirements[req.get_id()] = req
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 263..266
        rmtoo/lib/RequirementSet.py on lines 268..271

        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

            def add_testcase(self, testcase):
                '''Add testcase to the internal container.'''
                tracer.debug("Add testcase [%s]", testcase.get_id())
                self.__testcases[testcase.get_id()] = testcase
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 258..261
        rmtoo/lib/RequirementSet.py on lines 263..266

        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

            def add_constraint(self, ctr):
                '''Add constraint to the internal container.'''
                tracer.debug("Add constraint [%s]", ctr.get_id())
                self.__constraints[ctr.get_id()] = ctr
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 2 other locations - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 258..261
        rmtoo/lib/RequirementSet.py on lines 268..271

        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 req.is_usable():
                    # Store in the map, so that it is easy to access the
                    # node by id.
                    self.add_requirement(req)
                    # Also store it in the digraph's node list for simple
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 1 other location - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 192..201

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

        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 result.is_usable():
                    # Store in the map, so that it is easy to access the
                    # node by id.
                    self.add_constraint(result)
                    # Also store it in the digraph's node list for simple
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 1 other location - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 86..95

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

        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 dep == req.get_id():
                        logger.error(LogFormatter.format(
                            75, "'Solved by' points to the "
                            "requirement itself", req.get_id()))
                        return False
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 1 other location - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 432..436

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

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

                    if split_tag == req.get_id():
                        logger.error(LogFormatter.format(
                            59, "'Depends on' points to the "
                            "requirement itself", req.get_id()))
                        return False
        Severity: Major
        Found in rmtoo/lib/RequirementSet.py and 1 other location - About 1 hr to fix
        rmtoo/lib/RequirementSet.py on lines 344..348

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 38.

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

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

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

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

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status