Konano/arknights-mower

View on GitHub

Showing 944 of 1,043 total issues

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

def agent(img, draw=False):
Severity: Critical
Found in arknights_mower/utils/segment.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 ("LowerLimit" in self.agent_base_config[current_base[key][idx]["agent"]]):

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Merge this if statement with the enclosing one.
Open

                if '.' in __str:

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Rename function "writeConf" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

def writeConf():
Severity: Major
Found in menu.py by sonar-python

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...
Severity
Category
Status
Source
Language