-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add style config and enforce formatting * remove leading underscore from var name
- Loading branch information
1 parent
bb6a707
commit 16b9cd5
Showing
13 changed files
with
188 additions
and
68 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,16 @@ | ||
--- | ||
BasedOnStyle: Google | ||
AccessModifierOffset: '-2' | ||
AlignTrailingComments: 'true' | ||
AllowAllParametersOfDeclarationOnNextLine: 'false' | ||
AlwaysBreakTemplateDeclarations: 'No' | ||
BreakBeforeBraces: Attach | ||
ColumnLimit: '100' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' | ||
IncludeBlocks: Regroup | ||
IndentPPDirectives: AfterHash | ||
IndentWidth: '2' | ||
NamespaceIndentation: All | ||
BreakBeforeBinaryOperators: All | ||
BreakBeforeTernaryOperators: 'true' | ||
... |
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,57 @@ | ||
format: | ||
tab_size: 2 | ||
line_width: 100 | ||
dangle_parens: true | ||
|
||
parse: | ||
additional_commands: | ||
cpmaddpackage: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: CPMAddPackage | ||
kwargs: &cpmaddpackagekwargs | ||
NAME: 1 | ||
FORCE: 1 | ||
VERSION: 1 | ||
GIT_TAG: 1 | ||
DOWNLOAD_ONLY: 1 | ||
GITHUB_REPOSITORY: 1 | ||
GITLAB_REPOSITORY: 1 | ||
GIT_REPOSITORY: 1 | ||
SVN_REPOSITORY: 1 | ||
SVN_REVISION: 1 | ||
SOURCE_DIR: 1 | ||
DOWNLOAD_COMMAND: 1 | ||
FIND_PACKAGE_ARGUMENTS: 1 | ||
NO_CACHE: 1 | ||
GIT_SHALLOW: 1 | ||
URL: 1 | ||
URL_HASH: 1 | ||
URL_MD5: 1 | ||
DOWNLOAD_NAME: 1 | ||
DOWNLOAD_NO_EXTRACT: 1 | ||
HTTP_USERNAME: 1 | ||
HTTP_PASSWORD: 1 | ||
OPTIONS: + | ||
cpmfindpackage: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: CPMFindPackage | ||
kwargs: *cpmaddpackagekwargs | ||
packageproject: | ||
pargs: | ||
nargs: '*' | ||
flags: [] | ||
spelling: packageProject | ||
kwargs: | ||
NAME: 1 | ||
VERSION: 1 | ||
NAMESPACE: 1 | ||
INCLUDE_DIR: 1 | ||
INCLUDE_DESTINATION: 1 | ||
BINARY_DIR: 1 | ||
COMPATIBILITY: 1 | ||
VERSION_HEADER: 1 | ||
DEPENDENCIES: + |
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 @@ | ||
name: Style | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
style: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Install format dependencies | ||
run: | | ||
brew install clang-format | ||
pip3 install cmake_format==0.6.11 pyyaml | ||
- name: configure | ||
run: cmake -Stest/style -Bbuild/style | ||
|
||
- name: check style | ||
run: cmake --build build/style --target check-format |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include <iostream> | ||
#include <dependency/version.h> | ||
|
||
#include <iostream> | ||
|
||
void dependencyFunction() { | ||
std::cout << "Using dependency version " << DEPENDENCY_VERSION << std::endl; | ||
} |
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
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
namespace ns { | ||
|
||
void namespacedDependencyFunction(); | ||
void namespacedDependencyFunction(); | ||
|
||
} |
12 changes: 7 additions & 5 deletions
12
test/namespaced_dependency/source/namespaced_dependency.cpp
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
#include <iostream> | ||
#include <namespaced_dependency/version.h> | ||
|
||
#include <iostream> | ||
|
||
namespace ns { | ||
void namespacedDependencyFunction() { | ||
std::cout << "Using namespaced_dependency version " << NAMESPACED_DEPENDENCY_VERSION << std::endl; | ||
} | ||
} | ||
void namespacedDependencyFunction() { | ||
std::cout << "Using namespaced_dependency version " << NAMESPACED_DEPENDENCY_VERSION | ||
<< std::endl; | ||
} | ||
} // namespace ns |
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,23 @@ | ||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||
|
||
project(StyleCheck) | ||
|
||
set(CPM_DOWNLOAD_VERSION 0.28.1) | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
|
||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) | ||
message(STATUS "Downloading CPM.cmake v${CPM_DOWNLOAD_VERSION}") | ||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} | ||
) | ||
endif() | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) | ||
|
||
CPMAddPackage( | ||
NAME Format.cmake | ||
VERSION 1.6 | ||
GITHUB_REPOSITORY TheLartians/Format.cmake | ||
OPTIONS "FORMAT_CHECK_CMAKE ON" | ||
) |
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