Showing 104 of 104 total issues
Function show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show():
"""Get all markdown files from 'content/news/', parse them and put
them in a list for the template.
The formatting of these files is described in the readme.
"""
- 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 index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def index():
"""Usersuite landing page with user account information
and traffic overview.
"""
info = current_user.finance_information
- 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 activate_network_access
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def activate_network_access():
"""As user, activate your network access
"""
capability_or_403('network_access_active', 'edit')
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Similar blocks of code found in 2 locations. Consider refactoring. Open
@pytest.mark.parametrize("num", (-3, -5, -1.6, -7.4, -0.5))
def test_negative_style_returned(num):
assert money_style(num) == STYLE_NEG
- 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 36.
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
@pytest.mark.parametrize("num", (3, 5, 1.6, 7.4, 0))
def test_positive_style_returned(num):
assert money_style(num) == STYLE_POS
- 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 36.
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 hosting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hosting(action=None):
"""Change various settings for Helios.
"""
if not current_user.has_property("userdb"):
abort(403)
- 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 change_mail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def change_mail():
"""Frontend page to change the user's mail address"""
capability_or_403('mail', 'edit')
- 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 continue_membership
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def continue_membership():
"""
Cancel termination of membership
: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 request_password_reset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_password_reset():
user_id = None
ip_user = backends.user_from_ip(request.remote_addr)
if ip_user.is_authenticated:
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self, parent, blocks):
""" Parse a table block and build table. """
block = blocks.pop(0).split('\n')
header = block[0].strip()
seperator = block[1].strip()
- 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 send_complex_mail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_complex_mail(subject: str, message: str, tag: str = "",
Function activate_network_access
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def activate_network_access(self, password, mac, birthdate, host_name):
Function send_contact_mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_contact_mail(author: str, subject: str, message: str,
Function change_mac
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_mac(self, user_id, password, interface_id, new_mac, host_name):
Function assert_url_response_code
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assert_url_response_code(
Function send_usersuite_contact_mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_usersuite_contact_mail(subject: str, message: str, category: str,
Function match_person
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def match_person(self, first_name: str, last_name: str, birthdate: date, tenant_number: int,
Function send_mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_mail(author: str, recipient: str, subject: str, message: str,
Function activate_network_access
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def activate_network_access(self, user_id, password, mac, birthdate, host_name):