KissPeter/APIFuzzer

View on GitHub

Showing 395 of 395 total issues

Expected an indentation at 12 instead of at 10.
Open

          retention_days: "30"

Expected an indentation at 4 instead of at 2.
Open

  autoupdate:

Expected an indentation at 20 instead of at 18.
Open

                  api_definition_file=args.src_file,
Severity: Minor
Found in APIFuzzer by editorconfig

Expected an indentation at 16 instead of at 14.
Open

              f' Feel free to report the issue',)
Severity: Minor
Found in APIFuzzer by editorconfig

Expected an indentation at 4 instead of at 2.
Open

  apifuzzer:
Severity: Minor
Found in docker-compose.yml by editorconfig

Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
Open

    def _resolve(self, data):
Severity: Critical
Found in apifuzzer/move_json_parts.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open

    def _process_request_body(self):

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 40 to the 15 allowed.
Open

    def transmit(self, **kwargs):

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 44 to the 15 allowed.
Open

    def _process_api_resources(self, paths=None, existing_template=None):

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Remove this commented out code.
Open

# schema = materialize(RefDict("https://json-schema.org/draft-04/schema#/"))
Severity: Major
Found in json_ref_resolve.py by sonar-python

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Either merge this branch with the identical one on line "51" or change one of the implementations.
Open

            handler = logging.StreamHandler(stream=sys.stdout)
Severity: Major
Found in apifuzzer/utils.py by sonar-python

Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

Noncompliant Code Example

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_thing()  # Noncompliant; duplicates first condition
else:
    do_the_rest()

b = 4 if a > 12 else 4

Compliant Solution

if (0 <= a < 10) or (20 <= a < 50):
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
else:
    do_the_rest()

b = 4

or

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_third_thing()
else:
    do_the_rest()

b = 8 if a > 12 else 4

Remove or correct this useless self-assignment.
Open

        self.logger = self.logger = get_logger(self.__class__.__name__)
Severity: Major
Found in apifuzzer/custom_fuzzers.py by sonar-python

There is no reason to re-assign a variable to itself. Either this statement is redundant and should be removed, or the re-assignment is a mistake and some other value or variable was intended for the assignment instead.

Noncompliant Code Example

name = name

Compliant Solution

name = other.name

See

Either merge this branch with the identical one on line "257" or change one of the implementations.
Open

            template.params.add(
                fuzz_type(name=param_name, value=str(sample_data))
            )

Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

Noncompliant Code Example

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_thing()  # Noncompliant; duplicates first condition
else:
    do_the_rest()

b = 4 if a > 12 else 4

Compliant Solution

if (0 <= a < 10) or (20 <= a < 50):
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
else:
    do_the_rest()

b = 4

or

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_third_thing()
else:
    do_the_rest()

b = 8 if a > 12 else 4

Method "__init__" has 11 parameters, which is greater than the 7 authorized.
Open

        self,
        report_dir,
        test_level,
        log_level,
        basic_output,
Severity: Major
Found in apifuzzer/fuzzer.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Remove or correct this useless self-assignment.
Open

        self.logger = self.logger = get_logger(self.__class__.__name__)

There is no reason to re-assign a variable to itself. Either this statement is redundant and should be removed, or the re-assignment is a mistake and some other value or variable was intended for the assignment instead.

Noncompliant Code Example

name = name

Compliant Solution

name = other.name

See

Severity
Category
Status
Source
Language