-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ruff config file #758
Comments
If you can find a way to configure pre-commit/ruff to do this automatically on PRs without adding configuration files at the root, I would accept it. This means no |
You mean only Sounds suspiciously like a challenge 🤔. |
This is for anyone like me who forgets to apply CLI command to format the code. Since the CLI command is the source of truth, one can force pre-commit to run the CLI command instead of hooks. repos:
# default hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
# Ruff
- repo: local
hooks:
- id: ruff-CLI
name: ruff-CLI
entry: bash -c "ruff check * --select E,W,F,S --extend-select C4,SIM,RET,PT,I001,ANN001,ANN201,ANN205,ANN206,ARG001 --ignore E501,E731,S108,S101,S113,S603,PT007,S310,E402,PT004,C408 --per-file-ignores "*/**/__init__.py":I001,"*/**/__init__.py":F401,"tests/*":ANN,"*/**/unsloth/kernels/*":ALL --line-length 120 --target-version py38 --fix-only"
language: system
pass_filenames: false
# Black
- repo: local
hooks:
- id: black-CLI
name: black-CLI
entry: bash -c "black -l120 -C --preview --target-version py38 config_hub eval extensions litgpt tests --exclude unsloth/kernels"
language: system
pass_filenames: false
# Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint-fix
args:
- --disable
- MD013 # line-length
- MD033 # no-inline-html Another way of doing via GitHub Actions is described in the #765. |
Hi there 👋
Core maintainer of the repo decided for simplicity to not have a linter config, so every now and then something like this CLI command is applyed:
If someone wants to apply changes inside, let's say VSCode, then this config should match the CLI command above:
Just put it inside
ruff.toml
file and don't forget to add it to global .gitignore file.Important
Sometimes Ruff/Black extensions for VSCode have a different view on how to apply code style changes in comparison to CLI command.
Remember that CLI command always supersedes VSCode extension!
The text was updated successfully, but these errors were encountered: