Files @ 4bf9d7f18253
Branch filter:

Location: kallithea/scripts/pyflakes

mads
diff: fix ignorews/context link to use the right target as anchor

The value in url_fid might not be a valid anchor.

For changesets, url_fid would be like 'C--9c390eb52cd6' even though the actual
target included the changeset hash and were like 'C-1536d03b4869-9c390eb52cd6'.

For pullrequests and compare, it wouldn't link to anything at all, even though
there was a target like 'C--56535da5df40'.

Instead, pass id_fid as anchor value as a separate argument. That one is a
valid anchor.
#!/usr/bin/env python3
"""
pyflakes with filter configuration for Kallithea.
Inspired by pyflakes/api.py and flake8/plugins/pyflakes.py .
"""

import sys

import pyflakes.api
import pyflakes.messages


class Reporter:

    warned = False

    def flake(self, warning):
        # ignore known warnings
        if isinstance(warning, pyflakes.messages.UnusedVariable):
            return
        if warning.filename == 'kallithea/bin/kallithea_cli_ishell.py':
            if isinstance(warning, pyflakes.messages.ImportStarUsed) and warning.message_args == ('kallithea.model.db',):
                return
            if isinstance(warning, pyflakes.messages.UnusedImport) and warning.message_args == ('kallithea.model.db.*',):
                return

        print('%s:%s %s   [%s %s]' % (warning.filename, warning.lineno, warning.message % warning.message_args, type(warning).__name__, warning.message_args))
        self.warned = True

    def unexpectedError(self, filename, msg):
        print('Unexpected error for %s: %s' % (filename, msg))


reporter = Reporter()

for filename in sorted(set(sys.argv[1:])):
    pyflakes.api.checkPath(filename, reporter=reporter)
if reporter.warned:
    raise SystemExit(1)