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 automated style/linting checks with Ruff #138

Merged

Conversation

RupeshMangalam21
Copy link
Contributor

@RupeshMangalam21 RupeshMangalam21 commented Jan 22, 2025

Pull Request

Description

Added GitHub Actions workflow for automated code style and linting checks using Ruff.

This PR implements automated style/linting checks which was requested in #28. The implementation includes:

  • Added a new GitHub Actions workflow that runs Ruff checks with proper GitHub output formatting
  • Updated the existing ruff.toml configuration to use the newer recommended structure with [lint] section
  • Fixed deprecation warnings in the configuration
  • Runs automated checks on all pushes
  • Helps maintain consistent code quality across contributions

Main changes:

  1. Added .github/workflows/lint.yml:
    • Uses Python 3.11 and latest GitHub Actions
    • Configured for both linting and formatting checks
    • Set up for automatic inline annotations in PRs
  2. Updated ruff.toml:
    • Moved linting settings under proper [lint] section
    • Removed deprecated configurations
    • Added GitHub-specific output formatting
    • Maintained existing rules and exclusions

Fixes #28

How Has This Been Tested?

  • Yes
  • Tested the workflow locally using ruff check . and ruff format --check .
  • Verified the GitHub Actions configuration using act
  • Confirmed all deprecation warnings are resolved
  • Tested with sample code changes to ensure linting rules are properly enforced

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes
    (Not applicable as this change only affects development tooling)

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (workflow and configuration files are self-documenting)
  • I have added tests that prove my fix is effective or that my feature works (workflow will test itself when merged)
  • I have checked my code and corrected any misspellings

@RupeshMangalam21
Copy link
Contributor Author

RupeshMangalam21 commented Jan 22, 2025

Hi, @peterdudfield @Sukh-P After Implementing the linting check, we have encountered several linting errors across the repository. Shall i create new issues to resolve them categorically?

RupeshMangalam21

This comment was marked as off-topic.

@peterdudfield
Copy link
Contributor

Thanks @RupeshMangalam21

My vote would be to

  1. Merge this
  2. create a separate issue to fix linting

@Sukh-P @dfulu you happy with adding this style of linting?

@RupeshMangalam21
Copy link
Contributor Author

RupeshMangalam21 commented Feb 1, 2025

@peterdudfield Are we okay to merge this? I will create a new issue to resolve linting after merging.

@peterdudfield
Copy link
Contributor

Thanks for this, im just asking the team about this, as it will effect a few things.
Ill let @Sukh-P @AUdaltsova and @dfulu comment

@Sukh-P
Copy link
Member

Sukh-P commented Feb 3, 2025

This LGTM, sounds like a good plan to raise a PR after this to apply the linting to the codebase

@peterdudfield peterdudfield merged commit e05d96b into openclimatefix:main Feb 7, 2025
3 checks passed
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.

Consider adding automated style/linting checks
3 participants