Skip to content

Commit

Permalink
Fix pylint warnings in scripts
Browse files Browse the repository at this point in the history
Also setup CI to check them.
  • Loading branch information
ExcaliburZero committed Oct 7, 2023
1 parent 45ecbda commit 48b1deb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
black --check **/*.py
- name: Lint with pylint
run: |
pylint cbpickaxe/*.py
pylint cbpickaxe/*.py cbpickaxe_scripts/*.py
- name: Run regression tests
run: |
make regression_test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
test:
python -m black **/*.py
python -m mypy **/*.py
python -m pylint cbpickaxe/*.py
python -m pylint cbpickaxe/*.py cbpickaxe_scripts/*.py

regression_test:
python -m pytest regression_tests/test_*.py
Expand Down
3 changes: 3 additions & 0 deletions cbpickaxe_scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Scripts for data mining the game Cassette Beasts.
"""
from .extract_translation import main_without_args as extract_translation_main
from .get_move_users import main_without_args as get_move_users_main
from .generate_docs import main_without_args as generate_docs_main
Expand Down
7 changes: 3 additions & 4 deletions cbpickaxe_scripts/extract_translation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from typing import Dict, List

import argparse
import csv
import json
import pathlib
import re
import sys

import cbpickaxe as cbp
Expand All @@ -24,7 +23,7 @@ def main(argv: List[str]) -> int:

strings_to_translate = []
for filepath in args.strings_text_files:
with open(filepath, "r") as input_stream:
with open(filepath, "r", encoding="utf-8") as input_stream:
for line in input_stream:
line = line.strip()
if line == "":
Expand All @@ -44,7 +43,7 @@ def main(argv: List[str]) -> int:
for translation_filepath in args.translation_files
}

with open(args.output_file, "w") as ouput_stream:
with open(args.output_file, "w", encoding="utf-8") as ouput_stream:
writer = csv.DictWriter(
ouput_stream, fieldnames=["id", *sorted(set(locales.values()))]
)
Expand Down
3 changes: 2 additions & 1 deletion cbpickaxe_scripts/generate_docs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from dataclasses import dataclass
from typing import Any, cast, Dict, IO, List

Expand Down Expand Up @@ -116,7 +117,7 @@ def main(argv: List[str]) -> int:
config.output_directory.mkdir()

hoylake = cbp.Hoylake()
for name, root in config.roots.items():
for _, root in config.roots.items():
hoylake.load_root(pathlib.Path(root))

for monsters_path in OFFICIAL_MONSTER_FORM_PATHS + config.monster_forms.paths:
Expand Down
1 change: 1 addition & 0 deletions cbpickaxe_scripts/get_move_users.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=missing-module-docstring,missing-function-docstring,missing-class-docstring
from typing import List

import argparse
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ warn_return_any = true
warn_unused_ignores = true

[tool.pylint]
disable = ["C0301", "R0914", "I1101", "R1705", "R0915", "R0902", "W1203", "R0801"]
disable = ["C0301", "R0914", "I1101", "R1705", "R0915", "R0902", "W1203", "R0801", "R0913"]

0 comments on commit 48b1deb

Please sign in to comment.