Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
On-Board Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
On-Board Software
Commits
8f663947
Commit
8f663947
authored
6 years ago
by
Luca Erbetta
Browse files
Options
Downloads
Patches
Plain Diff
[SCRIPTS] Added linter
parent
d27da7d2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/cppcheck_suppressions_list.txt
+2
-0
2 additions, 0 deletions
scripts/cppcheck_suppressions_list.txt
scripts/linter.sh
+38
-0
38 additions, 0 deletions
scripts/linter.sh
with
40 additions
and
0 deletions
scripts/cppcheck_suppressions_list.txt
0 → 100644
+
2
−
0
View file @
8f663947
*:src/tests/*
This diff is collapsed.
Click to expand it.
scripts/linter.sh
0 → 100644
+
38
−
0
View file @
8f663947
#!/bin/bash
declare
-i
RESULT
=
0
function
check
{
B
=
$(
eval
"
$3
"
)
A
=
$?
echo
-n
"[LINTER]
$2
... "
if
[
"
$1
"
==
"OUT"
]
;
then
if
[
${#
B
}
-gt
0
]
;
then
A
=
$1
fi
;
fi
;
if
[
"
$A
"
==
"
$1
"
]
;
then
echo
-e
"FAIL
\n
------------ OUTPUT ------------"
echo
"
$B
"
echo
"--------------------------------"
return
1
else
echo
"OK"
return
0
fi
;
}
#check 0 "Checking for files with lines longer than 80 characters" 'egrep --include="*.cpp" --include="*.h" -nr ".{81}" src/'
check 0
"Checking for files with lines longer than 120 characters"
'egrep --include="*.cpp" --include="*.h" -nr ".{121}" src/'
RESULT+
=
$?
check OUT
"Checking for files having
\n\n\n
"
"grep -HPcrz '(
\\
r?
\\
n){4,}' src | egrep -v ':0
$'
| cut -d ':' -f 1"
check OUT
"Checking for files not having the copyright"
"grep -rL '* Permission is hereby granted, free of charge' src/"
check OUT
"Checking for tabulations instead of spaces"
"grep -Pr '
\t
' src"
check OUT
"MMP wants his full name"
"grep -rl 'Matteo Piazzolla' src/"
check OUT
"Launching cppcheck"
"cppcheck --suppressions-list=./scripts/cppcheck_suppressions_list.txt --template=gcc -q --suppress=unusedFunction --suppress=missingInclude --std=c++11 --enable=all src/ 2>&1"
RESULT+
=
$?
check OUT
"Checking for using namespace in header files"
"grep -rl 'using namespace' src | egrep '.h(pp)?
$'
"
RESULT+
=
$?
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment