-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for static checks (#31)
* Add workflows for cpplint and cppcheck. - Add GitHub workflows for static checks. - Style changes for conformance with Google style enforced by cpplint. - Apply exceptions / filters documented in CPPLINT.cfg. - Changes mostly concern line length, indentation within namespaces, and terminating whitespace. Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com> * Add status badges for cpplink and cppcheck. Fix badge for build. Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
- Loading branch information
1 parent
5b30c4a
commit 8686cc1
Showing
13 changed files
with
600 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# GitHub Action to run cppcheck | ||
# | ||
name: cppcheck | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
cpplint: | ||
runs-on: ubuntu-20.04 | ||
name: cppcheck | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install cppcheck | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install cppcheck | ||
- name: Run cppcheck | ||
run: | | ||
cppcheck --std=c++17 ./include/*.hh | ||
cppcheck --std=c++17 ./src/*.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# GitHub Action to run cpplint | ||
# | ||
# The cpplint configuration file is: | ||
# | ||
# ./CPPLINT.cfg | ||
# | ||
name: ccplint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
cpplint: | ||
runs-on: ubuntu-20.04 | ||
name: cpplint | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install cpplint | ||
run: | | ||
pip install cpplint | ||
- name: Run cpplint | ||
run: | | ||
cpplint ./include/*.hh | ||
cpplint ./src/*.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# filters | ||
# | ||
# 1. [-whitespace/braces] | ||
# { should almost always be at the end of the previous line | ||
# | ||
# Allow: | ||
# bool SocketAPM::pollout(uint32_t timeout_ms) | ||
# { | ||
# | ||
# Instead of: | ||
# bool SocketAPM::pollout(uint32_t timeout_ms) { | ||
# | ||
# 2. [-runtime/references] | ||
# Is this a non-const reference? If so, make const or use a pointer | ||
# | ||
# Allow: | ||
# void last_recv_address(const char *&ip_addr, uint16_t &port); | ||
# | ||
# Instead of: | ||
# void last_recv_address(const char *&ip_addr, uint16_t *port); | ||
# | ||
# 3. [-whitespace/indent] | ||
# private: should be indented +1 space | ||
# | ||
# 4. [-whitespace/blank_line] | ||
# Do not leave a blank line after "private:" | ||
# | ||
# 3 and 4 are to allow Gazebo Sim class formatting where each | ||
# function / method must have an access specifier. | ||
# | ||
# | ||
# 5. [-whitespace/newline] | ||
# An else should appear on the same line as the preceding } | ||
# | ||
# Allow: | ||
# } | ||
# else if (time > this->dataPtr->lastUpdateTime) | ||
# { | ||
# | ||
# Instead of: | ||
# } else if (time > this->dataPtr->lastUpdateTime) { | ||
# | ||
# 6. [-build/include_subdir] | ||
# Include the directory when naming header files | ||
# | ||
# This prevent an error when including the plugin headers as: | ||
# #include "GimbalSmall2dPlugin.hh" | ||
# | ||
# 7. [-build/c++11], [+build/c++14] | ||
# | ||
# This is to allow headers not approved for C++11 such as <chrono> etc. | ||
# | ||
set noparent | ||
filter=-whitespace/braces,-runtime/references,-whitespace/indent,-whitespace/blank_line,-whitespace/newline,-build/include_subdir,-build/c++11,+build/c++14 | ||
linelength=80 | ||
root=include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.