Skip to content

Commit

Permalink
ci: replace flake8 with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
tbdsux committed Jan 3, 2025
1 parent e671518 commit b9de81e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 496 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

31 changes: 15 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ jobs:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 app/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 app/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
uv run ruff check
- name: Test with pytest
run: |
pytest
uv run pytest tests
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"python.analysis.extraPaths": ["venv/lib"],
"python.linting.mypyEnabled": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
}
}
9 changes: 5 additions & 4 deletions app/handlers/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _get_main_container(self) -> None:
_work_headers = [i.text.strip() for i in _works_container.find_all("h5")]
_work_tables = _works_container.find_all("table")

for j, k in zip(_work_headers, _work_tables):
for j, k in zip(_work_headers, _work_tables, strict=False):
# theaders = ['episodes' if i.text.strip() == '#' else i.text.strip() for i in k.find("thead").find_all("th")]
bare_works: List[Dict[str, Any]] = []

Expand Down Expand Up @@ -209,7 +209,7 @@ def _get_main_container(self) -> None:
__temp_cast_headers = __casts_container.find_all("h3")
__temp_cast_lists = __casts_container.find_all("ul")

for j, k in zip(__temp_cast_headers, __temp_cast_lists):
for j, k in zip(__temp_cast_headers, __temp_cast_lists, strict=False):
casts = []
for i in k.find_all("li"):
__temp_cast = i.find("a", class_="text-primary")
Expand Down Expand Up @@ -365,8 +365,8 @@ def _get_main_container(self) -> None:
dramas = [self._parse_drama(item) for item in container]
stats = [self._parse_total_stats(item) for item in container]

items = dict()
for title, drama, stat in zip(titles, dramas, stats):
items = {}
for title, drama, stat in zip(titles, dramas, stats, strict=False):
items[title] = {"items": drama, "stats": stat}

self.info["list"] = items
Expand Down Expand Up @@ -405,6 +405,7 @@ def _parse_drama(self, item: BeautifulSoup) -> Dict[str, str]:
item_scores,
item_episode_seens,
item_episode_totals,
strict=False,
):
parsed_item = {
"name": name.get_text(strip=True),
Expand Down
18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "kuryana"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.12"
dependencies = [
"beautifulsoup4>=4.12.3",
"cloudscraper>=1.2.71",
Expand All @@ -12,9 +12,13 @@ dependencies = [
]

[dependency-groups]
dev = [
"flake8>=7.1.1",
"mypy>=1.14.1",
"pytest>=8.3.4",
"ruff>=0.8.5",
]
dev = ["mypy>=1.14.1", "pytest>=8.3.4", "ruff>=0.8.5"]


[tool.ruff]
line-length = 88
indent-width = 4

[tool.ruff.lint]
select = ["C", "E", "F", "W", "B", "B9"]
ignore = ["E501", "E203"]
Loading

0 comments on commit b9de81e

Please sign in to comment.