Add and fix cpplint whitespace/comments (#434)

* Add whitespace/comments check

* Adapt spacing in clang-format

* Fix cpplint whitespace/comments issues

* Grammar

* Do not use clang-format for comment spacing

* Fix with clang-format pre-commit hook
This commit is contained in:
Christoph Bachhuber 2020-03-06 06:04:59 +01:00 committed by GitHub
parent ba68040e92
commit d8a5bdc294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 170 additions and 174 deletions

View File

@ -75,7 +75,7 @@ SortIncludes: true
# SpaceBeforeAssignmentOperators: true # SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never SpaceBeforeParens: Never
# SpaceInEmptyParentheses: false # SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1 SpacesBeforeTrailingComments: 2
# SpacesInAngles: false # SpacesInAngles: false
# SpacesInContainerLiterals: true # SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false # SpacesInCStyleCastParentheses: false

View File

@ -1,7 +1,7 @@
set noparent set noparent
linelength=120 # As in .clang-format linelength=120 # As in .clang-format
# Non-used filters # Unused filters
filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers
filter=-readability/nolint # Conflicts with clang-tidy filter=-readability/nolint # Conflicts with clang-tidy
filter=-runtime/references # Requires fundamental change of API, don't see need for this filter=-runtime/references # Requires fundamental change of API, don't see need for this
@ -9,6 +9,3 @@ filter=-whitespace/blank_line # Unnecessarily strict with blank lines that othe
filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers filter=-whitespace/indent # Requires strange 3-space indent of private/protected/public markers
filter=-whitespace/parens,-whitespace/braces # Conflict with clang-format filter=-whitespace/parens,-whitespace/braces # Conflict with clang-format
# Filters to be included in future
filter=-whitespace/comments

View File

@ -727,8 +727,8 @@ class Option : public OptionBase<Option> {
/// Will include / prefer the positional name if positional is true. /// Will include / prefer the positional name if positional is true.
/// If all_options is false, pick just the most descriptive name to show. /// If all_options is false, pick just the most descriptive name to show.
/// Use `get_name(true)` to get the positional name (replaces `get_pname`) /// Use `get_name(true)` to get the positional name (replaces `get_pname`)
std::string get_name(bool positional = false, //<[input] Show the positional name std::string get_name(bool positional = false, ///< Show the positional name
bool all_options = false //<[input] Show every option bool all_options = false ///< Show every option
) const { ) const {
if(get_group().empty()) if(get_group().empty())
return {}; // Hidden return {}; // Hidden

View File

@ -780,7 +780,7 @@ class Transformer : public Validator {
// if the type does not have first_type and second_type, these are both value_type // if the type does not have first_type and second_type, these are both value_type
using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed
using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map
using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones
// (const char * to std::string) // (const char * to std::string)
// Make a local copy of the filter function, using a std::function if not one already // Make a local copy of the filter function, using a std::function if not one already
@ -838,10 +838,9 @@ class CheckedTransformer : public Validator {
// if the type does not have first_type and second_type, these are both value_type // if the type does not have first_type and second_type, these are both value_type
using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed using element_t = typename detail::element_type<T>::type; // Removes (smart) pointers if needed
using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map using item_t = typename detail::pair_adaptor<element_t>::first_type; // Is value_type if not a map
using local_item_t = typename IsMemberType<item_t>::type; // This will convert bad types to good ones using local_item_t = typename IsMemberType<item_t>::type; // Will convert bad types to good ones
// (const char * to std::string) // (const char * to std::string)
using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair // using iteration_type_t = typename detail::pair_adaptor<element_t>::value_type; // the type of the object pair
// the type of the object pair
// Make a local copy of the filter function, using a std::function if not one already // Make a local copy of the filter function, using a std::function if not one already
std::function<local_item_t(local_item_t)> filter_fn = filter_function; std::function<local_item_t(local_item_t)> filter_fn = filter_function;