Skip to content

Commit b13aad3

Browse files
committed
OD-1730: Switch to using ruff for linting
1 parent 564f453 commit b13aad3

5 files changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/python-app-linux.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ jobs:
3434
shell: bash
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install flake8 pytest
37+
pip install pytest
3838
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
39-
- name: Lint with flake8
39+
- name: Lint with ruff
4040
run: |
41-
# stop the build if there are Python syntax errors or undefined names
42-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
ruff check .
4542
- name: Test with pytest
4643
run: |
4744
pytest

.github/workflows/python-app-macos-windows.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@ jobs:
2727
shell: bash
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install flake8 pytest
30+
pip install pytest
3131
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32-
- name: Lint with flake8
32+
- name: Lint with ruff
3333
run: |
34-
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+
ruff check .
3835
- name: Test with pytest - exclude MySQL integration tests
3936
run: |
4037
pytest --ignore "opendoors/tests/test_sql_db.py" --ignore "efiction/tests/test_metadata.py"

opendoors/mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def dump_database(self, database: str, destination_filepath: str):
159159
f.write(f"INSERT INTO {database}.`{str(table)}` ({column_names}) VALUES \n")
160160
field_arr = []
161161
for field in row:
162-
if type(row[field]) == str or type(row[field]) == datetime.datetime:
162+
if type(row[field]) == str or type(row[field]) == datetime.datetime: # noqa: E721
163163
field_arr.append(self.conn.escape(row[field]))
164164
elif row[field] is None:
165165
field_arr.append("NULL")
@@ -198,7 +198,7 @@ def __del__(self):
198198
"""
199199
try:
200200
self.conn.close()
201-
except:
201+
except: # noqa: E722
202202
pass
203203

204204

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pycparser==2.20
1616
PyMySQL==0.10.1
1717
pyparsing==2.4.7
1818
pytest==6.1.0
19+
ruff==0.1.3
1920
shutils==0.1.0
2021
six==1.15.0
2122
sqlparse==0.3.1

start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def save_config_and_exit():
4646
code_name = sys.argv[1]
4747
else:
4848
code_name = None
49-
while (code_name == None or any([x not in "qwertyuiopasdfghjklzxcvbnm" for x in code_name])):
49+
while (code_name == None or any([x not in "qwertyuiopasdfghjklzxcvbnm" for x in code_name])): # noqa: E711
5050
code_name = input(
5151
"Please provide a short, lowercase code name with no spaces or punctuation for the archive "
5252
"you are processing (and make a note of it as you'll need it in future!):\n>> ")

0 commit comments

Comments
 (0)