Too many arguments (6/5) Open
def __init__(self, fun, step=None, method='above', order=4, full_output=False, **options):
- Read upRead up
- Exclude checks
Used when a function or method takes too many arguments.
Too few public methods (1/2) Open
class _Limit(object):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Consider using Python 3 style super() without arguments Open
super(Limit, self).__init__(step=step, **options)
- Read upRead up
- Exclude checks
Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.
Consider using Python 3 style super() without arguments Open
super(CStepGenerator,
- Read upRead up
- Exclude checks
Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.
Class '_Limit' inherits from object, can be safely removed from bases in python3 Open
class _Limit(object):
- Read upRead up
- Exclude checks
Used when a class inherit from object, which under python3 is implicit, hence can be safely removed from bases.
Too many arguments (7/5) Open
def __init__(self, base_step=None, step_ratio=4.0, num_steps=None, step_nom=None,
- Read upRead up
- Exclude checks
Used when a function or method takes too many arguments.
Consider using '{forward
: 1, above
: 1, backward
: -1, below
: -1}' instead of a call to 'dict'. Open
sign = dict(forward=1, above=1, backward=-1, below=-1)[self.method]
- Read upRead up
- Exclude checks
Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.
Consider using Python 3 style super() without arguments Open
super(Residue, self).__init__(f, step=step, method=method, order=order,
- Read upRead up
- Exclude checks
Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.
Too many arguments (7/5) Open
def __init__(self, f, step=None, method='above', order=None, pole_order=1,
- Read upRead up
- Exclude checks
Used when a function or method takes too many arguments.
Unable to import 'numpy' Open
import numpy as np
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Identical blocks of code found in 2 locations. Consider refactoring. Open
@staticmethod
def _vstack(sequence, steps):
original_shape = np.shape(sequence[0])
f_del = np.vstack([np.ravel(r) for r in sequence])
one = np.ones(original_shape)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Trailing whitespace Open
p25, median, p75 = np.nanpercentile(der, [25,50, 75], axis=0)
- Read upRead up
- Exclude checks
Trailing whitespace is superfluous.
The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.
Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n \n bang = 12
Line break after binary operator Open
outliers = (((abs(der) < (a_median / trim_fact)) +
- Read upRead up
- Exclude checks
Avoid breaks after binary operators.
The preferred place to break around a binary operator is before the
operator, not after it.
W504: (width == 0 +\n height == 0)
W504: (width == 0 and\n height == 0)
W504: var = (1 &\n ~2)
Okay: foo(\n -x)
Okay: foo(x\n [])
Okay: x = '''\n''' + ''
Okay: x = '' + '''\n'''
Okay: foo(x,\n -y)
Okay: foo(x, # comment\n -y)
The following should be W504 but unary_context is tricky with these
Okay: var = (1 /\n -2)
Okay: var = (1 +\n -1 +\n -2)
Missing whitespace after ',' Open
p25, median, p75 = np.percentile(der, [25,50, 75], axis=0)
- Read upRead up
- Exclude checks
Each comma, semicolon or colon should be followed by whitespace.
Okay: [a, b]
Okay: (3,)
Okay: a[1:4]
Okay: a[:4]
Okay: a[1:]
Okay: a[1:4:2]
E231: ['a','b']
E231: foo(bar,baz)
E231: [{'a':'b'}]
Multiple spaces after ',' Open
super(Limit, self).__init__(step=step, **options)
- Read upRead up
- Exclude checks
Avoid extraneous whitespace after a comma or a colon.
Note: these checks are disabled by default
Okay: a = (1, 2)
E241: a = (1, 2)
E242: a = (1,\t2)
Line break after binary operator Open
(abs(der) > (a_median * trim_fact))) * (a_median > 1e-8) +
- Read upRead up
- Exclude checks
Avoid breaks after binary operators.
The preferred place to break around a binary operator is before the
operator, not after it.
W504: (width == 0 +\n height == 0)
W504: (width == 0 and\n height == 0)
W504: var = (1 &\n ~2)
Okay: foo(\n -x)
Okay: foo(x\n [])
Okay: x = '''\n''' + ''
Okay: x = '' + '''\n'''
Okay: foo(x,\n -y)
Okay: foo(x, # comment\n -y)
The following should be W504 but unary_context is tricky with these
Okay: var = (1 /\n -2)
Okay: var = (1 +\n -1 +\n -2)
Missing whitespace after ',' Open
p25, median, p75 = np.nanpercentile(der, [25,50, 75], axis=0)
- Read upRead up
- Exclude checks
Each comma, semicolon or colon should be followed by whitespace.
Okay: [a, b]
Okay: (3,)
Okay: a[1:4]
Okay: a[:4]
Okay: a[1:]
Okay: a[1:4:2]
E231: ['a','b']
E231: foo(bar,baz)
E231: [{'a':'b'}]
Trailing whitespace Open
p25, median, p75 = np.nanpercentile(der, [25,50, 75], axis=0)
- Read upRead up
- Exclude checks
Used when there is whitespace between the end of a line and the newline.
Formatting a regular string which could be a f-string Open
_assert(self.path in ['spiral', 'radial'], 'Invalid Path: {}'.format(str(self.path)))
- Read upRead up
- Exclude checks
Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6
.