Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add script checking for #pragma once to CI #1866

Merged
merged 6 commits into from
Feb 15, 2023
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ jobs:
- name: Check
run: >
CI/check_include_guards.py . --fail-global --exclude "*thirdparty/*"
pragma_once:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check
run: >
CI/check_pragma_once.sh
boost_test_macro:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 13 additions & 0 deletions CI/check_pragma_once.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

ec=0

for file in $(find Core Examples Tests Plugins -name "*.hpp"); do
res=$(grep -e "^[[:space:]]*#pragma once" $file)
if [[ "$res" != "#pragma once" ]]; then
ec=1
echo "'#pragma once' missing in '$file'"
fi
done

exit $ec
2 changes: 2 additions & 0 deletions Core/include/Acts/Utilities/Zip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <tuple>

namespace Acts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "ActsExamples/Framework/BareAlgorithm.hpp"

namespace ActsExamples {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "ActsExamples/Framework/BareAlgorithm.hpp"

namespace ActsExamples {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#pragma once

#pragma once

#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Plugins/ActSVG/LayerSvgConverter.hpp"
#include "Acts/Plugins/ActSVG/SvgUtils.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Plugins/ExaTrkX/src/weaklyConnectedComponentsCugraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <cerrno>
#include <cstring>
#include <fstream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Plugins/Identification/Identifier.hpp"

Expand Down
2 changes: 2 additions & 0 deletions Tests/IntegrationTests/PropagationDatasets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <boost/test/data/test_case.hpp>

#include "Acts/Definitions/Units.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Tests/IntegrationTests/PropagationTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/NeutralTrackParameters.hpp"
#include "Acts/EventData/TrackParameters.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Core/Geometry/BVHDataTestCase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

namespace bdata = boost::unit_test::data;
using Box = Acts::Volume::BoundingBox;
using Ray = Acts::Ray<double, 3>;
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Core/Geometry/TrackingVolumeCreation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/CylinderLayer.hpp"
#include "Acts/Geometry/CylinderVolumeBounds.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Core/Seeding/ATLASCuts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Seeding/IExperimentCuts.hpp"

#include <algorithm>
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/Core/Surfaces/BoundaryCheckTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"

#include "BoundaryCheckTestsRefs.hpp"

namespace Acts {
namespace Test {
BOOST_AUTO_TEST_SUITE(Surfaces)
Expand Down Expand Up @@ -83,8 +85,6 @@ BOOST_AUTO_TEST_CASE(BoundaryCheckBoxCovariance) {
BOOST_AUTO_TEST_CASE(BoundaryCheckPolyDistance) {
// we check a box again, but this time described as a poly

#include "BoundaryCheckTestsRefs.hpp"

BoundaryCheck bcheck(true);

for (size_t i = 0; i < rectTestPoints.size(); i++) {
Expand Down
44 changes: 22 additions & 22 deletions Tests/UnitTests/Core/Surfaces/BoundaryCheckTestsRefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Definitions/Algebra.hpp"

// clang-format off
std::vector<Vector2> rectVertices = {
Vector2(-2.000000, -1.000000),
Vector2(2.000000, -1.000000),
Vector2(2.000000, 1.000000),
Vector2(-2.000000, 1.000000)
const std::vector<Acts::Vector2> rectVertices = {
{-2.000000, -1.000000},
{2.000000, -1.000000},
{2.000000, 1.000000},
{-2.000000, 1.000000}
};

struct {
const struct {
double xmin = -2;
double xmax = 2;
double ymin = -1;
double ymax = 1;
} rectDimensions;

(void)rectDimensions;

std::vector<Vector2> rectTestPoints = {
const std::vector<Acts::Vector2> rectTestPoints = {
{-3.00, -2.00}, {-3.00, -1.60}, {-3.00, -1.20}, {-3.00, -0.80}, {-3.00, -0.40},
{-3.00, 0.00}, {-3.00, 0.40}, {-3.00, 0.80}, {-3.00, 1.20}, {-3.00, 1.60},
{-3.00, 2.00}, {-2.40, -2.00}, {-2.40, -1.60}, {-2.40, -1.20}, {-2.40, -0.80},
Expand All @@ -50,7 +52,7 @@ std::vector<Vector2> rectTestPoints = {
{3.00, 0.00}, {3.00, 0.40}, {3.00, 0.80}, {3.00, 1.20}, {3.00, 1.60},
{3.00, 2.00}
};
std::vector<Vector2> rectClosestPoints = {
const std::vector<Acts::Vector2> rectClosestPoints = {
{-2.00, -1.00}, {-2.00, -1.00}, {-2.00, -1.00}, {-2.00, -0.80}, {-2.00, -0.40},
{-2.00, 0.00}, {-2.00, 0.40}, {-2.00, 0.80}, {-2.00, 1.00}, {-2.00, 1.00},
{-2.00, 1.00}, {-2.00, -1.00}, {-2.00, -1.00}, {-2.00, -1.00}, {-2.00, -0.80},
Expand All @@ -77,7 +79,7 @@ std::vector<Vector2> rectClosestPoints = {
{2.00, 0.00}, {2.00, 0.40}, {2.00, 0.80}, {2.00, 1.00}, {2.00, 1.00},
{2.00, 1.00}
};
std::vector<double> rectDistances = {
const std::vector<double> rectDistances = {
1.4142135623730951, 1.1661903789690602, 1.019803902718557, 1.0, 1.0, 1.0, 1.0,
1.0, 1.019803902718557, 1.1661903789690602, 1.4142135623730951,
1.0770329614269007, 0.7211102550927979, 0.4472135954999578, 0.3999999999999999,
Expand Down Expand Up @@ -111,23 +113,21 @@ std::vector<double> rectDistances = {
1.1661903789690602, 1.4142135623730951
};

std::vector<Vector2> rectShiftedVertices = {
Vector2(1.000000, 2.000000),
Vector2(3.000000, 2.000000),
Vector2(3.000000, 4.000000),
Vector2(1.000000, 4.000000)
const std::vector<Acts::Vector2> rectShiftedVertices = {
{1.000000, 2.000000},
{3.000000, 2.000000},
{3.000000, 4.000000},
{1.000000, 4.000000}
};

struct {
const struct {
double xmin = 1;
double xmax = 3;
double ymin = 2;
double ymax = 4;
} rectShiftedDimensions;

(void)rectShiftedDimensions;

std::vector<Vector2> rectShiftedTestPoints = {
const std::vector<Acts::Vector2> rectShiftedTestPoints = {
{0.00, 1.50}, {0.00, 1.80}, {0.00, 2.10}, {0.00, 2.40}, {0.00, 2.70},
{0.00, 3.00}, {0.00, 3.30}, {0.00, 3.60}, {0.00, 3.90}, {0.00, 4.20},
{0.00, 4.50}, {0.40, 1.50}, {0.40, 1.80}, {0.40, 2.10}, {0.40, 2.40},
Expand All @@ -154,7 +154,7 @@ std::vector<Vector2> rectShiftedTestPoints = {
{4.00, 3.00}, {4.00, 3.30}, {4.00, 3.60}, {4.00, 3.90}, {4.00, 4.20},
{4.00, 4.50}
};
std::vector<Vector2> rectShiftedClosestPoints = {
const std::vector<Acts::Vector2> rectShiftedClosestPoints = {
{1.00, 2.00}, {1.00, 2.00}, {1.00, 2.10}, {1.00, 2.40}, {1.00, 2.70},
{1.00, 3.00}, {1.00, 3.30}, {1.00, 3.60}, {1.00, 3.90}, {1.00, 4.00},
{1.00, 4.00}, {1.00, 2.00}, {1.00, 2.00}, {1.00, 2.10}, {1.00, 2.40},
Expand All @@ -181,7 +181,7 @@ std::vector<Vector2> rectShiftedClosestPoints = {
{3.00, 3.00}, {3.00, 3.30}, {3.00, 3.60}, {3.00, 3.90}, {3.00, 4.00},
{3.00, 4.00}
};
std::vector<double> rectShiftedDistances = {
const std::vector<double> rectShiftedDistances = {
1.118033988749895, 1.019803902718557, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0198039027185568, 1.118033988749895, 0.7810249675906654, 0.6324555320336759,
0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6324555320336757, 0.7810249675906654,
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Core/Visualization/Visualization3DTester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <iostream>
#include <sstream>
#include <string>
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Fatras/Physics/Dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <boost/test/data/test_case.hpp>

#include "Acts/Definitions/Units.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Fatras/Selectors/Dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <boost/test/data/test_case.hpp>

#include "Acts/Definitions/Units.hpp"
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Plugins/Cuda/Seeding/ATLASCuts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Seeding/IExperimentCuts.hpp"

#include <algorithm>
Expand Down
4 changes: 3 additions & 1 deletion Tests/UnitTests/Plugins/Json/EqualityHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <boost/test/unit_test.hpp>

#include "Acts/Geometry/Extent.hpp"
Expand Down Expand Up @@ -106,4 +108,4 @@ inline static bool isEqual(const Acts::Extent& ea, const Acts::Extent& eb,
return equalRange and equalConstrains;
}

} // namespace Acts
} // namespace Acts
2 changes: 2 additions & 0 deletions Tests/UnitTests/Plugins/Sycl/Seeding/ATLASCuts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Seeding/IExperimentCuts.hpp"

#include <algorithm>
Expand Down