Skip to content

Commit 24577f0

Browse files
massongitclaude
andcommitted
super-linter v8対応
super-linterのv7からv8へのアップグレードに伴う各種修正。 Workflowの修正: - super-linter/super-linterアクションをSHAでピン留め - persist-credentials: falseを追加 - BIOME_LINTを無効化 - zizmor: テンプレートインジェクション警告を修正 (dockle.yml, fix_env.yml) - dependabot: cooldownを7日に設定 Linter設定の追加: - .github/linters/.python-lint: ノートブック向けpylint設定を追加 - .github/linters/trivy.yaml: TRIVY設定を追加 - .github/linters/trivy-secret.yaml: .gitleaks.tomlの誤検知を抑制 Notebookの修正: super-linter v8でJupyter notebook向けlinterが有効化されたため、 各linterのエラーをnotebookに対して修正した。 docker/work直下の問題ノートブックとdocker/work/answer内の解答ノートブックは 対応関係にあるため、両方に同じ修正を適用した。 - JUPYTER_NBQA_BLACK: シングルクォートをダブルクォートに統一するなど、 blackのコードスタイルに準拠するようフォーマットを修正 - JUPYTER_NBQA_FLAKE8: - F401: 演習用として配置されている未使用インポートに # noqa: F401 を追加 - E402: SQLノートブックでは %load_ext sql マジックコマンドの後にインポートが あるためE402が発生する。これを抑制するため # noqa: E402 を追加 - F821: ans_preprocess_knock_Python.ipynb で display が未インポートのまま 使用されているため from IPython.display import display を追加。 また、問題・解答ノートブック間でインポートを揃えるため、 preprocess_knock_Python.ipynb にも同インポートを # noqa: F401 付きで追加 - JUPYTER_NBQA_ISORT: インポートの順序がisortのルールに従っていないため修正 - JUPYTER_NBQA_PYLINT: - W0109: dtype辞書でpostal_cdキーが重複していたバグを修正 - R1705/R1710: pct_group関数でreturnの後にelifを使用していたため、 elif を if に変更し、返り値の一貫性も修正 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent df26a17 commit 24577f0

12 files changed

Lines changed: 1426 additions & 640 deletions

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ updates:
1010
schedule:
1111
interval: "daily"
1212
open-pull-requests-limit: 1
13+
cooldown:
14+
default-days: 7
1315
- package-ecosystem: "docker"
1416
directory: "/dockerfiles/postgres"
1517
schedule:
1618
interval: "daily"
1719
open-pull-requests-limit: 1
20+
cooldown:
21+
default-days: 7
1822
- package-ecosystem: "docker"
1923
directory: "/dockerfiles/notebook"
2024
schedule:
2125
interval: "daily"
2226
open-pull-requests-limit: 1
27+
cooldown:
28+
default-days: 7

.github/linters/.python-lint

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# https://github.com/super-linter/super-linter/blob/eec862d0ea33fe6a836dfd545eef1125e530c794/TEMPLATES/.python-lint
2+
[MASTER]
3+
4+
# Use multiple processes to speed up Pylint.
5+
jobs=0
6+
7+
[MESSAGES CONTROL]
8+
9+
# Ignoring Import Errors is desired as super-linter
10+
# does not support installing dependencies as it runs
11+
disable=
12+
import-error,
13+
C0103,
14+
C0114,
15+
C0116,
16+
C0302,
17+
C0413,
18+
R0801,
19+
W0104,
20+
W0611,
21+
W0621,

.github/linters/trivy-secret.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
allow-rules:
2+
- id: allow-gitleaks-gcp-rule
3+
description: .gitleaks.toml に含まれるGCPサービスアカウントパターンはregexルールの定義であり、実際のシークレットではない
4+
path: ".*\\.gitleaks\\.toml$"

.github/linters/trivy.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
# https://github.com/super-linter/super-linter/blob/542ff97039e06088e30e3306fd6c34a3090e3946/TEMPLATES/trivy.yaml
3+
disable-telemetry: true
4+
exit-code: 1
5+
exit-on-eol: 2
6+
scan:
7+
scanners:
8+
- vuln
9+
- misconfig
10+
- secret
11+
secret:
12+
config: /github/workspace/.github/linters/trivy-secret.yaml

