Skip to content

Commit

Permalink
roll back from docker; follow radon example
Browse files Browse the repository at this point in the history
  • Loading branch information
nlebovits committed Sep 25, 2024
1 parent 85f7de1 commit 2362f75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/pr_checks_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Radon MI and Halstead Checks in Docker
- name: Install Radon
run: pip install radon

- name: Run Radon MI and Halstead Checks
run: |
# Run the Radon container
docker compose run --rm radon
# Run MI checks
radon mi ./data/ -s
# Run Halstead complexity analysis
radon hal ./data/ -s
- name: Flag issues from Radon MI and Halstead checks
run: |
# Check Maintainability Index (MI) results and flag any grade below B
bad_grades=$(docker compose run --rm radon | grep -E " - [CDEF] \(" || true)
bad_grades=$(radon mi ./data/ -s | grep -E " - [CDEF] \(" || true)
if [[ ! -z "$bad_grades" ]]; then
echo "Warning: Bad MI grades found (below B):"
echo "$bad_grades"
Expand All @@ -53,7 +59,7 @@ jobs:
fi
# Check Halstead complexity for effort > 2000
high_effort=$(docker compose run --rm radon | awk '/effort/ { if ($3 > 2000) print $0 }')
high_effort=$(radon hal ./data/ -s | awk '/effort/ { if ($3 > 2000) print $0 }')
if [[ ! -z "$high_effort" ]]; then
echo "Warning: High Halstead effort found (above 2000):"
echo "$high_effort"
Expand Down
8 changes: 0 additions & 8 deletions data/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ services:
command: sh -c "pip install ruff && ruff check --fix --exclude '/usr/src/app/awkde/'"
network_mode: 'host'

radon:
build:
context: .
volumes:
- ./src:/usr/src/app
command: sh -c "pip install radon && radon mi /usr/src/app && radon hal /usr/src/app"
network_mode: 'host'

streetview:
build:
context: .
Expand Down

0 comments on commit 2362f75

Please sign in to comment.