Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into On-AIR-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
williamzhang0306 committed Jul 10, 2024
2 parents 89da31f + 32eb0f8 commit 56ec60d
Show file tree
Hide file tree
Showing 46 changed files with 1,443 additions and 863 deletions.
16 changes: 2 additions & 14 deletions .github/codeql/codeql-coding-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,5 @@ name: "CodeQL Coding Standard Configuration File"
disable-default-queries: true

queries:
- name: JPL Rules
uses: github/codeql/cpp/ql/src/JPL_C@main
- name: MISRA Rule 9-5-1
uses: github/codeql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 153.ql@main
- name: MISRA Rule 5-18-1
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 168.ql@main
- name: MISRA 6-2-2
uses: github/codeql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 202.ql@main
- name: MISRA Rule 5-14-1
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql@main
- name: MISRA Rule 5-3-2
uses: github/codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql@main
- name: MISRA Rule 7-5-2
uses: github/codeql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 173.ql@main
- name: JPL and MISRA
uses: nasa/cFS/.github/codeql/jpl-misra.qls@main
31 changes: 31 additions & 0 deletions .github/codeql/jpl-misra.qls
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Start with all the queries in the codeql/cpp-queries pack.
- queries: .
from: codeql/cpp-queries
# Restrict to only the queries with the following ID patterns.
- include:
id:
# MISRA Rule 5-3-2
- cpp/jsf/av-rule-173
# MISRA Rule 5-14-1
- cpp/jsf/av-rule-165
# MISRA Rule 5-18-1
- cpp/jsf/av-rule-168
# MISRA 6-2-2
- cpp/jsf/av-rule-202
# JPL Rules
- /cpp/jpl-c/*/
# Exclude queries with too many results
- exclude:
id:
# JPL 14
- cpp/jpl-c/checking-return-values
# JPL 15
- cpp/jpl-c/checking-parameter-values
# JPL 17
- cpp/jpl-c/basic-int-types
# JPL 24
- cpp/jpl-c/multiple-stmts-per-line
- cpp/jpl-c/multiple-var-decls-per-line
# Excluded since cFS use unions judiciously
# MISRA Rule 9-5-1
- cpp/jsf/av-rule-153
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**Checklist (Please check before submitting)**

* [ ] I reviewed the [Contributing Guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md).
* [ ] I signed and emailed the appropriate Contributor License agreement to [email protected] and copied [email protected].
* [ ] I signed and emailed the appropriate [Contributor License Agreement](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla) to [email protected] and copied [email protected].

**Describe the contribution**
A clear and concise description of what the contribution is.
Expand Down Expand Up @@ -31,4 +31,4 @@ The cFS repository is provided to bundle the cFS Framework. It is utilized for

**Contributor Info - All information REQUIRED for consideration of pull request**
Full name and company/organization/center of all contributors ("Personal" if individual work)
- Note CLA's apply to software contributions.
- Note CLAs apply to only software contributions.
25 changes: 25 additions & 0 deletions .github/scripts/cppcheck-merge.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:variable name="merge_items" select="document($merge_file)/results/errors/error" />

<!-- A default template that makes an XML output identical to the input -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<!--
A specific template for the "errors" element, which includes:
all the "error" child elements from this element
all the "error" elements from the merged document
-->
<xsl:template match="results/errors">
<xsl:copy>
<xsl:apply-templates select="error" />
<xsl:apply-templates select="$merge_items" />
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
17 changes: 17 additions & 0 deletions .github/scripts/cppcheck-xml2text.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">## CppCheck <xsl:value-of select="//cppcheck/@version"/> Summary
<xsl:if test="count(//error) > 0">
| error | warning | style | performance | portability | information |
| --- | --- | --- | --- | --- | --- |
| <xsl:value-of select="count(//error[@severity='error'])"/> | <xsl:value-of select="count(//error[@severity='warning'])"/> | <xsl:value-of select="count(//error[@severity='style'])"/> | <xsl:value-of select="count(//error[@severity='performance'])"/> | <xsl:value-of select="count(//error[@severity='portability'])"/> | <xsl:value-of select="count(//error[@severity='information'])"/> |

| severity | location | error id | issue |
| --- | --- | --- | --- |
<xsl:for-each select="results//error">| <xsl:value-of select="@severity"/> | <xsl:value-of select="location/@file"/>:<xsl:value-of select="location/@line"/> | <xsl:value-of select="@id"/> | <xsl:value-of select="@msg"/> |
</xsl:for-each>
</xsl:if>
**<xsl:value-of select="count(//error)"/> error(s) reported**
</xsl:template>
</xsl:stylesheet>
69 changes: 69 additions & 0 deletions .github/scripts/create_ccb_agenda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import subprocess
import json
import sys
import time
import os

# extract pull request data from GitHub
repos = ['cFS', 'cFE', 'osal', 'psp', 'sch_lab', 'ci_lab', 'to_lab', 'sample_app', 'sample_lib', 'elf2cfetbl', 'tblcrctool','cFS-GroundSystem', 'CF', 'CS', 'DS','FM', 'HK', 'HS', 'LC', 'MD', 'MM', 'SC']

for repo in repos:
subprocess.Popen('gh pr list --repo nasa/' + str(repo) + ' --search "draft:false" --json number,author,title,url,additions,deletions,labels | jq -c ' + '\'reduce range(0, length) as $index (.; (.[$index].author=.[$index].author.login | .[$index].number=(.[$index].number|"\'' + str(repo) + '\' PR #\(.)") )) | .[]\' ' + '>> temp.json', shell=True)

time.sleep(5)
subprocess.Popen('jq -s . temp.json > prs.json', shell=True)
time.sleep(5)

# load a list of pull requests as python dictionaries
with open ('prs.json') as prs_file:
prs = json.load(prs_file)

PrData = dict() # {author: [pr1, pr2, pr3, ...]}
AuthorPrChanges = dict() # {author: #TotalChanges}

for pr in prs:
ignore = False
for label in pr['labels']:
if label['name'] == 'CCB:Ignore' or label['name'] == 'CCB:Approved':
ignore = True
break
if ignore == False:
if pr['author'] not in PrData:
PrData[pr['author']] = [pr]
AuthorPrChanges[pr['author']] = pr['additions'] + pr['deletions']
else:
PrData[pr['author']].append(pr)
AuthorPrChanges[pr['author']] += pr['additions'] + pr['deletions']

# no prs to write, exit program
if len(PrData) == 0:
print("Failed to find relevant Pull Requests for the agenda. Exiting...\n")
sys.exit()

# re-order dict according to sum(additions, deletions) of each pr for each author
AuthorPrChanges = {k: v for k, v in sorted(AuthorPrChanges.items(), key=lambda item: item[1])}

# write to markdown
CCBfilename = "CCBAgenda.md"
with open(CCBfilename, 'w') as f:
f.write("## Items for Discussion\n\n")
for author in AuthorPrChanges.keys():
f.write("### @" + author + "\n\n")
for pr_auth in PrData[author]:
if (author == pr_auth['author']):
f.write("[" + pr_auth['number'] + "](" + pr_auth['url'].replace("pull", "issues") + ") " + pr_auth['title'] + "\n\n")

# close files
f.close()
prs_file.close()
time.sleep(5)
try:
os.remove("prs.json")
os.remove("temp.json")
except OSError:
pass

time.sleep(5)

if (os.stat(CCBfilename).st_size != 0):
print("CCB markdown has been successfully created")
10 changes: 10 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Our Workflows

## Reusable Workflows

To reduce duplication, the workflows CodeQL Analysis, Static Analysis, and Format Checker are placed in cFS to be reused in the subrepositories.

CodeQL Analysis and Static Analysis require inputs, therefore, they are called in an additional workflow in cFS to be utilized. Format checker does not need to be reused in cFS because it does not require inputs.

Provided is a diagram of the architecture of the reusable workflows.

![Reusable Workflows Architecture](./Reusable-Workflows-Architecture.svg)

## Deprecated Build, Test, and Run
[![Deprecated Build, Test, and Run](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml/badge.svg)](https://github.com/nasa/cfs/actions/workflows/build-cfs-deprecated.yml)

Expand Down
Loading

0 comments on commit 56ec60d

Please sign in to comment.