Showing 18 of 23 total issues
File recipe_layer.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
# import shapefile
import fiona
import glob
Similar blocks of code found in 2 locations. Consider refactoring. Open
nr_dict = {
'name_to_validate': name_result.name_to_validate,
'is_parsable': name_result.is_parsable,
'valid_clause_list': [
{'valid_clause': clause_msg} for clause_msg in sorted(valid_clause_list)],
- 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 51.
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
nr_dict = {
'name_to_validate': ncr.name_to_validate,
'is_parsable': ncr.is_parsable,
'valid_clause_list': [
{'valid_clause': clause_msg} for clause_msg in sorted(valid_clause_list)],
- 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 51.
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 layer_reg_ex_adapter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def layer_reg_ex_adapter(recipe_lyr, cmf):
"""
Creates context data to support human readable intepritation of the regex used to
seach for datasets.
The key to this adapter is the fact that in most cases the layer's `reg_ex` property
- 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 parse_feedback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_feedback(status, msg, step, **kwargs):
"""
This is called once per step execution.
It provides a hook into print messages to the terminal, log files and the JIRA Client.
"""
- 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 _get_version_number
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_version_number():
travis_build = environ.get('TRAVIS_BUILD_NUMBER')
travis_tag = environ.get('TRAVIS_TAG')
repo_slug = environ.get('TRAVIS_REPO_SLUG')
if repo_slug:
- 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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, cmf, extension, verify_on_creation=True):
"""
Positional Arguments:
* cmf: Either a CrashMoveFolder object or a path to a cmf_description.json file. If it
is a CrashMoveFolder object and cmf.verify_paths() returns False then an
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, nc_json_path):
self.nc_json_path = nc_json_path
self._clause_validation = {}
with open(self.nc_json_path) as json_file:
- 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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
def __init__(self, func, fail_threshold, running_msg, complete_msg, fail_msg):
Function _get_requires_list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_requires_list():
# Items for which the version does not need to be pinned to support py2.7
requires = [
'chevron',
'dicttoxml',
- 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 search_issue_by_unique_summary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_issue_by_unique_summary(self, search_summary, op_id):
# Default if `op_id` is None
jql_op_id = 'operational_id is EMPTY'
if op_id:
jql_op_id = 'operational_id ~ "{}"'.format(op_id)
- 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 _init_known_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _init_known_values(self, csv_path, csv_file, lookup_field):
csv_reader = csv.DictReader(
csv_file, delimiter=',', quotechar='"')
if lookup_field in csv_reader.fieldnames:
- 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
TODO found Confirmed
# TODO read these in from a config file
- Exclude checks
TODO found Open
# TODO: This results in calling `os.path.join` twice for certain files
- Exclude checks
TODO found Open
# TODO re-enable "Have the input files changed?"
- Exclude checks
TODO found Open
# TODO: asmith 2020/03/03
- Exclude checks
TODO found Open
# TODO: This is hackish. It should really be evident from the DataClauseValues object
- Exclude checks
TODO found Open
# TODO Review is it is possible in the case of warnings, to pass back an updated
- Exclude checks