-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ament_mypy pytest is not working as intended and pass the CI when it shouldn't #509
Comments
After a quick glance at main.py of ament_mypy I noticed the return value of the function is some kind of error code that is unrelated to the amount of error raised by the program. |
I don't think this means that there were errors:
It says "2 errors" because the output has 2 lines: ament_lint/ament_mypy/ament_mypy/main.py Line 108 in f701809
In short, this is working as intended. It probably shouldn't say "N errors" if there were no actual errors found, though. PRs would be welcome! |
Maybe this was a bad example then but I have been running the file https://github.com/ament/ament_lint/blob/rolling/ament_mypy/test/test_mypy.py as a test in my package and it has been passing without issue while the cli command was not. I am still investigating it. Thanks for your quick response tho. |
Can you show an example of a file that |
I will try to provide you a minimal file yes. |
As you mentionned before, the "errors" I was having were misleading and they were more of warnings than proper errors. Hence why the linter would succeed. However I have a hard time seeing the purpose of mypy as an ament_package if it's not to enforce typing. As is, it is checking anything. I don't feel like it is coming with good default like other linters or formatters could have here. Would it make sense to update the default config file of mypy ? |
By default, That being said,
See also the You could enable these options for your own project using a config file. For example: https://github.com/ament/ament_lint/blob/rolling/ament_mypy/ament_mypy/configuration/ament_mypy.ini. You can provide your config file through the |
I agree it would not be best to enforce it at once however this linter is not mandatory and not part of ament_lint_auto either there is no template provided for testing unlike ament_flake8 or ament_pep257. Hence, wouldn't it make sense to set particular defaults for ament_mypy that could enforce typing over ros packages ? If users wants to have mypy default linting behavior then they may as well use their own mypy test. |
Or you could flip it and say that users wanting to force typing annotations should just set the necessary config options. Let's see what others think. Since |
I've tried to make colcon test fail for ament_mypy to confirm my doubt.
In order to do so, I removed every typing annotation in the ament_mypy/ament_mypy/main.py
After, I on the cli
ament_mypy
and this error prompts :There, we expect colcon tests to fail with the same behavior and raising 2 errors but if you run
colcon test --event-handlers console_direct+ --packages-select ament_mypy
the following output (please ignore flake8 errors) :The text was updated successfully, but these errors were encountered: