forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a build with clang-tidy enabled. (googleapis#87)
This fixes googleapis#22. The clang-tidy build needs cmake >= 3.6 run at all, and cmake >= 3.8 to get the exit status used by the cmake builds. Fedora 27 has all the right tools pre-built, so we use it there. Also introduced a clang-tidy configuration that everybody can use in their own builds, and we can fine tune over time.
- Loading branch information
Showing
8 changed files
with
80 additions
and
24 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 @@ | ||
--- | ||
# Configure clang-tidy for this project. | ||
|
||
# Disabled: | ||
# -google-readability-namespace-comments the BIGTABLE_CLIENT_NS is a macro, and | ||
# clang-tidy fails to match it against the initial value. | ||
Checks: google-readability-*,modernize-*,readability-*,-google-readability-namespace-comments | ||
|
||
# Enable most warnings as errors. | ||
WarningsAsErrors: clang-*,google-*,modernize-*,readability-*,-readability-identifier-naming | ||
|
||
CheckOptions: | ||
- { key: readability-identifier-naming.NamespaceCase, value: lower_case } | ||
- { key: readability-identifier-naming.ClassCase, value: CamelCase } | ||
- { key: readability-identifier-naming.StructCase, value: CamelCase } | ||
- { key: readability-identifier-naming.FunctionCase, value: CamelCase } | ||
- { key: readability-identifier-naming.VariableCase, value: lower_case } | ||
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } | ||
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } | ||
- { key: readability-identifier-naming.MacroDefinition, value: UPPER_CASE } | ||
- { key: readability-identifier-naming.TemplateParameter, value: CamelCase } |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2017 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if (${CMAKE_VERSION} VERSION_LESS "3.6") | ||
message(STATUS "clang-tidy is not enabled because cmake version is too old") | ||
else () | ||
if (${CMAKE_VERSION} VERSION_LESS "3.8") | ||
message(WARNING "clang-tidy exit code ignored in this version of cmake") | ||
endif () | ||
find_program( | ||
CLANG_TIDY_EXE | ||
NAMES "clang-tidy" | ||
DOC "Path to clang-tidy executable" | ||
) | ||
|
||
if (NOT CLANG_TIDY_EXE) | ||
message(STATUS "clang-tidy not found.") | ||
else () | ||
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") | ||
endif () | ||
endif () |