Skip to content

Commit

Permalink
apply clang-tidy include cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
eliogovea committed Mar 8, 2024
1 parent 0f14f3f commit fe3254a
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 40 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ name: CMake

on:
push:
branches: [ "main", "dev" ]
branches: ["main", "dev"]
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
branches: ["main"]

jobs:
build:
Expand All @@ -18,28 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt install libgtest-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
--toolchain cmake/toolchain/gcc.cmake \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build \
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- uses: actions/checkout@v3

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --extra-verbose
- name: Install dependencies
run: sudo apt install libgtest-dev

- name: make-clang-debug
run: cmake --workflow --preset make-clang-debug
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "make-base",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"DNS_ENABLE_FORMATTING": true
},
Expand Down
7 changes: 6 additions & 1 deletion sources/dns_decode.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#include "dns_decode.hpp"

#include <arpa/inet.h>
#include <netinet/in.h>

#include <cstdint>
#include <cstring>
#include <optional>
#include <span>
#include <vector>

#include "dns.hpp"
#include "dns_name.hpp"
#include "dns_record.hpp"

namespace DNS {
auto Decode(std::uint8_t const* msg_ptr,
Expand Down
6 changes: 3 additions & 3 deletions sources/dns_decode_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iterator>
#include <utility>
#include <vector>
#include <cstddef>
#include <cstdint>

#include "dns.hpp"
#include "dns_decode.hpp"

extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
Expand Down
6 changes: 6 additions & 0 deletions sources/dns_decode_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include <cstdint>
#include <vector>

#include <gtest/gtest.h>

#include "dns.hpp"
#include "dns_decode.hpp"
#include "dns_name.hpp"
#include "dns_record.hpp"

TEST(dns_decoder, decode_16_bits_integer)
{
Expand Down
9 changes: 8 additions & 1 deletion sources/dns_encode.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#include "dns_encode.hpp"

#include <arpa/inet.h>
#include <netinet/in.h>

#include <cstdint>
#include <cstring>
#include <iterator>
#include <numeric>
#include <span>

#include "dns.hpp"
#include "dns_name.hpp"
#include "dns_record.hpp"

namespace DNS {
Header MakeHeader(Message const& message)
Expand Down
7 changes: 7 additions & 0 deletions sources/dns_encode_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include <cstdint>
#include <iterator>
#include <vector>

#include <gtest/gtest.h>

#include "dns.hpp"
#include "dns_record.hpp"

#include "dns_encode.hpp"

TEST(dns_encoder, encode_record)
Expand Down
6 changes: 6 additions & 0 deletions sources/dns_name.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include "dns_name.hpp"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <span>
#include <string>
#include <variant>

namespace DNS {
auto ToNameView(Name const& name) -> NameView
Expand Down
5 changes: 3 additions & 2 deletions sources/dns_name_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iterator>
#include <utility>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>

#include "dns_name.hpp"
Expand Down
6 changes: 6 additions & 0 deletions sources/dns_name_test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#include <array>
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>

#include <gtest/gtest.h>

#include "dns_name.hpp"
Expand Down
2 changes: 2 additions & 0 deletions sources/dns_record.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "dns_record.hpp"

#include <variant>

namespace DNS {
auto ToRecordDataView(RecordData const& data) -> RecordDataView
{
Expand Down
9 changes: 6 additions & 3 deletions sources/dns_resolver_testapp.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#include <linux/socket.h>

#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>

#include <array>
#include <cstdint>
#include <cstdlib>
#include <format>
#include <iomanip>
#include <iostream>
#include <span>
#include <vector>

#include "dns.hpp"
#include "dns_decode.hpp"
#include "dns_encode.hpp"
#include "dns_name.hpp"
#include "dns_record.hpp"

void HexDump(std::ostream& output, std::span<std::uint8_t const> const& data)
{
Expand Down

0 comments on commit fe3254a

Please sign in to comment.