swimlane/swimlane-python

View on GitHub

Showing 54 of 441 total issues

File test_user_group_fields.py has 838 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import pytest
from swimlane import exceptions


@pytest.fixture(autouse=True, scope='module')
Severity: Major
Found in functional_tests/driver_tests/test_user_group_fields.py - About 2 days to fix

    File test_records_bulk_adaptor.py has 837 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import pytest
    import pendulum
    from swimlane import exceptions
    from swimlane.core.bulk import Clear, Append, Remove
    # bulk_create
    Severity: Major
    Found in functional_tests/driver_tests/test_records_bulk_adaptor.py - About 2 days to fix

      File test_reporting_filters.py has 673 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import pytest
      import pendulum
      
      
      @pytest.fixture(autouse=True, scope='module')
      Severity: Major
      Found in functional_tests/driver_tests/test_reporting_filters.py - About 1 day to fix

        File test_text_fields.py has 571 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import pytest
        from swimlane import exceptions
        
        # Not testing the followig field sub-types, because of no format limitations:
        # - Telephone
        Severity: Major
        Found in functional_tests/driver_tests/test_text_fields.py - About 1 day to fix

          Function _validate_item has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

              def _validate_item(self, item):
                  """Validate char/word count"""
                  if not isinstance(item, six.string_types):
                      raise ValidationError(
                          self._record,
          Severity: Minor
          Found in swimlane/core/fields/list.py - About 4 hrs 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

          File record.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import copy
          from functools import total_ordering
          import time
          import pendulum
          import six
          Severity: Minor
          Found in swimlane/core/resources/record.py - About 4 hrs to fix

            File conftest.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import pytest
            import json
            import random
            import string
            import time
            Severity: Minor
            Found in functional_tests/conftest.py - About 4 hrs to fix

              File test_helpers_adaptor.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import pytest
              from swimlane import exceptions
              
              # add_comment
              # add_record_references
              Severity: Minor
              Found in functional_tests/driver_tests/test_helpers_adaptor.py - About 3 hrs to fix

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

                """Core Swimlane client class"""
                
                import logging
                
                import jwt
                Severity: Minor
                Found in swimlane/core/client.py - About 3 hrs to fix

                  Function __init__ has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, swimlane, raw):
                          super(App, self).__init__(swimlane, raw)
                  
                          self.acronym = self._raw['acronym']
                          self.name = self._raw['name']
                  Severity: Minor
                  Found in swimlane/core/resources/app.py - About 2 hrs 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

                  File test_record_restriction_adaptor.py has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import pytest
                  from swimlane import exceptions
                  
                  
                  @pytest.fixture(autouse=True, scope='module')
                  Severity: Minor
                  Found in functional_tests/driver_tests/test_record_restriction_adaptor.py - About 2 hrs to fix

                    File record.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import six
                    
                    from swimlane.core.bulk import Replace, _BulkModificationOperation
                    from swimlane.core.cache import check_cache
                    from swimlane.core.resolver import AppResolver
                    Severity: Minor
                    Found in swimlane/core/adapters/record.py - About 2 hrs to fix

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

                      class Record(APIResource):
                          """A single Swimlane Record instance
                      
                          Attributes:
                              id (str): Full Record ID
                      Severity: Minor
                      Found in swimlane/core/resources/record.py - About 2 hrs to fix

                        Function bulk_modify has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def bulk_modify(self, *filters_or_records, **kwargs):
                                """Shortcut to bulk modify records
                                
                                .. versionadded:: 2.17.0
                                
                        Severity: Minor
                        Found in swimlane/core/adapters/record.py - About 2 hrs 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

                        File test_date_time_fields.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import pytest
                        import pendulum
                        from swimlane import exceptions
                        
                        
                        
                        Severity: Minor
                        Found in functional_tests/driver_tests/test_date_time_fields.py - About 2 hrs to fix

                          Function _evaluate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _evaluate(self):
                                  """Lazily retrieve and paginate report results and build Record instances from returned data"""
                                  if self._elements:
                                      for element in self._elements:
                                          yield element
                          Severity: Minor
                          Found in swimlane/core/cursor.py - About 2 hrs 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 one_of_keyword_only has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def one_of_keyword_only(*valid_keywords):
                              """Decorator to help make one-and-only-one keyword-only argument functions more reusable
                          
                              Notes:
                                  Decorated function should take 2 arguments, the first for the key, the second the value
                          Severity: Minor
                          Found in swimlane/utils/__init__.py - About 2 hrs 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 _set has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _set(self, value):
                                  # Force to appropriate Pendulum instance for consistency
                                  if value is not None:
                                      if self.input_type != self._type_interval:
                                          if self.input_type == self._type_date:
                          Severity: Minor
                          Found in swimlane/core/fields/datetime.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 findCreateApp has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def findCreateApp(self, defaultApp):
                                  appId = ""
                                  app = ""
                                  refFieldData = None
                                  try:
                          Severity: Minor
                          Found in functional_tests/conftest.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 createRole has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def createRole(self, name=None, groups=None, users=None, sections=None):
                                  if sections is None:
                                      sections = ['Application', 'Report', 'Workspace',
                                                  'Dashboard', 'Applet', 'Settings']
                                  globalPerms = self.swimlane_instance.request('get', 'global').json()
                          Severity: Minor
                          Found in functional_tests/conftest.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

                          Severity
                          Category
                          Status
                          Source
                          Language