From e99e1cf09be8a7b25ce4cee1bc93d58de437b55d Mon Sep 17 00:00:00 2001 From: toddmartin Date: Sun, 3 Jan 2021 04:03:51 -0800 Subject: [PATCH 1/4] Remove end of function comments --- fsw/src/to_lab_app.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fsw/src/to_lab_app.c b/fsw/src/to_lab_app.c index 9d11476..ad4132f 100644 --- a/fsw/src/to_lab_app.c +++ b/fsw/src/to_lab_app.c @@ -123,7 +123,7 @@ void TO_Lab_AppMain(void) CFE_ES_ExitApp(RunStatus); -} /* End of TO_Lab_AppMain() */ +} /* ** TO delete callback function. @@ -245,7 +245,7 @@ int32 TO_LAB_init(void) TO_LAB_VERSION_STRING); return CFE_SUCCESS; -} /* End of TO_LAB_init() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -270,7 +270,7 @@ int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data) ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; -} /* End of TO_LAB_EnableOutput() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -312,7 +312,7 @@ void TO_LAB_process_commands(void) return; } } -} /* End of TO_process_commands() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -362,7 +362,7 @@ void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr) ++TO_LAB_Global.HkTlm.Payload.CommandErrorCounter; } -} /* End of TO_exec_local_command() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -386,7 +386,7 @@ int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data) TO_LAB_Global.HkTlm.Payload.CommandErrorCounter = 0; TO_LAB_Global.HkTlm.Payload.CommandCounter = 0; return CFE_SUCCESS; -} /* End of TO_LAB_ResetCounters() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -436,7 +436,7 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data) ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; -} /* End of TO_LAB_SendDataTypes() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -448,7 +448,7 @@ int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data) CFE_SB_TimeStampMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg); CFE_SB_TransmitMsg(&TO_LAB_Global.HkTlm.TlmHeader.Msg, true); return CFE_SUCCESS; -} /* End of TO_LAB_SendHousekeeping() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -468,7 +468,7 @@ void TO_LAB_openTLM(void) /*---------------- Add static arp entries ----------------*/ -} /* End of TO_open_TLM() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -492,7 +492,7 @@ int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data) ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; -} /* End of TO_AddPkt() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -514,7 +514,7 @@ int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data) (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream)); ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; -} /* End of TO_LAB_RemovePacket() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -544,7 +544,7 @@ int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data) ++TO_LAB_Global.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; -} /* End of TO_LAB_RemoveAll() */ +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ @@ -593,7 +593,7 @@ void TO_LAB_forward_telemetry(void) } /* If CFE_SB_status != CFE_SUCCESS, then no packet was received from CFE_SB_ReceiveBuffer() */ } while (CFE_SB_status == CFE_SUCCESS); -} /* End of TO_forward_telemetry() */ +} /************************/ /* End of File Comment */ From 7cdbedf840f8bef6b11cb42c37b4d6dae3fe1180 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 1 Feb 2021 15:59:03 -0500 Subject: [PATCH 2/4] Fix #80, Add static analysis and format check --- .github/workflows/format-check.yml | 53 +++++++++++++++++++++++++++ .github/workflows/static-analysis.yml | 40 ++++++++++++++++++++ README.md | 3 ++ 3 files changed, 96 insertions(+) create mode 100644 .github/workflows/format-check.yml create mode 100644 .github/workflows/static-analysis.yml diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 0000000..0a998ec --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,53 @@ +name: Format Check + +# Run on main push and pull requests +on: + push: + branches: + - main + pull_request: + +jobs: + + static-analysis: + name: Run format check + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + + - name: Install format checker + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' + sudo apt-get update && sudo apt-get install clang-format-10 + + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + + - name: Checkout + uses: actions/checkout@v2 + with: + path: repo + + - name: Generate format differences + run: | + cd repo + find . -name "*.[ch]" -exec clang-format-10 -i -style=file {} + + git diff > $GITHUB_WORKSPACE/style_differences.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: style_differences + path: style_differences.txt + + - name: Error on differences + run: | + if [[ -s style_differences.txt ]]; + then + cat style_differences.txt + exit -1 + fi diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..de318d5 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,40 @@ +name: Static Analysis + +# Run on main push and pull requests +on: + push: + branches: + - main + pull_request: + +jobs: + + static-analysis: + name: Run cppcheck + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + + - name: Install cppcheck + run: sudo apt-get install cppcheck -y + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run general cppcheck + run: cppcheck --force --inline-suppr --quiet . 2> cppcheck_err.txt + + - name: Archive Static Analysis Artifacts + uses: actions/upload-artifact@v2 + with: + name: cppcheck-err + path: ./cppcheck_err.txt + + - name: Check for errors + run: | + if [[ -s cppcheck_err.txt ]]; + then + cat cppcheck_err.txt + exit -1 + fi diff --git a/README.md b/README.md index 8165123..ee75fd9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![Static Analysis](https://github.com/nasa/to_lab/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/to_lab/workflows/Format%20Check/badge.svg) + # Core Flight System : Framework : App : Telemetry Output Lab This repository contains NASA's Telemetry Output Lab (to_lab), which is a framework component of the Core Flight System. From ca0d2436a257db8922d0dab5938296b1ff737b2e Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 8 Feb 2021 15:23:43 -0500 Subject: [PATCH 3/4] Fix #82, Add CodeQL analysis to workflow --- .github/workflows/codeql-build.yml | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/codeql-build.yml diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml new file mode 100644 index 0000000..66ca85a --- /dev/null +++ b/.github/workflows/codeql-build.yml @@ -0,0 +1,55 @@ +name: "CodeQL Analysis" + +on: + push: + branches: + - main + pull_request: + +env: + SIMULATION: native + ENABLE_UNIT_TESTS: true + OMIT_DEPRECATED: true + BUILDTYPE: release + +jobs: + + CodeQL-Build: + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: apps/to_lab + + - name: Check versions + run: git submodule + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: c + queries: +security-extended, security-and-quality + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + # Build the code + - name: Build + run: make to_lab + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From e70e3bdf987f9581252b53e61c375452a1031740 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 16 Feb 2021 10:21:30 -0500 Subject: [PATCH 4/4] Bump to v2.4.0-rc1+dev32 Apply clang-format --- README.md | 7 +++++++ fsw/src/to_lab_app.c | 3 --- fsw/src/to_lab_version.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee75fd9..fa29f74 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,13 @@ To send telemtry to the "ground" or UDP/IP port, edit the subscription table in ## Version History +### Development Build: 2.4.0-rc1+dev32 + +- Removes end-of-function comments in `to_lab_app.c` +- Adds static analysis and code format check to continuous integration workflow. Updates workflow status badges in ReadMe +- Adds CodeQL analysis to continuous integration workflow +- See + ### Development Build: 2.4.0-rc1+dev21 - TO remains command-able after a "remove all subscriptions" command; the command now only removes all subscriptions to the Tlm_pipe diff --git a/fsw/src/to_lab_app.c b/fsw/src/to_lab_app.c index ad4132f..305fbf0 100644 --- a/fsw/src/to_lab_app.c +++ b/fsw/src/to_lab_app.c @@ -122,7 +122,6 @@ void TO_Lab_AppMain(void) } CFE_ES_ExitApp(RunStatus); - } /* @@ -361,7 +360,6 @@ void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr) (unsigned int)CommandCode); ++TO_LAB_Global.HkTlm.Payload.CommandErrorCounter; } - } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -467,7 +465,6 @@ void TO_LAB_openTLM(void) } /*---------------- Add static arp entries ----------------*/ - } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/fsw/src/to_lab_version.h b/fsw/src/to_lab_version.h index bf8ecb3..2858fa2 100644 --- a/fsw/src/to_lab_version.h +++ b/fsw/src/to_lab_version.h @@ -30,7 +30,7 @@ */ /* Development Build Macro Definitions */ -#define TO_LAB_BUILD_NUMBER 21 /*!< Development Build: Number of commits since baseline */ +#define TO_LAB_BUILD_NUMBER 32 /*!< Development Build: Number of commits since baseline */ #define TO_LAB_BUILD_BASELINE \ "v2.4.0-rc1" /*!< Development Build: git tag that is the base for the current development */