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: Use pre-commit for CI lint #3464

Merged
merged 11 commits into from
Aug 8, 2024
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: 1 addition & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
BasedOnStyle: Google
Language: Cpp
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
PointerAlignment: Left
ColumnLimit: 80
Expand All @@ -28,4 +27,3 @@ IncludeCategories:
- Regex: '^<.*>'
Priority: 3
# all headers not explicitly listed will be assigned to the last group
---
4 changes: 2 additions & 2 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FOR YOUR INFORMATION AND MUST BE REMOVED BEFORE SUBMITTING THE ISSUE.

- [ ] If the issue reports a bug:

- [ ] Please suggest whether this bug is critical / a blocker. One of the
- [ ] Please suggest whether this bug is critical / a blocker. One of the
maintainers will assign a corresponding labels.
- [ ] Does the description contain all necessary information to reproduce
the error?
the error?
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ REQUEST.

- If you push updates, and you know they will be superceded later on, consider adding
`[skip ci]` in the commit message. This will instruct the CI system not to run any
jobs on this commit.
jobs on this commit.
3 changes: 1 addition & 2 deletions .github/wip.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- locations:
- locations:
- title
- label_name
terms:
- WIP

2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- closed
- labeled

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

Expand Down
49 changes: 19 additions & 30 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@ concurrency:
cancel-in-progress: true

jobs:
format:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/format14:51
steps:
- uses: actions/checkout@v4
- name: Check
run: >
git config --global safe.directory "$GITHUB_WORKSPACE"
&& CI/check_format .
- uses: actions/upload-artifact@v4
if: failure()
with:
name: changed
path: changed
format-py:
lint:
runs-on: ubuntu-latest
env:
PRE_COMMIT_HOME: '/tmp/pre-commit'

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install black
run: pip install black[jupyter]==24.4.2
- name: Run black format check
run: black --check . --extend-exclude ".*thirdparty.*"

- uses: actions/cache@v4
with:
path: |
${{ env.PRE_COMMIT_HOME }}
key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

license:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -67,16 +66,6 @@ jobs:
- name: Check
run: >
CI/check_pragma_once.sh
end_of_line:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Check
run: >
CI/check_end_of_file.py . --exclude "thirdparty/*" --reject-multiple-newlines --github
type_t:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
-b linkcheck
. _build/html/


- uses: actions/upload-artifact@v4
with:
name: acts-docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release

on:
on:
push:
branches:
- 'releases'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
return false;
}


let number = Number(fs.readFileSync(file, {encoding: 'utf8'}).trim());
console.log('PR number is '+number);
core.exportVariable('PR_NUMBER', number)
Expand Down
4 changes: 2 additions & 2 deletions .merge-sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rules:
- "main"
- "develop/*"
paths_ignore:
- "docs/*"
- "docs/*"

required_checks:
- Docs / docs
Expand All @@ -24,6 +24,6 @@ rules:
- "main"
- "develop/*"
paths:
- "docs/*"
- "docs/*"
required_checks:
- Docs / docs
4 changes: 2 additions & 2 deletions Alignment/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Alignment package

