firehol/netdata

View on GitHub
src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py

Summary

Maintainability
F
1 wk
Test Coverage

Function parse_node has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_node(self, block=False, indentless_sequence=False):
        if self.check_token(AliasToken):
            token = self.get_token()
            event = AliasEvent(token.value, token.start_mark, token.end_mark)
            self.state = self.states.pop()
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.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

File parser.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT

# The following YAML grammar is LL(1) and is parsed by a recursive descent
# parser.
#
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 5 hrs to fix

    Parser has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Parser:
        # Since writing a recursive-descendant parser is a straightforward task, we
        # do not give many comments here.
    
        DEFAULT_TAGS = {
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 3 hrs to fix

      Function process_directives has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_directives(self):
              self.yaml_version = None
              self.tag_handles = {}
              while self.check_token(DirectiveToken):
                  token = self.get_token()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 2 hrs 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_flow_mapping_key has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_flow_mapping_key(self, first=False):
              if not self.check_token(FlowMappingEndToken):
                  if not first:
                      if self.check_token(FlowEntryToken):
                          self.get_token()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.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 check_event has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_event(self, *choices):
              # Check the type of the next event.
              if self.current_event is None:
                  if self.state:
                      self.current_event = self.state()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.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 parse_flow_sequence_entry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_flow_sequence_entry(self, first=False):
              if not self.check_token(FlowSequenceEndToken):
                  if not first:
                      if self.check_token(FlowEntryToken):
                          self.get_token()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.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

          def parse_flow_sequence_entry_mapping_value(self):
              if self.check_token(ValueToken):
                  token = self.get_token()
                  if not self.check_token(FlowEntryToken, FlowSequenceEndToken):
                      self.states.append(self.parse_flow_sequence_entry_mapping_end)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 570..582

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

      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

          def parse_flow_mapping_value(self):
              if self.check_token(ValueToken):
                  token = self.get_token()
                  if not self.check_token(FlowEntryToken, FlowMappingEndToken):
                      self.states.append(self.parse_flow_mapping_key)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 513..525

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

      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

          def parse_flow_sequence_entry_mapping_key(self):
              token = self.get_token()
              if not self.check_token(ValueToken,
                      FlowEntryToken, FlowSequenceEndToken):
                  self.states.append(self.parse_flow_sequence_entry_mapping_value)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 429..436
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 448..455
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 552..560

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

      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 self.check_token(KeyToken):
                      token = self.get_token()
                      if not self.check_token(ValueToken,
                              FlowEntryToken, FlowMappingEndToken):
                          self.states.append(self.parse_flow_mapping_value)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 429..436
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 448..455
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 503..511

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

      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 self.check_token(KeyToken):
                  token = self.get_token()
                  if not self.check_token(KeyToken, ValueToken, BlockEndToken):
                      self.states.append(self.parse_block_mapping_value)
                      return self.parse_block_node_or_indentless_sequence()
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 448..455
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 503..511
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 552..560

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

      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 self.check_token(ValueToken):
                  token = self.get_token()
                  if not self.check_token(KeyToken, ValueToken, BlockEndToken):
                      self.states.append(self.parse_block_mapping_key)
                      return self.parse_block_node_or_indentless_sequence()
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 429..436
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 503..511
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 552..560

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

      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 not first:
                      if self.check_token(FlowEntryToken):
                          self.get_token()
                      else:
                          token = self.peek_token()
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 479..485

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

      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 not first:
                      if self.check_token(FlowEntryToken):
                          self.get_token()
                      else:
                          token = self.peek_token()
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 545..551

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

      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 not self.check_token(BlockEndToken):
                  token = self.peek_token()
                  raise ParserError("while parsing a block collection", self.marks[-1],
                          "expected <block end>, but found %r" % token.id, token.start_mark)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 437..440

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

      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 not self.check_token(BlockEndToken):
                  token = self.peek_token()
                  raise ParserError("while parsing a block mapping", self.marks[-1],
                          "expected <block end>, but found %r" % token.id, token.start_mark)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 391..394

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

      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

          def parse_flow_sequence_first_entry(self):
              token = self.get_token()
              self.marks.append(token.start_mark)
              return self.parse_flow_sequence_entry(first=True)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 538..541

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

      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

          def parse_flow_mapping_first_key(self):
              token = self.get_token()
              self.marks.append(token.start_mark)
              return self.parse_flow_mapping_key(first=True)
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 472..475

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

      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 block and self.check_token(BlockMappingStartToken):
                          end_mark = self.peek_token().start_mark
                          event = MappingStartEvent(anchor, tag, implicit,
                                  start_mark, end_mark, flow_style=False)
                          self.state = self.parse_block_mapping_first_key
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 338..342
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 343..347
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 348..352

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

      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 block and self.check_token(BlockSequenceStartToken):
                          end_mark = self.peek_token().start_mark
                          event = SequenceStartEvent(anchor, tag, implicit,
                                  start_mark, end_mark, flow_style=False)
                          self.state = self.parse_block_sequence_first_entry
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 338..342
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 343..347
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 353..357

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

      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 self.check_token(FlowMappingStartToken):
                          end_mark = self.peek_token().end_mark
                          event = MappingStartEvent(anchor, tag, implicit,
                                  start_mark, end_mark, flow_style=True)
                          self.state = self.parse_flow_mapping_first_key
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 338..342
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 348..352
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 353..357

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

      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 self.check_token(FlowSequenceStartToken):
                          end_mark = self.peek_token().end_mark
                          event = SequenceStartEvent(anchor, tag, implicit,
                                  start_mark, end_mark, flow_style=True)
                          self.state = self.parse_flow_sequence_first_entry
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 343..347
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 348..352
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 353..357

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

      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

          def parse_block_sequence_first_entry(self):
              token = self.get_token()
              self.marks.append(token.start_mark)
              return self.parse_block_sequence_entry()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py and 1 other location - About 45 mins to fix
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 423..426

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

      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

          def parse_block_mapping_first_key(self):
              token = self.get_token()
              self.marks.append(token.start_mark)
              return self.parse_block_mapping_key()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py and 1 other location - About 45 mins to fix
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 377..380

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

      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.check_token(KeyToken):
                      token = self.peek_token()
                      event = MappingStartEvent(None, None, True,
                              token.start_mark, token.end_mark,
                              flow_style=True)
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py and 1 other location - About 40 mins to fix
      src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py on lines 552..563

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

      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