Skip to content

Commit

Permalink
Trac #32879: src/tox.ini: Check that there are no .all imports from n…
Browse files Browse the repository at this point in the history
…amespace packages

We add the following test to the `relint` linting workflow:
Library code should not import from `sage.PAC.KAGE.all` when
`sage.PAC.KAGE` is a namespace package (see #32501)

URL: https://trac.sagemath.org/32879
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Dec 16, 2021
2 parents 90aff98 + 928561e commit 8f1a34e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/.relint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@
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
Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import.
pattern: 'from\s+sage[.](categories|misc|rings|combinat|graphs|interfaces|libs)[.]all\s+import'
filePattern: '.*[.](py|pyx)$'

0 comments on commit 8f1a34e

Please sign in to comment.