Skip to content

Commit

Permalink
hato-botのCIを反映するよ!
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 7, 2024
1 parent 4fc3354 commit 0bc2103
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/pr-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
run: sed -i -e "s/python_version = \".*\"/python_version = \"$(echo ${{ steps.setup_python.outputs.python-version }} | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/g')\"/g" Pipfile
- name: Install pipenv
id: install_pipenv
continue-on-error: true
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/pr_format/pr_format/install_pipenv.sh"
- name: Install dependencies
Expand All @@ -49,8 +48,8 @@ jobs:
id: format
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/pr_format/pr_format/format.sh"
continue-on-error: true
- uses: dev-hato/[email protected]
if: success() || failure()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
branch-name-prefix: fix-format
Expand Down
3 changes: 3 additions & 0 deletions .textlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"人人",
"よし"
]
},
"no-mix-dearu-desumasu": {
"preferInList": "ですます"
}
},
"preset-jtf-style": {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions scripts/pr_format/pr_format/fix_pipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ def get_imported_packages(project_root: Path) -> set[str]:
for imported_package in re.findall(
r"^(?:import|from)\s+(\w+)", python_file.read(), re.MULTILINE
):
if not is_std_or_local_lib(project_root, imported_package):
if imported_package != "sudden_death" and not is_std_or_local_lib(
project_root, imported_package
):
imported_packages.add(imported_package)

return imported_packages
Expand All @@ -160,7 +162,8 @@ def get_pipfile_packages(pipfile: Pipfile) -> set[str] | NoReturn:
if not is_pipfile_packages(pipfile_value):
raise TypeError("Failed to cast to PipfilePackages: " + str(pipfile_value))

pipfile_packages |= set(pipfile_value.keys())
for package_name in pipfile_value.keys():
pipfile_packages.add(package_name.lower())

return pipfile_packages

Expand All @@ -173,9 +176,8 @@ def exist_package_in_pipfile(packages: list[str], pipfile_packages: set[str]) ->
:return: 与えられたパッケージ群のいずれかがPipfile内に存在するか
"""
for package_name in packages:
for pn in [package_name, package_name.lower()]:
if pn in pipfile_packages:
return True
if package_name.lower() in pipfile_packages:
return True

return False

Expand Down

0 comments on commit 0bc2103

Please sign in to comment.