Skip to content

Commit 61a3f53

Browse files
Alexander Regueiromark-i-m
Alexander Regueiro
authored andcommitted
Added check for all source files to ensure they have no lines longer than 80 chars.
1 parent dbc65d2 commit 61a3f53

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
language: rust
22
cache:
33
- cargo
4+
before_install:
5+
- MAX_LINE_LENGTH=80 bash ci/check_line_lengths.sh src/**/*.md
46
install:
57
- source ~/.cargo/env || true
68
- bash ci/install.sh

ci/check_line_lengths.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..."
4+
5+
echo "Offending files and lines:"
6+
(( success = 1 ))
7+
for file in "$@" ; do
8+
echo "$file"
9+
(( line_no = 0 ))
10+
while IFS="" read -r line || [[ -n "$line" ]] ; do
11+
(( line_no++ ))
12+
if (( "${#line}" > $MAX_LINE_LENGTH )) ; then
13+
(( success = 0 ))
14+
echo -e "\t$line_no : $line"
15+
fi
16+
done < "$file"
17+
done
18+
19+
(( $success )) && echo "No offending lines found."

ci/install.sh

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
set -ex
34

45
function cargo_install() {

0 commit comments

Comments
 (0)