-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Static Analysis for JPL Coding Guidelines (#1742)
* Added JPL Coding Standard workflow * Trigger queries * Clean up config file * Fix devel branch name
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: "CodeQL JPL Coding Standard - Errors and Warnings" | ||
|
||
disable-default-queries: true | ||
|
||
packs: | ||
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C | ||
- codeql/cpp-queries:JPL_C | ||
|
||
query-filters: | ||
- exclude: | ||
problem.severity: | ||
- recommendation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "CodeQL JPL Coding Standard - Recommendations 1 of 2" | ||
|
||
disable-default-queries: true | ||
|
||
packs: | ||
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C | ||
- codeql/cpp-queries:JPL_C | ||
|
||
query-filters: | ||
- exclude: | ||
problem.severity: | ||
- error | ||
- warning | ||
# We are excluding the following query because it overflows the limit of | ||
# 5000 results that the SARIF upload can handle | ||
# This sole query is ran in jpl-standard-pack-3.yml | ||
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions | ||
- exclude: | ||
id: | ||
- cpp/jpl-c/basic-int-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "CodeQL JPL Coding Standard - Recommendations 2 of 2" | ||
|
||
disable-default-queries: true | ||
|
||
packs: | ||
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C | ||
- codeql/cpp-queries:JPL_C | ||
|
||
query-filters: | ||
# This will ONLY include the following query | ||
- include: | ||
id: | ||
- cpp/jpl-c/basic-int-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Semantic code analysis with CodeQL | ||
# see https://github.com/github/codeql-action | ||
|
||
name: "JPL Coding Standard Scan" | ||
|
||
on: | ||
push: | ||
branches: [ master, devel ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ master, devel ] | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'cpp' ] | ||
config-file: ['jpl-standard-pack-1.yml', 'jpl-standard-pack-2.yml', 'jpl-standard-pack-3.yml'] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# Run jobs in parallel for each config-file | ||
config-file: ./.github/actions/codeql/${{ matrix.config-file }} | ||
|
||
- name: Build | ||
run: | | ||
python3 -m venv ./fprime-venv | ||
. ./fprime-venv/bin/activate | ||
pip install -U setuptools setuptools_scm wheel pip | ||
pip install -r ./requirements.txt | ||
fprime-util generate | ||
fprime-util build --all | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |