Compare commits
436 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9aeda5d1f4 | ||
![]() |
d19233b897 | ||
![]() |
76e47323a8 | ||
![]() |
12753357c0 | ||
![]() |
39f54b73c7 | ||
![]() |
24e02b24b8 | ||
![]() |
f0fe93c067 | ||
![]() |
e84319e627 | ||
![]() |
d119aaff68 | ||
![]() |
8304991d8f | ||
![]() |
9719235819 | ||
![]() |
716f3372a2 | ||
![]() |
25a8c8da6c | ||
![]() |
03d1860500 | ||
![]() |
87c3371eb1 | ||
![]() |
99abe27a5a | ||
![]() |
2b7436a2b1 | ||
![]() |
41d2daf392 | ||
![]() |
2c8dce6094 | ||
![]() |
f78b4d43a4 | ||
![]() |
efa716b1aa | ||
![]() |
895ebb3898 | ||
![]() |
d7f0995508 | ||
![]() |
871f3bcae4 | ||
![]() |
36b36942c5 | ||
![]() |
73413df07b | ||
![]() |
18ba2d02dc | ||
![]() |
8d1fdcef55 | ||
![]() |
89c421dff2 | ||
![]() |
751b8b57ba | ||
![]() |
6299d2ca23 | ||
![]() |
f0b5944bef | ||
![]() |
fc6ef5d0dd | ||
![]() |
8b76f04e7e | ||
![]() |
859e42ab7d | ||
![]() |
0710b94280 | ||
![]() |
cafecb2f68 | ||
![]() |
6a19e69c83 | ||
![]() |
52c175db9e | ||
![]() |
4edcbde74a | ||
![]() |
8983acb92e | ||
![]() |
75b98813cf | ||
![]() |
46cdcac1de | ||
![]() |
cc915bbf18 | ||
![]() |
9f089bd3b7 | ||
![]() |
ef9b09598d | ||
![]() |
79f422bd92 | ||
![]() |
03d82ba032 | ||
![]() |
f1ebc5730d | ||
![]() |
24d039e647 | ||
![]() |
8b5112a3b2 | ||
![]() |
20d9ac3f11 | ||
![]() |
718fbf5fa5 | ||
![]() |
ac97362543 | ||
![]() |
89fdf53fde | ||
![]() |
1ee2e38793 | ||
![]() |
cbaa26132c | ||
![]() |
34e6222063 | ||
![]() |
47533c0f59 | ||
![]() |
f6793c73d5 | ||
![]() |
987f9d7d01 | ||
![]() |
1dc9eb131c | ||
![]() |
a5c7353d59 | ||
![]() |
02609a0003 | ||
![]() |
99e5311c54 | ||
![]() |
f428577948 | ||
![]() |
06206113ba | ||
![]() |
fc609d3ce5 | ||
![]() |
f8a3f8c471 | ||
![]() |
5559d0350d | ||
![]() |
596470fba2 | ||
![]() |
21d9bff1d6 | ||
![]() |
2ca3d774ce | ||
![]() |
e76e45000a | ||
![]() |
c0bff48397 | ||
![]() |
1e9839fabf | ||
![]() |
2b6485a44b | ||
![]() |
4025f7f381 | ||
![]() |
0ccbb5b794 | ||
![]() |
53e3b33bd4 | ||
![]() |
6e85b5cd1f | ||
![]() |
1986670a8c | ||
![]() |
c22645f6b4 | ||
![]() |
522df5be28 | ||
![]() |
0431f238e5 | ||
![]() |
0dd3437ad9 | ||
![]() |
cc575a3e58 | ||
![]() |
1bd02b3569 | ||
![]() |
ae24203671 | ||
![]() |
bbaf495f2d | ||
![]() |
1d42195ebc | ||
![]() |
abe8946973 | ||
![]() |
0511de30af | ||
![]() |
fbe77be689 | ||
![]() |
10d650cb4b | ||
![]() |
7bcc70ca47 | ||
![]() |
d7c4946c7c | ||
![]() |
a6ff26895e | ||
![]() |
75d1925b52 | ||
![]() |
3d440bd6c6 | ||
![]() |
f1ef5ac6b5 | ||
![]() |
3dacd83b1e | ||
![]() |
76536a3fe1 | ||
![]() |
8a43105c59 | ||
![]() |
00ca9a349a | ||
![]() |
51ae37a780 | ||
![]() |
382100c524 | ||
![]() |
42f98979db | ||
![]() |
ba4269e9c6 | ||
![]() |
146c621c9f | ||
![]() |
e5fa9aeaf1 | ||
![]() |
e6d90feffc | ||
![]() |
6fcbf19c7c | ||
![]() |
1b38aa0ddb | ||
![]() |
55147f81dc | ||
![]() |
0b90c17c1a | ||
![]() |
277125742a | ||
![]() |
5accf96811 | ||
![]() |
25507cf2f9 | ||
![]() |
caa92debff | ||
![]() |
9845d84394 | ||
![]() |
36c161038e | ||
![]() |
2f86fcef83 | ||
![]() |
36d09b6e15 | ||
![]() |
3a6d4075bf | ||
![]() |
47023bed2b | ||
![]() |
294ccdf82a | ||
![]() |
cf997e2039 | ||
![]() |
21ca293cbc | ||
![]() |
b9787ef94f | ||
![]() |
9808e002ad | ||
![]() |
b9a5dc23ed | ||
![]() |
a5b0cb4741 | ||
![]() |
24ae3f3414 | ||
![]() |
6c0ceaccff | ||
![]() |
ade96e24aa | ||
![]() |
2cdabd9873 | ||
![]() |
2b844a9c8b | ||
![]() |
5997ecd133 | ||
![]() |
1c8d30bd03 | ||
![]() |
c16fde55ad | ||
![]() |
b09212dc36 | ||
![]() |
da18a96f5b | ||
![]() |
e2a2094fd1 | ||
![]() |
bbb75905dc | ||
![]() |
d87e2b0f73 | ||
![]() |
89791c7aee | ||
![]() |
a140cebced | ||
![]() |
95f113d634 | ||
![]() |
b0e3596b76 | ||
![]() |
9f69b173ce | ||
![]() |
bd40d9bdd1 | ||
![]() |
1ac904bbe4 | ||
![]() |
770e3ceae2 | ||
![]() |
bfba38bcf2 | ||
![]() |
17c401c7cc | ||
![]() |
026315ed3d | ||
![]() |
ba0094c234 | ||
![]() |
42ad6adf01 | ||
![]() |
ec6bc276b8 | ||
![]() |
0afdbd1c79 | ||
![]() |
8698dbc7cd | ||
![]() |
ec8193bd58 | ||
![]() |
5bd2636577 | ||
![]() |
d2acb90115 | ||
![]() |
fdea37e497 | ||
![]() |
3da5cf99ae | ||
![]() |
56d5440fd2 | ||
![]() |
14b59ee3b1 | ||
![]() |
b05164188e | ||
![]() |
4520e4045e | ||
![]() |
7c149cf0b9 | ||
![]() |
fbc96a6c25 | ||
![]() |
a486fba16b | ||
![]() |
11c1d1d46c | ||
![]() |
8f86941f1e | ||
![]() |
7cdf339482 | ||
![]() |
d121fa5899 | ||
![]() |
26ceedc01e | ||
![]() |
9e466ccca3 | ||
![]() |
aad2f97dee | ||
![]() |
a87a77eb94 | ||
![]() |
2c3a89a6fd | ||
![]() |
343c49ab88 | ||
![]() |
b04e21cf61 | ||
![]() |
bae101822d | ||
![]() |
fb3d722e81 | ||
![]() |
f6346ef27f | ||
![]() |
6a0efc1edf | ||
![]() |
3c6d40da8d | ||
![]() |
13eadaf3e8 | ||
![]() |
05e717e4f6 | ||
![]() |
0f888cd9d4 | ||
![]() |
e812d61e6e | ||
![]() |
69d01574ee | ||
![]() |
8dc355dcbe | ||
![]() |
9db230353b | ||
![]() |
6a0ba18549 | ||
![]() |
c8ba6a0b13 | ||
![]() |
8cddec33c0 | ||
![]() |
c9e6ab0c7a | ||
![]() |
52dd739afa | ||
![]() |
81c9dd5384 | ||
![]() |
c59ff2e43b | ||
![]() |
a794b11a96 | ||
![]() |
8c0354fe90 | ||
![]() |
8a02e520ef | ||
![]() |
2d99f9295f | ||
![]() |
9f84243c82 | ||
![]() |
1591f358dc | ||
![]() |
0a169f3ce7 | ||
![]() |
657c9074f1 | ||
![]() |
9560a1972e | ||
![]() |
90c3bb65f4 | ||
![]() |
a82915bc2d | ||
![]() |
6ba454799f | ||
![]() |
0613495e88 | ||
![]() |
2cdb49b068 | ||
![]() |
edb89ee9e1 | ||
![]() |
0cf5de2c7c | ||
![]() |
94dd638548 | ||
![]() |
b6da66599f | ||
![]() |
29d304ed11 | ||
![]() |
3a2abcf71c | ||
![]() |
aa446bc4da | ||
![]() |
514931592b | ||
![]() |
380e8f2639 | ||
![]() |
88a2db201e | ||
![]() |
99c84d0468 | ||
![]() |
a34d15d78d | ||
![]() |
e360af9e86 | ||
![]() |
6aa52c1faa | ||
![]() |
02ec0f1838 | ||
![]() |
8947c2c0a1 | ||
![]() |
d21ecbf143 | ||
![]() |
b0a6088322 | ||
![]() |
37d0b1fbf6 | ||
![]() |
03f230aa49 | ||
![]() |
1fd18c8bce | ||
![]() |
f4d052ae75 | ||
![]() |
69ca4c697b | ||
![]() |
91ae702800 | ||
![]() |
9a046441a9 | ||
![]() |
e7fe3c1758 | ||
![]() |
b7d7c83e4a | ||
![]() |
379c9c7588 | ||
![]() |
64a5530ea4 | ||
![]() |
17f03398ae | ||
![]() |
4d26077229 | ||
![]() |
29c6a96c28 | ||
![]() |
baa9cad82c | ||
![]() |
fd50e8507a | ||
![]() |
1bf8669d27 | ||
![]() |
f44cdeaacd | ||
![]() |
f8c0ef6663 | ||
![]() |
19210b5d1f | ||
![]() |
d3c4f88721 | ||
![]() |
e48252e706 | ||
![]() |
bebbffd7ed | ||
![]() |
965d6d14cc | ||
![]() |
eb4a22e056 | ||
![]() |
bc91a833b8 | ||
![]() |
c8889c58dc | ||
![]() |
271d0c17b9 | ||
![]() |
23ab53501e | ||
![]() |
7f6683dabc | ||
![]() |
b86f2fab79 | ||
![]() |
4a91fdbcf7 | ||
![]() |
4803a6e6b2 | ||
![]() |
e898edf05c | ||
![]() |
8873376169 | ||
![]() |
7e962894dd | ||
![]() |
9e4bffa3ea | ||
![]() |
99b8051fec | ||
![]() |
3156dc12ae | ||
![]() |
ff2f775ddb | ||
![]() |
a1dd52c75a | ||
![]() |
090282139c | ||
![]() |
cb5287829c | ||
![]() |
456d797579 | ||
![]() |
9566f686f8 | ||
![]() |
648d96030a | ||
![]() |
313c6cdbee | ||
![]() |
380b7871ff | ||
![]() |
6bf258ba87 | ||
![]() |
4147a259e2 | ||
![]() |
f5b1cc9e17 | ||
![]() |
a307d8dccd | ||
![]() |
35274748ff | ||
![]() |
c0f4b19386 | ||
![]() |
4c06a9e520 | ||
![]() |
789b68ca9b | ||
![]() |
59e7afc150 | ||
![]() |
c06205404b | ||
![]() |
8988889210 | ||
![]() |
4b5fb23659 | ||
![]() |
24e3e404f2 | ||
![]() |
d6330564ad | ||
![]() |
9845a553b8 | ||
![]() |
3cb2db2dd8 | ||
![]() |
2f620b6207 | ||
![]() |
5e2d583d78 | ||
![]() |
4253f1f550 | ||
![]() |
39e510b43b | ||
![]() |
3733c4e385 | ||
![]() |
50fd4a42a4 | ||
![]() |
4d2a2fdc41 | ||
![]() |
d0a48c918a | ||
![]() |
affc25d7c4 | ||
![]() |
bb75b59a85 | ||
![]() |
f7845095c6 | ||
![]() |
b3300d9ad0 | ||
![]() |
6e4664a23d | ||
![]() |
6ed527f160 | ||
![]() |
26108c84b0 | ||
![]() |
faab05110a | ||
![]() |
9708a42857 | ||
![]() |
05f8f5d51e | ||
![]() |
9bb1cd1204 | ||
![]() |
6c5009049b | ||
![]() |
253612f324 | ||
![]() |
95e09bbe9b | ||
![]() |
74212953c4 | ||
![]() |
2aa0ce8036 | ||
![]() |
426206004d | ||
![]() |
96c4bb9944 | ||
![]() |
f38ae7c453 | ||
![]() |
029271784f | ||
![]() |
d513ee6d6d | ||
![]() |
362031d79c | ||
![]() |
12f56b078d | ||
![]() |
74f34294f2 | ||
![]() |
4a0046d515 | ||
![]() |
7b467bc74c | ||
![]() |
9ee15be98b | ||
![]() |
08fdeb7351 | ||
![]() |
9a9e64d35c | ||
![]() |
287cdd5a51 | ||
![]() |
14f1fabec9 | ||
![]() |
debf101837 | ||
![]() |
0f3b78adc5 | ||
![]() |
bfbdcab8e8 | ||
![]() |
9c1ac3dcf8 | ||
![]() |
105f96238e | ||
![]() |
3f64776d96 | ||
![]() |
dad4a03885 | ||
![]() |
e61c8f5535 | ||
![]() |
7f2d781c26 | ||
![]() |
96a08db858 | ||
![]() |
4ea05fc4e4 | ||
![]() |
7182becc8d | ||
![]() |
cfc99395a2 | ||
![]() |
f02d9bfe59 | ||
![]() |
5b486f1d38 | ||
![]() |
94ee522cae | ||
![]() |
bb87396b08 | ||
![]() |
a2f1915bd7 | ||
![]() |
b06ea0401b | ||
![]() |
e9fb874d9a | ||
![]() |
7712c96d70 | ||
![]() |
0955a5efcf | ||
![]() |
4f274e6881 | ||
![]() |
58f9bd7a73 | ||
![]() |
e145ea5ac8 | ||
![]() |
9ac07e27c7 | ||
![]() |
c2d999512b | ||
![]() |
5ce8772a2c | ||
![]() |
888bf46a89 | ||
![]() |
9a83de9c14 | ||
![]() |
9690b526dc | ||
![]() |
4824769ace | ||
![]() |
edc552015f | ||
![]() |
04b6e6e82a | ||
![]() |
48af87ed07 | ||
![]() |
c9c9fc5b49 | ||
![]() |
301fe68ff7 | ||
![]() |
1c077b20b0 | ||
![]() |
c3fb7b9694 | ||
![]() |
0584045f9c | ||
![]() |
5759eb92be | ||
![]() |
0489182c46 | ||
![]() |
4ead656ead | ||
![]() |
c51783f66a | ||
![]() |
2fdf355f86 | ||
![]() |
6c21374606 | ||
![]() |
c30c609d90 | ||
![]() |
f3269e9898 | ||
![]() |
e413e40763 | ||
![]() |
aa139ff210 | ||
![]() |
c07fe1867f | ||
![]() |
81501c0b55 | ||
![]() |
9fca8c1ea1 | ||
![]() |
09a34838da | ||
![]() |
7e02bb6e58 | ||
![]() |
635516a879 | ||
![]() |
c7b6469113 | ||
![]() |
b160a560b5 | ||
![]() |
13c2dd3900 | ||
![]() |
d390230cac | ||
![]() |
e7d1200457 | ||
![]() |
f92f874e53 | ||
![]() |
1db6acee43 | ||
![]() |
bcfdc86594 | ||
![]() |
143ae1928b | ||
![]() |
c6a3e65594 | ||
![]() |
b8d8d7c2ed | ||
![]() |
126c3b8643 | ||
![]() |
b7864b9df0 | ||
![]() |
ff61611bc1 | ||
![]() |
ad207b3915 | ||
![]() |
e4989904d6 | ||
![]() |
a7d59f320f | ||
![]() |
51cc73130c | ||
![]() |
0d1691429e | ||
![]() |
392c85ba2f | ||
![]() |
9e0cd11cff | ||
![]() |
790386360b | ||
![]() |
f4c5b6d3d5 | ||
![]() |
c90b3a6f80 | ||
![]() |
e7c156ebd4 | ||
![]() |
ec573b995c | ||
![]() |
5722d4a400 | ||
![]() |
0f5e62fb63 | ||
![]() |
5c0d1109f3 | ||
![]() |
c39effc638 | ||
![]() |
b15e892001 | ||
![]() |
4d7232e4c1 | ||
![]() |
dc0624eeb9 | ||
![]() |
4e8204443b | ||
![]() |
e630a7962f | ||
![]() |
16b6f5863d | ||
![]() |
398cfa101f | ||
![]() |
23f3979865 | ||
![]() |
37297c7d15 | ||
![]() |
03e6e30389 | ||
![]() |
84d3cd7ace |
10
.github/ISSUE_TEMPLATE.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<!--
|
||||
Thank you for taking the time to report an issue! We're glad to have you involved with Ruff.
|
||||
|
||||
If you're filing a bug report, please consider including the following information:
|
||||
|
||||
* A minimal code snippet that reproduces the bug.
|
||||
* The current Ruff settings (any relevant sections from your `pyproject.toml`).
|
||||
* The current Ruff version (`ruff --version`).
|
||||
* A description of your environment (e.g., operating system, Python version, etc.).
|
||||
-->
|
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<!--
|
||||
Thank you for contributing to Ruff! To help us out with reviewing, please consider the following:
|
||||
|
||||
- Does this pull request include a summary of the change? (See below.)
|
||||
- Does this pull request include a descriptive title?
|
||||
- Does this pull request include references to any relevant issues?
|
||||
-->
|
||||
|
||||
## Summary
|
||||
|
||||
<!-- What's the purpose of the change? What does it do, and why? -->
|
||||
|
||||
## Test Plan
|
||||
|
||||
<!-- How was it tested? -->
|
52
.github/workflows/main.yml
vendored
52
.github/workflows/main.yml
vendored
@ -1,27 +1,59 @@
|
||||
name: main
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
- cron: "0 */4 * * *"
|
||||
workflow_dispatch:
|
||||
repository_dispatch:
|
||||
types: [pypi_release]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: main
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- if: ${{ startsWith(github.event_name, 'repository_dispatch') }}
|
||||
run: sleep 30
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: pip install pre-commit-mirror-maker
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: set git config
|
||||
run: |
|
||||
git config user.name 'Github Actions'
|
||||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
|
||||
- run: pre-commit-mirror --language python --package-name ruff --entry ruff --id lint --types python --description "Run ruff to lint Python files." .
|
||||
- run: uv run --no-project mirror.py
|
||||
|
||||
- run: git push origin HEAD:refs/heads/main --tags
|
||||
- name: check for unpushed commits
|
||||
id: check_unpushed
|
||||
run: |
|
||||
UNPUSHED_COMMITS=$(git log origin/main..HEAD)
|
||||
if [ -z "$UNPUSHED_COMMITS" ]; then
|
||||
echo "No unpushed commits found."
|
||||
echo "changes_exist=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Unpushed commits found."
|
||||
echo "changes_exist=true" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: push changes if they exist
|
||||
if: env.changes_exist == 'true'
|
||||
run: |
|
||||
git push origin HEAD:refs/heads/main
|
||||
git push origin HEAD:refs/heads/main --tags
|
||||
|
||||
- name: create release on new tag if new changes exist
|
||||
if: env.changes_exist == 'true'
|
||||
run: |
|
||||
TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
echo $TAG_NAME
|
||||
gh release create "$TAG_NAME" \
|
||||
--title "$TAG_NAME" \
|
||||
--notes "See: https://github.com/astral-sh/ruff/releases/tag/${TAG_NAME/v}" \
|
||||
--latest
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
130
.gitignore
vendored
130
.gitignore
vendored
@ -1,129 +1,3 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
__pycache__
|
||||
*.pyc
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
@ -1,10 +1,33 @@
|
||||
- id: lint
|
||||
name: ruff
|
||||
description: 'Run ruff to lint Python files.'
|
||||
entry: ruff
|
||||
language: python
|
||||
'types': [python]
|
||||
args: []
|
||||
require_serial: false
|
||||
additional_dependencies: []
|
||||
minimum_pre_commit_version: '0'
|
||||
- id: ruff-check
|
||||
name: ruff check
|
||||
description: "Run 'ruff check' for extremely fast Python linting"
|
||||
entry: ruff check --force-exclude
|
||||
language: python
|
||||
types_or: [python, pyi, jupyter]
|
||||
args: []
|
||||
require_serial: true
|
||||
additional_dependencies: []
|
||||
minimum_pre_commit_version: "2.9.2"
|
||||
|
||||
- id: ruff-format
|
||||
name: ruff format
|
||||
description: "Run 'ruff format' for extremely fast Python formatting"
|
||||
entry: ruff format --force-exclude
|
||||
language: python
|
||||
types_or: [python, pyi, jupyter]
|
||||
args: []
|
||||
require_serial: true
|
||||
additional_dependencies: []
|
||||
minimum_pre_commit_version: "2.9.2"
|
||||
|
||||
# Legacy alias
|
||||
- id: ruff
|
||||
name: ruff (legacy alias)
|
||||
description: "Run 'ruff check' for extremely fast Python linting"
|
||||
entry: ruff check --force-exclude
|
||||
language: python
|
||||
types_or: [python, pyi, jupyter]
|
||||
args: []
|
||||
require_serial: true
|
||||
additional_dependencies: []
|
||||
minimum_pre_commit_version: "2.9.2"
|
||||
|
202
LICENSE-APACHE
Normal file
202
LICENSE-APACHE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Charlie Marsh
|
||||
Copyright (c) 2024 Astral Software Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
86
README.md
86
README.md
@ -1,10 +1,90 @@
|
||||
# ruff-pre-commit
|
||||
|
||||
A [pre-commit](https://pre-commit.com/) hook for [ruff](https://github.com/charliermarsh/ruff).
|
||||
[](https://github.com/astral-sh/ruff)
|
||||
[](https://pypi.python.org/pypi/ruff)
|
||||
[](https://pypi.python.org/pypi/ruff)
|
||||
[](https://pypi.python.org/pypi/ruff)
|
||||
[](https://github.com/astral-sh/ruff-pre-commit/actions)
|
||||
|
||||
Distributed as a standalone repository to enable installing ruff via prebuilt wheels from
|
||||
A [pre-commit](https://pre-commit.com/) hook for [Ruff](https://github.com/astral-sh/ruff).
|
||||
|
||||
Distributed as a standalone repository to enable installing Ruff via prebuilt wheels from
|
||||
[PyPI](https://pypi.org/project/ruff/).
|
||||
|
||||
### Using Ruff with pre-commit
|
||||
|
||||
To run Ruff's [linter](https://docs.astral.sh/ruff/linter) and [formatter](https://docs.astral.sh/ruff/formatter)
|
||||
(available as of Ruff v0.0.289) via pre-commit, add the following to your `.pre-commit-config.yaml`:
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.13
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff-check
|
||||
# Run the formatter.
|
||||
- id: ruff-format
|
||||
```
|
||||
|
||||
To enable lint fixes, add the `--fix` argument to the lint hook:
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.13
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff-check
|
||||
args: [ --fix ]
|
||||
# Run the formatter.
|
||||
- id: ruff-format
|
||||
```
|
||||
|
||||
To avoid running on Jupyter Notebooks, remove `jupyter` from the list of allowed filetypes:
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.13
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff-check
|
||||
types_or: [ python, pyi ]
|
||||
args: [ --fix ]
|
||||
# Run the formatter.
|
||||
- id: ruff-format
|
||||
types_or: [ python, pyi ]
|
||||
```
|
||||
|
||||
When running with `--fix`, Ruff's lint hook should be placed _before_ Ruff's formatter hook, and
|
||||
_before_ Black, isort, and other formatting tools, as Ruff's fix behavior can output code changes
|
||||
that require reformatting.
|
||||
|
||||
When running without `--fix`, Ruff's formatter hook can be placed before or after Ruff's lint hook.
|
||||
|
||||
(As long as your Ruff configuration avoids any [linter-formatter incompatibilities](https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules),
|
||||
`ruff format` should never introduce new lint errors, so it's safe to run Ruff's format hook _after_
|
||||
`ruff check --fix`.)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
ruff-pre-commit is licensed under either of
|
||||
|
||||
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
|
||||
|
||||
at your option.
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in ruff-pre-commit by you, as defined in the Apache-2.0 license, shall be
|
||||
dually licensed as above, without any additional terms or conditions.
|
||||
|
||||
<div align="center">
|
||||
<a target="_blank" href="https://astral.sh" style="background:none">
|
||||
<img src="https://raw.githubusercontent.com/astral-sh/ruff/main/assets/svg/Astral.svg">
|
||||
</a>
|
||||
</div>
|
||||
|
84
mirror.py
Normal file
84
mirror.py
Normal file
@ -0,0 +1,84 @@
|
||||
# /// script
|
||||
# requires-python = ">=3.12"
|
||||
# dependencies = [
|
||||
# "packaging==23.1",
|
||||
# "urllib3==2.0.5",
|
||||
# ]
|
||||
# ///
|
||||
"""Update ruff-pre-commit to the latest version of ruff."""
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import tomllib
|
||||
import typing
|
||||
from pathlib import Path
|
||||
|
||||
import urllib3
|
||||
from packaging.requirements import Requirement
|
||||
from packaging.version import Version
|
||||
|
||||
|
||||
def main():
|
||||
with open(Path(__file__).parent / "pyproject.toml", "rb") as f:
|
||||
pyproject = tomllib.load(f)
|
||||
|
||||
all_versions = get_all_versions()
|
||||
current_version = get_current_version(pyproject=pyproject)
|
||||
target_versions = [v for v in all_versions if v > current_version]
|
||||
|
||||
for version in target_versions:
|
||||
paths = process_version(version)
|
||||
if subprocess.check_output(["git", "status", "-s"]).strip():
|
||||
subprocess.run(["git", "add", *paths], check=True)
|
||||
subprocess.run(["git", "commit", "-m", f"Mirror: {version}"], check=True)
|
||||
subprocess.run(["git", "tag", f"v{version}"], check=True)
|
||||
else:
|
||||
print(f"No change v{version}")
|
||||
|
||||
|
||||
def get_all_versions() -> list[Version]:
|
||||
response = urllib3.request("GET", "https://pypi.org/pypi/ruff/json")
|
||||
if response.status != 200:
|
||||
raise RuntimeError("Failed to fetch versions from pypi")
|
||||
|
||||
versions = [Version(release) for release in response.json()["releases"]]
|
||||
return sorted(versions)
|
||||
|
||||
|
||||
def get_current_version(pyproject: dict) -> Version:
|
||||
requirements = [Requirement(d) for d in pyproject["project"]["dependencies"]]
|
||||
requirement = next((r for r in requirements if r.name == "ruff"), None)
|
||||
assert requirement is not None, "pyproject.toml does not have ruff requirement"
|
||||
|
||||
specifiers = list(requirement.specifier)
|
||||
assert (
|
||||
len(specifiers) == 1 and specifiers[0].operator == "=="
|
||||
), f"ruff's specifier should be exact matching, but `{requirement}`"
|
||||
|
||||
return Version(specifiers[0].version)
|
||||
|
||||
|
||||
def process_version(version: Version) -> typing.Sequence[str]:
|
||||
def replace_pyproject_toml(content: str) -> str:
|
||||
return re.sub(r'"ruff==.*"', f'"ruff=={version}"', content)
|
||||
|
||||
def replace_readme_md(content: str) -> str:
|
||||
content = re.sub(r"rev: v\d+\.\d+\.\d+", f"rev: v{version}", content)
|
||||
return re.sub(r"/ruff/\d+\.\d+\.\d+\.svg", f"/ruff/{version}.svg", content)
|
||||
|
||||
paths = {
|
||||
"pyproject.toml": replace_pyproject_toml,
|
||||
"README.md": replace_readme_md,
|
||||
}
|
||||
|
||||
for path, replacer in paths.items():
|
||||
with open(path) as f:
|
||||
content = replacer(f.read())
|
||||
with open(path, mode="w") as f:
|
||||
f.write(content)
|
||||
|
||||
return tuple(paths.keys())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
6
pyproject.toml
Normal file
6
pyproject.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[project]
|
||||
name = "ruff-pre-commit"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"ruff==0.11.13",
|
||||
]
|
Loading…
Reference in New Issue
Block a user