forked from ls1mardyn/ls1-mardyn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ls1mardyn#260 from ls1mardyn/codeCleanup
Code cleanup (using namespace std)
- Loading branch information
Showing
550 changed files
with
8,176 additions
and
8,183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Static-Code-Analysis | ||
|
||
on: | ||
push: | ||
# pushes to master | ||
branches: [ master ] | ||
pull_request: | ||
# PRs to master | ||
branches: [ master ] | ||
|
||
jobs: | ||
static_analysis: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y cpplint | ||
- name: Run static code analysis script | ||
run: ./checks/run-staticAnalysis.sh $PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
# Script to test the building process by altering through different build options | ||
# It uses the default settings and sets the specified options one by one | ||
|
||
numJobs=20 | ||
|
||
checkFolder=$PWD | ||
buildFolder=$PWD/../build_test_$(date '+%Y-%m-%d') | ||
|
||
declare -A optionsList | ||
|
||
optionsList[ENABLE_MPI]=ON | ||
optionsList[VECTOR_INSTRUCTIONS]=SSE | ||
optionsList[VECTOR_INSTRUCTIONS]=AVX2 | ||
optionsList[CMAKE_BUILD_TYPE]=Debug | ||
optionsList[OPENMP]=ON | ||
optionsList[ENABLE_AUTOPAS]=ON | ||
optionsList[ENABLE_UNIT_TESTS]=ON | ||
optionsList[QUICKSCHED]=ON | ||
optionsList[FMM_FFT]=ON | ||
optionsList[WITH_PAPI]=ON | ||
optionsList[ENABLE_ALLLBL]=ON | ||
optionsList[ENABLE_VTK]=ON | ||
optionsList[REDUCED_MEMORY_MODE]=ON | ||
|
||
|
||
# CMAKE | ||
mkdir -p $buildFolder | ||
cd $buildFolder | ||
|
||
echo "Running CMAKE in folder: $buildFolder" | ||
|
||
for option in "${!optionsList[@]}" | ||
do | ||
echo " Running option: ${option}=${optionsList[${option}]}" | ||
rm $buildFolder/* -rf | ||
( CC=mpicc CXX=mpicxx cmake -D${option}=${optionsList[${option}]} .. && make -j${numJobs} ; echo "$?" ) &> $checkFolder/build_test_cmake_${option}.log | ||
done | ||
|
||
|
||
# MAKE | ||
cd $checkFolder/../src | ||
|
||
echo "Running make in src" | ||
|
||
for option in "${!optionsList[@]}" | ||
do | ||
echo " Running option: ${option}=${optionsList[${option}]}" | ||
make clean &> /dev/null | ||
( make -j${numJobs} -f Makefile ${option}=${optionsList[${option}]} ; echo "$?" ) &> $checkFolder/build_test_make_${option}.log | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
# Script to run static code analysis | ||
|
||
#set strict pipefail option | ||
#set -eo pipefail | ||
|
||
# A path to the root folder of ls1 mardyn can be set via an argument; if not, the parent folder of "checks" is used | ||
if [ $# -eq 1 ] | ||
then | ||
rootFolder=$1 | ||
else | ||
rootFolder=$PWD/.. | ||
fi | ||
|
||
echo "Running in $rootFolder" | ||
|
||
warnings="" | ||
|
||
codeFiles=$( find $rootFolder/src -name "*.h" -or -name "*.cpp" -printf "%p " ) | ||
|
||
# Similar to check_format of MegaMol repo | ||
for file in $codeFiles; do | ||
|
||
# Check if using namespace std is used | ||
if grep -q "using namespace std;" "$file"; then | ||
echo "\"using namespace std;\" was used in $file" | ||
warnings+="Do not use \"using namespace std;\"\n" | ||
fi | ||
|
||
# Check if using Log::global_log is used | ||
if grep -q "using Log::global_log;" "$file"; then | ||
echo "\"using Log::global_log;\" was used in $file" | ||
warnings+="Do not use \"using Log::global_log;\"\n" | ||
fi | ||
|
||
# Check if file is UTF-8 (or ASCII) | ||
encoding=$(file -b --mime-encoding "$file") | ||
if [[ $encoding != "us-ascii" && $encoding != "utf-8" ]]; then | ||
echo "The following file is not ASCII/UTF-8 encoded: $file ($encoding)" | ||
echo " Fix with:" | ||
echo " tmp_file=\$(mktemp)" | ||
echo " iconv -f \"\$(file -b --mime-encoding \"$file\")\" -t utf-8 -o \"\$tmp_file\" \"\$file\"" | ||
echo " mv -f \"\$tmp_file\" \"\$file\"" | ||
warnings+="At least one file is not ASCII/UTF-8 encoded\n" | ||
fi | ||
|
||
# Check if file contains CRLF line endings | ||
fileinfo=$(file -k "$file") | ||
if [[ $fileinfo == *"CRLF"* ]]; then | ||
echo "The following file contains CRLF line endings: $file" | ||
echo " Fix with:" | ||
echo " sed -i 's/\r$//' \"$file\"" | ||
sed -i 's/\r$//' "$file" | ||
warnings+="At least one file contains CRLF line endings\n" | ||
fi | ||
|
||
# Check if file starts with BOM | ||
if [[ $fileinfo == *"BOM"* ]]; then | ||
echo "The following file starts with BOM: $file" | ||
echo " Fix with:" | ||
echo " sed -i '1s/^\xEF\xBB\xBF//' \"$file\"" | ||
warnings+="At least one file starts with BOM\n" | ||
fi | ||
|
||
# Check if file ends with newline | ||
if [[ -n "$(tail -c 1 "$file")" ]]; then | ||
echo "The following file does not end with newline: $file" | ||
echo " Fix with:" | ||
echo " sed -i -e '\$a\' \"$file\"" | ||
warnings+="At least one file does not end with newline\n" | ||
fi | ||
|
||
done | ||
|
||
printf "\n\n\n" # Some space to make output clearer | ||
|
||
# Only print warnings once to job summary | ||
warnings=$(printf "$warnings" | sort | uniq) | ||
warnings="# Warnings\n"$warnings"\n\n" | ||
|
||
printf "\n$warnings\n" # Print to job output | ||
printf "\n$warnings\n" >> $GITHUB_STEP_SUMMARY # Print to job summary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# Testscript running validation tests according to GitHub Actions but without comparison to master | ||
# | ||
# Copyright (c) 2023 Simon Homes | ||
# | ||
|
||
repoPath="$PWD/.." # Path to root directory | ||
|
||
export OMP_NUM_THREADS=2 | ||
|
||
logfileName="${repoPath}/examples/run-validation.log" | ||
rm -f ${logfileName} | ||
|
||
IFS=$'\n' | ||
for i in $(cat "${repoPath}/examples/example-list.txt" ) | ||
do | ||
# skip if comment or empty line | ||
if [[ $i == \#* || -z "$i" ]] | ||
then | ||
continue | ||
fi | ||
cd ${repoPath}/examples/$(dirname $i) | ||
|
||
# run the examples | ||
printf "Running example: ${i} ... " | tee -a ${logfileName} | ||
EXE=${repoPath}/build/src/MarDyn | ||
|
||
mpirun --oversubscribe -np 4 ${EXE} $(basename $i) --steps=20 | tee -a ${logfileName} | ||
printf "done\n" | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.