From 3512c4ea42947241a2ade706678370d741cf2cde Mon Sep 17 00:00:00 2001 From: martintc Date: Sat, 31 Oct 2020 11:12:41 -0700 Subject: [PATCH 1/4] Changed full word help option '-help' to '--help' as per issue #19. --- cfe_ts_crc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index 5209f6d..db33774 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -133,7 +133,7 @@ int main(int argc, char **argv) char buffer[100]; /* check for valid input */ - if ((argc != 2) || (strncmp(argv[1], "-help", 100) == 0)) + if ((argc != 2) || (strncmp(argv[1], "--help", 100) == 0)) { printf("\ncFE TS CRC calculator for LRO files."); printf("\nUsage: cfe_ts_crc [filename]\n"); From 77427a40cdea26fe0d1c389ee79698b37d53d4d7 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 3 Feb 2021 09:10:24 -0500 Subject: [PATCH 2/4] Fix #31, 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 22bc0ff..1152a07 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![Static Analysis](https://github.com/nasa/tblCRCTool/workflows/Static%20Analysis/badge.svg) +![Format Check](https://github.com/nasa/tblCRCTool/workflows/Format%20Check/badge.svg) + # Core Flight System : Framework : Tool : Table CRC Generator This repository contains NASA's Table CRC Generator Tool (tblCRCTool), which is a framework component of the Core Flight System. From 1245c41a4d87277134af1ea0047d9ac0b7443af6 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 8 Feb 2021 14:42:32 -0500 Subject: [PATCH 3/4] Fix #33, 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..d0aa629 --- /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: tools/tblCRCTool + + - 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 tools/tblCRCTool/ + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From edcf316848f6818d14d3d1fbaaec3cc8e624b47f Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Tue, 16 Feb 2021 10:33:02 -0500 Subject: [PATCH 4/4] Bump to v1.2.0-rc1+dev19 Also apply clang-format --- README.md | 7 +++++++ cfe_ts_crc.c | 1 - cfe_ts_crc_version.h | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1152a07..e3883ec 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,13 @@ This lab application is a ground utility to generate binary table CRCs for cFS. ## Version Notes +### Development Build: 1.2.0-rc1+dev19 + +- Changes CLI "help" option to use two dashes: `--help` +- Adds static analysis and format check to continuous integration workflow. Adds workflow status badges to ReadMe. +- Adds CodeQL Analysis to continuous integration workflow. +- See + ### Development Build: 1.2.0-rc1+dev12 - Documentation: Add `Security.md` with instructions on reporting vulnerabilities diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index 0b6806f..0eba5d4 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -98,7 +98,6 @@ uint32 CalculateCRC(void *DataPtr, uint32 DataLength, uint32 InputCRC) } return (Crc); - } int main(int argc, char **argv) diff --git a/cfe_ts_crc_version.h b/cfe_ts_crc_version.h index 0da92f5..0895201 100644 --- a/cfe_ts_crc_version.h +++ b/cfe_ts_crc_version.h @@ -31,7 +31,7 @@ /* * Development Build Macro Definitions */ -#define CFE_TS_CRC_BUILD_NUMBER 12 /*!< @brief Number of commits since baseline */ +#define CFE_TS_CRC_BUILD_NUMBER 19 /*!< @brief Number of commits since baseline */ #define CFE_TS_CRC_BUILD_BASELINE \ "v1.2.0+dev" /*!< @brief Development Build: git tag that is the base for the current */ @@ -40,9 +40,11 @@ */ #define CFE_TS_CRC_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define CFE_TS_CRC_MINOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ -#define CFE_TS_CRC_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased development version. */ +#define CFE_TS_CRC_REVISION \ + 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. A value of "99" indicates an unreleased \ + development version. */ -#define CFE_TS_CRC_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ +#define CFE_TS_CRC_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ /* * Tools to construct version string @@ -61,10 +63,10 @@ * @details Reports the current development build's baseline, number, and name. Also includes a note about the latest * official version. @n See @ref cfsversions for format differences between development and release versions. */ -#define CFE_TS_CRC_VERSION_STRING \ - " cFE TS CRC calculator (tblCRCtool) \n" \ - " DEVELOPMENT BUILD \n" \ - " " CFE_TS_CRC_VERSION " \n" \ - " Last Offical Release: tblCRCtool v3.1.0" /* For full support please use official release version */ +#define CFE_TS_CRC_VERSION_STRING \ + " cFE TS CRC calculator (tblCRCtool) \n" \ + " DEVELOPMENT BUILD \n" \ + " " CFE_TS_CRC_VERSION " \n" \ + " Last Offical Release: tblCRCtool v3.1.0" /* For full support please use official release version */ #endif /* CFE_TS_CRC_VERSION_H */