CSCfi/pebbles

View on GitHub

Showing 106 of 169 total issues

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

    def __init__(self, worker_id, config, cluster_config, client, controller_name):
Severity: Minor
Found in pebbles/worker/controllers.py - About 35 mins to fix

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

        def __init__(self, id, target, source, status, data):
    Severity: Minor
    Found in pebbles/models.py - About 35 mins to fix

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

          def add_provisioning_log(self, application_session_id, message, timestamp=None, log_type='provisioning',
      Severity: Minor
      Found in pebbles/client.py - About 35 mins to fix

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

            def __init__(self, application_session_id, log_level, log_type, timestamp, message):
        Severity: Minor
        Found in pebbles/models.py - About 35 mins to fix

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

          def toggle_enable_template(form, args, application_template):
              """Logic for activating and deactivating a application template"""
              if form.is_enabled.raw_data:
                  application_template.is_enabled = form.is_enabled.raw_data[0]  # WTForms Issue#451
              else:
          Severity: Minor
          Found in pebbles/views/application_templates.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 check_membership_expiry_policy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_membership_expiry_policy(mep):
                  """ Return validation errors for given membership expiry policy or None if successful """
                  if not isinstance(mep, dict):
                      return 'membership expiry policy must be a dict'
                  kind = mep.get('kind')
          Severity: Minor
          Found in pebbles/models.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 load_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def load_data(file, update=False):
              """
              Loads an annotated YAML file into database. Use -u/--update to update existing entries instead of skipping.
              """
              with open(file, 'r') as f:
          Severity: Minor
          Found in manage.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self):
                  for k, default in vars(BaseConfig).items():
                      if type(default) is tuple and len(default) == 2:
                          default, doc_ = default
                      else:
          Severity: Minor
          Found in pebbles/config.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, ext_id, password=None, is_admin=False, email_id=None, expiry_ts=None, pseudonym=None,
                           workspace_quota=None):
                  self.id = uuid.uuid4().hex
                  self.ext_id = ext_id
                  self.is_admin = is_admin
          Severity: Minor
          Found in pebbles/models.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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def post(self):
                  res = []
          
                  for entry in request.json:
                      target = entry.get('target')
          Severity: Minor
          Found in pebbles/views/alerts.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 env_string_to_dict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def env_string_to_dict(keyval_string):
              """ Extract a dictionary from space separated key=val formatted string """
              res = dict()
              for keyval in keyval_string.split():
                  if '=' not in keyval:
          Severity: Minor
          Found in pebbles/utils.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 patch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def patch(self, workspace_id):
                  parser = reqparse.RequestParser()
                  parser.add_argument('new_owner_id', type=str)
          
                  args = parser.parse_args()
          Severity: Minor
          Found in pebbles/views/workspaces.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

          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 val
            Severity: Major
            Found in pebbles/config.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 %s needs owner privileges, please contact administrator' % args.new_owner_id}, 403
                Severity: Major
                Found in pebbles/views/workspaces.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 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 'There is already an existing session for this application', 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 ts, 'image could not be pulled'
                        Severity: Major
                        Found in pebbles/drivers/provisioning/kubernetes_driver.py - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language