Showing 28 of 30 total issues
Function updateTextElements
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def updateTextElements(self, recipe):
"""
Updates Text Elements in Marginalia
"""
for elm in arcpy.mapping.ListLayoutElements(self.mxd, "TEXT_ELEMENT"):
- 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
File map_chef.py
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import arcpy
import logging
import re
from datetime import datetime
Similar blocks of code found in 2 locations. Consider refactoring. Open
def disableLayers(self):
"""
Makes all layers invisible for all data-frames
"""
for df in arcpy.mapping.ListDataFrames(self.mxd):
- 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 50.
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
def enableLayers(self):
"""
Makes all layers visible for all data-frames
"""
for df in arcpy.mapping.ListDataFrames(self.mxd):
- 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 50.
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 main
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def main(args):
args = parser.parse_args()
layerDirectory = args.layerDirectory
# r=root, d=directories, f = files
- 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 _export_atlas
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _export_atlas(self, recipe_with_atlas, arc_mxd, export_dir):
"""
Exports each individual page for recipes which contain an atlas definition
"""
if not recipe_with_atlas.atlas:
- 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 apply_label_classes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def apply_label_classes(self, arc_lyr_to_add, recipe_lyr):
if arc_lyr_to_add.supports("LABELCLASSES"):
for labelClass in recipe_lyr.label_classes:
for lblClass in arc_lyr_to_add.labelClasses:
if (lblClass.className == labelClass.class_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 get_layer_properties
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_layer_properties(file):
lyr = arcpy.mapping.Layer(file)
layerName = lyr.name.encode('utf-8').strip()
if lyr.supports("DEFINITIONQUERY"):
- 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 showLegendEntries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def showLegendEntries(self):
for legend in arcpy.mapping.ListLayoutElements(self.mxd, "LEGEND_ELEMENT"):
layerNames = list()
for lyr in legend.listLegendItemLayers():
if ((lyr.name in self.legendEntriesToRemove) or (lyr.name in layerNames)):
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_version_number():
travis_build = environ.get('TRAVIS_BUILD_NUMBER')
travis_tag = environ.get('TRAVIS_TAG')
if travis_build:
- 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 cook
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cook(self, recipe):
arcpy.env.addOutputsToMap = False
self.disableLayers()
self.removeLayers()
- 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 removeLayers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def removeLayers(self):
"""
Removes all layers for all data-frames
"""
for df in arcpy.mapping.ListDataFrames(self.mxd):
- 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 Open
# TODO add proper fix for applyZoom in line with these two cards
- Exclude checks
TODO found Open
# TODO: asmith 2020/03/03
- Exclude checks
TODO found Open
# TODO asmith 2020/03/06
- Exclude checks
TODO found Open
# TODO: asmith 2020/03/03
- Exclude checks
TODO found Open
# TODO asmith 2020/03/06
- Exclude checks
TODO found Open
# TODO: asmith
- Exclude checks
TODO found Open
# TODO asmith 2020/03/06
- Exclude checks
TODO found Open
# TODO asmith 2020/03/06
- Exclude checks