Skip to content

Commit

Permalink
Check style in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Aug 18, 2024
1 parent 9540650 commit 9e5ac4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Install shellcheck and checkbashisms
run: sudo apt update && sudo apt install shellcheck devscripts
- name: Check style
run: make style
run: make check-style
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
all: style gradle-assemble

style: shell-script-style python-style java-style
fix-style: fix-python-style fix-java-style

check-style: check-shell-script-style check-python-style check-java-style

SH_SCRIPTS = $(shell grep --exclude-dir=build --exclude-dir=repos --exclude-dir=cache -r -l '^\#! \?\(/bin/\|/usr/bin/env \)sh' * | grep -v 'git-hires-merge' | grep -v /.git/ | grep -v '~$$' | grep -v '\.tar$$' | grep -v gradlew)
BASH_SCRIPTS = $(shell grep --exclude-dir=build --exclude-dir=repos --exclude-dir=cache -r -l '^\#! \?\(/bin/\|/usr/bin/env \)bash' * | grep -v /.git/ | grep -v '~$$' | grep -v '\.tar$$' | grep -v gradlew)
Expand All @@ -13,23 +15,30 @@ CSV_RESULTS = $(CSV_RESULTS_COMBINED)

NUM_PROCESSES = 0

shell-script-style:
shellcheck -e SC2153 -x -P SCRIPTDIR --format=gcc ${SH_SCRIPTS} ${BASH_SCRIPTS}
checkbashisms ${SH_SCRIPTS}

showvars:
@echo "SH_SCRIPTS=${SH_SCRIPTS}"
@echo "BASH_SCRIPTS=${BASH_SCRIPTS}"
@echo "PYTHON_FILES=${PYTHON_FILES}"

python-style:
check-shell-script-style:
shellcheck -e SC2153 -x -P SCRIPTDIR --format=gcc ${SH_SCRIPTS} ${BASH_SCRIPTS}
checkbashisms ${SH_SCRIPTS}

fix-python-style:
ruff format ${PYTHON_FILES}
ruff check ${PYTHON_FILES} --fix

check-python-style:
ruff format ${PYTHON_FILES} --check
ruff check ${PYTHON_FILES}

fix-java-style:
./gradlew -q spotlessApply -g ../.gradle/

check-java-style:
./gradlew -q spotlessCheck javadoc requireJavadoc -g ../.gradle/


# This target deletes files that are not committed to version control.
clean:
${MAKE} clean-workdir
Expand Down Expand Up @@ -163,9 +172,6 @@ check-merges-reproducibility:
protect-repos:
find repos -mindepth 1 -type d -exec chmod a-w {} +

java-style:
./gradlew -q spotlessCheck javadoc requireJavadoc -g ../.gradle/

download-merge-tools: jars/IntelliMerge-1.0.9-all.jar jars/spork.jar

jars/IntelliMerge-1.0.9-all.jar:
Expand Down

0 comments on commit 9e5ac4f

Please sign in to comment.