This packages provides tools for detector geometry alignment.
Currently, the KalmanFitter-based alignment with internal minimization is implemented.
In the future, the minimization will be done based on the external minimization package e.g. Millepede.
Currently, the KalmanFitter-based alignment with internal minimization is implemented.
In the future, the minimization will be done based on the external minimization package e.g. Millepede.
2 changes: 1 addition & 1 deletion CI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Since [`poetry`](https://python-poetry.org) supports more robust dependency lock

```console
poetry export -f requirements.txt > requirements.txt
```
```
2 changes: 1 addition & 1 deletion CI/codespell_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ ans
dthe
dthe
vart
pixelx
pixelx
5 changes: 2 additions & 3 deletions CI/ctest2junit.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Extended by providing total Start date, total time, total test stats
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>

<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Expand Down Expand Up @@ -101,7 +101,7 @@ Extended by providing total Start date, total time, total test stats
</xsl:if>
</xsl:for-each>
</xsl:variable>

<testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
<system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
Expand Down Expand Up @@ -130,4 +130,3 @@ Extended by providing total Start date, total time, total test stats
</xsl:template>

</xsl:stylesheet>

4 changes: 2 additions & 2 deletions CI/physmon/config/vertexing_4muon_50vertices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ histograms:
nbins: 100
min: 0.999
max: 1

"trk_weight":
nbins: 100
min: -0.01
max: 1.01

"sumPt2":
nbins: 100
min: 0
Expand Down
2 changes: 1 addition & 1 deletion CI/physmon/config/vertexing_ttbar_pu200.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ histograms:
nbins: 100
min: 0.999
max: 1

"sumPt2":
nbins: 100
min: 0
Expand Down
4 changes: 2 additions & 2 deletions CI/physmon/phys_perf_mon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function trackfinding() {
$refdir/$path/performance_ckf_ambi.root \
"Ambisolver | ${name}" \
$path/performance_ckf_ambi.html \
$path/performance_ckf_ambi
$path/performance_ckf_ambi
fi
}

Expand Down Expand Up @@ -344,7 +344,7 @@ function generation() {
$outdir/data/simulation/particles_ttbar_hist.root \
--silent \
--config CI/physmon/config/pythia8_ttbar.yml

# remove ntuple file because it's large
rm $outdir/data/simulation/particles_ttbar.root

Expand Down
2 changes: 1 addition & 1 deletion CI/setup_cvmfs_lcg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ elif test -n "$ZSH_VERSION"; then
setopt function_argzero
this_script=$0
else
echo "Unsupported shell. Please use bash or zsh." 1>&2
echo "Unsupported shell. Please use bash or zsh." 1>&2
return
fi

Expand Down
2 changes: 1 addition & 1 deletion CI/setup_cvmfs_lcg105.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if test -e /etc/centos-release && grep 'CentOS Linux release 7' /etc/centos-rele
lcg_os=centos7
elif test -e /etc/centos-release && grep 'CentOS Stream release 8' /etc/centos-release; then
lcg_os=centos8
# not centos. Check for RHEL
# not centos. Check for RHEL
elif test -e /etc/redhat-release && grep 'Linux release 9' /etc/redhat-release; then
lcg_os=el9
else
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code Of Conduct

The Acts project observes [CERN's Code of Conduct](https://cern.ch/codeofconduct).
The Acts project observes [CERN's Code of Conduct](https://cern.ch/codeofconduct).
Below is a plain text summary of the [official PDF](https://cds.cern.ch/record/2240689/files/BrochureCodeofConductEN.pdf?)
as of 1. April 2020. Please consult the [PDF](https://cds.cern.ch/record/2240689/files/BrochureCodeofConductEN.pdf?)
for up-to-date information.
Expand Down
4 changes: 2 additions & 2 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if(ACTS_LOG_FAILURE_THRESHOLD)
message(STATUS "Enable log failure threshold, set to ${ACTS_LOG_FAILURE_THRESHOLD}")
target_compile_definitions(
ActsCore
PUBLIC
PUBLIC
-DACTS_LOG_FAILURE_THRESHOLD=${ACTS_LOG_FAILURE_THRESHOLD}
-DACTS_ENABLE_LOG_FAILURE_THRESHOLD)

Expand All @@ -59,7 +59,7 @@ if(ACTS_ENABLE_LOG_FAILURE_THRESHOLD)
message(STATUS "Enable log failure threshold")
target_compile_definitions(
ActsCore
PUBLIC
PUBLIC
-DACTS_ENABLE_LOG_FAILURE_THRESHOLD)
endif()

Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Utilities/JacobianHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inline ActsMatrix<3, 2> sphericalToFreeDirectionJacobian(

// clang-format off
ActsMatrix<3, 2> jacobian;
jacobian <<
jacobian <<
-direction.y(), cosTheta * cosPhi,
direction.x(), cosTheta * sinPhi,
0, -sinTheta;
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Geometry/Extent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ bool Acts::Extent::operator==(const Extent& e) const {

std::string Acts::Extent::toString(const std::string& indent) const {
std::stringstream sl;
sl << indent << "Extent in space : " << std::endl;
sl << indent << "Extent in space :" << std::endl;
for (const auto& bv : allBinningValues()) {
if (constrains(bv)) {
sl << indent << " - value :" << std::setw(10) << binningValueName(bv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion Examples/Algorithms/Geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(ActsExamplesGeometry SHARED
add_library(ActsExamplesGeometry SHARED
src/VolumeAssociationTest.cpp)

target_include_directories(
Expand Down
2 changes: 1 addition & 1 deletion Examples/Algorithms/Propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(ActsExamplesPropagation SHARED
add_library(ActsExamplesPropagation SHARED
src/PropagationAlgorithm.cpp)

target_include_directories(
Expand Down
2 changes: 1 addition & 1 deletion Examples/Algorithms/TrackFinding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ target_link_libraries(
ActsExamplesFramework
ActsExamplesIoJson
ActsExamplesMagneticField

PRIVATE ROOT::Core ROOT::Geom ROOT::Graf ROOT::Hist ROOT::Gpad
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ActsExamples::TrackFindingAlgorithmExaTrkX::TrackFindingAlgorithmExaTrkX(
dummyInput.data() + dummyInput.size());
std::vector<int> spacepointIDs;
std::iota(spacepointIDs.begin(), spacepointIDs.end(), 0);

runPipeline(dummyInputVec, spacepointIDs);
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Examples/Algorithms/TrackFindingML/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(SOURCES
set(SOURCES
src/AmbiguityResolutionML.cpp
src/AmbiguityResolutionMLAlgorithm.cpp
src/AmbiguityResolutionMLDBScanAlgorithm.cpp
src/AmbiguityResolutionMLDBScanAlgorithm.cpp
src/SeedFilterMLAlgorithm.cpp
)

Expand Down
1 change: 0 additions & 1 deletion Examples/Detectors/Geant4Detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ target_link_libraries(
install(
TARGETS ActsExamplesDetectorGeant4
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ target_link_libraries(
install(
TARGETS ActsExamplesMuonSpectrometerMockupDetector
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

6 changes: 3 additions & 3 deletions Examples/Detectors/TGeoDetector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_library(
ActsExamplesDetectorTGeo SHARED
src/TGeoDetector.cpp
src/TGeoITkModuleSplitter.cpp)

target_include_directories(
ActsExamplesDetectorTGeo
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
Expand All @@ -17,5 +17,5 @@ install(
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(
DIRECTORY include/ActsExamples
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
DIRECTORY include/ActsExamples
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Loading
Loading