tobspr/RenderPipeline

View on GitHub
rplibs/yaml/yaml_py2/__init__.py

Summary

Maintainability
F
3 days
Test Coverage

File __init__.py has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from error import *

from tokens import *
from events import *
from nodes import *
Severity: Minor
Found in rplibs/yaml/yaml_py2/__init__.py - About 2 hrs to fix

    Function dump_all has 15 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def dump_all(documents, stream=None, Dumper=Dumper,
    Severity: Major
    Found in rplibs/yaml/yaml_py2/__init__.py - About 1 hr to fix

      Function serialize_all has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def serialize_all(nodes, stream=None, Dumper=Dumper,
      Severity: Major
      Found in rplibs/yaml/yaml_py2/__init__.py - About 1 hr to fix

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

        def emit(events, stream=None, Dumper=Dumper,
        Severity: Major
        Found in rplibs/yaml/yaml_py2/__init__.py - About 1 hr to fix

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

          def add_implicit_resolver(tag, regexp, first=None,
          Severity: Minor
          Found in rplibs/yaml/yaml_py2/__init__.py - About 35 mins to fix

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

            def add_path_resolver(tag, path, kind=None, Loader=Loader, Dumper=Dumper):
            Severity: Minor
            Found in rplibs/yaml/yaml_py2/__init__.py - About 35 mins to fix

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

              def dump_all(documents, stream=None, Dumper=Dumper,
                      default_style=None, default_flow_style=None,
                      canonical=None, indent=None, width=None,
                      allow_unicode=None, line_break=None,
                      encoding='utf-8', explicit_start=None, explicit_end=None,
              Severity: Minor
              Found in rplibs/yaml/yaml_py2/__init__.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 serialize_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def serialize_all(nodes, stream=None, Dumper=Dumper,
                      canonical=None, indent=None, width=None,
                      allow_unicode=None, line_break=None,
                      encoding='utf-8', explicit_start=None, explicit_end=None,
                      version=None, tags=None):
              Severity: Minor
              Found in rplibs/yaml/yaml_py2/__init__.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 4 locations. Consider refactoring.
              Open

              def scan(stream, Loader=Loader):
                  """
                  Scan a YAML stream and produce scanning tokens.
                  """
                  loader = Loader(stream)
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 3 other locations - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 30..39
              rplibs/yaml/yaml_py2/__init__.py on lines 52..62
              rplibs/yaml/yaml_py2/__init__.py on lines 75..85

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

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

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

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

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

              Refactorings

              Further Reading

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

              def parse(stream, Loader=Loader):
                  """
                  Parse a YAML stream and produce parsing events.
                  """
                  loader = Loader(stream)
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 3 other locations - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 19..28
              rplibs/yaml/yaml_py2/__init__.py on lines 52..62
              rplibs/yaml/yaml_py2/__init__.py on lines 75..85

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

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

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

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

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

              Refactorings

              Further Reading

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

              def load_all(stream, Loader=Loader):
                  """
                  Parse all YAML documents in a stream
                  and produce corresponding Python objects.
                  """
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 3 other locations - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 19..28
              rplibs/yaml/yaml_py2/__init__.py on lines 30..39
              rplibs/yaml/yaml_py2/__init__.py on lines 52..62

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

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

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

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

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

              Refactorings

              Further Reading

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

              def compose_all(stream, Loader=Loader):
                  """
                  Parse all YAML documents in a stream
                  and produce corresponding representation trees.
                  """
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 3 other locations - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 19..28
              rplibs/yaml/yaml_py2/__init__.py on lines 30..39
              rplibs/yaml/yaml_py2/__init__.py on lines 75..85

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

              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 stream is None:
                      if encoding is None:
                          from StringIO import StringIO
                      else:
                          from cStringIO import StringIO
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 135..141

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

                  if stream is None:
                      if encoding is None:
                          from StringIO import StringIO
                      else:
                          from cStringIO import StringIO
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 174..180

              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 add_path_resolver(tag, path, kind=None, Loader=Loader, Dumper=Dumper):
                  """
                  Add a path based resolver for the given tag.
                  A path is a list of keys that forms a path
                  to a node in the representation tree.
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 220..229

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 39.

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

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

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

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

              Refactorings

              Further Reading

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

                  try:
                      dumper.open()
                      for node in nodes:
                          dumper.serialize(node)
                      dumper.close()
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 187..193

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 39.

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

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

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

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

              Refactorings

              Further Reading

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

                  try:
                      dumper.open()
                      for data in documents:
                          dumper.represent(data)
                      dumper.close()
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 146..152

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 39.

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

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

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

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

              Refactorings

              Further Reading

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

              def add_implicit_resolver(tag, regexp, first=None,
                      Loader=Loader, Dumper=Dumper):
                  """
                  Add an implicit scalar detector.
                  If an implicit scalar value matches the given regexp,
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 231..239

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 39.

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

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

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

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

              Refactorings

              Further Reading

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

              def compose(stream, Loader=Loader):
                  """
                  Parse the first YAML document in a stream
                  and produce the corresponding representation tree.
                  """
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 64..73

              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 load(stream, Loader=Loader):
                  """
                  Parse the first YAML document in a stream
                  and produce the corresponding Python object.
                  """
              Severity: Major
              Found in rplibs/yaml/yaml_py2/__init__.py and 1 other location - About 1 hr to fix
              rplibs/yaml/yaml_py2/__init__.py on lines 41..50

              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

              There are no issues that match your filters.

              Category
              Status