Skip to content

Commit

Permalink
Updating submodule references
Browse files Browse the repository at this point in the history
  • Loading branch information
Figueroa committed Aug 5, 2024
1 parent 0539508 commit 4095156
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/hk
2 changes: 1 addition & 1 deletion apps/lc
2 changes: 1 addition & 1 deletion apps/md
2 changes: 1 addition & 1 deletion apps/mm
25 changes: 25 additions & 0 deletions 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 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>
2 changes: 1 addition & 1 deletion runCFSscript.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

cfs_apps=( apps/sch_lab apps/ci_lab apps/to_lab apps/sample_app tools/cFS-GroundSystem tools/elf2cfetbl tools/tblCRCTool apps/cf apps/cs apps/ds apps/fm apps/hk apps/hs apps/lc apps/md apps/mm apps/sc )
cfs_apps=( apps/sch_lab apps/ci_lab apps/to_lab apps/sample_app tools/cFS-GroundSystem tools/elf2cfetbl tools/tblCRCTool apps/cf apps/cs apps/ds apps/fm apps/hk apps/hs apps/lc apps/md apps/mm apps/sc cfe )
scriptNums=( 1 2 3 4 5 6 7 8 )

# Process each element to get the substring after the last '/'
Expand Down
41 changes: 41 additions & 0 deletions scripts/static-analysis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# cd cert_testbed
DIR=$(pwd) # Save the current working directory to DIR
applist="cf cs ds fm hk hs lc md mm sc"
app=$1
make distclean

# # change directory to app to be tested
# if [[ " $applist " =~ " $app " ]]; then
# cd apps/${app}
# else
# cd ${app}
# fi

# default
cppcheck_xslt_path="nasa/cFS/main/.github/scripts"
source="${app}"

if [ ${app} = "osal" ]; then
cmake_project_options="-DENABLE_UNIT_TESTS=TRUE -DOSAL_OMIT_DEPRECATED=TRUE -DOSAL_SYSTEM_BSPTYPE=generic-linux"
else
cmake_project_options=""
fi

# Fetch conversion XSLT
wget -O cppcheck-xml2text.xslt https://github.com/raw/${cppcheck_xslt_path}/cppcheck-xml2text.xslt
wget -O cppcheck-merge.xslt https://github.com/raw/${cppcheck_xslt_path}/cppcheck-merge.xslt


# For a CMake-based project, get the list of files by setting up a build with CMAKE_EXPORT_COMPILE_COMMANDS=ON and
# referencing the compile_commands.json file produced by the tool. This will capture the correct include paths and
# compile definitions based on how the source is actually compiled.
if [ -n "$cmake_project_options" ]; then
# CMake Setup
cmake -DCMAKE_INSTALL_PREFIX=$DIR/staging -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=debug ${cmake_project_options} -S ${source} -B build
export CPPCHECK_OPTS="--project=\"${DIR}/build/compile_commands.json\""
else
# Non-CMake Setup
export CPPCHECK_OPTS="${DIR}/${source}"
echo ${CPPCHECK_OPTS}
fi

0 comments on commit 4095156

Please sign in to comment.