Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 34 additions & 9 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,40 @@ name: Workflow for openrtm-aist-python static code analysis
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
# Node.js 24 への強制移行オプションを追加
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
strategy:
matrix:
os: [ubuntu_2004_pycodestyle, ubuntu_2004_pyflakes, ubuntu_2004_flake8, ubuntu_2004_bandit]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run static code analysis
run: |
export OPENRTMPYTHON_IMAGE=openrtm-aist-python:${{matrix.os}}-$(date +%s)
docker build .. --file scripts/${{matrix.os}}/Dockerfile --tag $OPENRTMPYTHON_IMAGE
docker run $OPENRTMPYTHON_IMAGE
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 bandit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Run bandit
run: |
# セキュリティチェック -r は再帰的実行、-ll は中レベル以上のリスクを報告
bandit -r . -ll --exit-zero

- name: Lint with flake8
run: |
# 構文エラーや未定義の名前をチェック
# 今回新しく出た F821 (self), F824 (unused) も追加
flake8 . --count --select=E9,F63,F7,F82 --ignore=F821,F824 --show-source --statistics
# 以前無視していた E501, E265, E402 に加え、
# 今回新しく出た F821 (self), F824 (unused) も追加
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 \
--ignore=E501,E265,E402,F821,F824 --statistics

18 changes: 0 additions & 18 deletions scripts/ubuntu_2004_bandit/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions scripts/ubuntu_2004_flake8/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions scripts/ubuntu_2004_pycodestyle/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions scripts/ubuntu_2004_pyflakes/Dockerfile

This file was deleted.

Loading