ament / ament/ament_lint

ament_mypy: Exclude does not work as described and file discovery handling differs to mypy

Offen
#519 2 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @sloretz Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
50
Forks
129
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
3

Beschreibung

Currently, ament_mypy passes all files explicitly to mypy. There are a few issues with this approach.

First of all, there was #516 until recently (it is still present in jazzy etc.). The logic from #516 is already present in mypy if we pass it a directory, but ament_mypy passes all files individually, because some might be in a folder that is flagged with AMENT_IGNORE and need to be removed. Adding all files individually also disables the exclude feature in the mypy.ini. This is especially relevant since the ament_mypy exclude feature does not really work. Contrary to its help page, only whole directories can be excluded.

My suggestion would be to just pass the given path(s) to mypy without extracting any filenames. The AMENT_IGNORE can be handled by appending these directories to the native exclude parameter of mypy. Similarly, I would just pass the exclude parameter of ament_mypy through to mypy.

This would enable the usage of excludes in the .ini, excludes of files, the removal of the stub priority logic and filename discovery. In the end it is very confusing if e.g. the exclude doesn't work like it's described in the mypy docs.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.