diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml index 45dc0a1..c4e2e1a 100644 --- a/.github/workflows/style-check.yml +++ b/.github/workflows/style-check.yml @@ -16,7 +16,7 @@ jobs: - name: Install pylint run: pip install pylint - name: Run pylint - run: pylint -E generate.py + run: find . -type f -name "*.py" | xargs pylint black: name: black runs-on: ubuntu-latest @@ -46,4 +46,4 @@ jobs: - name: Install isort run: pip install isort - name: Run isort - run: isort --ensure-newline-before-comments --diff generate.py + run: isort --ensure-newline-before-comments --diff -v . diff --git a/generate.py b/generate.py index 91a516a..884b55b 100755 --- a/generate.py +++ b/generate.py @@ -34,7 +34,7 @@ def parse_args() -> argparse.Namespace: "--start", type=int, help="Start generation from this problem", default=0 ) parser.add_argument( - "--stop", type=int, help="Stop generation on this problem", default=2 ** 64 + "--stop", type=int, help="Stop generation on this problem", default=2**64 ) parser.add_argument( "--page-size", diff --git a/leetcode_anki/helpers/leetcode.py b/leetcode_anki/helpers/leetcode.py index af318cb..b5486d0 100644 --- a/leetcode_anki/helpers/leetcode.py +++ b/leetcode_anki/helpers/leetcode.py @@ -1,3 +1,4 @@ +# pylint: disable=missing-module-docstring import functools import json import logging @@ -230,7 +231,7 @@ def _get_problems_data( leetcode.models.graphql_question_detail.GraphqlQuestionDetail ] = [] - logging.info(f"Fetching {stop - start + 1} problems {page_size} per page") + logging.info("Fetching %s problems %s per page", stop - start + 1, page_size) for page in tqdm( range(math.ceil((stop - start + 1) / page_size)), @@ -261,6 +262,8 @@ def _get_problem_data( if problem_slug in cache: return cache[problem_slug] + raise ValueError(f"Problem {problem_slug} is not in cache") + async def _get_description(self, problem_slug: str) -> str: """ Problem description diff --git a/pyproject.toml b/pyproject.toml index 00a86b1..953fe9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,3 +3,7 @@ asyncio_mode = "strict" testpaths = [ "test", ] + +[tool.pylint] +max-line-length = 88 +disable = ["line-too-long"]