Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting CI check #293

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BasedOnStyle: WebKit
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore generated files
./include_all_in_one/*
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,14 @@ jobs:
- name: Build
shell: bash
run: script/ci_build.sh


formatting-check:
name: "formatting"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: DoozyX/clang-format-lint-action@master
name: "Verify formatting"
with:
clangFormatVersion: 16
2 changes: 1 addition & 1 deletion api_search/parse_source_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int main(int argc, char* argv[])
using fplus::transform;
std::cout << "duplicate help names:" << std::endl;
print_duplicates(transform(get_function_help_name, functions));
//print_duplicates(transform(get_function_help_signature, functions));
// print_duplicates(transform(get_function_help_signature, functions));
std::cout << "duplicate help documentations:" << std::endl;
print_duplicates(transform(get_function_help_documentation, functions));
std::cout << "duplicate help declarations:" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions include/fplus/internal/meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace internal {
#ifndef PROVIDE_IS_FUNCTION_POLYFILL
template <class... Any>
using is_function = std::is_function<Any...>;
#else //PROVIDE_IS_FUNCTION_POLYFILL
#else // PROVIDE_IS_FUNCTION_POLYFILL
// primary template
template <class>
struct is_function : std::false_type {
Expand Down Expand Up @@ -161,7 +161,7 @@ namespace internal {
template <class Ret, class... Args>
struct is_function<Ret(Args..., ...) const volatile&&> : std::true_type {
};
#endif //PROVIDE_IS_FUNCTION_POLYFILL
#endif // PROVIDE_IS_FUNCTION_POLYFILL

template <typename>
struct reverse_integer_sequence_impl;
Expand Down
2 changes: 1 addition & 1 deletion script/auto_format.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
(find api_search -name "*.cpp" && find include -name "*.hpp" && find examples -name "*.cpp" && find test -name "*.cpp") | xargs clang-format --style=WebKit -i {}
(find api_search -name "*.cpp" && find include -name "*.hpp" && find examples -name "*.cpp" && find test -name "*.cpp") | xargs clang-format -i {}
4 changes: 2 additions & 2 deletions test/composition_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ TEST_CASE("composition_test - state")
stateAdd(state, 2);
REQUIRE_EQ(state.Get(), 3);

//auto stateAddBoundFPP = Bind1of2(stateAdd, &state); // crashes VC2015 compiler
//stateAddBoundFPP(3);
// auto stateAddBoundFPP = Bind1of2(stateAdd, &state); // crashes VC2015 compiler
// stateAddBoundFPP(3);

auto stateAddBoundStl = std::bind(&CompositionTestState::Add, std::placeholders::_1, std::placeholders::_2);
stateAddBoundStl(state, 3);
Expand Down
4 changes: 2 additions & 2 deletions test/sets_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TEST_CASE("set_test - set functions")
using unordSetVector = std::vector<IntUnordSet>;
using StringUnordSet = std::unordered_set<std::string>;

//std::set tests
// std::set tests
REQUIRE(set_includes(IntSet({ 0, 1, 2, 3 }), IntSet({ 0, 2 })));
REQUIRE_FALSE(set_includes(IntSet({ 0, 2 }), IntSet({ 0, 1, 2, 3 })));
REQUIRE_FALSE(set_includes(IntSet({ 0, 1, 2, 3 }), IntSet({ 2, 3, 4, 5 })));
Expand All @@ -28,7 +28,7 @@ TEST_CASE("set_test - set functions")
REQUIRE_EQ(set_intersection(IntSet({ 0, 1, 2, 3 }), IntSet({ 2, 3, 4, 5 })), IntSet({ 2, 3 }));
REQUIRE_EQ(sets_intersection(setVector({ IntSet({ 0, 1, 2, 3 }), IntSet({ 2, 3, 4, 5 }), IntSet({ 0, 2 }) })), IntSet({ 2 }));

//set::unordered_set tests
// set::unordered_set tests
REQUIRE(unordered_set_includes(IntUnordSet({ 0, 1, 2, 3 }), IntUnordSet({ 0, 2 })));
REQUIRE_FALSE(unordered_set_includes(IntUnordSet({ 0, 2 }), IntUnordSet({ 0, 1, 2, 3 })));
REQUIRE_FALSE(unordered_set_includes(IntUnordSet({ 0, 1, 2, 3 }), IntUnordSet({ 2, 3, 4, 5 })));
Expand Down
2 changes: 1 addition & 1 deletion test/udemy_course_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ std::function<int(int)> decorate_with_logging(const std::string& str, F f)
return [str, f](int x) -> int {
int result = f(x);
// no side effects in tests
//std::cout << str << ": " << x << " => " << result << std::endl;
// std::cout << str << ": " << x << " => " << result << std::endl;
return result;
};
}
Expand Down
12 changes: 6 additions & 6 deletions test/variant_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ TEST_CASE("variant_test - visit")
using namespace fplus;

// should not compile
//int_or_double.visit_one<std::string>(print_string);
// int_or_double.visit_one<std::string>(print_string);

fplus::variant<int, std::string> int_or_string(3);

Expand All @@ -131,24 +131,24 @@ TEST_CASE("variant_test - visit")
std::cout << fplus::show_maybe(y) << std::endl;

// should not compile
//std::cout << int_or_string.visit(show_int, show_float) << std::endl;
// std::cout << int_or_string.visit(show_int, show_float) << std::endl;

// should not compile
//std::cout << int_or_string.visit(show_int, show_int) << std::endl;
// std::cout << int_or_string.visit(show_int, show_int) << std::endl;

// should not compile
//std::cout << int_or_string.visit(show_int, show_string, show_double) << std::endl;
// std::cout << int_or_string.visit(show_int, show_string, show_double) << std::endl;

// should not compile
//std::cout << int_or_string.visit(show_int) << std::endl;
// std::cout << int_or_string.visit(show_int) << std::endl;
}

TEST_CASE("variant_test - effect")
{
using namespace fplus;

// should not compile
//int_or_double.effect_one(print_string);
// int_or_double.effect_one(print_string);

fplus::variant<int, std::string> int_or_string(3);
//
Expand Down