netdata/netdata

View on GitHub
src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py

Summary

Maintainability
F
3 wks
Test Coverage

File emitter.py has 955 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT

# Emitter expects events obeying the following grammar:
# stream ::= STREAM-START document* STREAM-END
# document ::= DOCUMENT-START node DOCUMENT-END
Severity: Major
Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 2 days to fix

    Function analyze_scalar has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
    Open

        def analyze_scalar(self, scalar):
    
            # Empty scalar is a special case.
            if not scalar:
                return ScalarAnalysis(scalar=scalar, empty=True, multiline=False,
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 write_single_quoted has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_single_quoted(self, text, split=True):
            self.write_indicator(u'\'', True)
            spaces = False
            breaks = False
            start = end = 0
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 write_folded has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_folded(self, text):
            hints = self.determine_block_hints(text)
            self.write_indicator(u'>'+hints, True)
            if hints[-1:] == u'+':
                self.open_ended = True
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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

    Emitter has 59 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Emitter(object):
    
        DEFAULT_TAG_PREFIXES = {
            u'!' : u'!',
            u'tag:yaml.org,2002:' : u'!!',
    Severity: Major
    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 1 day to fix

      Function write_plain has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_plain(self, text, split=True):
              if self.root_context:
                  self.open_ended = True
              if not text:
                  return
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 write_double_quoted has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_double_quoted(self, text, split=True):
              self.write_indicator(u'"', True)
              start = end = 0
              while end <= len(text):
                  ch = None
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 7 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 write_literal has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_literal(self, text):
              hints = self.determine_block_hints(text)
              self.write_indicator(u'|'+hints, True)
              if hints[-1:] == u'+':
                  self.open_ended = True
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 5 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 choose_scalar_style has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def choose_scalar_style(self):
              if self.analysis is None:
                  self.analysis = self.analyze_scalar(self.event.value)
              if self.event.style == '"' or self.canonical:
                  return '"'
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 3 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 expect_document_start has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def expect_document_start(self, first=False):
              if isinstance(self.event, DocumentStartEvent):
                  if (self.event.version or self.event.tags) and self.open_ended:
                      self.write_indicator(u'...', True)
                      self.write_indent()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 3 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 prepare_tag has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare_tag(self, tag):
              if not tag:
                  raise EmitterError("tag must not be empty")
              if tag == u'!':
                  return tag
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 process_tag has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_tag(self):
              tag = self.event.tag
              if isinstance(self.event, ScalarEvent):
                  if self.style is None:
                      self.style = self.choose_scalar_style()
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 expect_node has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def expect_node(self, root=False, sequence=False, mapping=False,
                  simple_key=False):
              self.root_context = root
              self.sequence_context = sequence
              self.mapping_context = mapping
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 prepare_tag_prefix has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare_tag_prefix(self, prefix):
              if not prefix:
                  raise EmitterError("tag prefix must not be empty")
              chunks = []
              start = end = 0
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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_simple_key has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_simple_key(self):
              length = 0
              if isinstance(self.event, NodeEvent) and self.event.anchor is not None:
                  if self.prepared_anchor is None:
                      self.prepared_anchor = self.prepare_anchor(self.event.anchor)
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 expect_flow_mapping_key has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def expect_flow_mapping_key(self):
              if isinstance(self.event, MappingEndEvent):
                  self.indent = self.indents.pop()
                  self.flow_level -= 1
                  if self.canonical:
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 __init__ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, stream, canonical=None, indent=None, width=None,
                  allow_unicode=None, line_break=None):
      
              # The stream should have the methods `write` and possibly `flush`.
              self.stream = stream
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 1 hr to fix

        Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, scalar, empty, multiline,
        Severity: Major
        Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if (not (self.simple_key_context and
                              (self.analysis.empty or self.analysis.multiline))
                          and (self.flow_level and self.analysis.allow_flow_plain
                              or (not self.flow_level and self.analysis.allow_block_plain))):
                          return ''
          Severity: Major
          Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if self.encoding:
                                        data = data.encode(self.encoding)
                                    self.stream.write(data)
            Severity: Major
            Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if br == u'\n':
                                          self.write_line_break()
                                      else:
                                          self.write_line_break(br)
                                  self.write_indent()
              Severity: Major
              Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if br == u'\n':
                                            self.write_line_break()
                                        else:
                                            self.write_line_break(br)
                                    if ch is not None:
                Severity: Major
                Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if br == u'\n':
                                              self.write_line_break()
                                          else:
                                              self.write_line_break(br)
                                      if ch is not None:
                  Severity: Major
                  Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self, stream, canonical=None, indent=None, width=None,
                    Severity: Minor
                    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                      Function expect_first_flow_mapping_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def expect_first_flow_mapping_key(self):
                              if isinstance(self.event, MappingEndEvent):
                                  self.indent = self.indents.pop()
                                  self.flow_level -= 1
                                  self.write_indicator(u'}', False)
                      Severity: Minor
                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                              if self.encoding:
                                                  data = data.encode(self.encoding)
                                              self.stream.write(data)
                      Severity: Major
                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if self.encoding:
                                                    data = data.encode(self.encoding)
                                                self.stream.write(data)
                        Severity: Major
                        Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if br == u'\n':
                                                      self.write_line_break()
                                                  else:
                                                      self.write_line_break(br)
                                              self.write_indent()
                          Severity: Major
                          Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if self.encoding:
                                                        data = data.encode(self.encoding)
                                                    self.stream.write(data)
                            Severity: Major
                            Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 45 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                          if ch is None or ch in u'"\\\x85\u2028\u2029\uFEFF' \
                                                  or not (u'\x20' <= ch <= u'\x7E'
                                                      or (self.allow_unicode
                                                          and (u'\xA0' <= ch <= u'\uD7FF'
                                                              or u'\uE000' <= ch <= u'\uFFFD'))):
                              Severity: Major
                              Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if ((not self.canonical or tag is None) and
                                                ((self.style == '' and self.event.implicit[0])
                                                        or (self.style != '' and self.event.implicit[1]))):
                                                self.prepared_tag = None
                                                return
                                Severity: Major
                                Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          if isinstance(self.event, DocumentStartEvent):
                                              if (self.event.version or self.event.tags) and self.open_ended:
                                                  self.write_indicator(u'...', True)
                                                  self.write_indent()
                                              if self.event.version:
                                  Severity: Major
                                  Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 40 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                if u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'   \
                                                        or ch in u'-;/?:@&=+$,_.~*\'()[]'   \
                                                        or (ch == u'!' and handle != u'!'):
                                                    end += 1
                                                else:
                                    Severity: Major
                                    Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 40 mins to fix

                                      Function determine_block_hints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def determine_block_hints(self, text):
                                              hints = u''
                                              if text:
                                                  if text[0] in u' \n\x85\u2028\u2029':
                                                      hints += unicode(self.best_indent)
                                      Severity: Minor
                                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 35 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 need_events has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def need_events(self, count):
                                              level = 0
                                              for event in self.events[1:]:
                                                  if isinstance(event, (DocumentStartEvent, CollectionStartEvent)):
                                                      level += 1
                                      Severity: Minor
                                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 35 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 process_scalar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def process_scalar(self):
                                              if self.analysis is None:
                                                  self.analysis = self.analyze_scalar(self.event.value)
                                              if self.style is None:
                                                  self.style = self.choose_scalar_style()
                                      Severity: Minor
                                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 35 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 prepare_tag_handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def prepare_tag_handle(self, handle):
                                              if not handle:
                                                  raise EmitterError("tag handle must not be empty")
                                              if handle[0] != u'!' or handle[-1] != u'!':
                                                  raise EmitterError("tag handle must start and end with '!': %r"
                                      Severity: Minor
                                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 35 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

                                      Avoid too many return statements within this function.
                                      Open

                                              return '"'
                                      Severity: Major
                                      Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return False
                                        Severity: Major
                                        Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py - About 30 mins to fix

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

                                              def write_indent(self):
                                                  indent = self.indent or 0
                                                  if not self.indention or self.column > indent   \
                                                          or (self.column == indent and not self.whitespace):
                                                      self.write_line_break()
                                          Severity: Minor
                                          Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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 expect_flow_sequence_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              def expect_flow_sequence_item(self):
                                                  if isinstance(self.event, SequenceEndEvent):
                                                      self.indent = self.indents.pop()
                                                      self.flow_level -= 1
                                                      if self.canonical:
                                          Severity: Minor
                                          Found in src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.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

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

                                                      if not self.canonical and self.check_simple_key():
                                                          self.states.append(self.expect_flow_mapping_simple_value)
                                                          self.expect_node(mapping=True, simple_key=True)
                                                      else:
                                                          self.write_indicator(u'?', True)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 348..354

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

                                          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 not self.canonical and self.check_simple_key():
                                                          self.states.append(self.expect_flow_mapping_simple_value)
                                                          self.expect_node(mapping=True, simple_key=True)
                                                      else:
                                                          self.write_indicator(u'?', True)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 327..333

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

                                          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 u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'   \
                                                              or ch in u'-;/?!:@&=+$,_.~*\'()[]':
                                                          end += 1
                                                      else:
                                                          if start < end:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 601..611

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

                                          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 u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'   \
                                                              or ch in u'-;/?:@&=+$,_.~*\'()[]'   \
                                                              or (ch == u'!' and handle != u'!'):
                                                          end += 1
                                                      else:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 569..578

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

                                          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

                                                  for ch in anchor:
                                                      if not (u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'  \
                                                              or ch in u'-_'):
                                                          raise EmitterError("invalid character %r in the anchor: %r"
                                                                  % (ch.encode('utf-8'), anchor.encode('utf-8')))
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 553..557

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

                                          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

                                                  for ch in handle[1:-1]:
                                                      if not (u'0' <= ch <= u'9' or u'A' <= ch <= u'Z' or u'a' <= ch <= u'z'  \
                                                              or ch in u'-_'):
                                                          raise EmitterError("invalid character %r in the tag handle: %r"
                                                                  % (ch.encode('utf-8'), handle.encode('utf-8')))
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 623..627

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

                                          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 ch is None or ch in u' \n\x85\u2028\u2029' or ch == u'\'':
                                                              if start < end:
                                                                  data = text[start:end]
                                                                  self.column += len(data)
                                                                  if self.encoding:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 941..947

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

                                          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 start < end:
                                                              data = text[start:end]
                                                              self.column += len(data)
                                                              if self.encoding:
                                                                  data = data.encode(self.encoding)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 890..897

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

                                          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 isinstance(self.event, SequenceEndEvent):
                                                      self.indent = self.indents.pop()
                                                      self.flow_level -= 1
                                                      if self.canonical:
                                                          self.write_indicator(u',', False)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 336..343

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

                                          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 isinstance(self.event, MappingEndEvent):
                                                      self.indent = self.indents.pop()
                                                      self.flow_level -= 1
                                                      if self.canonical:
                                                          self.write_indicator(u',', False)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 295..302

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

                                          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

                                                      elif ch in u'\n\x85\u2028\u2029':
                                                          if index == 0:
                                                              leading_break = True
                                                          if index == len(scalar)-1:
                                                              trailing_break = True
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 713..721

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

                                          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 ch == u' ':
                                                          if index == 0:
                                                              leading_space = True
                                                          if index == len(scalar)-1:
                                                              trailing_space = True
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 722..730

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

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

                                                              if start+1 == end and self.column > self.best_width and split   \
                                                                      and start != 0 and end != len(text):
                                                                  self.write_indent()
                                                              else:
                                                                  data = text[start:end]
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1024..1031
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1105..1114

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

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

                                                              if start+1 == end and self.column > self.best_width:
                                                                  self.write_indent()
                                                              else:
                                                                  data = text[start:end]
                                                                  self.column += len(data)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 868..876
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1105..1114

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

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

                                                              if start+1 == end and self.column > self.best_width and split:
                                                                  self.write_indent()
                                                                  self.whitespace = False
                                                                  self.indention = False
                                                              else:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 868..876
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1024..1031

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

                                          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 expect_flow_sequence(self):
                                                  self.write_indicator(u'[', True, whitespace=True)
                                                  self.flow_level += 1
                                                  self.increase_indent(flow=True)
                                                  self.state = self.expect_first_flow_sequence_item
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 312..316

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

                                          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 expect_flow_mapping(self):
                                                  self.write_indicator(u'{', True, whitespace=True)
                                                  self.flow_level += 1
                                                  self.increase_indent(flow=True)
                                                  self.state = self.expect_first_flow_mapping_key
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 276..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 49.

                                          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.whitespace:
                                                      data = u' '
                                                      self.column += len(data)
                                                      if self.encoding:
                                                          data = data.encode(self.encoding)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 974..979

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

                                          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 text[start] == u' ':
                                                              data = u'\\'
                                                              self.column += len(data)
                                                              if self.encoding:
                                                                  data = data.encode(self.encoding)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1088..1093

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

                                          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 isinstance(self.event, SequenceEndEvent):
                                                      self.indent = self.indents.pop()
                                                      self.flow_level -= 1
                                                      self.write_indicator(u']', False)
                                                      self.state = self.states.pop()
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 319..323

                                          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 isinstance(self.event, MappingEndEvent):
                                                      self.indent = self.indents.pop()
                                                      self.flow_level -= 1
                                                      self.write_indicator(u'}', False)
                                                      self.state = self.states.pop()
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 283..287

                                          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 isinstance(self.event, (ScalarEvent, CollectionStartEvent))  \
                                                          and self.event.tag is not None:
                                                      if self.prepared_tag is None:
                                                          self.prepared_tag = self.prepare_tag(self.event.tag)
                                                      length += len(self.prepared_tag)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 441..444

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

                                          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 isinstance(self.event, NodeEvent) and self.event.anchor is not None:
                                                      if self.prepared_anchor is None:
                                                          self.prepared_anchor = self.prepare_anchor(self.event.anchor)
                                                      length += len(self.prepared_anchor)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 445..449

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

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

                                                              for br in text[start:end]:
                                                                  if br == u'\n':
                                                                      self.write_line_break()
                                                                  else:
                                                                      self.write_line_break(br)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1014..1018
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1062..1066
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1120..1124

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

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

                                                              for br in text[start:end]:
                                                                  if br == u'\n':
                                                                      self.write_line_break()
                                                                  else:
                                                                      self.write_line_break(br)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 882..886
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1014..1018
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1120..1124

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

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

                                                              for br in text[start:end]:
                                                                  if br == u'\n':
                                                                      self.write_line_break()
                                                                  else:
                                                                      self.write_line_break(br)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 882..886
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1014..1018
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1062..1066

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

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

                                                              for br in text[start:end]:
                                                                  if br == u'\n':
                                                                      self.write_line_break()
                                                                  else:
                                                                      self.write_line_break(br)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 882..886
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1062..1066
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1120..1124

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

                                          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 expect_block_mapping_simple_value(self):
                                                  self.write_indicator(u':', False)
                                                  self.states.append(self.expect_block_mapping_key)
                                                  self.expect_node(mapping=True)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 356..359

                                          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

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

                                              def expect_flow_mapping_simple_value(self):
                                                  self.write_indicator(u':', False)
                                                  self.states.append(self.expect_flow_mapping_key)
                                                  self.expect_node(mapping=True)
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 411..414

                                          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

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

                                                      elif isinstance(self.event, MappingStartEvent):
                                                          if self.flow_level or self.canonical or self.event.flow_style   \
                                                                  or self.check_empty_mapping():
                                                              self.expect_flow_mapping()
                                                          else:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 247..252

                                          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

                                                      elif isinstance(self.event, SequenceStartEvent):
                                                          if self.flow_level or self.canonical or self.event.flow_style   \
                                                                  or self.check_empty_sequence():
                                                              self.expect_flow_sequence()
                                                          else:
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 253..258

                                          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 check_empty_mapping(self):
                                                  return (isinstance(self.event, MappingStartEvent) and self.events
                                                          and isinstance(self.events[0], MappingEndEvent))
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 424..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 37.

                                          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 check_empty_sequence(self):
                                                  return (isinstance(self.event, SequenceStartEvent) and self.events
                                                          and isinstance(self.events[0], SequenceEndEvent))
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 428..430

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

                                          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 ch is not None:
                                                          spaces = (ch == u' ')
                                                          breaks = (ch in u'\n\x85\u2028\u2029')
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 1137..1139

                                          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 ch is not None:
                                                          spaces = (ch == u' ')
                                                          breaks = (ch in u'\n\x85\u2028\u2029')
                                          src/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py on lines 905..907

                                          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