schwehr/libais

View on GitHub

Showing 169 of 169 total issues

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

    'turn': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in range(-127, 129),
        'good': 125,
        'bad': -1000
Severity: Major
Found in utils/benthos_validate.py and 4 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 37..40
utils/benthos_validate.py on lines 52..55
utils/benthos_validate.py on lines 92..95
utils/benthos_validate.py on lines 159..162

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 4 locations. Consider refactoring.
Open

    'hour': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in range(0, 25),
        'good': 23,
        'bad': ','
Severity: Major
Found in utils/benthos_validate.py and 3 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 164..167
utils/benthos_validate.py on lines 169..172
utils/benthos_validate.py on lines 179..182

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

Function DictDiff has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def DictDiff(a, b):
  """Compares two dictionaries. Intended to be used in a test to
  compare the actual return value from some function with a
  known-good value.

Severity: Minor
Found in test/testutils.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 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()
Severity: Minor
Found in ais/stats.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 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
    '''
Severity: Minor
Found in utils/maritime_id_codes.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 parseTagBlock has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def parseTagBlock(line):
  if not line.startswith("\\"):
    return {}, line
  tagblock, line = line[1:].split("\\", 1)
  tagblock, checksum = tagblock.rsplit("*", 1)
Severity: Minor
Found in ais/stream/__init__.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 11 locations. Consider refactoring.
Open

    'maneuver': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (1, 2),
        'good': 2,
        'bad': 3
Severity: Major
Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 67..70
utils/benthos_validate.py on lines 102..105
utils/benthos_validate.py on lines 194..197
utils/benthos_validate.py on lines 216..219
utils/benthos_validate.py on lines 226..229
utils/benthos_validate.py on lines 231..234
utils/benthos_validate.py on lines 236..239
utils/benthos_validate.py on lines 241..244
utils/benthos_validate.py on lines 250..253
utils/benthos_validate.py on lines 277..280

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

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 11 locations. Consider refactoring.
Open

    'raim': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: bool is more Pythonic if the field is actually boolean and not state
        'good': 0,
        'bad': -2
Severity: Major
Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 67..70
utils/benthos_validate.py on lines 97..100
utils/benthos_validate.py on lines 194..197
utils/benthos_validate.py on lines 216..219
utils/benthos_validate.py on lines 226..229
utils/benthos_validate.py on lines 231..234
utils/benthos_validate.py on lines 236..239
utils/benthos_validate.py on lines 241..244
utils/benthos_validate.py on lines 250..253
utils/benthos_validate.py on lines 277..280

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

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 11 locations. Consider refactoring.
Open

    'dsc': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: Switch to a more Pythonic bool?
        'good': 1,
        'bad': -45
Severity: Major
Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 67..70
utils/benthos_validate.py on lines 97..100
utils/benthos_validate.py on lines 102..105
utils/benthos_validate.py on lines 194..197
utils/benthos_validate.py on lines 216..219
utils/benthos_validate.py on lines 231..234
utils/benthos_validate.py on lines 236..239
utils/benthos_validate.py on lines 241..244
utils/benthos_validate.py on lines 250..253
utils/benthos_validate.py on lines 277..280

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

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 sentence_num == 1:
      self.groups[group_id] = {
          'line_nums': [self.line_num],
          'lines': [line],
          'matches': [match],
Severity: Major
Found in ais/uscg.py and 1 other location - About 1 hr to fix
ais/tag_block.py on lines 147..154

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

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 11 locations. Consider refactoring.
Open

    'assigned': {
        'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: Switch to a more Pythonic bool?
        'good': 1,
        'bad': -33
Severity: Major
Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 67..70
utils/benthos_validate.py on lines 97..100
utils/benthos_validate.py on lines 102..105
utils/benthos_validate.py on lines 194..197
utils/benthos_validate.py on lines 216..219
utils/benthos_validate.py on lines 226..229
utils/benthos_validate.py on lines 231..234
utils/benthos_validate.py on lines 236..239
utils/benthos_validate.py on lines 250..253
utils/benthos_validate.py on lines 277..280

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

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

    'lon': {
        'test': lambda x: isinstance(x, float) and -180 <= x <= 180 or x == 181,  # TODO: Should -180 be a valid value?  Maybe `-180 < x` instead?
        'good': 181,
        'bad': -180.1
Severity: Major
Found in utils/benthos_validate.py and 2 other locations - About 1 hr to fix
utils/benthos_validate.py on lines 62..65
utils/benthos_validate.py on lines 72..75

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

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

Function normalize has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def normalize(nmea=sys.stdin,
Severity: Major
Found in ais/stream/__init__.py - About 1 hr to fix

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

        'band': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: Switch to a more Pythonic bool?
            'good': 0,
            'bad': 4
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 194..197
    utils/benthos_validate.py on lines 216..219
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 236..239
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 250..253
    utils/benthos_validate.py on lines 277..280

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

    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 11 locations. Consider refactoring.
    Open

        'partno': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),
            'good': 0,
            'bad': -1
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 194..197
    utils/benthos_validate.py on lines 216..219
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 231..234
    utils/benthos_validate.py on lines 236..239
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 277..280

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

    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 11 locations. Consider refactoring.
    Open

        'cs': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # Not bool - state
            'good': 0,
            'bad': 7
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 194..197
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 231..234
    utils/benthos_validate.py on lines 236..239
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 250..253
    utils/benthos_validate.py on lines 277..280

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

    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

        'lat': {
            'test': lambda x: isinstance(x, float) and -90 <= x <= 90 or x == 91,
            'good': 91,
            'bad': -100
    Severity: Major
    Found in utils/benthos_validate.py and 2 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 62..65
    utils/benthos_validate.py on lines 77..80

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

    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 11 locations. Consider refactoring.
    Open

        'msg22': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: Switch to a more Pythonic bool?
            'good': 0,
            'bad': -2
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 194..197
    utils/benthos_validate.py on lines 216..219
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 231..234
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 250..253
    utils/benthos_validate.py on lines 277..280

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

    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 11 locations. Consider refactoring.
    Open

        'gnss': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # Not bool - state
            'good': 0,
            'bad': 3
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 194..197
    utils/benthos_validate.py on lines 216..219
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 231..234
    utils/benthos_validate.py on lines 236..239
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 250..253

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

    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 11 locations. Consider refactoring.
    Open

        'dte': {
            'test': lambda x: isinstance(x, int) and not isinstance(x, bool) and x in (0, 1),  # TODO: Switch to a more Pythonic bool if this is actually boolean and not a status
            'good': 0,
            'bad': 8
    Severity: Major
    Found in utils/benthos_validate.py and 10 other locations - About 1 hr to fix
    utils/benthos_validate.py on lines 67..70
    utils/benthos_validate.py on lines 97..100
    utils/benthos_validate.py on lines 102..105
    utils/benthos_validate.py on lines 216..219
    utils/benthos_validate.py on lines 226..229
    utils/benthos_validate.py on lines 231..234
    utils/benthos_validate.py on lines 236..239
    utils/benthos_validate.py on lines 241..244
    utils/benthos_validate.py on lines 250..253
    utils/benthos_validate.py on lines 277..280

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

    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

    Severity
    Category
    Status
    Source
    Language