Class '_Common' inherits from object, can be safely removed from bases in python3 Open
class _Common(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, fun, step=None, method='central', order=2,
- Read upRead up
- Exclude checks
Used when a function or method takes too many arguments.
Too few public methods (1/2) Open
class Jacobian(_Common):
- 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
return super(Gradient, self).__call__(np.atleast_1d(x).ravel(),
- 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 few public methods (1/2) Open
class Gradient(Jacobian):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Consider using '{complex
: 'cs', central
: '3-point', forward
: '2-point', backward
: '2-point', ... }' instead of a call to 'dict'. Open
method = dict(complex='cs', central='3-point', forward='2-point',
- 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 '{method
: method, rel_step
: self.step, args
: args, kwargs
: kwds, ... }' instead of a call to 'dict'. Open
options = dict(method=method, rel_step=self.step, args=args,
- 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.
Too few public methods (0/2) Open
class _Common(object):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Unable to import 'scipy.optimize' Open
from scipy.optimize import approx_fprime
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Unable to import 'scipy.optimize._numdiff' Open
from scipy.optimize._numdiff import approx_derivative
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Unused argument 'order' Open
def __init__(self, fun, step=None, method='central', order=2,
- Read upRead up
- Exclude checks
Used when a function or method argument is not used.
Unused approx_fprime imported from scipy.optimize Open
from scipy.optimize import approx_fprime
- Read upRead up
- Exclude checks
Used when an imported module or variable is not used.
TODO found Open
TODO: The following does not work:
- Exclude checks
Unable to import 'numpy' Open
import numpy as np
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Similar blocks of code found in 2 locations. Consider refactoring. Open
class Gradient(Jacobian):
"""
Calculate Gradient with finite difference approximation
Parameters
- 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 46.
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
Missing module docstring Open
from __future__ import absolute_import, division, print_function
- Read upRead up
- Exclude checks
Used when a module has no docstring. Empty modules do not require a docstring.