diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 56d4b2571515f53573bf33bac5f0e4fa8aeccf67..85be87ff55ddba5a7d840fb6fa24c258fdb90aae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,16 +42,12 @@ coverage: # special pipeline for master with coverage report - cd build - cmake .. -DCMAKE_BUILD_TYPE=Coverage - cmake --build . -- -j4 - - ctest -j4 -V >& test.log || gzip -v -9 -S .gz test.log + - ctest -j4 -V - cmake --build . --target coverage && tar czf coverage-report.tar.gz coverage-report artifacts: expire_in: 1 year paths: - build/coverage-report.tar.gz - - build/test.log.gz - reports: - junit: - - build/test_outputs/junit*.xml only: - master diff --git a/Documentation/Examples/boundary_example.cc b/Documentation/Examples/boundary_example.cc index d97c504a41f48af0d3a178aa212c257890a14acd..c8532185a0484c1df13a353fc15b4362b6793840 100644 --- a/Documentation/Examples/boundary_example.cc +++ b/Documentation/Examples/boundary_example.cc @@ -52,7 +52,6 @@ using namespace corsika::environment; using namespace std; using namespace corsika::units::si; - template <bool deleteParticle> struct MyBoundaryCrossingProcess : public BoundaryCrossingProcess<MyBoundaryCrossingProcess<deleteParticle>> { diff --git a/Documentation/Examples/cascade_proton_example.cc b/Documentation/Examples/cascade_proton_example.cc index beb3693212fab2abedd8425ec8e1f0b8960e248c..c917d9b4360c6663fd7c4ee6e63b8fed73217e93 100644 --- a/Documentation/Examples/cascade_proton_example.cc +++ b/Documentation/Examples/cascade_proton_example.cc @@ -58,7 +58,6 @@ using namespace corsika::environment; using namespace std; using namespace corsika::units::si; - // // The example main program for a particle cascade // diff --git a/Processes/ParticleCut/ParticleCut.cc b/Processes/ParticleCut/ParticleCut.cc index 28e7013d08d864471de08c742250b3ecb4357760..1c9ad8c671ade7fdfbc056be1d7f4eb8df38708b 100644 --- a/Processes/ParticleCut/ParticleCut.cc +++ b/Processes/ParticleCut/ParticleCut.cc @@ -27,7 +27,7 @@ namespace corsika::process { auto const energyLab = vP.GetEnergy(); // nuclei if (vP.GetPID() == particles::Code::Nucleus) { - // calculate energy per nucleon + // calculate energy per nucleon auto const ElabNuc = energyLab / vP.GetNuclearA(); return (ElabNuc < fECut); } else { diff --git a/Processes/SwitchProcess/SwitchProcess.h b/Processes/SwitchProcess/SwitchProcess.h index fd13021d23e72f7981968e2e0f16a9f47fc039fd..4a251b360f7b4855619d2165512475adba3e8c38 100644 --- a/Processes/SwitchProcess/SwitchProcess.h +++ b/Processes/SwitchProcess/SwitchProcess.h @@ -1,3 +1,13 @@ +/* + * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #ifndef _corsika_SwitchProcess_h #define _corsika_SwitchProcess_h diff --git a/Processes/SwitchProcess/testSwitchProcess.cc b/Processes/SwitchProcess/testSwitchProcess.cc index 4e902e8857367bfbb4d1ab7643941cdcce27c04c..be3ced44fe2c9f3ffdf66d5a1d3ab70c0ba25189 100644 --- a/Processes/SwitchProcess/testSwitchProcess.cc +++ b/Processes/SwitchProcess/testSwitchProcess.cc @@ -1,3 +1,13 @@ +/* + * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #include <corsika/process/switch_process/SwitchProcess.h> #include <corsika/stack/SecondaryView.h> #include <corsika/stack/Stack.h> @@ -160,15 +170,15 @@ TEST_CASE("SwitchProcess from InteractionProcess") { // high energy process creates 2 secondaries SECTION("SelectInteraction") { - typename SimpleStack::ParticleType theParticle = - stack.GetNextParticle(); // as in corsika::Cascade - StackTestView view(theParticle); - auto projectile = view.GetProjectile(); + typename SimpleStack::ParticleType theParticle = + stack.GetNextParticle(); // as in corsika::Cascade + StackTestView view(theParticle); + auto projectile = view.GetProjectile(); - InverseGrammageType invLambda = 0 / kgMSq; - switchProcess.SelectInteraction(p, projectile, 0.01 / kgMSq, invLambda); + InverseGrammageType invLambda = 0 / kgMSq; + switchProcess.SelectInteraction(p, projectile, 0.01 / kgMSq, invLambda); - REQUIRE(view.GetSize() == 2); + REQUIRE(view.GetSize() == 2); } } } @@ -196,27 +206,27 @@ TEST_CASE("SwitchProcess from ProcessSequence") { } SECTION("SelectInteraction") { - std::vector<int> numberOfSecondaries; + std::vector<int> numberOfSecondaries; - for (int i = 0; i < 1000; ++i) { - typename SimpleStack::ParticleType theParticle = - stack.GetNextParticle(); // as in corsika::Cascade - StackTestView view(theParticle); - auto projectile = view.GetProjectile(); + for (int i = 0; i < 1000; ++i) { + typename SimpleStack::ParticleType theParticle = + stack.GetNextParticle(); // as in corsika::Cascade + StackTestView view(theParticle); + auto projectile = view.GetProjectile(); - double r = i / 1000.; - InverseGrammageType invLambda = r * 7./4 / kgMSq; + double r = i / 1000.; + InverseGrammageType invLambda = r * 7. / 4 / kgMSq; - InverseGrammageType accumulator = 0 / kgMSq; - completeSeq.SelectInteraction(p, projectile, invLambda, accumulator); + InverseGrammageType accumulator = 0 / kgMSq; + completeSeq.SelectInteraction(p, projectile, invLambda, accumulator); - numberOfSecondaries.push_back(view.GetSize()); - } + numberOfSecondaries.push_back(view.GetSize()); + } - auto const mean = - std::accumulate(numberOfSecondaries.cbegin(), numberOfSecondaries.cend(), 0.) / - numberOfSecondaries.size(); - REQUIRE(mean == Approx(12./7.).margin(0.01)); + auto const mean = + std::accumulate(numberOfSecondaries.cbegin(), numberOfSecondaries.cend(), 0.) / + numberOfSecondaries.size(); + REQUIRE(mean == Approx(12. / 7.).margin(0.01)); } } diff --git a/do-clang-format.sh b/do-clang-format.sh index ebfcb2322063638db155308dfb1c5d45272324f9..816ef19bdb0646f8d1de7ac9703fa8ccb156adfe 100755 --- a/do-clang-format.sh +++ b/do-clang-format.sh @@ -4,7 +4,12 @@ command="clang-format -style=file `find . -iregex '^.*\.\(cc\|h\)$' -not -path ' if [ "$1" == "check" ]; then - ! ${command} -output-replacements-xml | grep -c "<replacement " -else + `! ${command} -output-replacements-xml | grep -qc "<replacement "` || \ + { echo "format-check FAILED!"; exit $ERRCODE; } + echo "Congratulations: format-check succeeded" +elif [ "$1" == "apply" ]; +then ${command} -i +else + echo "please use: ./do-clang-format.sh [check] or [apply]" fi