noirbizarre/json4humans

View on GitHub

Showing 605 of 605 total issues

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

Severity: Major
Found in docs/snippets/json5/basic.py and 2 other locations - About 2 hrs to fix
docs/snippets/json/basic.py on lines 0..16
docs/snippets/jsonc/basic.py on lines 0..17

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

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

Severity: Major
Found in docs/snippets/json/basic.py and 2 other locations - About 2 hrs to fix
docs/snippets/json5/basic.py on lines 0..17
docs/snippets/jsonc/basic.py on lines 0..17

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

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

Severity: Major
Found in docs/snippets/jsonc/basic.py and 2 other locations - About 2 hrs to fix
docs/snippets/json/basic.py on lines 0..16
docs/snippets/json5/basic.py on lines 0..17

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

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

Error: invalid syntax (<unknown>, line 86)</unknown>
Open

    match wsc:
Severity: Minor
Found in json4humans/wsc.py by radon

We encountered an error attempting to analyze this line.

Error: invalid syntax (<unknown>, line 34)</unknown>
Open

        if attrs := getattr(self, "__dict__"):
Severity: Minor
Found in json4humans/types.py by radon

We encountered an error attempting to analyze this line.

Error: invalid syntax (<unknown>, line 52)</unknown>
Open

        match token.value:
Severity: Minor
Found in json4humans/json.py by radon

We encountered an error attempting to analyze this line.

Error: invalid syntax (<unknown>, line 132)</unknown>
Open

        match obj:
Severity: Minor
Found in json4humans/json5.py by radon

We encountered an error attempting to analyze this line.

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

    def __init__(
Severity: Major
Found in json4humans/types.py - About 1 hr to fix

    Function implement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def implement(
        grammar: str, transformer: Transformer, encoder: type[JSONEncoder], lexer: LexerType = "auto"
    ):
        """
        A [JSON module][json4humans.protocol.JSONModule] attributes factory.
    Severity: Minor
    Found in json4humans/protocol.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in json4humans/types.py - About 50 mins to fix

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

          def dump(
      Severity: Minor
      Found in json4humans/protocol.py - About 35 mins to fix

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

            def __init__(
        Severity: Minor
        Found in json4humans/types.py - About 35 mins to fix

          Line length
          Open

          - Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
          Severity: Info
          Found in CONTRIBUTING.md by markdownlint

          MD013 - Line length

          Tags: line_length

          Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

          This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

          This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

          You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

          Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

          Multiple consecutive blank lines
          Open

          
          
          Severity: Info
          Found in README.md by markdownlint

          MD012 - Multiple consecutive blank lines

          Tags: whitespace, blank_lines

          Aliases: no-multiple-blanks

          This rule is triggered when there are multiple consecutive blank lines in the document:

          Some text here
          
          
          Some more text here

          To fix this, delete the offending lines:

          Some text here
          
          Some more text here

          Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

          Code block style
          Open

              ```python
          Severity: Info
          Found in docs/usage.md by markdownlint

          Line too long (100 > 79 characters)
          Open

                  return token.value.replace("\\/", "/").encode().decode("unicode_escape", "surrogatepass"), [
          Severity: Minor
          Found in json4humans/json5.py by pep8

          Limit all lines to a maximum of 79 characters.

          There are still many devices around that are limited to 80 character
          lines; plus, limiting windows to 80 characters makes it possible to
          have several windows side-by-side.  The default wrapping on such
          devices looks ugly.  Therefore, please limit all lines to a maximum
          of 79 characters. For flowing long blocks of text (docstrings or
          comments), limiting the length to 72 characters is recommended.
          
          Reports error E501.

          Line too long (91 > 79 characters)
          Open

                  :param cls: An encoder class to use. Will use the default module encoder if `None`.
          Severity: Minor
          Found in json4humans/protocol.py by pep8

          Limit all lines to a maximum of 79 characters.

          There are still many devices around that are limited to 80 character
          lines; plus, limiting windows to 80 characters makes it possible to
          have several windows side-by-side.  The default wrapping on such
          devices looks ugly.  Therefore, please limit all lines to a maximum
          of 79 characters. For flowing long blocks of text (docstrings or
          comments), limiting the length to 72 characters is recommended.
          
          Reports error E501.

          Line too long (100 > 79 characters)
          Open

                  self, members: TupleWithTrailingComa[Member], tail: list[WSC | str] | None = None, last=None
          Severity: Minor
          Found in json4humans/style.py by pep8

          Limit all lines to a maximum of 79 characters.

          There are still many devices around that are limited to 80 character
          lines; plus, limiting windows to 80 characters makes it possible to
          have several windows side-by-side.  The default wrapping on such
          devices looks ugly.  Therefore, please limit all lines to a maximum
          of 79 characters. For flowing long blocks of text (docstrings or
          comments), limiting the length to 72 characters is recommended.
          
          Reports error E501.

          Line too long (84 > 79 characters)
          Open

                          "".join(wsc.encode_wsc(w) for w in getattr(obj, "json_before", [])),
          Severity: Minor
          Found in json4humans/style.py by pep8

          Limit all lines to a maximum of 79 characters.

          There are still many devices around that are limited to 80 character
          lines; plus, limiting windows to 80 characters makes it possible to
          have several windows side-by-side.  The default wrapping on such
          devices looks ugly.  Therefore, please limit all lines to a maximum
          of 79 characters. For flowing long blocks of text (docstrings or
          comments), limiting the length to 72 characters is recommended.
          
          Reports error E501.

          Line length
          Open

          - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
          Severity: Info
          Found in CONTRIBUTING.md by markdownlint

          MD013 - Line length

          Tags: line_length

          Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

          This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

          This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

          You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

          Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

          Severity
          Category
          Status
          Source
          Language