Showing 8 of 8 total issues
File resources_rc.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Thu Jul 23 16:26:35 2015
Function validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
"""Make sure that all fields have valid values."""
message = ''
if not self.dialog.sourceLayerCombo.currentText():
message += self.tr('Please select an input layer.')
- 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 setupUi
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setupUi(self, CartogramDialog):
CartogramDialog.setObjectName(_fromUtf8("CartogramDialog"))
CartogramDialog.resize(280, 190)
CartogramDialog.setModal(True)
self.formLayout = QtGui.QFormLayout(CartogramDialog)
Function run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
ret = None
try:
feature_count = self.layer.featureCount()
- 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 transform_polygon
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def transform_polygon(self, polygon, meta_features,
force_reduction_factor):
"""Transform the geometry of a single polygon."""
new_line = []
- 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_reduction_factor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_reduction_factor(self, layer, field):
"""Calculate the reduction factor."""
data_provider = layer.dataProvider()
meta_features = []
- 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_vector_layer_by_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_vector_layer_by_name(self, layer_name):
"""Retrieve a layer from the registry by name."""
layerMap = QgsMapLayerRegistry.instance().mapLayers()
for name, layer in layerMap.iteritems():
if layer.type() == QgsMapLayer.VectorLayer \
- 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 count_vector_layers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def count_vector_layers(self):
"""Count the number of vector layers on the canvas."""
layermap = QgsMapLayerRegistry.instance().mapLayers()
count = 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"