Commit 3b95b9440667ef49d43bcd35f0e00375641c8049

Authored by Henry Schreiner
Committed by GitHub
1 parent 81b092e0

chore: use PyPI clang-format package, pinned (#647)

* 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>
.github/workflows/tests.yml
@@ -9,14 +9,6 @@ on: @@ -9,14 +9,6 @@ on:
9 - master 9 - master
10 10
11 jobs: 11 jobs:
12 - pre-commit:  
13 - name: Formatting  
14 - runs-on: ubuntu-latest  
15 - steps:  
16 - - uses: actions/checkout@v2  
17 - - uses: actions/setup-python@v2  
18 - - uses: pre-commit/action@v2.0.3  
19 -  
20 cuda-build: 12 cuda-build:
21 name: CUDA build only 13 name: CUDA build only
22 runs-on: ubuntu-latest 14 runs-on: ubuntu-latest
.pre-commit-config.yaml
1 ci: 1 ci:
2 autoupdate_commit_msg: "chore(deps): pre-commit.ci autoupdate" 2 autoupdate_commit_msg: "chore(deps): pre-commit.ci autoupdate"
3 autofix_commit_msg: "style: pre-commit.ci fixes" 3 autofix_commit_msg: "style: pre-commit.ci fixes"
4 - skip:  
5 - - docker-clang-format  
6 4
7 5
8 repos: 6 repos:
@@ -23,17 +21,10 @@ repos: @@ -23,17 +21,10 @@ repos:
23 - id: mixed-line-ending 21 - id: mixed-line-ending
24 - id: trailing-whitespace 22 - id: trailing-whitespace
25 23
26 -- repo: local 24 +- repo: https://github.com/ssciwr/clang-format-hook
  25 + rev: v12.0.1
27 hooks: 26 hooks:
28 - - id: docker-clang-format  
29 - name: Docker Clang Format  
30 - language: docker_image  
31 - types:  
32 - - c++  
33 - entry: unibeautify/clang-format:latest  
34 - args:  
35 - - -style=file  
36 - - -i 27 + - id: clang-format
37 28
38 - repo: https://github.com/cheshirekow/cmake-format-precommit 29 - repo: https://github.com/cheshirekow/cmake-format-precommit
39 rev: v0.6.13 30 rev: v0.6.13
include/CLI/App.hpp
@@ -3169,25 +3169,25 @@ struct AppFriend { @@ -3169,25 +3169,25 @@ struct AppFriend {
3169 #ifdef CLI11_CPP14 3169 #ifdef CLI11_CPP14
3170 3170
3171 /// Wrap _parse_short, perfectly forward arguments and return 3171 /// Wrap _parse_short, perfectly forward arguments and return
3172 - template <typename... Args> static decltype(auto) parse_arg(App *app, Args &&... args) { 3172 + template <typename... Args> static decltype(auto) parse_arg(App *app, Args &&...args) {
3173 return app->_parse_arg(std::forward<Args>(args)...); 3173 return app->_parse_arg(std::forward<Args>(args)...);
3174 } 3174 }
3175 3175
3176 /// Wrap _parse_subcommand, perfectly forward arguments and return 3176 /// Wrap _parse_subcommand, perfectly forward arguments and return
3177 - template <typename... Args> static decltype(auto) parse_subcommand(App *app, Args &&... args) { 3177 + template <typename... Args> static decltype(auto) parse_subcommand(App *app, Args &&...args) {
3178 return app->_parse_subcommand(std::forward<Args>(args)...); 3178 return app->_parse_subcommand(std::forward<Args>(args)...);
3179 } 3179 }
3180 #else 3180 #else
3181 /// Wrap _parse_short, perfectly forward arguments and return 3181 /// Wrap _parse_short, perfectly forward arguments and return
3182 template <typename... Args> 3182 template <typename... Args>
3183 - static auto parse_arg(App *app, Args &&... args) -> 3183 + static auto parse_arg(App *app, Args &&...args) ->
3184 typename std::result_of<decltype (&App::_parse_arg)(App, Args...)>::type { 3184 typename std::result_of<decltype (&App::_parse_arg)(App, Args...)>::type {
3185 return app->_parse_arg(std::forward<Args>(args)...); 3185 return app->_parse_arg(std::forward<Args>(args)...);
3186 } 3186 }
3187 3187
3188 /// Wrap _parse_subcommand, perfectly forward arguments and return 3188 /// Wrap _parse_subcommand, perfectly forward arguments and return
3189 template <typename... Args> 3189 template <typename... Args>
3190 - static auto parse_subcommand(App *app, Args &&... args) -> 3190 + static auto parse_subcommand(App *app, Args &&...args) ->
3191 typename std::result_of<decltype (&App::_parse_subcommand)(App, Args...)>::type { 3191 typename std::result_of<decltype (&App::_parse_subcommand)(App, Args...)>::type {
3192 return app->_parse_subcommand(std::forward<Args>(args)...); 3192 return app->_parse_subcommand(std::forward<Args>(args)...);
3193 } 3193 }
include/CLI/Option.hpp
@@ -781,7 +781,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -781,7 +781,7 @@ class Option : public OptionBase&lt;Option&gt; {
781 /// Use `get_name(true)` to get the positional name (replaces `get_pname`) 781 /// Use `get_name(true)` to get the positional name (replaces `get_pname`)
782 std::string get_name(bool positional = false, ///< Show the positional name 782 std::string get_name(bool positional = false, ///< Show the positional name
783 bool all_options = false ///< Show every option 783 bool all_options = false ///< Show every option
784 - ) const { 784 + ) const {
785 if(get_group().empty()) 785 if(get_group().empty())
786 return {}; // Hidden 786 return {}; // Hidden
787 787
include/CLI/Validators.hpp
@@ -676,7 +676,7 @@ class IsMember : public Validator { @@ -676,7 +676,7 @@ class IsMember : public Validator {
676 676
677 /// This allows in-place construction using an initializer list 677 /// This allows in-place construction using an initializer list
678 template <typename T, typename... Args> 678 template <typename T, typename... Args>
679 - IsMember(std::initializer_list<T> values, Args &&... args) 679 + IsMember(std::initializer_list<T> values, Args &&...args)
680 : IsMember(std::vector<T>(values), std::forward<Args>(args)...) {} 680 : IsMember(std::vector<T>(values), std::forward<Args>(args)...) {}
681 681
682 /// This checks to see if an item is in a set (empty function) 682 /// This checks to see if an item is in a set (empty function)
@@ -728,7 +728,7 @@ class IsMember : public Validator { @@ -728,7 +728,7 @@ class IsMember : public Validator {
728 728
729 /// You can pass in as many filter functions as you like, they nest (string only currently) 729 /// You can pass in as many filter functions as you like, they nest (string only currently)
730 template <typename T, typename... Args> 730 template <typename T, typename... Args>
731 - IsMember(T &&set, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other) 731 + IsMember(T &&set, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
732 : IsMember( 732 : IsMember(
733 std::forward<T>(set), 733 std::forward<T>(set),
734 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); }, 734 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },
@@ -745,7 +745,7 @@ class Transformer : public Validator { @@ -745,7 +745,7 @@ class Transformer : public Validator {
745 745
746 /// This allows in-place construction 746 /// This allows in-place construction
747 template <typename... Args> 747 template <typename... Args>
748 - Transformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&... args) 748 + Transformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&...args)
749 : Transformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {} 749 : Transformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {}
750 750
751 /// direct map of std::string to std::string 751 /// direct map of std::string to std::string
@@ -789,7 +789,7 @@ class Transformer : public Validator { @@ -789,7 +789,7 @@ class Transformer : public Validator {
789 789
790 /// You can pass in as many filter functions as you like, they nest 790 /// You can pass in as many filter functions as you like, they nest
791 template <typename T, typename... Args> 791 template <typename T, typename... Args>
792 - Transformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other) 792 + Transformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
793 : Transformer( 793 : Transformer(
794 std::forward<T>(mapping), 794 std::forward<T>(mapping),
795 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); }, 795 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },
@@ -803,7 +803,7 @@ class CheckedTransformer : public Validator { @@ -803,7 +803,7 @@ class CheckedTransformer : public Validator {
803 803
804 /// This allows in-place construction 804 /// This allows in-place construction
805 template <typename... Args> 805 template <typename... Args>
806 - CheckedTransformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&... args) 806 + CheckedTransformer(std::initializer_list<std::pair<std::string, std::string>> values, Args &&...args)
807 : CheckedTransformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {} 807 : CheckedTransformer(TransformPairs<std::string>(values), std::forward<Args>(args)...) {}
808 808
809 /// direct map of std::string to std::string 809 /// direct map of std::string to std::string
@@ -865,7 +865,7 @@ class CheckedTransformer : public Validator { @@ -865,7 +865,7 @@ class CheckedTransformer : public Validator {
865 865
866 /// You can pass in as many filter functions as you like, they nest 866 /// You can pass in as many filter functions as you like, they nest
867 template <typename T, typename... Args> 867 template <typename T, typename... Args>
868 - CheckedTransformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&... other) 868 + CheckedTransformer(T &&mapping, filter_fn_t filter_fn_1, filter_fn_t filter_fn_2, Args &&...other)
869 : CheckedTransformer( 869 : CheckedTransformer(
870 std::forward<T>(mapping), 870 std::forward<T>(mapping),
871 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); }, 871 [filter_fn_1, filter_fn_2](std::string a) { return filter_fn_2(filter_fn_1(a)); },