-
Notifications
You must be signed in to change notification settings - Fork 1
/
.relint.yml
63 lines (52 loc) · 3.1 KB
/
.relint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# From https://github.com/sagemath/sage-patchbot/blob/master/sage_patchbot/plugins.py
# (simple pattern-exclusion plugins)
# The patterns have been edited slightly because relint tests the regexp to the whole file,
# whereas the patchbots tests them line by line.
- name: 'python3: Python3 incompatible code'
hint: |
# ifilter, imap, izip # __metaclass__
# update raise statements # except Exception, var
# six is no longer allowed
pattern: '(import.*[, ]ifilter|import.*[, ]imap|import.*[, ]izip|^\s*raise\s*[A-Za-z]*Error\s*,|__metaclass__|except\s*[A-Za-z]\s*,|import six|from six import)'
filePattern: .*[.](py|pyx|rst)
- name: 'foreign_latex: foreign commands in LaTeX'
hint: |
use equivalent LaTeX commands instead of plain TeX commands such as \over, \choose, etc.
pattern: '(\\choose|\\atop|\\above|\\overwithdelims|\\atopwithdelims|\\abovewithdelims)'
# \over appears in bad latex code coming from Fricas and Maxima
- name: 'blocks: wrong syntax for blocks (INPUT, OUTPUT, EXAMPLES, NOTE, etc.)'
hint: |
# the correct syntax is .. SEEALSO::
# TESTS and EXAMPLES should be plural, NOTE singular
# no :: after INPUT, OUTPUT, REFERENCE blocks
# no " :" at the end of lines
pattern: '(\.\.SEE|SEE ALSO|SEEALSO:($|[^:])|^\s*TEST:|^\s*EXAMPLE:|^\s*NOTES:|^\s*[A-Z]*PUT::|^\s*REFERENCES?::$)'
- name: 'trac_links: bad trac link'
hint: |
the correct syntax for trac roles is :trac:`NUMBER`, note the initial colon
pattern: '[^:]trac:`[0-9]'
- name: 'triple_colon: triple colon (::: or : ::)'
pattern: ':[ ]*::$'
# From various typo tickets
# https://github.com/sagemath/sage/issues/30585
- name: 'typo "homogenous" detected'
hint: |
in mathematics it should be "homogeneous"
pattern: 'homogenous'
# Modularization anti-patterns
- name: 'namespace_pkg_all_import: import from .all of a namespace package'
hint: |
Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit
namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import,
or use 'sage --fiximports' to fix automatically in the source file.
# Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py
pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|symbolic|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import'
# imports from .all are allowed in all.py; also allow in some modules that need sage.all
filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$'
# Magic doctest comments
- name: 'multiline_doctest_comment: magic comment on a continuation line'
hint: |
magic doctest comments should appear on the "sage:" line, not "....:" lines
# see optional_regex in src/sage/doctest/parsing.py
# "indirect doctest" is from src/bin/sage-coverage
pattern: '^[ ]*[.][.][.][.]:.*#.*(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug|optional|indirect doctest)'