CSCfi/pebbles

View on GitHub

Showing 106 of 169 total issues

Avoid too many return statements within this function.
Open

        return marshal_based_on_role(user, application_session), 200
Severity: Major
Found in pebbles/views/application_sessions.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return dict(message=msg), 422
    Severity: Major
    Found in pebbles/views/workspaces.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return marshal_based_on_role(user, workspace)
      Severity: Major
      Found in pebbles/views/workspaces.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 'Invalid user or password', 401
        Severity: Major
        Found in pebbles/views/sessions.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 'Account has expired', 403
          Severity: Major
          Found in pebbles/views/sessions.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 'Concurrent session memory limit for workspace exceeded', 409
            Severity: Major
            Found in pebbles/views/application_sessions.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return application.attribute_limits
              Severity: Major
              Found in pebbles/views/applications.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return val
                Severity: Major
                Found in pebbles/config.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return None
                  Severity: Major
                  Found in pebbles/models.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return marshal_based_on_role(user, workspace)
                    Severity: Major
                    Found in pebbles/views/workspaces.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return ts, 'image could not be pulled'
                      Severity: Major
                      Found in pebbles/drivers/provisioning/kubernetes_driver.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return ts, 'starting'
                        Severity: Major
                        Found in pebbles/drivers/provisioning/kubernetes_driver.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return {'error': 'User is already owner of the workspace'}, 403
                          Severity: Major
                          Found in pebbles/views/workspaces.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                return ts, 'starting'
                            Severity: Major
                            Found in pebbles/drivers/provisioning/kubernetes_driver.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return 'Invalid attribute limits, error: %s' % error, 422
                              Severity: Major
                              Found in pebbles/views/applications.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return None
                                Severity: Major
                                Found in pebbles/utils.py - About 30 mins to fix

                                  Function get_application_fields_from_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def get_application_fields_from_config(application, field_name):
                                      """Hybrid fields for Application model which need processing"""
                                      provisioning_config = get_provisioning_config(application)
                                  
                                      if field_name == 'cost_multiplier':
                                  Severity: Minor
                                  Found in pebbles/utils.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 load_yaml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def load_yaml(yaml_data):
                                      """
                                      A function to load annotated yaml data into the database.
                                      Example can be found in devel_dataset.yaml
                                      """
                                  Severity: Minor
                                  Found in pebbles/models.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 generate_application_query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def generate_application_query(user, args):
                                      # handle admins separately
                                      if user.is_admin:
                                          s = select(Application).join(Application.workspace)
                                          # admins can query deleted applications
                                  Severity: Minor
                                  Found in pebbles/rules.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 is_workspace_manager has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def is_workspace_manager(user, workspace=None):
                                      if workspace:
                                          if workspace.status != Workspace.STATUS_ACTIVE:
                                              return False
                                          manager_cache = g.setdefault('manager_cache', dict())
                                  Severity: Minor
                                  Found in pebbles/views/commons.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