Skip to content
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
50 changes: 0 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,56 +159,6 @@ jobs:
sudo apt-get install -y gcc-arm-none-eabi
- run: arm-none-eabi-gcc -Ilib/cavl/ libudpard/*.c -c -std=${{matrix.std}} ${{ env.flags }}

sonar:
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts24.4.3
if: >
(
(github.event_name == 'pull_request' || contains(github.ref, '/main') || contains(github.ref, '/release')) &&
!contains(github.event.head_commit.message, '#yolo')
) || (
contains(github.event.head_commit.message, '#sonar')
)
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: "zulu"
# language=bash
- run: |
clang --version
- name: Install Sonar tools
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
# language=bash
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
# Sonar is not run on builds originating from forks due to secrets not being available (avoids errors).
# language=bash
- run: |
[ -z "$SONAR_TOKEN" ] || tools/run_sonar.sh
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/
retention-days: 3

style_check:
if: github.event_name == 'push'
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## Standards

The library shall be implemented in ISO C99/C11 following MISRA C:2012.
The MISRA compliance is enforced by Clang-Tidy and SonarQube.
Deviations are documented directly in the source code as follows:

```c
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Cyphal/UDP transport in C

[![Main Workflow](https://github.com/OpenCyphal-Garage/libudpard/actions/workflows/main.yml/badge.svg)](https://github.com/OpenCyphal-Garage/libudpard/actions/workflows/main.yml)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=libudpard&metric=reliability_rating)](https://sonarcloud.io/summary?id=libudpard)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=libudpard&metric=coverage)](https://sonarcloud.io/summary?id=libudpard)
[![Forum](https://img.shields.io/discourse/users.svg?server=https%3A%2F%2Fforum.opencyphal.org&color=1700b3)](https://forum.opencyphal.org)

</div>
Expand Down Expand Up @@ -66,11 +64,10 @@ standards-compliant C99 compiler is available.

## Revisions

### v3.0 -- WORK IN PROGRESS
### v3.0.alpha

The library has been redesigned from scratch to support Cyphal v1.1 and named topics.
No porting guide is provided since the changes are too significant;
please refer to the new API docs in `libudpard/udpard.h`.
The main intended use case is with [**Cy**](https://github.com/OpenCyphal-Garage/cy) rather than standalone.

### v2.0

Expand Down
14 changes: 7 additions & 7 deletions libudpard/udpard.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
/// To disable assertion checks completely, make it expand into `(void)(0)`.
#ifndef UDPARD_ASSERT
// Intentional violation of MISRA: assertion macro cannot be replaced with a function definition.
#define UDPARD_ASSERT(x) assert(x) // NOSONAR
#define UDPARD_ASSERT(x) assert(x)
#endif

#if __STDC_VERSION__ < 201112L
// Intentional violation of MISRA: static assertion macro cannot be replaced with a function definition.
#define static_assert(x, ...) typedef char _static_assert_gl(_static_assertion_, __LINE__)[(x) ? 1 : -1] // NOSONAR
#define _static_assert_gl(a, b) _static_assert_gl_impl(a, b) // NOSONAR
#define static_assert(x, ...) typedef char _static_assert_gl(_static_assertion_, __LINE__)[(x) ? 1 : -1]
#define _static_assert_gl(a, b) _static_assert_gl_impl(a, b)
// Intentional violation of MISRA: the paste operator ## cannot be avoided in this context.
#define _static_assert_gl_impl(a, b) a##b // NOSONAR
#define _static_assert_gl_impl(a, b) a##b
#endif

#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
Expand All @@ -36,8 +36,8 @@

#define CAVL2_T udpard_tree_t
#define CAVL2_RELATION int32_t
#define CAVL2_ASSERT(x) UDPARD_ASSERT(x) // NOSONAR
#include "cavl2.h" // NOSONAR
#define CAVL2_ASSERT(x) UDPARD_ASSERT(x)
#include "cavl2.h"

typedef unsigned char byte_t; ///< For compatibility with platforms where byte size is not 8 bits.

Expand Down Expand Up @@ -135,7 +135,7 @@ static const byte_t* deserialize_u32(const byte_t* ptr, uint32_t* const out_valu
UDPARD_ASSERT((ptr != NULL) && (out_value != NULL));
*out_value = 0;
for (size_t i = 0; i < 4U; i++) {
*out_value |= (uint32_t)((uint32_t)*ptr << (i * 8U)); // NOLINT(google-readability-casting) NOSONAR
*out_value |= (uint32_t)((uint32_t)*ptr << (i * 8U)); // NOLINT(google-readability-casting)
ptr++;
}
return ptr;
Expand Down
75 changes: 0 additions & 75 deletions tools/run_sonar.sh

This file was deleted.

Loading