.github/workflows/dockle.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1616
with:
1717
fetch-depth: 0
18+
persist-credentials: false
1819
- name: Run docker containers
1920
run: docker compose up -d
2021
- name: Get latest dockle version
@@ -34,7 +35,7 @@ jobs:
3435
for image_name in $(docker compose images | awk 'OFS=":" {print $2,$3}' | tail -n +2); do
3536
docker save "${image_name}" | gzip > image.tar.gz
3637
cmd="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/.dockleignore:/.dockleignore -v $(pwd)/image.tar.gz:/image.tar.gz "
37-
cmd+="goodwithtech/dockle:${{ steps.get_latest_dockle_version.outputs.result }} --exit-code 1 --exit-level info --input /image.tar.gz "
38+
cmd+="goodwithtech/dockle:${DOCKLE_VERSION} --exit-code 1 --exit-level info --input /image.tar.gz "
3839
3940
if [[ "${image_name}" =~ "dss-notebook" ]]; then
4041
cmd+="--timeout 600s -ae mdf -af settings.py -af credentials -i DKL-DI-0001 "
@@ -46,3 +47,5 @@ jobs:
4647
echo "> ${cmd}"
4748
eval "${cmd}"
4849
done
50+
env:
51+
DOCKLE_VERSION: ${{ steps.get_latest_dockle_version.outputs.result }}

.github/workflows/fix_env.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
if: github.event_name != 'pull_request' || github.event.action != 'closed'
2424
with:
2525
fetch-depth: 0
26+
persist-credentials: false
2627
ref: ${{ github.event.pull_request.head.sha }}
2728
- name: Get Python version
2829
id: get_python_version
@@ -44,11 +45,13 @@ jobs:
4445
pip install -r requirements.txt
4546
pipenv install
4647
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
47-
run: sed -i -e "s/python_version = \".*\"/python_version = \"${{ steps.get_python_version.outputs.minor_version }}\"/g" Pipfile
48+
run: sed -i -e "s/python_version = \".*\"/python_version = \"${PYTHON_VERSION}\"/g" Pipfile
49+
env:
50+
PYTHON_VERSION: ${{ steps.get_python_version.outputs.minor_version }}
4851
- name: Copy packages from Pipfile to environment.yml
4952
if: github.event_name != 'pull_request' || github.event.action != 'closed'
5053
run: |
51-
sed -i -e "s/ python=.*/ python=${{ steps.get_python_version.outputs.minor_version }}/g" environment.yml
54+
sed -i -e "s/ python=.*/ python=${PYTHON_VERSION}/g" environment.yml
5255
for package_name in $(yq -p toml -o tsv '.packages | keys' Pipfile)
5356
do
5457
if ! grep "$package_name" environment.yml
@@ -61,6 +64,8 @@ jobs:
6164
sed -i -e "s/ $package_name==[0-9.]*$/ $package/g" environment.yml
6265
sed -i -e "s/ $package_name=[0-9.]*$/ ${package//==/=}/g" environment.yml
6366
done
67+
env:
68+
PYTHON_VERSION: ${{ steps.get_python_version.outputs.minor_version }}
6469
- uses: dev-hato/actions-diff-pr-management@b446497d139ed3eadc62ec1dd90dd27960ad1a0c # v2.2.4
6570
if: success() || failure()
6671
with:

.github/workflows/run_notebooks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1616
with:
1717
fetch-depth: 0
18+
persist-credentials: false
1819
- name: Run docker containers
1920
run: docker compose up -d --wait
2021
- name: Run notebooks

.github/workflows/super-linter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ jobs:
4444
with:
4545
# Full git history is needed to get a proper list of changed files within `super-linter`
4646
fetch-depth: 0
47+
persist-credentials: false
4748

4849
################################
4950
# Run Linter against code base #
5051
################################
5152
- name: Lint Code Base
52-
uses: super-linter/super-linter@v8.3.1
53+
uses: super-linter/super-linter@47984f49b4e87383eed97890fe2dca6063bbd9c3 # v8.3.1
5354
env:
5455
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5556
VALIDATE_HTML: false
5657
VALIDATE_HTML_PRETTIER: false
5758
FILTER_REGEX_EXCLUDE: docker/.jupyter/jupyter_lab_config.py
5859
VALIDATE_SQLFLUFF: false
60+
VALIDATE_BIOME_LINT: false

0 commit comments

Comments
 (0)