Skip to content

Commit fe47dec

Browse files
Allow lint to be called from any folder
This allows use of the lint script without changing to the root of the CBMC folder first; e.g. to lint a non-CBMC project
1 parent 60ec171 commit fe47dec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/run_lint.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -e
44

5+
script_folder=`dirname $0`
6+
57
if [[ "$#" -ne 2 ]]
68
then
79
echo "Script for running the CPP linter only on modified lines."
@@ -12,10 +14,10 @@ then
1214
exit 1
1315
fi
1416

15-
if ! [[ -e scripts/cpplint.py ]]
17+
if ! [[ -e $script_folder/cpplint.py ]]
1618
then
17-
echo "Lint script could not be found in the scripts directory"
18-
echo "Ensure cpplint.py is inside the scripts directory then run again"
19+
echo "Lint script could not be found in the $script_folder directory"
20+
echo "Ensure cpplint.py is inside the $script_folder directory then run again"
1921
exit 1
2022
fi
2123

@@ -81,7 +83,7 @@ for file in $diff_files; do
8183
# Run the linting script and filter by the filter we've build
8284
# of all the modified lines
8385
# The errors from the linter go to STDERR so must be redirected to STDOUT
84-
result=`python scripts/cpplint.py $file 2>&1 | { grep -E "$lint_grep_filter" || true; }`
86+
result=`python $script_folder/cpplint.py $file 2>&1 | { grep -E "$lint_grep_filter" || true; }`
8587

8688
# Providing some errors were relevant we print them out
8789
if [ "$result" ]

0 commit comments

Comments
 (0)