summaryrefslogtreecommitdiff
path: root/cs
blob: 4e9cc9520e393c42f631d19fc7b8e6683aeab677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash

ruleset_dir="$HOME/scripts/banana-coding-style-checker/vera"

start_time=$(date +%s)
if [ -z "$1" ]; then
  project_dir=$(pwd)
else
  project_dir="$1"
fi
echo "Running norm in $project_dir"

count=$(find "$project_dir"       \
    -type f                       \
    -not -path "*/.git/*"         \
    -not -path "*/.idea/*"        \
    -not -path "*/.vscode/*"      \
    -not -path "bonus/*"          \
    -not -path "tests/*"          \
    -not -path "/*build/*"        \
    -not -path "\#*\#"            \
    -not -path "*\~"              \
    | vera++                      \
    --profile epitech             \
    --root $ruleset_dir           \
    --error                       \
    2>&1                          \
    | sed "s|$project_dir/||"     \
    | tee /dev/tty | wc -l
)

end_time=$(date +%s)

echo "Found $count issues"
echo "Ran in $((end_time - start_time))s"

if [ $count -gt 0 ]; then
  exit 1
fi
exit 0