TraceableItem
has 28 functions (exceeds 25 allowed). Consider refactoring. Open
class TraceableItem(TraceableBaseClass):
'''
Storage for a traceable documentation item
'''
Unnecessary elif
after raise
, remove the leading el
from elif
Open
if relation in self.explicit_relations and target in self.explicit_relations[relation]:
- Read upRead up
- Exclude checks
Used in order to highlight an unnecessary block of code following an if containing a raise statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a raise statement.
Consider using Python 3 style super() without arguments Open
data = super(TraceableItem, self).to_dict()
- 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(TraceableItem, self).update(other)
- 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 instance attributes (8/7) Open
class TraceableItem(TraceableBaseClass):
- Read upRead up
- Exclude checks
Used when class has too many instance attributes, try to reduce this to get a simpler (and so easier to use) class.
Too many public methods (22/20) Wontfix
class TraceableItem(TraceableBaseClass):
- Read upRead up
- Exclude checks
Used when class has too many public methods, try to reduce this to get a simpler (and so easier to use) class.
Merge this if statement with the enclosing one. Open
if target in database[relation]:
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if condition1: if condition2: # ...
Compliant Solution
if condition1 and condition2: # ...
Dangerous default value set() (builtins.set) as argument Confirmed
def remove_targets(self, target_id, explicit=False, implicit=True, relations=set()):
- Read upRead up
- Exclude checks
Used when a mutable value as list or dictionary is detected in a default value for an argument.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('item {item}: cannot remove invalid attribute {attr}'
- 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
.
Formatting a regular string which could be a f-string Open
retval += '\tAttribute {attribute} = {value}\n'.format(attribute=attribute,
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('item {item} attribute does not match defined attributes ({attr}={value})'
- 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
.
Formatting a regular string which could be a f-string Open
retval += '\t{text} {relation}\n'.format(text=description, relation=relation)
- 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
.
Formatting a regular string which could be a f-string Open
retval += '\t\t{target}\n'.format(target=tgtid)
- 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
.
Formatting a regular string which could be a f-string Open
retval += '\tPlaceholder: {placeholder}\n'.format(placeholder=self.is_placeholder)
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('duplicating {src} {rel} {tgt}'.format(src=self.identifier,
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('item {item} is not defined'.format(item=self.identifier), self.docname)
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('item {item} has invalid attribute value for {attribute}'
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('item {item} has invalid attribute ({attr}={value})'
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('{cnt} duplicate target(s) found for {item} {relation})'
- 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
.
Formatting a regular string which could be a f-string Open
raise TraceabilityException('circular relationship {src} {rel} {tgt}'.format(src=self.identifier,
- 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
.
Consider iterating with .items() Open
for attribute in self.attributes:
- Read upRead up
- Exclude checks
Emitted when iterating over the keys of a dictionary and accessing the value by index lookup. Both the key and value can be accessed by iterating using the .items() method of the dictionary instead.