edgewall/trac

View on GitHub

Showing 1,372 of 1,372 total issues

Avoid deeply nested control flow statements.
Open

                    if 'svn:special' in props and data.startswith('link '):
                        data = data[5:]
                        kwargs['symlink'] = True
                    if 'svn:executable' in props:
Severity: Major
Found in trac/versioncontrol/web_ui/util.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for chg in c.get_changes():
                                resource = c.resource.parent.child('source',
                                                                   chg[0] or '/',
                                                                   r.id)
                                if 'FILE_VIEW' not in context.perm(resource):
    Severity: Major
    Found in trac/versioncontrol/web_ui/changeset.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if ($('em', cells[3]).length) newTag = "\\";
      Severity: Major
      Found in trac/htdocs/js/diff.js - About 45 mins to fix

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

        def get_filtered_hunks(fromlines, tolines, context=None,
        Severity: Minor
        Found in trac/versioncontrol/diff.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if prev_rev:
                                      prev_href = req.href.changeset(prev_rev, reponame,
                                                                     prev_path)
                              else:
          Severity: Major
          Found in trac/versioncontrol/web_ui/changeset.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if processor != 'comment':
                                        buf.write(' [...]\n')
                                    processor = None
            Severity: Major
            Found in trac/wiki/formatter.py - About 45 mins to fix

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

                  def render_timeline_event(self, context, field, event):
                      wiki_page, comment = event[3]
                      if field == 'url':
                          return context.href.wiki(wiki_page.id, version=wiki_page.version)
                      elif field == 'title':
              Severity: Minor
              Found in trac/wiki/web_ui.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 load_pages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def load_pages(self, dir, ignore=[], create_only=[], replace=False):
                      loaded = []
                      with self.env.db_transaction:
                          for page in sorted(os.listdir(dir)):
                              if page in ignore:
              Severity: Minor
              Found in trac/wiki/admin.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 _validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _validate(self, req, page):
                      valid = True
              
                      # Validate page size
                      if len(req.args.get('text', '')) > self.max_size:
              Severity: Minor
              Found in trac/wiki/web_ui.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

                                      for chg in c.get_changes():
                                          resource = c.resource.parent.child('source',
                                                                             chg[0] or '/',
                                                                             r.id)
                                          if 'FILE_VIEW' not in context.perm(resource):
              Severity: Major
              Found in trac/versioncontrol/web_ui/changeset.py - About 45 mins to fix

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

                    def _next_prev_rev(self, direction, rev, path=''):
                        srev = self.db_rev(rev)
                        with self.env.db_query as db:
                            # the changeset revs are sequence of ints:
                            sql = "SELECT %(aggr)s(rev) FROM %(tab)s " \
                Severity: Minor
                Found in trac/versioncontrol/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

                Avoid deeply nested control flow statements.
                Open

                                            if isinstance(elt, tuple):
                                                subkey, subnodes = elt
                                                elt = (key + subkey, subnodes)
                                            groups.append(elt)
                Severity: Major
                Found in trac/wiki/macros.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if m:
                                              val = m.group(1)
                                          attr[str(key)] = val  # will be used as a __call__ kwd
                  Severity: Major
                  Found in trac/wiki/macros.py - About 45 mins to fix

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

                        def get_timeline_events(self, req, start, stop, filters):
                            if 'wiki' in filters:
                                wiki_realm = Resource(self.realm)
                                for ts, name, comment, author, version in self.env.db_query("""
                                        SELECT time, name, comment, author, version FROM wiki
                    Severity: Minor
                    Found in trac/wiki/web_ui.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 rename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def rename(self, new_name):
                            """Rename wiki page in-place, keeping the history intact.
                            Renaming a page this way will eventually leave dangling references
                            to the old page - which literally doesn't exist anymore.
                            """
                    Severity: Minor
                    Found in trac/wiki/model.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 _bolditalic_formatter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _bolditalic_formatter(self, match, fullmatch):
                            if self._list_stack and not self.in_list_item:
                                self.close_list()
                    
                            bold_open = self.tag_open_p('MM_BOLD')
                    Severity: Minor
                    Found in trac/wiki/formatter.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 _i18n_parse_date_0 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _i18n_parse_date_0(text, order, regexp, period_names, month_names, tzinfo):
                    Severity: Minor
                    Found in trac/util/datefmt.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if old_offset != depth: # adjust last depth
                                                  self._list_stack[-1] = (old_type, depth)
                                              close_item()
                      Severity: Major
                      Found in trac/wiki/formatter.py - About 45 mins to fix

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

                            def check_permission(self, action, username, resource, perm):
                                if resource and resource.realm == self.realm:
                                    if action == 'WIKI_CHANGE_READONLY':
                                        return 'WIKI_ADMIN' in perm(resource)
                                    if action in ('WIKI_DELETE', 'WIKI_MODIFY', 'WIKI_RENAME'):
                        Severity: Minor
                        Found in trac/wiki/web_ui.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 uid:
                                                        # uid can be seen in multiple repositories
                                                        if uid in uids_seen:
                                                            uids_seen[uid].append(repos.reponame)
                                                            continue  # already viewable, just append
                        Severity: Major
                        Found in trac/versioncontrol/web_ui/changeset.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language