Skip to content

Commit

Permalink
add codechecker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
driftregion committed Jan 25, 2025
1 parent 96f4f12 commit 723be05
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Static Analysis

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


jobs:
build:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v3

- name: generate compile commands
run: bazel run //:lib_compile_commands

- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
logfile: ${{ github.workspace }}/compile_commands.json

- uses: actions/upload-artifact@v2
with:
name: "CodeChecker Bug Reports"
path: ${{ steps.codechecker.outputs.result-html-dir }}
38 changes: 37 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ refresh_compile_commands(
}
)

refresh_compile_commands(
name = "example_compile_commands",
targets = {
"//examples/linux_rdbi_wdbi:all": "",
}
)

refresh_compile_commands(
name = "lib_compile_commands",
targets = {
"//:iso14229": "",
}
)

cc_library(
name = "iso14229",
srcs = [
"iso14229.c",
"iso14229.h",
],
defines = [
"UDS_LINES",
]
)

py_binary(
name="amalgamate",
srcs=["amalgamate.py"],
Expand All @@ -33,4 +58,15 @@ genrule(
],
outs = ["iso14229.zip"],
cmd = "mkdir iso14229 && cp -L $(SRCS) iso14229/ && zip -r $(OUTS) iso14229",
)
)

# genrule(
# name = "cppcheck",
# srcs = [
# "iso14229.c",
# "iso14229.h",
# ".cppcheck/misra.json",
# ],
# outs = ["cppcheck.xml"],
# cmd = "cppcheck --xml --addon=.cppcheck/misra.json $(location iso14229.h) $(location iso14229.c) 2> $(OUTS)",
# )
2 changes: 1 addition & 1 deletion src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static UDSErr_t SendRequest(UDSClient_t *client) {

if (client->_options_copy & UDS_SUPPRESS_POS_RESP) {
// UDS-1:2013 8.2.2 Table 11
client->send_buf[1] |= 0x80;
client->send_buf[1] |= 0x80U;
}

changeState(client, kRequestStateSending);
Expand Down
1 change: 1 addition & 0 deletions src/tp/isotp_mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ UDSTp_t *ISOTPMockNew(const char *name, ISOTPMockArgs_t *args) {
return NULL;
}
ISOTPMock_t *tp = malloc(sizeof(ISOTPMock_t));
memset(tp, 0, sizeof(ISOTPMock_t));
if (name) {
strncpy(tp->name, name, sizeof(tp->name));
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "sys.h"
#include "config.h"
#include "util.h"
#include "uds.h"

Expand Down

0 comments on commit 723be05

Please sign in to comment.