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

Fix Format #183

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4.2.2

- name: Install Python
uses: actions/setup-python@v5
with:
# Since 3.10 is the development version for the project
python-version: '3.10'

- name: Install hatch
run: pip install hatch==$HATCH_VERSION

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/no_cheat.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
from pathlib import Path

DISABLE_TAG = '# pylint: disable='
DISABLE_TAG = "# pylint: disable="


def no_cheat(diff_text: str) -> str:
lines = diff_text.split('\n')
lines = diff_text.split("\n")
removed: dict[str, int] = {}
added: dict[str, int] = {}
for line in lines:
Expand All @@ -14,9 +14,9 @@ def no_cheat(diff_text: str) -> str:
idx = line.find(DISABLE_TAG)
if idx < 0:
continue
codes = line[idx + len(DISABLE_TAG) :].split(',')
codes = line[idx + len(DISABLE_TAG) :].split(",")
for code in codes:
code = code.strip().strip('\n').strip('"').strip("'")
code = code.strip().strip("\n").strip('"').strip("'")
if line.startswith("-"):
removed[code] = removed.get(code, 0) + 1
continue
Expand All @@ -26,7 +26,7 @@ def no_cheat(diff_text: str) -> str:
count -= removed.get(code, 0)
if count > 0:
results.append(f"Do not cheat the linter: found {count} additional {DISABLE_TAG}{code}")
return '\n'.join(results)
return "\n".join(results)


if __name__ == "__main__":
Expand Down
Loading