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 pre-commit cli #1914

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Add pre-commit cli #1914

merged 3 commits into from
Feb 19, 2024

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Feb 19, 2024

This PR adds the pre-commit cli to the repo so that the pre-commit will be run on pull requests and commits.

Reference: #1911

pip install pre-commit
pre-commit install
pre-commit run --all-files

@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

@slowy07 It only took 4.7 seconds to run the pre-commit. This is so much faster than GitHub Actions! Thank you.

https://results.pre-commit.ci/run/github/245837930/1708352021.a_tx5YhiREKyiGb9poDbWQ
image

Copy link

github-actions bot commented Feb 19, 2024

@github-actions github-actions bot temporarily deployed to pull request February 19, 2024 14:21 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 19, 2024 14:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 19, 2024 14:57 Inactive
@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

I have removed codespell from GitHub Actions and added check-large-files and black formatting for pre-commit.

@giswqs giswqs merged commit 13f9ca9 into master Feb 19, 2024
15 checks passed
@giswqs giswqs deleted the pre-commit branch February 19, 2024 15:04
@slowy07
Copy link
Collaborator

slowy07 commented Feb 19, 2024

sir @giswqs , i suggest for fomatter use ruff-formatter, cause is more advance and more usefull and faster than black formatter, cause the ruff based on rust which is extremly fast and more configureable

about that, i can do that by submit new pull request for linter and formatter

@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

@slowy07 It seems ruff supports Jupyter notebook as well. That's great.

https://docs.astral.sh/ruff/faq/#does-ruff-support-jupyter-notebooks

@slowy07
Copy link
Collaborator

slowy07 commented Feb 19, 2024

yes sir @giswqs , and for this one, i think mybe are best choice for replacing black formatter

@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

Ha, ruff detects 429 errors that need to be fixed. This might take sometime. Wish I had stared using ruff long time ago to avoid accumulating so many errors.

image

@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

Adding notebook checking found 830 errors. This will take a while to resolve. Will work on it when I have time.

https://github.com/astral-sh/ruff-pre-commit

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.2.2
  hooks:
    # Run the linter.
    - id: ruff
      types_or: [ python, pyi, jupyter ]
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format
      types_or: [ python, pyi, jupyter ]

image

@slowy07
Copy link
Collaborator

slowy07 commented Feb 19, 2024

we can create a configuration for passing or just ignore that error cause the ruff issue with toml configuration sir @giswqs if you want sir

reference: https://docs.astral.sh/ruff/settings/#lint_extend-unsafe-fixes

@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

Good to know that there is an option to ignore certain error types.

I notice some auto fixes by ruff are incorrect. Need to look into it.

image

@slowy07
Copy link
Collaborator

slowy07 commented Feb 19, 2024

ouch, mybe its cause --fix parameter was generate the auto fixing that are mybe not recommended for geemap project sir

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.

2 participants