Skip to content

Commit

Permalink
Merge pull request #25 from martelkr/17-add-clang-tidy
Browse files Browse the repository at this point in the history
add clang-tidy action
  • Loading branch information
martelkr authored Sep 6, 2023
2 parents 5b01df1 + 6ff17ae commit 0a9d5da
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 115 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Checks: >
readability-*,performance-*,misc-*,concurrency-*,clang-analyzer-*,bug-prone-*,modernize-*
CheckOptions:
- {key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp, value: expr-type}
35 changes: 35 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: clang-tidy

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

jobs:
ClangTidy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ssrobins/install-cmake@v1

- name: Install Openssl
run: sudo apt-get install -y openssl clang-tidy

- name: Install gtest
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a

- name: Write files
env:
FILE_ONE: ${{ secrets.KRM_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_SCND_FILE }}
run: |
echo "${FILE_ONE}" | base64 --decode > ${HOME}/key.pem |
echo "${FILE_TWO}" | base64 --decode > ${HOME}/scert.crt
- name: Run clang-tidy
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON |
clang-tidy -p ${{github.workspace}}/build inc/cppsocket.hpp
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22.1)
cmake_minimum_required (VERSION 3.16)

set(CMAKE_CXX_STANDARD 20)

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
![cppcheck Build](https://github.com/martelkr/cppsocket/actions/workflows/cppcheck.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/martelkr/cppsocket/badge.svg?branch=main)](https://coveralls.io/github/martelkr/cppsocket?branch=main)
![cpp-linter](https://github.com/martelkr/cppsocket/actions/workflows/linter.yml/badge.svg)
![Address Sanitization](https://github.com/martelkr/cppsocket/actions/workflows/addressSanitization.yml/badge.svg)
![Code QL](https://github.com/martelkr/cppsocket/actions/workflows/codeql.yml/badge.svg)
![Clang Tidy](https://github.com/martelkr/cppsocket/actions/workflows/clang-tidy.yml/badge.svg)

## About
This is a header file only implementation of a C++ client/server with or without SSL/TLS/DTLS.
Expand All @@ -29,7 +32,7 @@ Create a TCP server object for accepting TCP connections.

```cpp
// default no SSL and not IP/port bound
TCPServer();
TCPServer(void);

// default SSL and not IP/port bound
TCPServer(const std::string& keyFile, const std::string& certFile);
Expand Down Expand Up @@ -75,7 +78,7 @@ Create a UDP server object for accepting UDP connections.
```cpp
// default constructor creates unbound unsecure UDP server socket
UDPServer();
UDPServer(void);
// default DTLS constructor create unbound UDP server socket ready for DTLS
// NOTE: UDPServer s("", ""); results in unbound unsecure UDP server socket
Expand All @@ -94,7 +97,7 @@ Create a UDP client object to connect to a known UDP server.
```cpp

// default constructor creates unconnected UDP client socket
UDPClient();
UDPClient(void);

// creates UDP client socket connected to UDP server
UDPClient(const std::string& remoteIp, const uint16_t remotePort);
Expand Down
Loading

0 comments on commit 0a9d5da

Please sign in to comment.