Skip to content
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

Add flake8 and isort checks on python files in cpp folder #2838

Merged
merged 5 commits into from
Oct 30, 2023

Conversation

francesco-ballarin
Copy link
Member

There are some python files in the cpp folder, but they were not passed through flake8 or isort on CI. For the time being there is no point in running mypy on them because ufl is not typed.

@francesco-ballarin francesco-ballarin added the housekeeping Tidying and style improvements label Oct 30, 2023
cpp/.flake8 Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this file to the top level directory and remove python/.flake8?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python/.flake8 is not there yet, it will be once #2707 is merged.

@@ -69,13 +69,21 @@ jobs:
run: pip3 install matplotlib
- name: Flake8 checks
run: |
cd cpp/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just do python3 -m flake8 cpp/?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends: do you want cpp/doc/source/conf.py to be tested too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a vague recollection that the order of the imports in cpp/doc/source/conf.py is important.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if that is a yes or a no to my question 😄

  • if you want cpp/doc/source/conf.py to be tested, then we could move to python3 -m flake8 cpp/, but then it stands to reason that python/doc/source/conf.py should be tested too, and thus we should try to move to python3 -m flake8 python/ too.
  • if you do not want cpp/doc/source/conf.py to be tested, then we cannot just do python3 -m flake8 cpp/.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answer is do not use isort on cpp/doc/source/conf.py without testing.

@garth-wells garth-wells added this pull request to the merge queue Oct 30, 2023
Merged via the queue into main with commit 20a45a9 Oct 30, 2023
20 checks passed
@garth-wells garth-wells deleted the francesco/cpp-flake8 branch October 30, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Tidying and style improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants