Skip to content
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
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
Expand Down Expand Up @@ -47,7 +47,7 @@ DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Expand Down
21 changes: 21 additions & 0 deletions .github/scripts/clang-format-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Thin wrapper around clang-format for easier to parse output from the
# pre-commit hook.
#
# Needs to work with multiple input files as pre-commit passes multiple files to
# the "executables"

# Make sure that diff is actually recent enough (diffutils >= 3.4) to support
# colored output
COLOR_OUTPUT=$(diff --color=always <(echo) <(echo) > /dev/null 2>&1 && echo "--color=always")

success=0
for file in ${@}; do
if ! $(clang-format --style=file --Werror --dry-run ${file} > /dev/null 2>&1); then
echo "Necessary changes for: '${file}' (run 'clang-format --style=file -i ${file}' to fix it)"
diff ${COLOR_OUTPUT} -u ${file} <(clang-format --style=file ${file}) | tail -n +3
success=1
fi
done
exit ${success}
34 changes: 34 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pre-commit

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cvmfs-contrib/github-action-cvmfs@v4
- uses: aidasoft/run-lcg-view@v4
with:
container: el9
view-path: /cvmfs/sw-nightlies.hsf.org/key4hep
run: |
echo "::group::Setup pre-commit"
# Newer versions of git are more cautious around the github runner
# environment and without this git rev-parse --show-cdup in pre-commit
# fails
git config --global --add safe.directory $(pwd)
python -m venv /root/pre-commit-venv
source /root/pre-commit-venv/bin/activate
pip install pre-commit
echo "::endgroup::"
echo "::group::Run pre-commit"
pre-commit run --show-diff-on-failure \
--color=always \
--all-files
echo "::endgroup::"
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: mixed-line-ending
- id: trailing-whitespace
exclude: (doc/ReleaseNotes.md)
- repo: local
hooks:
- id: clang-format
name: clang-format
entry: .github/scripts/clang-format-hook
types: [c++]
language: system
32 changes: 16 additions & 16 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"license": "GPL-3.0",
"contributors": [
],
"notes": "webpage: http://github.com/ilcsoft/ConformalTracking",
"language": "eng",
"upload_type": "software",
],
"notes": "webpage: http://github.com/ilcsoft/ConformalTracking",
"language": "eng",
"upload_type": "software",
"keywords": [
"Track Reconstruction, ConformalTracking, Pattern Recognition"
],
"creators": [
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Hynds, Daniel"
},
},
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Leogrande, Emilia"
},
},
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Petric, Marko"
},
},
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Sailer, Andre"
},
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Brondolin, Erica"
},
{
"affiliation": "DESY",
"affiliation": "DESY",
"name": "Gaede, Frank"
},
{
"affiliation": "CERN",
"affiliation": "CERN",
"name": "Simoniello, Rosa"
}
}

],
],
"access_right": "open"
}
6 changes: 3 additions & 3 deletions cmake/clang-cpp-checks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ IF(CLANG_FORMAT)
${CLANG_FORMAT}
-style=file
-output-replacements-xml
${CHECK_CXX_SOURCE_FILES}
${CHECK_CXX_SOURCE_FILES}
# print output
| tee ${CMAKE_BINARY_DIR}/check_format_file.txt | grep -c "replacement " |
| tee ${CMAKE_BINARY_DIR}/check_format_file.txt | grep -c "replacement " |
tr -d "[:cntrl:]" && echo " replacements necessary" && cat ${CMAKE_BINARY_DIR}/check_format_file.txt
# WARNING: fix to stop with error if there are problems
COMMAND ! grep -c "replacement "
COMMAND ! grep -c "replacement "
${CMAKE_BINARY_DIR}/check_format_file.txt > /dev/null
COMMENT "Checking format compliance"
)
Expand Down
4 changes: 2 additions & 2 deletions include/Cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Cell {
public:
// Constructors, main initialisation is with two kd hits
Cell() { m_weight = 0; }
Cell(const Cell&) = delete;
Cell(Cell&&) = default;
Cell(const Cell&) = delete;
Cell(Cell&&) = default;
Cell& operator=(const Cell&) = delete;

Cell(SKDCluster const& hit1, SKDCluster const& hit2)
Expand Down
5 changes: 1 addition & 4 deletions include/ConformalTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ConformalTracking : public Processor {

ConformalTracking();
ConformalTracking(std::string const& procName);
ConformalTracking(const ConformalTracking&) = delete;
ConformalTracking(const ConformalTracking&) = delete;
ConformalTracking& operator=(const ConformalTracking&) = delete;

// Initialisation - run at the beginning to start histograms, etc.
Expand All @@ -53,9 +53,6 @@ class ConformalTracking : public Processor {
// Run over each event - the main algorithm
virtual void processEvent(LCEvent* evt);

// Run at the end of each event
virtual void check(LCEvent*){};

// Called at the very end for cleanup, histogram saving, etc.
virtual void end();

Expand Down
2 changes: 1 addition & 1 deletion include/ConformalTrackingV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ConformalTrackingV2 : public ConformalTracking {
virtual Processor* newProcessor() { return new ConformalTrackingV2; }

ConformalTrackingV2();
ConformalTrackingV2(const ConformalTrackingV2&) = delete;
ConformalTrackingV2(const ConformalTrackingV2&) = delete;
ConformalTrackingV2& operator=(const ConformalTrackingV2&) = delete;

// Called at the beginning of every run
Expand Down
6 changes: 3 additions & 3 deletions include/DebugTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ using SLCRelationNavigator = std::shared_ptr<UTIL::LCRelationNavigator>;
class ConformalDebugger {
public:
//--- Constructor and destructor
ConformalDebugger(){};
~ConformalDebugger(){};
ConformalDebugger() = default;
~ConformalDebugger() = default;

ConformalDebugger(const ConformalDebugger&) = delete;
ConformalDebugger(const ConformalDebugger&) = delete;
ConformalDebugger& operator=(const ConformalDebugger&) = delete;

//--- Member variables
Expand Down
4 changes: 2 additions & 2 deletions include/KDTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KDTrack {
KDTrack(Parameters const& par);
~KDTrack();

KDTrack(const KDTrack&) = default;
KDTrack(const KDTrack&) = default;
KDTrack& operator=(const KDTrack&) = delete;

//--- Functions to add and remove clusters
Expand All @@ -36,7 +36,7 @@ class KDTrack {
m_nPoints++;
}
void remove(int clusterN) {
if(clusterN < 0 || clusterN >= int(m_clusters.size())) {
if (clusterN < 0 || clusterN >= int(m_clusters.size())) {
throw std::out_of_range("KDTrack::remove: clusterN out of range");
}
m_clusters.erase(m_clusters.begin() + clusterN);
Expand Down
2 changes: 1 addition & 1 deletion include/KDTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class KDTree {
explicit KDTree(const SharedKDClusters& pts, double overlapTheta, bool sort);
~KDTree();

KDTree(const KDTree&) = delete;
KDTree(const KDTree&) = delete;
KDTree& operator=(const KDTree&) = delete;

void nearestNeighbours(
Expand Down
6 changes: 3 additions & 3 deletions include/KalmanTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class KalmanNode {
public:
// Constructor
KalmanNode(){};
KalmanNode() = default;
KalmanNode(SKDCluster measurement, bool rotated) {
if (!rotated) {
m_uMeasured = measurement->getU();
Expand All @@ -29,7 +29,7 @@ class KalmanNode {
};

// Destructor
~KalmanNode(){};
~KalmanNode() = default;

// Functions

Expand Down Expand Up @@ -68,7 +68,7 @@ class KalmanTrack {
KalmanTrack();
KalmanTrack(KDTrack*);

KalmanTrack(const KalmanTrack&) = default;
KalmanTrack(const KalmanTrack&) = default;
KalmanTrack& operator=(const KalmanTrack&) = default;

// Destructor
Expand Down
4 changes: 2 additions & 2 deletions include/kdtree2.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace kdtree2 {

KDTree(KDTreeArray& data_in, bool rearrange_in = true, int dim_in = -1);

KDTree(const KDTree&) = delete;
KDTree(const KDTree&) = delete;
KDTree& operator=(const KDTree&) = delete;

// destructor
Expand Down Expand Up @@ -180,7 +180,7 @@ namespace kdtree2 {
// destructor
~KDTreeNode();

KDTreeNode(const KDTreeNode&) = delete;
KDTreeNode(const KDTreeNode&) = delete;
KDTreeNode& operator=(const KDTreeNode&) = delete;

private:
Expand Down
7 changes: 3 additions & 4 deletions source/test/TestConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ int main() {
It startString = begin(configString), endString = end(configString);
bool ok = qi::phrase_parse(startString, endString, myGrammar, qi::blank, parsed);

std::cout << "--- File ---"
<< "\n";
std::cout << "--- File ---\n";
std::cout << "parsed = " << std::boolalpha << ok << "\n";
if (ok) {
std::cout << "Number " << parsed.size() << std::endl;
Expand All @@ -111,8 +110,8 @@ int main() {
std::cout << c;
} else {
std::cout << "\\x" << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(c);
} //if
} //while
}
}
std::cout << std::endl;
return 1;
} //if
Expand Down
Loading