edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

Function display_html has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def display_html(self, req, query):
        # The most recent query is stored in the user session;
        orig_list = None
        orig_time = datetime_now(utc)
        query_time = req.session.as_int('query_time', 0)
Severity: Minor
Found in trac/ticket/query.py - About 1 hr to fix

    Function _insert_ticket_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _insert_ticket_data(self, req, ticket, data, author_id, field_changes):
            """Insert ticket data into the template `data`"""
            replyto = req.args.get('replyto')
            data['replyto'] = replyto
            data['version'] = ticket.resource.version
    Severity: Minor
    Found in trac/ticket/web_ui.py - About 1 hr to fix

      Function appendBatchListControls has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function appendBatchListControls(td, propertyName, inputName) {
            var modeSelect = createSelect("batchmod_mode_" + propertyName,
                                          batch_list_modes).attr("id", inputName);
            var name1 = "batchmod_primary_" + propertyName;
            var name2 = "batchmod_secondary_" + propertyName;
      Severity: Minor
      Found in trac/htdocs/js/query.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if resource.realm == self.changeset_realm:
                    parent = resource.parent
                    return href.changeset(resource.id, parent and parent.id or None)
                elif resource.realm == self.source_realm:
                    parent = resource.parent
        Severity: Major
        Found in trac/versioncontrol/api.py - About 1 hr to fix

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

              def _from_database(self, id, sid, authenticated, distributor, format,
          Severity: Major
          Found in trac/notification/model.py - About 1 hr to fix

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

                def __init__(self, section, name, interface, default=None,
            Severity: Major
            Found in trac/config.py - About 1 hr to fix

              Function init_db has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def init_db(self, path, schema=None, log=None, user=None, password=None,
              Severity: Major
              Found in trac/db/postgres_backend.py - About 1 hr to fix

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

                    def __init__(self, section, name, default=None, sep=',', keep_empty=False,
                Severity: Major
                Found in trac/config.py - About 1 hr to fix

                  Function init_db has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def init_db(self, path, schema=None, log=None, user=None, password=None,
                  Severity: Major
                  Found in trac/db/mysql_backend.py - About 1 hr to fix

                    Function preview_data has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def preview_data(self, context, content, length, mimetype, filename,
                    Severity: Major
                    Found in trac/mimeview/api.py - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if not ticket.exists and 'owner' not in updated:
                                  updated['owner'] = self._sub_owner_keyword(ticket['owner'], ticket)
                              elif ticket['status'] == 'new' and \
                                      'component' in ticket.values and \
                                      'component' in ticket._old and \
                      Severity: Major
                      Found in trac/ticket/default_workflow.py - About 1 hr to fix

                        Function get_diff_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_diff_options(req):
                            """Retrieve user preferences for diffs.
                        
                            :return: ``(style, options, data)`` triple.
                        
                        
                        Severity: Minor
                        Found in trac/versioncontrol/diff.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 get_changes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_changes(repos, revs, log=None):
                            changes = {}
                            for rev in revs:
                                if rev in changes:
                                    continue
                        Severity: Minor
                        Found in trac/versioncontrol/web_ui/util.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 get_link_resolvers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def get_link_resolvers(self):
                                def link_resolver(formatter, ns, target, label):
                                    path, query, fragment = split_url_into_path_query_fragment(target)
                                    precision = None
                                    time = path.split("T", 1)
                        Severity: Minor
                        Found in trac/timeline/web_ui.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 _get_authz_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _get_authz_info(self):
                                if not self.authz_file:
                                    self.log.error("The [svn] authz_file configuration option in "
                                                   "trac.ini is empty or not defined")
                                    raise ConfigurationError()
                        Severity: Minor
                        Found in trac/versioncontrol/svn_authz.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 expand_macro has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def expand_macro(self, formatter, name, content):
                                args, kwargs = parse_args(content)
                                format = kwargs.get('format', 'compact')
                                glob = kwargs.get('glob', '*')
                                order = kwargs.get('order')
                        Severity: Minor
                        Found in trac/versioncontrol/web_ui/browser.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 _precise_now_windows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _precise_now_windows():
                                """Provide high-resolution system time if Windows 8+ and Windows
                                Server 2012+.
                                """
                                import ctypes
                        Severity: Minor
                        Found in trac/util/datefmt.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 _prepare_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _prepare_rules(self):
                                from trac.wiki.api import WikiSystem
                                if not self._compiled_rules:
                                    helpers = []
                                    handlers = {}
                        Severity: Minor
                        Found in trac/wiki/parser.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 _do_dump has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _do_dump(self, directory, *names):
                                if not names:
                                    names = ['*']
                                pages = self.get_wiki_list()
                                if not os.path.isdir(directory):
                        Severity: Minor
                        Found in trac/wiki/admin.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 url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def url(self, ns, target):
                                """Return `(url, title)` for the given InterWiki `ns`.
                        
                                Expand the colon-separated `target` arguments.
                                """
                        Severity: Minor
                        Found in trac/wiki/interwiki.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

                        Severity
                        Category
                        Status
                        Source
                        Language