Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Github Actions Code Scanner #1739

Merged
merged 3 commits into from
Oct 27, 2022
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
19 changes: 19 additions & 0 deletions .github/actions/codeql/security-pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "CodeQL security and quality"

queries:
- uses: security-and-quality

query-filters:
- include:
id: cpp/incorrect-not-operator-usage
- include:
tags contain: correctness
- include:
tags contain: reliability

paths-ignore:
- docs/
- cmake/docs/
- cmake/test/
- Autocoders/Python/src/fprime_ac/utils/DiffAndRename.py
- Autocoders/Python/src/fprime_ac/utils/pyparsing.py
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ cntx
cobj
CODEFILE
codegen
codeql
colno
COLORSTYLE
colorwheel
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/codeql-security-scan.yml
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: "CodeQL Security 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', 'python' ]

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 }}
config-file: ./.github/actions/codeql/security-pack.yml

- if: ${{ matrix.language == 'cpp' }}
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
with:
category: "/language:${{matrix.language}}"
5 changes: 1 addition & 4 deletions Autocoders/Python/src/fprime_ac/generators/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,10 +1318,7 @@ def subThreadModuleFirstCap(self, mod_id):
and no '_' in string form.
"""
mod_id_list = mod_id.strip("_").split("_")
if len(mod_id_list) == 1:
mod_id_cap = mod_id[0].upper() + mod_id[1:]
elif len(mod_id_list) == 2:
mod_id_cap = [x[0].upper() + x[1:] for x in mod_id_list]
mod_id_cap = [x[0].upper() + x[1:] for x in mod_id_list]
# size of mod_id list error in subThreadDir method.
mod_id_cap_str = "".join(mod_id_cap)
return mod_id_cap_str
Expand Down