Showing 88 of 88 total issues
File kassenbuch.py
has 1556 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PYTHON_ARGCOMPLETE_OK
- Create a ticketCreate a ticket
Function main
has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring. Open
def main():
"""parse args, run the desired action"""
args = parse_args()
# go to script dir (configs are relative path names)
- Read upRead up
- Create a ticketCreate a ticket
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 gui.py
has 782 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops.
# Copyright (C) 2015 Julian Hammer <julian.hammer@fablab.fau.de>
- Create a ticketCreate a ticket
File FAUcardPaymentThread.py
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from __future__ import print_function
- Create a ticketCreate a ticket
File abstract.py
has 425 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops.
# Copyright (C) 2013-2015 Julian Hammer <julian.hammer@fablab.fau.de>
# Maximilian Gaukler <max@fablab.fau.de>
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
if len(sys.argv) == 3:
dateFrom = datetime.datetime.strptime(sys.argv[1], "%Y-%m-%d")
dateTo = datetime.datetime.strptime(sys.argv[2], "%Y-%m-%d")
print("filtering from {0} to {1}".format(dateFrom, dateTo))
rechnungen = filter(lambda r: dateFrom < r.datum < dateTo, rechnungen)
- Read upRead up
- Create a ticketCreate a ticket
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 100.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if len(sys.argv) == 3:
dateFrom = datetime.datetime.strptime(sys.argv[1], "%Y-%m-%d")
dateTo = datetime.datetime.strptime(sys.argv[2], "%Y-%m-%d")
print("filtering from {0} to {1}".format(dateFrom, dateTo))
rechnungen = filter(lambda r: dateFrom < r.datum < dateTo, rechnungen)
- Read upRead up
- Create a ticketCreate a ticket
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 100.
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 35 (exceeds 5 allowed). Consider refactoring. Open
def main():
os.chdir(os.path.dirname(os.path.realpath(__file__)) + "/../")
def isWarningLine(line):
return "CRITICAL" in line or "ERROR" in line or "WARN" in line
- Read upRead up
- Create a ticketCreate a ticket
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 offline_base.py
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""basic functionality for offline backends
use case:
- categories and products are only loaded once at startup and then kept RAM for the whole application time.
- the carts are stored in RAM
- Create a ticketCreate a ticket
Function aggregate_consumption
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def aggregate_consumption(rechnungen):
"""Returns consumption from given rechnungen"""
consumption = {}
consumptionUnits = {}
name = {}
- Read upRead up
- Create a ticketCreate a ticket
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 _decrease_balance
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def _decrease_balance(self) -> int:
"""
Decreases card balance by self.amount_cents by following steps:
0. If user aborted: Quit by raising UserAbortionError.
1. Try to decrease balance
- Read upRead up
- Create a ticketCreate a ticket
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 generateLog.py
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
import sys
import os
- Create a ticketCreate a ticket
AbstractShoppingBackend
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class AbstractShoppingBackend(object):
"""manages products, categories and orders (cart)"""
__metaclass__ = ABCMeta
- Create a ticketCreate a ticket
Function main
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def main():
SHUTDOWN_LOCKFILE = "/tmp/fablabkasse-shutdown"
while file_exists(SHUTDOWN_LOCKFILE):
# This is a workaround for bug https://github.com/spanezz/nodm/issues/5 in the nodm display manager.
# The lockfile must be in /tmp and not in /run/user because is cleared early during shutdown.
- Read upRead up
- Create a ticketCreate a ticket
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 printFilteredFreiePreiseingabe
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def printFilteredFreiePreiseingabe(rechnungen, searchwords):
summe = 0
for r in rechnungen:
for p in r.positionen:
if p["produkt_ref"] != "9997":
- Read upRead up
- Create a ticketCreate a ticket
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 pxss.py
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# Copyright 2009 Yu-Jie Lin
# Copyright 2003 David McClosky
#
# This code is licensed under the GPLv3
- Create a ticketCreate a ticket
AbstractOfflineShoppingBackend
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class AbstractOfflineShoppingBackend(AbstractShoppingBackend):
"""manages products, categories and orders (cart)"""
__metaclass__ = ABCMeta
- Create a ticketCreate a ticket
File ClientDialogCode.py
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
#
# FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops.
# Copyright (C) 2015 Julian Hammer <julian.hammer@fablab.fau.de>
# Maximilian Gaukler <max@fablab.fau.de>
- Create a ticketCreate a ticket
File exportConsumptionMoney.py
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops.
# Copyright (C) 2014 Julian Hammer <julian.hammer@fablab.fau.de>
- Create a ticketCreate a ticket
File payment_methods.py
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
#
# FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops.
# Copyright (C) 2015 Julian Hammer <julian.hammer@fablab.fau.de>
# Maximilian Gaukler <max@fablab.fau.de>
- Create a ticketCreate a ticket