schwehr/libais

View on GitHub

Showing 48 of 169 total issues

Avoid too many return statements within this function.
Open

      return
Severity: Major
Found in ais/uscg.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return TAGB
    Severity: Major
    Found in ais/nmea.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return
      Severity: Major
      Found in ais/vdm.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return
        Severity: Major
        Found in ais/vdm.py - About 30 mins to fix

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

          def checksumStr(data):
              """Take a NMEA 0183 string and compute the checksum.
              @param data: NMEA message.  Leading ?/! and training checksum are optional
              @type data: str
              @return: hexadecimal value
          Severity: Minor
          Found in ais/stream/checksum.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 test_all_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def test_all_types(self):
                  for msg_type, msg_fields in MSG_TYPE_FIELDS.items():
          
                      # Check type field individually since the other tests force it to be correct
                      assert not validate_messages([{'field': 'val'}])
          Severity: Minor
          Found in utils/benthos_validate.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 Parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def Parse(data):
            """Unpack a TAG Block line or return None.
          
            Makes sure that the line matches the regex and the checksum matches.
          
          
          Severity: Minor
          Found in ais/tag_block.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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def __call__(self, msg):
              res = {}
              self.mangle(res, msg)
              method = 'mangle__%s' % (msg['id'],)
              if hasattr(self, method):
          Severity: Minor
          Found in ais/compatibility/gpsd.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

          Severity
          Category
          Status
          Source
          Language