swimlane/swimlane-python

View on GitHub

Showing 54 of 441 total issues

Function execute_task has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def execute_task(self, task_name, timeout=int(20)):
        job_info = swimlane.core.adapters.task.TaskAdapter(self.app._swimlane).execute(task_name, self._raw)
        timeout_start = pendulum.now()
        while pendulum.now() < timeout_start.add(seconds=timeout):
            status = self.app._swimlane.helpers.check_bulk_job_status(job_info.text)
Severity: Minor
Found in swimlane/core/resources/record.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 get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, arg, value):
        """Retrieve single user record by id or username

        Warnings:
            User display names are not unique. If using `display_name`, method will fail if multiple Users are returned
Severity: Minor
Found in swimlane/core/adapters/usergroup.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 updateUserGroupFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def updateUserGroupFields(fields):
    for eachField in fields:
        if "members" in eachField.keys():
            for eachMember in eachField["members"]:
                name = eachMember['name'][eachMember['name'].find("PYTHON-"):]
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 _build_field_type_map has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _build_field_type_map(base_class):
    """Create mapping from all $type values to their respective Field classes"""
    mapping = {}

    for cls in _get_recursive_subclasses(base_class):
Severity: Minor
Found in swimlane/core/fields/__init__.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in swimlane/core/client.py - About 1 hr to fix

    Function remove_restriction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_restriction(self, *usergroups):
            """Remove UserGroup(s) from list of accounts with access to record
    
            .. versionadded:: 2.16.1
    
    
    Severity: Minor
    Found in swimlane/core/resources/record.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get(self, key, value):
            """Get single app by one of id or name
    
            Supports resource cache
    
    
    Severity: Minor
    Found in swimlane/core/adapters/app.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 set_swimlane has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_swimlane(self, value):
            """Store record ids in separate location for later use, but ignore initial value"""
    
            # Move single record into list to be handled the same by cursor class
            if not self.multiselect:
    Severity: Minor
    Found in swimlane/core/fields/reference.py - About 55 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 requires_swimlane_version has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def requires_swimlane_version(min_version=None, max_version=None):
        """Decorator for SwimlaneResolver methods verifying Swimlane server build version is within a given inclusive range
    
        Raises:
            InvalidVersion: Raised before decorated method call if Swimlane server version is out of provided range
    Severity: Minor
    Found in swimlane/utils/version.py - About 55 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 validate_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_value(self, value):
            """Validate new user/group value against any User/Group restrictions
    
            Attempts to resolve generic UserGroup instances if necessary to respect special "Everyone" group, and
            "All Users" + "All Groups" options
    Severity: Minor
    Found in swimlane/core/fields/usergroup.py - About 55 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 check_cache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_cache(resource_type):
        """Decorator for adapter methods to check cache for resource before normally sending requests to retrieve data
    
        Only works with single kwargs, almost always used with @one_of_keyword_only decorator
    
    
    Severity: Minor
    Found in swimlane/core/cache.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 merge_environment_settings has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def merge_environment_settings(self, url, proxies, stream, verify, *args, **kwargs):
    Severity: Minor
    Found in swimlane/core/wrappedsession.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if selection_type == 'single':
                                  self._defaults[field['name']] = value['name']
                                  break
                              else:
                                  default = self._defaults.get(field['name'], list())
      Severity: Major
      Found in swimlane/core/resources/app.py - About 45 mins to fix

        Function cleanupData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def cleanupData(self):
                dashboardsList = []
                workspacesList = []
                for eachApp in self.appIds:
                    print("Removing app with ID: %s" % eachApp)
        Severity: Minor
        Found in functional_tests/conftest.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 open_swimlane_instance has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def open_swimlane_instance(self, url, user, password, verifyVersion, write_to_read_only=False):
        Severity: Minor
        Found in functional_tests/conftest.py - About 35 mins to fix

          Function add_comment has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def add_comment(self, app_id, record_id, field_id, message, rich_text=False):
          Severity: Minor
          Found in swimlane/core/adapters/helper.py - About 35 mins to fix

            Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(self, key, value):
                    """Get a single task by id or name"""
                    if key == 'id':
                        response = self._swimlane.request('get', 'task/{id}'.format(id=value))
                        return Task(self._swimlane, response.json())
            Severity: Minor
            Found in swimlane/core/adapters/task.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 test_record_bulk_delete_list_twice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def test_record_bulk_delete_list_twice(helpers):
                    textValue = "Delete Me twice"
                    pytest.app.records.bulk_create({'Text': textValue}, {'Text': textValue}, {
                                                   'Text': textValue}, {'Text': textValue})
            
            
            Severity: Minor
            Found in functional_tests/driver_tests/test_records_bulk_adaptor.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 _validate_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _validate_item(self, item):
                    if not isinstance(item, Number):
                        raise ValidationError(
                            self._record,
                            "Numeric list field items must be numbers, not '{}'".format(item.__class__)
            Severity: Minor
            Found in swimlane/core/fields/list.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(self, key, value):
                    """Retrieve single group record by id or name
            
                    Supports resource cache
            
            
            Severity: Minor
            Found in swimlane/core/adapters/usergroup.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

            Severity
            Category
            Status
            Source
            Language