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

Issue 0093 add lint at the actions #129

Merged
merged 3 commits into from
Oct 21, 2024
Merged

Conversation

Olender
Copy link
Collaborator

@Olender Olender commented Oct 17, 2024

Description

This PR addresses Issue #93 by adding a linting step to the GitHub Actions workflow to ensure code quality and maintain consistency.

Changes Made

  1. GitHub Actions Configuration (lint.yml):

    • Added a new workflow named "Run lint."
    • Configured the workflow to trigger on:
      • Push events to the master branch.
      • Pull requests.
  2. Makefile Adjustments:

    • Added a format target to format the codebase using autopep8 with setup.cfg as the configuration file.
    • Added a lint target to run flake8 on setup.py, spyro/, and test/*.py.
  3. Codebase Formatting:

    • Various files have been formatted according to the linting rules defined.

Additional Notes

  • Developers should run make lint locally to catch issues before pushing to reduce CI errors.
  • The formatting step (make format) ensures code consistency based on the settings defined in setup.cfg.

@Olender Olender requested a review from SouzaEM October 17, 2024 16:38
@Olender Olender linked an issue Oct 17, 2024 that may be closed by this pull request
@Olender Olender requested a review from Ig-dolci October 17, 2024 16:41
@Olender
Copy link
Collaborator Author

Olender commented Oct 17, 2024

I based the flake8 parameters and the lint.yml file configuration on the ones used by the Firedrake project (see Firedrake's setup.cfg for reference).

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 87.12871% with 13 lines in your changes missing coverage. Please review.

Project coverage is 84.23%. Comparing base (74bafaa) to head (9702d81).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
spyro/solvers/elastic_wave/isotropic_wave.py 57.14% 3 Missing ⚠️
spyro/meshing/meshing_functions.py 92.30% 2 Missing ⚠️
spyro/solvers/backward_time_integration.py 33.33% 2 Missing ⚠️
spyro/tools/input_models.py 33.33% 2 Missing ⚠️
spyro/receivers/changing_coordinates.py 92.85% 1 Missing ⚠️
spyro/solvers/elastic_wave/forms.py 0.00% 1 Missing ⚠️
spyro/solvers/inversion.py 75.00% 1 Missing ⚠️
spyro/solvers/wave.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #129      +/-   ##
==========================================
- Coverage   84.27%   84.23%   -0.05%     
==========================================
  Files          56       56              
  Lines        3733     3729       -4     
==========================================
- Hits         3146     3141       -5     
- Misses        587      588       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -763,4 +763,4 @@ def change_to_reference_hexa(p, cell_vertices):
# pny = px * a21 + py * a22 + pz * a23 + a24
# pnz = px * a31 + py * a32 + pz * a33 + a34

return (pnx, pny, pnz)
# return (pnx, pny, pnz)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here I think that removing the big block of comments is more appropriate to make the code easier to navigate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have temporarily removed this section in the latest commit. However, I plan on adding an improved version if we ever work with hexahedrals not based on extruded meshes. Thanks for the suggestion!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. In this case you could have left the comment, but the flag that you added is even better.

Copy link
Collaborator

@SouzaEM SouzaEM left a comment

Choose a reason for hiding this comment

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

Great work setting up the linter in the CI system! My only recommendation is to avoid big blocks of comments in the future. As the code is under version control, it is always possible to check previous implementations without leaving them commented.

@Olender Olender merged commit a701161 into main Oct 21, 2024
5 checks passed
@Olender Olender deleted the issue_0093-add-lint-at-the-actions branch October 21, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add lint at the actions
2 participants