Showing 48 of 169 total issues
File test_data.py
has 763 lines of code (exceeds 250 allowed). Consider refactoring. Open
top_level = [
{
'nmea': [ '!AIVDM,1,1,,B,181:Kjh01ewHFRPDK1s3IRcn06sd,0*08,raishub,1342569600' ],
'result': {'cog': 87.0,
'id': 1,
Function normalize
has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring. Open
def normalize(nmea=sys.stdin,
uscg=True,
validate_checksum=True,
allow_unknown=False,
window=2,
- Read upRead up
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
Mangler
has 88 functions (exceeds 20 allowed). Consider refactoring. Open
class Mangler(object):
"""Convert libais dictionaries to gpsd dictionaries."""
def __init__(self, copy_tagblock_timestamp=True):
self.copy_tagblock_timestamp = copy_tagblock_timestamp
File gpsd.py
has 447 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Convert libais message dictionaries to GPSD JSON."""
import datetime
File uscg_test.py
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Tests for ais.uscg."""
import unittest
from ais import uscg
File vdm_test.py
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""Tests for ais.vdm."""
import unittest
File nmea_messages_test.py
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Tests for ais.nmea_messages."""
import datetime
import unittest
File nmea_messages.py
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Parse non-AIS NMEA messages.
National Marine Electronics Association (NMEA) messages are comma separated
value lines of text that start with sender or "talker" code and the sentence
type. They finish up with a checksum. For example, this is a time message
File tag_block_test.py
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""Tests for ais.tag_block."""
import unittest
File benthos_validate.py
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
"""
Validator to ensure libais can produce Benthos's expected input
"""
Function put
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def put(self, line, line_num=None):
if line_num is not None:
self.line_num = line_num
else:
self.line_num += 1
- Read upRead up
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 validate_file
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def validate_file(self, base):
nmea_name = os.path.join(self.dir, base + '.nmea')
json_name = os.path.join(self.dir, base + '.gpsdecode.json')
subprocess.check_call('gpsdecode < %s > %s' % (nmea_name, json_name),
- Read upRead up
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 validate_file
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def validate_file(self, base):
nmea_name = os.path.join(self.dir, base + '.nmea')
json_name = os.path.join(self.dir, base + '.json')
def Json():
- Read upRead up
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 validate_messages
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate_messages(messages, err=None):
"""
Determine whether or not an input message conforms to the Benthos spec.
- Read upRead up
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 __init__.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Based on ais_normalize.py from https://github.com/schwehr/noaadata
import sys
import traceback
import warnings
File nmea_queue_test.py
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Tests for ais.nmea_queue."""
import contextlib
import unittest
Function put
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def put(self, line, line_num=None):
if line_num is not None:
self.line_num = line_num
else:
self.line_num += 1
- Read upRead up
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 put
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def put(self, line, line_num=None):
"""Add a line of NMEA or raw text to the queue."""
if line_num is not None:
self.line_num = line_num
- Read upRead up
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 AddLine
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def AddLine(self, line):
print(line.rstrip())
self.counts['lines'] += 1
self.queue.put(line)
msg = self.queue.GetOrNone()
- Read upRead up
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 mmsi_codes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def mmsi_codes(filename=None):
'''Create a table of 3 digit MMSI codes
@return: code lookup table
@rtype: dict
'''
- Read upRead up
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"