Skip to content

Commit

Permalink
Merge pull request #1219 from astrogeco/format-checks
Browse files Browse the repository at this point in the history
Fix #1161, #1130 Apply and check standard code format
  • Loading branch information
astrogeco authored Mar 16, 2021
2 parents 2b88448 + 9aee2c5 commit 7f8e475
Show file tree
Hide file tree
Showing 219 changed files with 21,278 additions and 26,621 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Format Check

# Run on main push and pull requests
on:
push:
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ script:
cat cppcheck_flight_cfe.txt
exit -1
fi
44 changes: 22 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@
# This will build cFS for all target machine(s) defined by the mission
#
# Note that the target CPUs may use different architectures, therefore each
# architecture must be done as a separate sub-build since none of the binaries
# architecture must be done as a separate sub-build since none of the binaries
# can be shared.
#
# This is actually two build scripts in one:
# - A "top-level" script which divides the overall build by architecture
# (This is run when TARGETSYSTEM is unset)
# - An architecture-specific build that generates the binaries
# - An architecture-specific build that generates the binaries
# (This is run when TARGETSYSTEM is set)
#
# This file implements the common operation sequence between the mission build
# and the architecture-specific sub build. It relies on several functions
# and the architecture-specific sub build. It relies on several functions
# that are implemented in a separate include files:
#
# initialize_globals:
# This function sets up the basic global variables such as MISSION_SOURCE_DIR,
# MISSIONCONFIG, ENABLE_UNIT_TESTS, SIMULATION and others. These are the
# basic variables that must exist _before_ the mission configuration is read.
#
# read_targetconfig:
#
# initialize_globals:
# This function sets up the basic global variables such as MISSION_SOURCE_DIR,
# MISSIONCONFIG, ENABLE_UNIT_TESTS, SIMULATION and others. These are the
# basic variables that must exist _before_ the mission configuration is read.
#
# read_targetconfig:
# Parse the information from targets.cmake and create the build lists. Note
# this function is common to both mission and arch-specific builds.
#
# this function is common to both mission and arch-specific builds.
#
# prepare:
# Use the information in the target config to set up additional variables
# and satisfy any preequisites for targets. Most importantly this stage
# is reposible for finding the actual location of all source files for apps
# listed in the mission configuration, along with collecting any supplemental
# sources, such as EDS files or additional compiler flags.
#
# sources, such as EDS files or additional compiler flags.
#
# process_arch:
# This is called multiple times, once for each CPU architecture specfied in
# the main targets.cmake file. At the mission level, this creates a sub
# project target using the correct toolchain for cross compile. In the arch
# specific level (inside the sub-project) it generates the actual library and
# executable targets.
#
#
#
##########################################################################

# Squelch a warning when building on Win32/Cygwin
Expand All @@ -53,7 +53,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE

# The minimum CMake version is chosen because v3.5.1 is what is
# available by default with Ubuntu 16.04 LTS at the time of development
# RHEL/CentOS users should install the "cmake3" package from EPEL repo
# RHEL/CentOS users should install the "cmake3" package from EPEL repo
cmake_minimum_required(VERSION 3.5)

# This top-level file does not define ANY targets directly but we know
Expand All @@ -69,20 +69,20 @@ enable_testing()
# Include the global routines
include("cmake/global_functions.cmake")

# Load a sub-script that defines the other functions,
# Load a sub-script that defines the other functions,
# depending on whether TARGETSYSTEM is defined or not
if (TARGETSYSTEM)
# Arch-specific/CPU build mode -- use the "arch_build" implementation
set(IS_CFS_ARCH_BUILD TRUE)
set(IS_CFS_ARCH_BUILD TRUE)
include("cmake/arch_build.cmake")
else (TARGETSYSTEM)
# Host System/Top Level build mode -- use the "mission_build" implementation
set(IS_CFS_MISSION_BUILD TRUE)
set(IS_CFS_MISSION_BUILD TRUE)
include("cmake/mission_build.cmake")
endif (TARGETSYSTEM)

# Call the initialization function defined by the sub-script
# This is implemented differently depending on whether this is a
# This is implemented differently depending on whether this is a
# top-level or arch-specific build
initialize_globals()

Expand All @@ -92,7 +92,7 @@ initialize_globals()
# file may override as necessary.
include("cmake/mission_defaults.cmake")
include(${MISSION_DEFS}/targets.cmake)

# Scan the list of targets and organize by target system type.
read_targetconfig()

Expand All @@ -115,7 +115,7 @@ elseif (IS_CFS_MISSION_BUILD)
endif (IS_CFS_ARCH_BUILD)

# Call the prepare function defined by the sub-script
# This is implemented differently depending on whether this is a
# This is implemented differently depending on whether this is a
# top-level or arch-specific build
prepare()

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: v6.8.0-rc1+dev412

- Apply standard code style and format
- Add new continuous integration workflow to enforce this format
- See <https://github.com/nasa/cFE/pull/1219>

### Development Build: v6.8.0-rc1+dev402

- HOTFIX 20210312, updates to work with older CMake
Expand Down
Loading

0 comments on commit 7f8e475

Please sign in to comment.