Showing 13 of 27 total issues
File ecdf_report.py
has 643 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
'''
This module provides a wizard able to generate XML annual financial reports
Generated files are ready for eCDF
Reports :
Function print_xml
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def print_xml(self):
'''
Generates the selected financial reports in XML format
The string is written in the base64 field "xml_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 _append_fr_lines
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _append_fr_lines(self, data_curr, form_data, data_prev=None):
'''
Appends lines "NumericField" in the "form_data" node
:param data_curr: data of the previous year
:param form_data: XML node "form_data"
- 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_chart_ac
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def _get_chart_ac(self, data, report_type, report_model):
'''
Generates the chart of accounts in XML format
:param data: Dictionary of values (name, technical name, value)
:param report_type: Technical name of the report type
- 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
EcdfReport
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class EcdfReport(models.TransientModel):
'''
This wizard allows to generate three types of financial reports :
- Profit & Loss (P&L)
- Balance Sheet (BS)
Function print_xml
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_xml(self):
'''
Generates the selected financial reports in XML format
The string is written in the base64 field "xml_file"
'''
Function _get_chart_ac
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _get_chart_ac(self, data, report_type, report_model):
'''
Generates the chart of accounts in XML format
:param data: Dictionary of values (name, technical name, value)
:param report_type: Technical name of the report type
Function _get_finan_report
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _get_finan_report(self, data_current, report_type, report_model,
data_previous=None):
'''
Generates a financial report (P&L or Balance Sheet) in XML format
:param data_current: dictionary of data of the current year
Avoid deeply nested control flow statements. Open
if report['val'] not in (AccountingNone, None):
record._append_num_field(form_data,
ecdf_code,
0.0)
Avoid deeply nested control flow statements. Open
if balance <= 0.0:
ecdf_codes = ['0118', '2260']
else:
ecdf_codes = ['0117', '2259']
Function get_vat_declarer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_vat_declarer(self):
'''
:returns: VAT number of the company, 8 characters, without the two\
uppercase letters 'LU'
If no VAT number, default value 'NE' is returned
- 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_vat_agent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_vat_agent(self):
'''
:returns: VAT number provided in the form. If no VAT number has been\
provided, the VAT number of the company is returned, without the two\
uppercase letters 'LU'.
- 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 _append_num_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _append_num_field(self, element, ecdf, val, comment=None):
'''
A numeric field's value can be a integer or a float
The only decimal separator accepted is the coma (",")
The point (".") is not accepted as a decimal separator nor as a \
- 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"