Showing 58 of 59 total issues
Function main
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(
Function calc_planes_angle
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def calc_planes_angle(a1, b1, c1, a2, b2, c2, aunit='radians'):
Function main
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(
Function frame_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def frame_list(len_traj, start=None, stop=None, step=None, flist=None,):
"""
Create frame integer list from a length and slice parameters.
Examples
- Read upRead up
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 export_data_to_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def export_data_to_file(
Function plot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def plot(
y_data,
x_labels=None,
x_label_rot=90,
labels=None,
- Read upRead up
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 main
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(
Function frame_list
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def frame_list(len_traj, start=None, stop=None, step=None, flist=None,):
Function evaluate_to_slice
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def evaluate_to_slice(*, value=None, start=None, stop=None, step=None):
Function mk_frame_path
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def mk_frame_path(ipath, frame=0, ext='.pdb', leading=0, suffix=None):
Avoid too many return
statements within this function. Open
return slice(value)
Avoid too many return
statements within this function. Open
return slice(*indexes)
Function "main" has 12 parameters, which is greater than the 7 authorized. Open
topology,
trajectories,
insort=False,
start=None,
stop=None,
- Read upRead up
- 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): ...
Remove this commented out code. Open
# subtitle = 'Selections: {}'.format(' · '.join(selections))
- Read upRead up
- 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"
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert q3s.shape == p4_vecs.shape
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert theta.size == p4_vecs.shape[0]
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert isinstance(frame_slice, slice)
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert p4_vecs.shape[1] == 3
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert q1x2.shape == (3,)
- Exclude checks
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Open
assert len(x_data) == y_data.shape[1], \
'{} vs {}'.format(len(x_data), y_data.shape[1])
- Exclude checks