florath/rmtoo

View on GitHub
rmtoo/outputs/html.py

Summary

Maintainability
F
3 days
Test Coverage

Html has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class Html(ExecutorTopicContinuum, CreateMakeDependencies):
    """HTML output module"""

    def __init__(self, oconfig):
        '''Create a graph output object.'''
Severity: Minor
Found in rmtoo/outputs/html.py - About 2 hrs to fix

    File html.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    '''
     rmtoo
       Free and Open Source Requirements Management Tool
    
     HTML output class.
    Severity: Minor
    Found in rmtoo/outputs/html.py - About 2 hrs to fix

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

          def requirement(self, req):
              '''Output one requirement.'''
              out_fd = self.__fd_stack[-1]
              level = len(self.__fd_stack)
      
      
      Severity: Minor
      Found in rmtoo/outputs/html.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 output_html_topic_output_content has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def output_html_topic_output_content(self, fd, topic):
              # Subtopics go in a ul
              ul_open = False
              for t in topic.get_tags():
                  tag = t.get_tag()
      Severity: Minor
      Found in rmtoo/outputs/html.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

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

              if req.outgoing:
                  # Create links to the corresponding dependency nodes.
                  out_fd.write(u'<dt><span class="dlt_dependent">Dependent'
                               '</span></dt><dd><span class="dlv_dependent">')
                  is_first = True
      Severity: Major
      Found in rmtoo/outputs/html.py and 1 other location - About 7 hrs to fix
      rmtoo/outputs/html.py on lines 148..160

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

      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.incoming:
                  # Create links to the corresponding labels.
                  out_fd.write(u'<dt><span class="dlt_depends_on">Depends on:'
                               '</span></dt><dd><span class="dlv_depends_on">')
                  is_first = True
      Severity: Major
      Found in rmtoo/outputs/html.py and 1 other location - About 7 hrs to fix
      rmtoo/outputs/html.py on lines 162..174

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

      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 self.html_footer_filename is not None:
                  with io.open(self.html_footer_filename, "r",
                               encoding="utf-8") as fd:
                      self.html_footer = fd.read()
      Severity: Major
      Found in rmtoo/outputs/html.py and 1 other location - About 1 hr to fix
      rmtoo/outputs/html.py on lines 258..261

      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 self.html_header_filename is not None:
                  with io.open(self.html_header_filename, "r",
                               encoding="utf-8") as fd:
                      self.html_header = fd.read()
      Severity: Major
      Found in rmtoo/outputs/html.py and 1 other location - About 1 hr to fix
      rmtoo/outputs/html.py on lines 262..265

      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 req.is_value_available("Rationale") \
                      and req.get_value("Rationale") is not None:
                  out_fd.write(
                      u'<dt><span class="dlt_rationale">Rationale</span>'
                      '</dt><dd><span class="dlv_rationale">%s</span></dd>'
      Severity: Minor
      Found in rmtoo/outputs/html.py and 1 other location - About 35 mins to fix
      rmtoo/outputs/html.py on lines 128..130

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

      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

              out_fd.write(u'<dt><span class="dlt_description">Description</span>'
                           '</dt><dd><span class="dlv_description">%s</span></dd>' %
                           self.__markup.replace(req.get_value("Description")
      Severity: Minor
      Found in rmtoo/outputs/html.py and 1 other location - About 35 mins to fix
      rmtoo/outputs/html.py on lines 133..138

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

      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