firehol/netdata

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

Summary

Maintainability
F
1 wk
Test Coverage

File constructor.py has 581 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# SPDX-License-Identifier: MIT

__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor',
    'ConstructorError']

Severity: Major
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 1 day to fix

    Function construct_object has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def construct_object(self, node, deep=False):
            if node in self.constructed_objects:
                return self.constructed_objects[node]
            if deep:
                old_deep = self.deep_construct
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 4 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 flatten_mapping has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def flatten_mapping(self, node):
            merge = []
            index = 0
            while index < len(node.value):
                key_node, value_node = node.value[index]
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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 construct_yaml_int has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def construct_yaml_int(self, node):
            value = self.construct_scalar(node)
            value = value.replace('_', '')
            sign = +1
            if value[0] == '-':

    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 construct_yaml_timestamp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def construct_yaml_timestamp(self, node):
            value = self.construct_scalar(node)
            match = self.timestamp_regexp.match(node.value)
            values = match.groupdict()
            year = int(values['year'])
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 55 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 set_python_instance_state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_python_instance_state(self, instance, state):
            if hasattr(instance, '__setstate__'):
                instance.__setstate__(state)
            else:
                slotstate = {}
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 55 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 not isinstance(subnode, MappingNode):
                                raise ConstructorError("while constructing a mapping",
                                        node.start_mark,
                                        "expected a mapping for merging, but found %s"
                                        % subnode.id, subnode.start_mark)
    Severity: Major
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 45 mins to fix

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

          def construct_yaml_float(self, node):
              value = self.construct_scalar(node)
              value = value.replace('_', '').lower()
              sign = +1
              if value[0] == '-':
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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

      Function make_python_instance has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def make_python_instance(self, suffix, node,
      Severity: Minor
      Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 35 mins to fix

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

            def construct_python_object_apply(self, suffix, node, newobj=False):
                # Format:
                #   !!python/object/apply       # (or !!python/object/new)
                #   args: [ ... arguments ... ]
                #   kwds: { ... keywords ... }
        Severity: Minor
        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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 sign*value
        Severity: Major
        Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return sign*int(value)
          Severity: Major
          Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py - About 30 mins to fix

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

                def construct_scalar(self, node):
                    if isinstance(node, MappingNode):
                        for key_node, value_node in node.value:
                            if key_node.tag == 'tag:yaml.org,2002:value':
                                return self.construct_scalar(value_node)
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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 construct_yaml_omap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def construct_yaml_omap(self, node):
                    # Note: we do not check for duplicate keys, because it's too
                    # CPU-expensive.
                    omap = []
                    yield omap
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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 construct_yaml_pairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def construct_yaml_pairs(self, node):
                    # Note: the same code as `construct_yaml_omap`.
                    pairs = []
                    yield pairs
                    if not isinstance(node, SequenceNode):
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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 construct_document has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def construct_document(self, node):
                    data = self.construct_object(node)
                    while self.state_generators:
                        state_generators = self.state_generators
                        self.state_generators = []
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.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

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

                def construct_yaml_omap(self, node):
                    # Note: we do not check for duplicate keys, because it's too
                    # CPU-expensive.
                    omap = []
                    yield omap
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 361..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 187.

            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 construct_yaml_pairs(self, node):
                    # Note: the same code as `construct_yaml_omap`.
                    pairs = []
                    yield pairs
                    if not isinstance(node, SequenceNode):
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 339..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 187.

            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 construct_yaml_binary(self, node):
                    try:
                        value = self.construct_scalar(node).encode('ascii')
                    except UnicodeEncodeError as exc:
                        raise ConstructorError(None, None,
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 476..490

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

            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 construct_python_bytes(self, node):
                    try:
                        value = self.construct_scalar(node).encode('ascii')
                    except UnicodeEncodeError as exc:
                        raise ConstructorError(None, None,
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 281..295

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

            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 value[0] == '0':
                        return sign*int(value, 8)
                    elif ':' in value:
                        digits = [int(part) for part in value.split(':')]
                        digits.reverse()
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 267..279

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

            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 value == '.nan':
                        return self.nan_value
                    elif ':' in value:
                        digits = [float(part) for part in value.split(':')]
                        digits.reverse()
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 238..250

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

            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 construct_python_module(self, suffix, node):
                    value = self.construct_scalar(node)
                    if value:
                        raise ConstructorError("while constructing a Python module", node.start_mark,
                                "expected the empty value, but found %r" % value, node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 533..538

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

            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 construct_python_name(self, suffix, node):
                    value = self.construct_scalar(node)
                    if value:
                        raise ConstructorError("while constructing a Python name", node.start_mark,
                                "expected the empty value, but found %r" % value, node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 540..545

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                @classmethod
                def add_constructor(cls, tag, constructor):
                    if not 'yaml_constructors' in cls.__dict__:
                        cls.yaml_constructors = cls.yaml_constructors.copy()
                    cls.yaml_constructors[tag] = constructor
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 152..156
            src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py on lines 65..69
            src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py on lines 71..75

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 52.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                @classmethod
                def add_multi_constructor(cls, tag_prefix, multi_constructor):
                    if not 'yaml_multi_constructors' in cls.__dict__:
                        cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy()
                    cls.yaml_multi_constructors[tag_prefix] = multi_constructor
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 146..150
            src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py on lines 65..69
            src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py on lines 71..75

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 52.

            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

                    try:
                        __import__(module_name)
                    except ImportError as exc:
                        raise ConstructorError("while constructing a Python object", mark,
                                "cannot find module %r (%s)" % (module_name, exc), mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 505..509

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    try:
                        __import__(name)
                    except ImportError as exc:
                        raise ConstructorError("while constructing a Python module", mark,
                                "cannot find module %r (%s)" % (name, exc), mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 521..525

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    if not isinstance(node, SequenceNode):
                        raise ConstructorError(None, None,
                                "expected a sequence node, but found %s" % node.id,
                                node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 105..108
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 120..123
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 135..138

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    if not isinstance(node, MappingNode):
                        raise ConstructorError(None, None,
                                "expected a mapping node, but found %s" % node.id,
                                node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 105..108
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 112..115
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 135..138

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    if not isinstance(node, MappingNode):
                        raise ConstructorError(None, None,
                                "expected a mapping node, but found %s" % node.id,
                                node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 105..108
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 112..115
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 120..123

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    if not isinstance(node, ScalarNode):
                        raise ConstructorError(None, None,
                                "expected a scalar node, but found %s" % node.id,
                                node.start_mark)
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 112..115
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 120..123
            src/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py on lines 135..138

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

            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