Showing 673 of 673 total issues
Block comment should start with '# ' Open
#html_use_opensearch = ''
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.
Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1 #Increment x
E262: x = x + 1 # Increment x
E265: #Block comment
E266: ### Block comment
Block comment should start with '# ' Open
#texinfo_no_detailmenu = False
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.
Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1 #Increment x
E262: x = x + 1 # Increment x
E265: #Block comment
E266: ### Block comment
Block comment should start with '# ' Open
#epub_identifier = ''
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Separate inline comments by at least two spaces.
An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.
Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).
Okay: x = x + 1 # Increment x
Okay: x = x + 1 # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1 #Increment x
E262: x = x + 1 # Increment x
E265: #Block comment
E266: ### Block comment
Method "extract_columns" has 10 parameters, which is greater than the 7 authorized. Open
def extract_columns(self, result={}, selector='', table_headers=[], attr='', connector='', default='', verbosity=0, *args, **kwargs):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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): ...
Refactor this function to reduce its Cognitive Complexity from 44 to the 15 allowed. Open
def run(self):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
# history = open('HISTORY.rst').read().replace('.. :changelog:', '')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 function "runCLI" to match the regular expression ^[a-z_][a-z0-9_]{2,}$. Open
def runCLI():
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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): ...
Merge this if statement with the enclosing one. Open
if projectname_re.search(args['<projectname>']) is not None:
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 31 to the 15 allowed. Open
def traverse_next(page, nextx, results, tabular_data_headers=[], verbosity=0):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 args['--output_type'] not in ['json', 'csv']:
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if condition1: if condition2: # ...
Compliant Solution
if condition1 and condition2: # ...
Method "extract_rows" has 10 parameters, which is greater than the 7 authorized. Open
def extract_rows(self, result={}, selector='', table_headers=[], attr='', connector='', default='', verbosity=0, *args, **kwargs):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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): ...
Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed. Open
def extract_columns(self, result={}, selector='', table_headers=[], attr='', connector='', default='', verbosity=0, *args, **kwargs):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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 16 to the 15 allowed. Open
def extract_rows(self, result={}, selector='', table_headers=[], attr='', connector='', default='', verbosity=0, *args, **kwargs):
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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.