LucaCappelletti94/compress_json

View on GitHub
build/lib/compress_json/compress_json.py

Summary

Maintainability
C
7 hrs
Test Coverage

File compress_json.py has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
A thin wrapper of standard ``json`` with standard compression libraries.
"""
import json
Severity: Minor
Found in build/lib/compress_json/compress_json.py - About 2 hrs to fix

    Function load has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def load(
        path: str,
        compression_kwargs: Optional[Dict] = None,
        json_kwargs: Optional[Dict] = None,
        encoding: str = "utf-8",
    Severity: Minor
    Found in build/lib/compress_json/compress_json.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 dump has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def dump(
        obj: Any,
        path: str,
        compression_kwargs: Optional[Dict] = None,
        json_kwargs: Optional[Dict] = None,
    Severity: Minor
    Found in build/lib/compress_json/compress_json.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 local_dump has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def local_dump(
    Severity: Minor
    Found in build/lib/compress_json/compress_json.py - About 35 mins to fix

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

      def load(
      Severity: Minor
      Found in build/lib/compress_json/compress_json.py - About 35 mins to fix

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

        def local_load(
        Severity: Minor
        Found in build/lib/compress_json/compress_json.py - About 35 mins to fix

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

          def dump(
          Severity: Minor
          Found in build/lib/compress_json/compress_json.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status