Skip to content

Commit

Permalink
chore: use PyPI clang-format package, pinned (#647)
Browse files Browse the repository at this point in the history
* chore: use PyPI clang-format package, pinned

* style: pre-commit.ci fixes

* ci: drop unneeded job

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
henryiii and pre-commit-ci[bot] authored Sep 29, 2021
1 parent 81b092e commit 3b95b94
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ on:
- master

jobs:
pre-commit:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

cuda-build:
name: CUDA build only
runs-on: ubuntu-latest
Expand Down
15 changes: 3 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ci:
autoupdate_commit_msg: "chore(deps): pre-commit.ci autoupdate"
autofix_commit_msg: "style: pre-commit.ci fixes"
skip:
- docker-clang-format


repos:
Expand All @@ -23,17 +21,10 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: local
- repo: https://github.com/ssciwr/clang-format-hook
rev: v12.0.1
hooks:
- id: docker-clang-format
name: Docker Clang Format
language: docker_image
types:
- c++
entry: unibeautify/clang-format:latest
args:
- -style=file
- -i
- id: clang-format

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
Expand Down
8 changes: 4 additions & 4 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3169,25 +3169,25 @@ struct AppFriend {
#ifdef CLI11_CPP14

/// Wrap _parse_short, perfectly forward arguments and return
template <typename... Args> static decltype(auto) parse_arg(App *app, Args &&... args) {
template <typename... Args> static decltype(auto) parse_arg(App *app, Args &&...args) {
return app->_parse_arg(std::forward<Args>(args)...);
}

/// Wrap _parse_subcommand, perfectly forward arguments and return
template <typename... Args> static decltype(auto) parse_subcommand(App *app, Args &&... args) {
template <typename... Args> static decltype(auto) parse_subcommand(App *app, Args &&...args) {
return app->_parse_subcommand(std::forward<Args>(args)...);
}
#else
/// Wrap _parse_short, perfectly forward arguments and return
template <typename... Args>
static auto parse_arg(App *app, Args &&... args) ->
static auto parse_arg(App *app, Args &&...args) ->
typename std::result_of<decltype (&App::_parse_arg)(App, Args...)>::type {
return app->_parse_arg(std::forward<Args>(args)...);
}

/// Wrap _parse_subcommand, perfectly forward arguments and return
template <typename... Args>
static auto parse_subcommand(App *app, Args &&... args) ->
static auto parse_subcommand(App *app, Args &&...args) ->
typename std::result_of<decltype (&App::_parse_subcommand)(App, Args...)>::type {
return app->_parse_subcommand(std::forward<Args>(args)...);
}
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ class Option : public OptionBase<Option> {
/// Use `get_name(true)` to get the positional name (replaces `get_pname`)
std::string get_name(bool positional = false, ///< Show the positional name
bool all_options = false ///< Show every option
) const {
) const {
if(get_group().empty())
return {}; // Hidden

Expand Down
12 changes: 6 additions & 6 deletions include/CLI/Validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ class IsMember : public Validator {

/// This allows in-place construction using an initializer list
template <typename T, typename... Args>
IsMember(std::initializer_list<T> values, Args &&... args)
IsMember(std::initializer_list<T> values, Args &&...args)
: IsMember(std::vector<T>(values), std::forward<Args>(args)...) {}

/// This checks to see if an item is in a set (empty function)
Expand Down Expand Up @@ -728,7 +728,7 @@ class IsMember : public Validator {

/// You can pass in as many filter functions as you like, they nest (string only currently)
template <typename T, typename... Args>
IsMember(T &&set, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other)
IsMember(T &&set, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
: IsMember(
std::forward<T>(set),
[filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },
Expand All @@ -745,7 +745,7 @@ class Transformer : public Validator {

/// This allows in-place construction
template <typename... Args>
Transformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&... args)
Transformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&...args)
: Transformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {}

/// direct map of std::string to std::string
Expand Down Expand Up @@ -789,7 +789,7 @@ class Transformer : public Validator {

/// You can pass in as many filter functions as you like, they nest
template <typename T, typename... Args>
Transformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other)
Transformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
: Transformer(
std::forward<T>(mapping),
[filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },
Expand All @@ -803,7 +803,7 @@ class CheckedTransformer : public Validator {

/// This allows in-place construction
template <typename... Args>
CheckedTransformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&... args)
CheckedTransformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&...args)
: CheckedTransformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {}

/// direct map of std::string to std::string
Expand Down Expand Up @@ -865,7 +865,7 @@ class CheckedTransformer : public Validator {

/// You can pass in as many filter functions as you like, they nest
template <typename T, typename... Args>
CheckedTransformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other)
CheckedTransformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
: CheckedTransformer(
std::forward<T>(mapping),
[filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },
Expand Down

0 comments on commit 3b95b94

Please sign in to comment.