open-synergy/opensynid-fleet

View on GitHub

Showing 20 of 82 total issues

File fleet_work_order_passanger.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=W0622
import base64
from datetime import datetime
Severity: Minor
Found in fleet_work_order_passanger/models/fleet_work_order_passanger.py - About 4 hrs to fix

    FleetWorkOrderPassanger has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FleetWorkOrderPassanger(models.Model):
        _name = "fleet.work_order_passanger"
        _inherit = ["mail.thread"]
        _description = "Fleet Work Order Passanger"
    
    
    Severity: Minor
    Found in fleet_work_order_passanger/models/fleet_work_order_passanger.py - About 3 hrs to fix

      File fleet_work_order.py has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2016 OpenSynergy Indonesia
      # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
      
      from openerp import _, api, fields, models
      from openerp.exceptions import Warning as UserError
      Severity: Minor
      Found in fleet_work_order/models/fleet_work_order.py - About 3 hrs to fix

        FleetWorkOrder has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class FleetWorkOrder(models.Model):
            _name = "fleet.work.order"
            _description = "Fleet Work Order"
            _inherit = ["mail.thread"]
        
        
        Severity: Minor
        Found in fleet_work_order/models/fleet_work_order.py - About 2 hrs to fix

          Function _constraint_cargo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def _constraint_cargo(self):
                  if not self.cargo_ids:
                      pass
          
                  if self.state == "depart":
          Severity: Minor
          Found in fleet_work_order_cargo/models/fleet_work_order.py - About 1 hr to fix

          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 button_calc_distance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_calc_distance(self):
                  if self.start_location_id and self.end_location_id:
                      keychain_account = self._get_auth()
          
                      data = keychain_account.get_data()
          Severity: Minor
          Found in fleet_work_order_multiple_route_distance/models/fleet_route.py - About 1 hr to fix

          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 _default_channel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _default_channel(self):
                  result = False
                  obj_fleet_work_order = self.env["fleet.work.order"]
                  work_order_id = self._context.get("default_work_order_id", False)
          
          
          Severity: Minor
          Found in fleet_work_order_passanger/wizards/passanger_boarding_disembark.py - About 1 hr to fix

          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 _default_device_id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def _default_device_id(self):
                  result = False
                  obj_fleet_work_order = self.env["fleet.work.order"]
                  work_order_id = self._context.get("default_work_order_id", False)
          
          
          Severity: Minor
          Found in fleet_work_order_passanger/wizards/passanger_boarding_disembark.py - About 1 hr to fix

          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 button_calc_distance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_calc_distance(self):
                  if self.start_location_id and self.end_location_id:
                      keychain_account = self._get_auth()
          
                      data = keychain_account.get_data()

          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 button_calc_distance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_calc_distance(self):
                  if self.start_location_id and self.end_location_id:
                      keychain_account = self._get_auth()
          
                      data = keychain_account.get_data()
          Severity: Minor
          Found in fleet_work_order_route_distance/models/fleet_work_order_type.py - About 1 hr to fix

          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 button_calc_distance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_calc_distance(self):
                  if self.start_location_id and self.end_location_id:
                      keychain_account = self._get_auth()
          
                      data = keychain_account.get_data()
          Severity: Minor
          Found in fleet_work_order_route_distance/models/fleet_work_order.py - About 1 hr to fix

          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 button_calc_distance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def button_calc_distance(self):
                  if self.start_location_id and self.end_location_id:
                      keychain_account = self._get_auth()
          
                      data = keychain_account.get_data()

          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_barcode_image has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_barcode_image(self):
                  for data in self:
                      data.barcode_image = None
                      if data.name != "/":
                          if t_product.check_ean(data.name):
          Severity: Minor
          Found in fleet_work_order_passanger/models/fleet_work_order_passanger.py - About 1 hr to fix

          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_route has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_route(self):
                  for document in self:
                      if document.multiple_route and len(document.route_ids) > 0:
                          document.function_start_location_id = document.route_ids[
                              0
          Severity: Minor
          Found in fleet_work_order_multiple_route/models/fleet_work_order_type_route.py - About 45 mins to fix

          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_route has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_route(self):
                  for document in self:
                      if document.multiple_route and len(document.route_ids) > 0:
                          document.function_start_location_id = document.route_ids[
                              0
          Severity: Minor
          Found in fleet_work_order_multiple_route/models/fleet_work_order.py - About 45 mins to fix

          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_allowed_type_ids has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_allowed_type_ids(self):
                  for passanger in self:
                      passanger.allowed_type_ids = False
                      if (
                          passanger.work_order_id
          Severity: Minor
          Found in fleet_work_order_passanger/models/fleet_work_order_passanger.py - About 35 mins to fix

          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_onboard_ticket_sale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_onboard_ticket_sale(self):
                  for wiz in self:
                      ticket_ids = []
                      passanger_type_ids = self.work_order_id.type_id.passanger_type_ids
                      if wiz.work_order_id.type_id.passanger_type_ids:

          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_route_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def onchange_route_ids(self):
                  self.route_ids.unlink()
                  if self.type_id:
                      wo_type = self.type_id
                      if wo_type.route_ids:
          Severity: Minor
          Found in fleet_work_order_multiple_route/models/fleet_work_order.py - About 25 mins to fix

          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_product_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def onchange_product_id(self):
                  self.product_id = False
                  if self.type_id:
                      criteria = [
                          ("passanger_type_id", "=", self.type_id.id),

          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_picking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _compute_picking(self):
                  for order in self:
                      picking_volume = (
                          picking_weight
                      ) = picking_weight_diff = picking_volume_diff = 0.0
          Severity: Minor
          Found in fleet_work_order_cargo_from_picking/models/fleet_work_order.py - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language