Skip to content
Draft
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
36 changes: 35 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,40 @@ jobs:
exit 1
fi

# CML file extensions are .hh for header files and .cc for source files.
- name: File extensions are correct
run: |
wrong_extensions=(
c
h
cpp cxx cp "c++"
hpp hxx hp "h++"
tpp txx thh th
)
declare -A forbidden
for ext in "${wrong_extensions[@]}"; do
forbidden["$ext"]=1
done

violating_files=()
while IFS= read -r basename; do
[[ "$basename" != *.* ]] && continue
ext="${basename##*.}"
ext="${ext,,}"
if [[ -n "${forbidden[$ext]:-}" ]]; then
violating_files+=("$basename")
fi
done < <(git ls-files | awk -F/ '{print $NF}')

violations=${#violating_files[@]}
if [[ $violations -gt 0 ]]; then
echo "Incorrect extension found for $violations file(s)."
printf '\t%s\n' "${violating_files[@]}" | tee file-extension-issues.log
echo
echo "Headers must use .hh and source files must use .cc"
fi
exit "$violations"

- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -231,4 +265,4 @@ jobs:
name: clang-tidy-failure-logs
path: clang-tidy.log
if-no-files-found: warn
retention-days: 2
retention-days: 2
2 changes: 1 addition & 1 deletion models/dynamics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ add_cml_tests(
dynamics

SOURCES
mass_derivative_dynamics/tests/test_mass_derivative_dynamics.cpp
mass_derivative_dynamics/test/test_mass_derivative_dynamics.cc
)
2 changes: 1 addition & 1 deletion models/environment/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ add_cml_library(
atmos/atmosphere_models/DRWP_atmos/include/lookup_winds.hh
atmos/atmosphere_models/simple_lookup_wind/include/simple_lookup_wind.hh
atmos/atmosphere_models/std_atmos_1976/include/std_atmos_1976.hh
atmos/atmosphere_models/std_atmos_1976/src/std_atmos_formula.h
atmos/atmosphere_models/std_atmos_1976/src/std_atmos_formula.hh
atmos/first_order_hold/include/first_order_hold.hh
atmos/gust/include/gust.hh
atmos/lagged_atmosphere/include/lagged_atmos_payload_data.hh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The source code WriteBinFile.cpp will generate the *.bin files if they ever
The source code write_bin_file.cc will generate the *.bin files if they ever
need to be modified.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ReadBinFile
ReadEntireBinFile
WriteBinFile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
all : ReadBinFile WriteBinFile ReadEntireBinFile

ReadBinFile : ReadBinFile.cpp
g++ -g -std=c++17 -Wall -Wextra -Werror -o ReadBinFile ReadBinFile.cpp -I.
ReadBinFile : read_bin_file.cc
g++ -g -std=c++17 -Wall -Wextra -Werror -o ReadBinFile read_bin_file.cc -I.

ReadEntireBinFile : ReadEntireBinFile.cpp
g++ -g -std=c++17 -Wall -Wextra -Werror -o ReadEntireBinFile ReadEntireBinFile.cpp -I.
ReadEntireBinFile : read_entire_bin_file.cc
g++ -g -std=c++17 -Wall -Wextra -Werror -o ReadEntireBinFile read_entire_bin_file.cc -I.

WriteBinFile : WriteBinFile.cpp
g++ -g -std=c++17 -Wall -Wextra -Werror -o WriteBinFile WriteBinFile.cpp -I.
WriteBinFile : write_bin_file.cc
g++ -g -std=c++17 -Wall -Wextra -Werror -o WriteBinFile write_bin_file.cc -I.

zap :
rm ReadBinFile ReadEntireBinFile WriteBinFile *.o
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ int main() {
std::cout.precision(std::numeric_limits<double>::digits10);

filename = "DRWP_6dependentvariables.bin";
int num_variables = 6;
int nProfiles = 3;
int nAltitudes = 5;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ASSUMPTIONS AND LIMITATIONS:
#include "cml/models/utilities/cml_message/include/cml_message.hh"

#include "../include/std_atmos_1976.hh"
#include "std_atmos_formula.h"
#include "std_atmos_formula.hh"


STD1976::STD1976()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LIBRARY DEPENDENCIES:
#include "cml/models/utilities/cml_message/include/cml_message.hh"

#include "../include/std_atmos_1976.hh"
#include "std_atmos_formula.h"
#include "std_atmos_formula.hh"


const double STD1976::min_valid_alt = -5000.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

********************************************************************************/

#ifndef CML_STD_ATMOS_FORMULA_H
#define CML_STD_ATMOS_FORMULA_H
#ifndef CML_STD_ATMOS_FORMULA_HH
#define CML_STD_ATMOS_FORMULA_HH

#include <cassert>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion models/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ add_cml_tests(
tools

SOURCES
unit_test/models/tests/test_unit_framework.cc
unit_test/models/test/test_unit_framework.cc
)
2 changes: 1 addition & 1 deletion models/utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ add_cml_library(
constraint_check/include/valset_constraint.hh
convert_string/include/convert_string.hh
double_to_words/include/convert_double_to_words.hh
env_utils/include/env_utils.h
env_utils/include/env_utils.hh
fault_arch/include/sSensorFaults.hh
fault_management/include/fault.hh
fault_management/include/fault_bias.hh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef CML_ENV_UTILS_H
#define CML_ENV_UTILS_H
#ifndef CML_ENV_UTILS_HH
#define CML_ENV_UTILS_HH

#include <cstdlib>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion models/utilities/env_utils/verif/SIM_verif/S_define
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Purpose:(The sim)
#define bad_env_variable "fhglkjdehglk"

// Include headers for classes that this class contains:
##include "cml/models/utilities/env_utils/include/env_utils.h"
##include "cml/models/utilities/env_utils/include/env_utils.hh"
##include <stdexcept>
##include <string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
when using JIT input files.

Consequently, we have implemented the test run as a JIT-input files in
input.cpp ***AS A DEVELOPMENT TEMPLATE ONLY *** to provide
input.cc ***AS A DEVELOPMENT TEMPLATE ONLY *** to provide
a guide as to how to implement the features of this model in an integrated
simulation. However, the automated test runs ***DOES NOT USE*** this JIT-compiled
implementations because we need to get code-coverage metrics from the
Expand All @@ -27,7 +27,7 @@
verif.framework.data_file_name = "Unit_test_data/data.txt"


'Here is the call that replaces input.cpp'
'Here is the call that replaces input.cc'
verif.jit_input_replacement()

verif.manager.enabled = True
Expand Down
4 changes: 2 additions & 2 deletions trickified/S_source.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PROGRAMMERS:
#include "cml/models/environment/atmos/atmosphere_models/DRWP_atmos/include/lookup_winds.hh"
#include "cml/models/environment/atmos/atmosphere_models/simple_lookup_wind/include/simple_lookup_wind.hh"
#include "cml/models/environment/atmos/atmosphere_models/std_atmos_1976/include/std_atmos_1976.hh"
#include "cml/models/environment/atmos/atmosphere_models/std_atmos_1976/src/std_atmos_formula.h"
#include "cml/models/environment/atmos/atmosphere_models/std_atmos_1976/src/std_atmos_formula.hh"
#include "cml/models/environment/atmos/first_order_hold/include/first_order_hold.hh"
#include "cml/models/environment/atmos/gust/include/gust.hh"
#include "cml/models/environment/atmos/lagged_atmosphere/include/lagged_atmos_payload_data.hh"
Expand Down Expand Up @@ -130,7 +130,7 @@ PROGRAMMERS:
#include "cml/models/utilities/constraint_check/include/valset_constraint.hh"
#include "cml/models/utilities/convert_string/include/convert_string.hh"
#include "cml/models/utilities/double_to_words/include/convert_double_to_words.hh"
#include "cml/models/utilities/env_utils/include/env_utils.h"
#include "cml/models/utilities/env_utils/include/env_utils.hh"
#include "cml/models/utilities/fault_arch/include/sSensorFaults.hh"
#include "cml/models/utilities/fault_management/include/fault_bias.hh"
#include "cml/models/utilities/fault_management/include/fault_function.hh"
Expand Down
Loading