Showing 88 of 547 total issues
Function action_move_create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def action_move_create(self):
"""Reconcile supplier invoice payables with the created move lines."""
res = super(HrExpense, self).action_move_create()
for expense in self:
for line in expense.account_move_id.line_id:
- 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 _create_attendance_schedule
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _create_attendance_schedule(self):
self.ensure_one()
obj_schedule = self.env["hr.timesheet_attendance_schedule"]
tz = self.employee_id.user_id.tz or self.env.user.tz
- 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 _compute_policy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute_policy(self):
for batch in self:
if self.env.user.id == SUPERUSER_ID:
batch.close_ok = batch.generate_ok = batch.set2draft_ok = True
continue
- 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
Avoid deeply nested control flow statements. Open
if abs(1 - rounded_start_hour) < 0.01:
attendance_start = datetime(
attendance_start.year,
attendance_start.month,
attendance_start.day,
Function get_name_data
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_name_data(
Avoid deeply nested control flow statements. Open
if matched_schedules:
intervals_within += 1
# sign in tolerance
if intervals_within == 1:
att = matched_schedules[0]
Function _compute_policy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute_policy(self):
for batch in self:
if self.env.user.id == SUPERUSER_ID:
batch.confirm_ok = (
batch.valid_ok
- 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 _compute_hour
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute_hour(self):
for ovt in self:
ovt_hour = 0.0
dt_start = dt_end = False
if ovt.date_start:
- 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
Avoid deeply nested control flow statements. Open
if len(matched_schedules) > 1:
raise UserError(
_("Wrongly configured working schedule with " "id %s")
% unicode(calendar_id) # noqa: F821
)
Function get_csv_detail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_csv_detail(self):
dict_field = {}
dict_date = {}
obj_csv_detail = self.env["hr.attendance_machine_csv_detail"]
- 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 _compute_policy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute_policy(self):
for batch in self:
if self.env.user.id == SUPERUSER_ID:
batch.confirm_ok = (
batch.refund_ok
- 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 action_cancel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def action_cancel(self):
for transition in self:
if not transition._check_cant_cancel_latest_transition():
msg = _("You can only cancel valid latest transition")
raise UserError(msg)
- 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 onchange_amount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onchange_amount(self):
_super = super(HrAnalyticTimesheet, self)
_super.onchange_amount()
is_sale_line = False
- 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
Avoid deeply nested control flow statements. Open
if attendance.outside_calendar_duration:
overtime = attendance.outside_calendar_duration
cal = reference_calendar
if cal.overtime_rounding_tolerance:
overtime = self.time_sum(
Function _compute_policy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute_policy(self):
for batch in self:
if self.env.user.id == SUPERUSER_ID:
batch.submit_ok = (
batch.approve_ok
- 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
Consider simplifying this complex logical expression. Open
if attn.start_attendance_id and attn.end_attendance_id:
attn.state = "present"
elif (attn.start_attendance_id and not attn.end_attendance_id) or (
not attn.start_attendance_id and attn.end_attendance_id
):
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, args, offset=0, limit=None, order=None, count=False):
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, args, offset=0, limit=None, order=None, count=False):
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, args, offset=0, limit=None, order=None, count=False):
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, args, offset=0, limit=None, order=None, count=False):