Use Ameba to enforce max line width

Didn't know Ameba supports this!
This commit is contained in:
Alex Ling 2021-01-27 04:18:47 +00:00
parent 07965b98b7
commit c1c8cca877
3 changed files with 5 additions and 6 deletions

View File

@ -7,3 +7,8 @@ Lint/UnusedArgument:
- src/routes/* - src/routes/*
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Enabled: false Enabled: false
Layout/LineLength:
Enabled: true
MaxLength: 80
Excluded:
- src/routes/api.cr

View File

@ -29,7 +29,6 @@ test:
check: check:
crystal tool format --check crystal tool format --check
./bin/ameba ./bin/ameba
./dev/linewidth.sh
arm32v7: arm32v7:
crystal build src/mango.cr --release --progress --error-trace --cross-compile --target='arm-linux-gnueabihf' -o mango-arm32v7 crystal build src/mango.cr --release --progress --error-trace --cross-compile --target='arm-linux-gnueabihf' -o mango-arm32v7

View File

@ -1,5 +0,0 @@
#!/bin/sh
[ ! -z "$(grep '.\{80\}' --exclude-dir=lib --include="*.cr" -nr --color=always . | grep -v "routes/api.cr" | tee /dev/tty)" ] \
&& echo "The above lines exceed the 80 characters limit" \
|| exit 0