Syncleus/apex

View on GitHub
src/apex/plugins/apexparadigm/__init__.py

Summary

Maintainability
F
1 wk
Test Coverage

Function __passive_digipeat has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

    def __passive_digipeat(self, frame, recv_port, recv_port_name):
        # can't digipeat packets if we are in the expended path
        if apex.routing.has_seen(self.port_map, frame):
            return

Severity: Minor
Found in src/apex/plugins/apexparadigm/__init__.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 __preemptive_digipeat has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    def __preemptive_digipeat(self, frame, recv_port, recv_port_name):
        # can't digipeat packets if we are in the expended path
        if apex.routing.has_seen(self.port_map, frame):
            return

Severity: Minor
Found in src/apex/plugins/apexparadigm/__init__.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

Avoid deeply nested control flow statements.
Open

                        if ssid is 0:
                            frame['path'][hop_index] = port_callsign + '*'
                        else:
                            frame['path'][hop_index] = port['identifier'] + '*'
                        port['tnc'].write(frame, port['tnc_port'])
Severity: Major
Found in src/apex/plugins/apexparadigm/__init__.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if band_path_net:
                                if node == port['net']:
                                    frame['path'] = frame['path'][:hop_index] + [recv_port['identifier'] + '*'] +\
                                                    [hop + '*'] + frame['path'][hop_index+1:]
                                    port['tnc'].write(frame, port['tnc_port'])
    Severity: Major
    Found in src/apex/plugins/apexparadigm/__init__.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

                          return
      Severity: Major
      Found in src/apex/plugins/apexparadigm/__init__.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return
        Severity: Major
        Found in src/apex/plugins/apexparadigm/__init__.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return
          Severity: Major
          Found in src/apex/plugins/apexparadigm/__init__.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return
            Severity: Major
            Found in src/apex/plugins/apexparadigm/__init__.py - About 30 mins to fix

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

                              if band_path_net and node == port['net']:
                                  # only when a ssid is present should it be treated preemptively if it is a band path
                                  if not selected_hop:
                                      selected_hop['index'] = hop_index
                                      selected_hop['hop'] = hop
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 day to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 178..197

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

              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

                              elif not band_path_net and port['net'].startswith(band_path):
                                  # only when a ssid is present should it be treated preemptively if it is a band path
                                  if not selected_hop:
                                      selected_hop['index'] = hop_index
                                      selected_hop['hop'] = hop
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 day to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 158..177

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

              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

                                  elif node == 'GATE' and port['net'].startswith('2M'):
                                      frame['path'] = frame['path'][:hop_index] + [recv_port['identifier'] + '*'] + [node + '*'] +\
                                                      frame['path'][hop_index+1:]
                                      port['tnc'].write(frame, port['tnc_port'])
                                      self.aprsis.write(frame)
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 3 other locations - About 7 hrs to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 80..85
              src/apex/plugins/apexparadigm/__init__.py on lines 87..92
              src/apex/plugins/apexparadigm/__init__.py on lines 113..117

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

              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

                              elif node.startswith('WIDE') and ssid is 1:
                                  frame['path'] = frame['path'][:hop_index] + [recv_port['identifier'] + '*'] + [node + '*'] + frame['path'][hop_index+1:]
                                  port['tnc'].write(frame, port['tnc_port'])
                                  self.aprsis.write(frame)
                                  return
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 3 other locations - About 7 hrs to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 80..85
              src/apex/plugins/apexparadigm/__init__.py on lines 87..92
              src/apex/plugins/apexparadigm/__init__.py on lines 101..106

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

              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 node == port['net']:
                                              frame['path'] = frame['path'][:hop_index] + [recv_port['identifier'] + '*'] +\
                                                              [hop + '*'] + frame['path'][hop_index+1:]
                                              port['tnc'].write(frame, port['tnc_port'])
                                              self.aprsis.write(frame)
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 3 other locations - About 7 hrs to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 87..92
              src/apex/plugins/apexparadigm/__init__.py on lines 101..106
              src/apex/plugins/apexparadigm/__init__.py on lines 113..117

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

              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 port['net'].startswith(node):
                                              frame['path'] = frame['path'][:hop_index] + [recv_port['identifier'] + '*'] +\
                                                              [hop + '*'] + frame['path'][hop_index+1:]
                                              port['tnc'].write(frame, port['tnc_port'])
                                              self.aprsis.write(frame)
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 3 other locations - About 7 hrs to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 80..85
              src/apex/plugins/apexparadigm/__init__.py on lines 101..106
              src/apex/plugins/apexparadigm/__init__.py on lines 113..117

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

              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 len(split_port_identifier) >= 2 and split_port_identifier[1]:
                                      port_ssid = int(split_port_identifier[1])
                                  else:
                                      port_ssid = 0
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 hr to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 57..60

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

              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 len(split_hop) >= 2 and split_hop[1]:
                                  ssid = int(split_hop[1])
                              else:
                                  ssid = 0
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 hr to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 73..76

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

              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 apex.routing.is_hop_consumed(hop) or apex.routing.is_hop_consumed(frame['path'][hop_index-1]):
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 hr to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 137..137

              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

                          if apex.routing.is_hop_consumed(hop) or apex.routing.is_hop_consumed(frame['path'][hop_index-1]):
              Severity: Major
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 1 hr to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 201..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 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

                          if band_match is not None:
                              band_path = band_match.group(1)
                              band_path_net = band_match.group(2)
              Severity: Minor
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 30 mins to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 65..67

              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

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

                              if band_match is not None:
                                  band_path = band_match.group(1)
                                  band_path_net = band_match.group(2)
              Severity: Minor
              Found in src/apex/plugins/apexparadigm/__init__.py and 1 other location - About 30 mins to fix
              src/apex/plugins/apexparadigm/__init__.py on lines 149..151

              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