Skip to content

Commit

Permalink
do not require git for linting
Browse files Browse the repository at this point in the history
While it is reasonable for local executions to exempt files not under
version-ctrl from linting, this is not actually helpful for pipelines.
Guard against absence of git and thus remove the necessity for pipelines
to install git.
  • Loading branch information
ccwienk committed Dec 5, 2024
1 parent da13a2c commit f57a345
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 8 additions & 4 deletions .ci/lint-flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ src_dir="${1:-"$(readlink -f "$(dirname "${0}")/..")"}"
error=0

# ignore files that are not under version-ctrl (helpful for local runs)
GIT_DIR="${src_dir}/.git" \
GIT_WORKTREE="${src_dir}" \
untracked=$(git status --porcelain=v2 | grep -e '^? ' | sed 's/^? //g')
if which git &>/dev/null; then
GIT_DIR="${src_dir}/.git" \
GIT_WORKTREE="${src_dir}" \
untracked=$(git status --porcelain=v2 | grep -e '^? ' | sed 's/^? //g')

exclude_args=$(echo -n "${untracked}" | tr \\n ,)
exclude_args=$(echo -n "${untracked}" | tr \\n ,)
else
exclude_args=""
fi

# flake8 / the linter it instruments cannot handle our special type-hints (CliHint)
if flake8 \
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,6 @@ jobs:
container:
image: python:3.12-alpine
steps:
- name: install git
run: |
apk add --no-cache git
- uses: actions/checkout@v4
- name: Retrieve Distribution Packages
uses: actions/download-artifact@v4
Expand Down

0 comments on commit f57a345

Please sign in to comment.