Skip to content

Commit

Permalink
test bad format
Browse files Browse the repository at this point in the history
  • Loading branch information
wardru committed Feb 4, 2024
1 parent 2df9ff1 commit 641d206
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Format
run: |
./scripts/format.sh
./scripts/format.sh --check
build:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(cmake/compiler.cmake)
include(cmake/format.cmake)
include(cmake/lib.cmake)

find_package(spdlog REQUIRED)
Expand Down
19 changes: 0 additions & 19 deletions cmake/format.cmake

This file was deleted.

10 changes: 5 additions & 5 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--format)
FORMAT_OPTIONS=true
FORMAT_OPTION=true
shift
shift
;;
--check)
CHECK_OPTIONS=true
CHECK_OPTION=true
shift
shift
;;
Expand All @@ -35,18 +35,18 @@ while [[ $# -gt 0 ]]; do
esac
done

if [ "$FORMAT_OPTIONS" == false ] && [ "$CHECK_OPTIONS" == false ]; then
if [ "$FORMAT_OPTION" == false ] && [ "$CHECK_OPTION" == false ]; then
echo "No options provided. Please provide either --format or --check."
exit 1
fi

if [ "$FORMAT_OPTIONS" == true ]
if [ "$FORMAT_OPTION" == true ]
then
echo "Formatting code..."
$CLANG_FORMAT_PATH --style=file -i $SOURCE_FILES
fi

if [ "$CHECK_OPTIONS" == true ]
if [ "$CHECK_OPTION" == true ]
then
echo "Checking code formatting..."
$CLANG_FORMAT_PATH --style=file -output-replacements-xml $SOURCE_FILES | grep "<replacement " &> /dev/null && echo "Error! Code is not well formatted." && exit 1 || echo "Format OK" && exit 0
Expand Down
2 changes: 1 addition & 1 deletion source/core/interface.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct itf_impl {
int send_message(const nlohmann::json &data);

itf_info info;
std::string topic_base;
std::string topic_base;
std::string topic_cmd;
mqtt_service *mqtt;
std::unordered_map<std::string, attribute::s_ptr> attributes;
Expand Down

0 comments on commit 641d206

Please sign in to comment.