nil0x42/phpsploit

View on GitHub

Showing 269 of 269 total issues

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

    def __call__(self, question=None):
Severity: Critical
Found in src/ui/input/expect.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

Remove this commented out code.
Open

            # validator = self._set_HTTP_header

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"

Rename field "expect"
Open

        self.expect = expect
Severity: Major
Found in src/ui/input/expect.py by sonar-python

It's confusing to have a class member with the same name (case differences aside) as its enclosing class. This is particularly so when you consider the common practice of naming a class instance for the class itself.

Best practice dictates that any field or member with the same name as the enclosing class be renamed to be more descriptive of the particular aspect of the class it represents or holds.

Noncompliant Code Example

class Foo:
  foo = ''

  def getFoo(self):
    ...

foo = Foo()
foo.getFoo() # what does this return?

Compliant Solution

class Foo:
  name = ''

  def getName(self):
    ...

foo = Foo()
foo.getName()

Merge this if statement with the enclosing one.
Open

            if len(gz_payload) < len(self.data):
Severity: Major
Found in src/core/tunnel/payload.py by sonar-python

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

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

    def __new__(cls, *args, mode='', filename='file.txt'):
Severity: Critical
Found in src/datatypes/Path.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

Remove this commented out code.
Open

            # help(type(importlib.import_module(name)))

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"

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

    def Send(self, request):
Severity: Critical
Found in src/core/tunnel/handler.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

Merge this if statement with the enclosing one.
Open

            if file != self.File or super().__getitem__("File") is None:
Severity: Major
Found in src/core/session/__init__.py by sonar-python

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Rename method "Read" to prevent any misunderstanding/clash with method "read" defined on line 582
Open

    def Read(self, response):
Severity: Blocker
Found in src/core/tunnel/handler.py by sonar-python

Looking at the set of methods and fields in a class and finding two that differ only by capitalization is confusing to users of the class.

This situation may simply indicate poor naming. Method names should be action-oriented, and thus contain a verb, which is unlikely in the case where both a method and a field have the same name (with or without capitalization differences). However, renaming a public method could be disruptive to callers. Therefore renaming the member is the recommended action.

Noncompliant Code Example

class SomeClass:
    lookUp = false
    def lookup():       # Non-compliant; method name differs from field name only by capitalization
        pass

Compliant Solution

class SomeClass:
    lookUp = false
    def getLookUp():
        pass
Severity
Category
Status
Source
Language