Files
@ 33a57f96c5e0
Branch filter:
Location: kallithea/scripts/pyflakes - annotation
33a57f96c5e0
1.2 KiB
text/plain
diff: fix width of line number columns
Column widths did in some cases break with 32757d5e9d0b. The markup was too
magic to find and fix the exact root cause, but we fix it by refactoring to a
slightly different approach:
Use fixed table-layout to be able to control columns width from the first row,
without too much auto sizing.
Instead of using padding, put the line number in a centered block-inline with
right-align and min-width. The numbers will thus generally be right aligned,
but will expand to use less margin for big line numbers.
Column widths did in some cases break with 32757d5e9d0b. The markup was too
magic to find and fix the exact root cause, but we fix it by refactoring to a
slightly different approach:
Use fixed table-layout to be able to control columns width from the first row,
without too much auto sizing.
Instead of using padding, put the line number in a centered block-inline with
right-align and min-width. The numbers will thus generally be right aligned,
but will expand to use less margin for big line numbers.
51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 abb83e4edfd9 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 abb83e4edfd9 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 51af7c12ffb1 | #!/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)
|