edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

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

    def appendrange(self, r):
        """Add ranges to the current one.

        A range is specified as a string of the form "low-high", and
        `r` can be a list of such strings, a string containing comma-separated
Severity: Minor
Found in trac/util/__init__.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 daemonize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def daemonize(pidfile=None, progname=None, stdin='/dev/null',
Severity: Minor
Found in trac/util/daemon.py - About 45 mins to fix

    Function groupattr_filter has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def groupattr_filter(_eval_ctx, iterable, num, attr, *args, **kwargs):
    Severity: Minor
    Found in trac/util/presentation.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if l.territory:
                                  locale = l
                                  break
                          except (UnknownLocaleError, ValueError):
      Severity: Major
      Found in trac/util/datefmt.py - About 45 mins to fix

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

            def reset_db(self, default_data=None):
                """Remove all data from Trac tables, keeping the tables themselves.
        
                :param default_data: after clean-up, initialize with default data
                :return: True upon success
        Severity: Minor
        Found in trac/test.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

        Avoid deeply nested control flow statements.
        Open

                                    if f['filename'].endswith(nsrc):
                                        plugin['frame_idx'] = i
                                        return
                    except KeyError:
        Severity: Major
        Found in trac/loader.py - About 45 mins to fix

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

          def _get_registry(cls, compmgr=None):
              """Return the descriptor registry.
          
              If `compmgr` is specified, only return descriptors for components that
              are enabled in the given `ComponentManager`.
          Severity: Minor
          Found in trac/config.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 backup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def backup(self, dest_file):
                  db_url = self.env.config.get('trac', 'database')
                  scheme, db_prop = parse_connection_uri(db_url)
                  db_params = db_prop.setdefault('params', {})
                  db_params.setdefault('schema', 'public')
          Severity: Minor
          Found in trac/db/postgres_backend.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

          Avoid deeply nested control flow statements.
          Open

                                  if col.auto_increment:
                                      db.update_sequence(cursor, new_table.name,
                                                         col.name)
                              self.drop_tables((temp_table_name,))
          Severity: Major
          Found in trac/db/api.py - About 45 mins to fix

            Function _from_database has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _from_database(self, id, sid, authenticated, class_, realm, target):
            Severity: Minor
            Found in trac/notification/model.py - About 45 mins to fix

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

                  def to_sql(self, table, max_bytes=None):
                      if max_bytes is None:
                          max_bytes = self._max_bytes(None)
                      sql = ['CREATE TABLE %s (' % _quote(table.name)]
                      coldefs = []
              Severity: Minor
              Found in trac/db/mysql_backend.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 copy_tables has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def copy_tables(src_env, dst_env, src_db, dst_db, src_dburi, dst_dburi):
              Severity: Minor
              Found in trac/db/convert.py - About 45 mins to fix

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

                    def destroy_db(self, path, log=None, params={}):
                        if path != ':memory:':
                            if not os.path.isabs(path):
                                path = os.path.join(self.env.path, path)
                            try:
                Severity: Minor
                Found in trac/db/sqlite_backend.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

                Avoid deeply nested control flow statements.
                Open

                                        if isinstance(option, Option):
                                            set_option_default(option)
                        else:
                Severity: Major
                Found in trac/config.py - About 45 mins to fix

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

                  def get_configinfo(env):
                      """Returns a list of dictionaries containing the `name` and `options`
                      of each configuration section. The value of `options` is a list of
                      dictionaries containing the `name`, `value` and `modified` state of
                      each configuration option. The `modified` value is True if the value
                  Severity: Minor
                  Found in trac/config.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 find_by_sid_class_realm_and_target has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def find_by_sid_class_realm_and_target(cls, env, sid, authenticated,
                  Severity: Minor
                  Found in trac/notification/model.py - About 45 mins to fix

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

                        def shutdown(self, tid=None):
                            """Close pooled connections not used in a while"""
                            delay = 120
                            if tid is None:
                                delay = 0
                    Severity: Minor
                    Found in trac/db/pool.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

                    Avoid deeply nested control flow statements.
                    Open

                                            while index >= len(messages):
                                                messages.append(None)
                                            messages[index - 1] = message
                    Severity: Major
                    Found in trac/dist.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if kwarg_name in func_kwargs_map:
                                                  messages_kwargs[kwarg_name] = message
                                              else:
                                                  messages.append(message)
                                              del buf[:]
                      Severity: Major
                      Found in trac/dist.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if info[k] == 'UNKNOWN':
                                                info[k] = ''
                                            else:
                                                # Must be encoded as unicode as otherwise Genshi
                                                # may raise a "UnicodeDecodeError".
                        Severity: Major
                        Found in trac/loader.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language