hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py

Summary

Maintainability
F
1 wk
Test Coverage

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

r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.

:mod:`json` exposes an API familiar to users of the standard library
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (not skipkeys and ensure_ascii and
            check_circular and allow_nan and
            cls is None and indent is None and separators is None and
            encoding == 'utf-8' and default is None and not kw):
            return _default_encoder.encode(obj)
    Severity: Critical
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if (not skipkeys and ensure_ascii and
              check_circular and allow_nan and
              cls is None and indent is None and separators is None and
              encoding == 'utf-8' and default is None and not kw):
              iterable = _default_encoder.iterencode(obj)
      Severity: Critical
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 2 hrs to fix

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

        def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 1 hr to fix

          Function dumps has 11 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if (cls is None and encoding is None and object_hook is None and
                        parse_int is None and parse_float is None and
                        parse_constant is None and object_pairs_hook is None and not kw):
                    return _default_decoder.decode(s)
                if cls is None:
            Severity: Critical
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 1 hr to fix

              Function loads has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 1 hr to fix

                Function load has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
                Severity: Major
                Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py - About 1 hr to fix

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

                  def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
                          parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
                      """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
                      document) to a Python object.
                  
                  Severity: Minor
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.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 dump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
                          allow_nan=True, cls=None, indent=None, separators=None,
                          encoding='utf-8', default=None, **kw):
                      """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
                      ``.write()``-supporting file-like object).
                  Severity: Minor
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__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

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

                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/json/__init__.py and 1 other location - About 6 days to fix
                  vector-uefi/fd/efi/StdLib/lib/python.27/json/__init__.py on lines 0..339

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

                  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