Skip to content

Commit 521fbca

Browse files
authored
Replace flake8 with ruff (TheAlgorithms#8184)
1 parent c96241b commit 521fbca

9 files changed

+20
-19
lines changed

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ We want your work to be readable by others; therefore, we encourage you to note
8181
black .
8282
```
8383

84-
- All submissions will need to pass the test `flake8 . --ignore=E203,W503 --max-line-length=88` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
84+
- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
8585

8686
```bash
87-
python3 -m pip install flake8 # only required the first time
88-
flake8 . --ignore=E203,W503 --max-line-length=88 --show-source
87+
python3 -m pip install ruff # only required the first time
88+
ruff .
8989
```
9090

9191
- Original code submission require docstrings or comments to describe your work.

audio_filters/equal_loudness_filter.py.broken.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class EqualLoudnessFilter:
2020
samplerate, use with caution.
2121

2222
Code based on matlab implementation at https://bit.ly/3eqh2HU
23-
(url shortened for flake8)
23+
(url shortened for ruff)
2424

2525
Target curve: https://i.imgur.com/3g2VfaM.png
2626
Yulewalk response: https://i.imgur.com/J9LnJ4C.png

data_structures/binary_tree/red_black_tree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
python/black : true
3-
flake8 : passed
2+
psf/black : true
3+
ruff : passed
44
"""
55
from __future__ import annotations
66

digital_image_processing/change_contrast.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
This algorithm is used in
55
https://noivce.pythonanywhere.com/ Python web app.
66
7-
python/black: True
8-
flake8 : True
7+
psf/black: True
8+
ruff : True
99
"""
1010

1111
from PIL import Image

maths/is_square_free.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
References: wikipedia:square free number
3-
python/black : True
4-
flake8 : True
3+
psf/black : True
4+
ruff : True
55
"""
66
from __future__ import annotations
77

maths/mobius_function.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
References: https://en.wikipedia.org/wiki/M%C3%B6bius_function
33
References: wikipedia:square free number
4-
python/black : True
5-
flake8 : True
4+
psf/black : True
5+
ruff : True
66
"""
77

88
from maths.is_square_free import is_square_free

other/linear_congruential_generator.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class LinearCongruentialGenerator:
99
"""
1010

1111
# The default value for **seed** is the result of a function call which is not
12-
# normally recommended and causes flake8-bugbear to raise a B008 error. However,
13-
# in this case, it is accptable because `LinearCongruentialGenerator.__init__()`
14-
# will only be called once per instance and it ensures that each instance will
15-
# generate a unique sequence of numbers.
12+
# normally recommended and causes ruff to raise a B008 error. However, in this case,
13+
# it is accptable because `LinearCongruentialGenerator.__init__()` will only be
14+
# called once per instance and it ensures that each instance will generate a unique
15+
# sequence of numbers.
1616

1717
def __init__(self, multiplier, increment, modulo, seed=int(time())): # noqa: B008
1818
"""

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ select = [ # https://beta.ruff.rs/docs/rules
5656
"W", # W: pycodestyle warnings
5757
"YTT", # YTT: year 2020
5858
]
59+
show-source = true
5960
target-version = "py311"
6061

6162
[tool.ruff.mccabe] # DO NOT INCREASE THIS VALUE

quantum/ripple_adder_classic.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def full_adder(
5454

5555

5656
# The default value for **backend** is the result of a function call which is not
57-
# normally recommended and causes flake8-bugbear to raise a B008 error. However,
58-
# in this case, this is acceptable because `Aer.get_backend()` is called when the
59-
# function is defined and that same backend is then reused for all function calls.
57+
# normally recommended and causes ruff to raise a B008 error. However, in this case,
58+
# this is acceptable because `Aer.get_backend()` is called when the function is defined
59+
# and that same backend is then reused for all function calls.
6060

6161

6262
def ripple_adder(

0 commit comments

Comments
 (0)