Showing 177 of 177 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
tc = odf.table.TableCell(
valuetype="string",
formula="oooc:=[Deps.%s3]" % self.__sscoords[i])
- 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 32.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
sprios_assigned = sorted(
prios_assigned, key=lambda x: x.get_value("Status").get_date_str(),
- 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 32.
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
Function write_analytics_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write_analytics_result(self, mstderr):
'''Write out the analytics results.'''
for k, val in sorted(self.analytics.items(),
key=operator.itemgetter(0)):
if val[0] < 0:
- 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 __common_topic_continuum_pre
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __common_topic_continuum_pre(self, topic_continuum, special):
'''Common method used by cmad_ and normal callback.'''
tracer.info("Called.")
output_config = topic_continuum.get_output_config()
- 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 add_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_values(soptions, name):
'''Add all the new command line parameter values.'''
if soptions is None:
return {}
- 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 _add_topic_relation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _add_topic_relation(self, topic_a, topic_b):
'''Add the relation between topic_a and topic_b.
(Here only one _ is used because this is used by the unit tests.)'''
# If not there, add the initial count [0, 0]
for topic in [topic_a.name, topic_b.name]:
- 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 __restrict_to_topics_one_req
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __restrict_to_topics_one_req(self, restricted_reqs, req):
tracer.debug("Restricting requirement [%s]", req.get_id())
# Add to the internal map
restricted_reqs.add_requirement(req)
# Add to the common digraph structure
- 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 connected_components
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def connected_components(digraph):
"""Compute the connected components of the given digraph"""
# This hold the components:
# the lists of the nodes which are in one component
components = ConnectedComponents()
- 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 _setup_directories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _setup_directories(self, cfg):
'''Cleans up and unifies the directories.'''
all_dirs = {}
tracer.debug("Called.")
for dir_type in ["requirements", "topics", "constraints", "testcases"]:
- 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 __resolve_depends_on_one_req_impl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __resolve_depends_on_one_req_impl(self, req):
tag_content = req.brmo["Depends on"]
# If available, it must not empty
if not tag_content.get_content():
- 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 topic_set_post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def topic_set_post(self, topic_set):
'''This is call in the TopicsSet post-phase.'''
# pylint: disable=consider-iterating-dictionary
for req_id in self.__req2topics.keys():
req_a = topic_set.get_topic_set().get_requirement_set().\
- 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 topological_sort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def topological_sort(digraph, nodes_sort=node_list_sort):
'''This algorithm is based upon a depth first search with 'making' some
special nodes.
The result is the topological sorted list of nodes.'''
# List of topological sorted nodes
- 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 create_tree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_tree(self, topic_continuum_set):
# Create a new scrolled window, with scrollbars only if needed
scrolled_window = gtk.ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- 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 _check_list_of_strings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _check_list_of_strings(name, tbc):
'''Checks if the given variable is a list of strings or None.'''
if tbc is None:
tracer.debug("Ignoring non existent configuration for [%s]", tbc)
return
- 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 execute_cmds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute_cmds(config, input_mods, _mstdout, mstderr):
'''Checks are always done - to be sure that e.g. the dependencies
are correct.
Please note: there is no 'ONE' latest continuum any more
- but a list.'''
- 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 __connect_nodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __connect_nodes(self):
'''Precondition: the depends_on must be set.
The method connect all the nodes based on this value.'''
for mod_name, mod in self.__tagtypes[InputModuleTypes.reqdeps].items():
for node in mod.depends_on:
- 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 __resolve_solved_by_one_req_deps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __resolve_solved_by_one_req_deps(self, req):
content = req.brmo["Solved by"].get_content()
# If available, it must not empty
if not content:
logger.error(LogFormatter.format(
- 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"