Skip to content

Commit

Permalink
Print Linter not found message in red
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhijit Sarkar committed Jan 2, 2025
1 parent a131c19 commit e509fbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ if [[ -z "$CI" ]]; then
ormolu_mode="inplace"
fi

green='\033[1;32m'
no_color='\033[0m'
green=$(tput -Txterm-256color setaf 2)
default=$(tput -Txterm-256color sgr0)
for m in "${manifests[@]}"; do
name="$(dirname "$(readlink -f "$m")")"
name="$(basename "$name")"

printf "Project dir: %b%s%b\n" "$green" "$name" "$no_color"
printf "Project dir: %b%s%b\n" "$green" "$name" "$default"

if (( no_test == 0 )); then
# profiling https://stackoverflow.com/a/40922201/839733
Expand All @@ -64,13 +64,13 @@ for m in "${manifests[@]}"; do
if [[ -x "$(command -v hlint)" ]]; then
hlint "$name/src"
else
printf "hlint not found"
printf "%bhlint not found%b\n" "$red" "$default"
fi

if [[ -x "$(command -v ormolu)" ]]; then
ormolu -m "$ormolu_mode" $(find "$name/src" -name '*.hs')
else
printf "ormolu not found"
printf "%bormolu not found%b\n" "$red" "$default"
fi
fi
done
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on: [push]

name: CI

on: [push, workflow_dispatch]

jobs:
build-and-test:
runs-on: ubuntu-latest
Expand All @@ -12,18 +12,18 @@ jobs:
uses: haskell-actions/setup@v2
with:
enable-stack: true
stack-no-global: true

- name: Test
run: .github/run.sh --no-lint

- name: 'Install HLint'
uses: haskell-actions/hlint-setup@v2

- name: 'Run HLint'
run: hlint --ignore-glob '*/test/*.hs' .
- run: hlint --ignore-glob '*/test/*.hs' .

- name: 'Run Ormolu'
- name: 'Check Formatting'
uses: haskell-actions/run-ormolu@v16
with:
pattern: '*/src/*.hs'
mode: check

- name: 'Test and Lint'
run: .github/run.sh --no-lint

0 comments on commit e509fbe

Please sign in to comment.