Skip to content
Merged
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# use format defined in .clang-format
FormatStyle: "file"
# comma-separated list of globs to enable or disable (`-` prefix)
# this one disables all and then enables readability-identifier-naming
Checks: "-*,readability-identifier-naming"
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/apply-clang-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,19 @@ jobs:
git remote set-branches origin trunk
git fetch --depth=1 --no-tags
- run: just install-denv init configure
- name: run clang-format and clang-tidy on the changed C++ files
- name: format and tidy the changed C++ files
if: github.ref != 'refs/heads/trunk'
run: |
just format-cpp-diff
just tidy-cpp-diff
- name: run clang-format and clang-tidy on all C++ files
if: github.ref == 'refs/heads/trunk'
run: |
set -e
just format-cpp
just tidy-cpp-all
git diff # fail job if format/tidy made a change
- name: auto-commit changes
if: github.ref != 'refs/heads/trunk'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Apply clang-format and clang-tidy" || exit 0
git commit -m "apply clang-format and clang-tidy" || exit 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like doing these as uppercase, it's a "semi sentence" to me... like bullet points in a talk, that's also uppercase but no full stop in the end. But ok that's just style

git push origin HEAD:${GITHUB_HEAD_REF}
- name: check format and tidy on all C++ files
if: github.ref == 'refs/heads/trunk'
run: |
just format-cpp-all
just tidy-cpp-all
git diff --exit-code
18 changes: 7 additions & 11 deletions .github/workflows/apply-python-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ jobs:
run: |
just format-python-diff
just lint-python-fix
- name: format and lint all Python files
if: github.ref == 'refs/heads/trunk'
run: |
set -e
just format-python
just lint-python-fix
git diff # fail job if format/lint made a change
- name: auto-commit changes
if: github.ref != 'refs/heads/trunk'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Apply ruff formatting and linting" || exit 0
git commit -m "apply ruff formatting and linting" || exit 0
git push origin HEAD:${GITHUB_HEAD_REF}
- name: check format and lint all Python files
if: github.ref == 'refs/heads/trunk'
run: |
just format-python
just lint-python-fix
git diff --exit-code
8 changes: 5 additions & 3 deletions SimCore/include/SimCore/MagneticFieldStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define SIMCORE_MAGNETICFIELDSTORE_H_

// Geant4
#include <map>

#include "G4MagneticField.hh"

namespace simcore {
Expand All @@ -21,7 +23,7 @@ class MagneticFieldStore {
/**
* Map of names to magnetic fields.
*/
typedef std::map<std::string, G4MagneticField*> MagFieldMap;
using MagFieldMap = std::map<std::string, G4MagneticField*>;

/**
* Get the global instance of the magnetic field store.
Expand All @@ -38,8 +40,8 @@ class MagneticFieldStore {
* Cleans up all stored G4MagneticFields
*/
~MagneticFieldStore() {
for (auto& nameField : mag_fields_) {
delete nameField.second;
for (auto& name_field : mag_fields_) {
delete name_field.second;
}
mag_fields_.clear();
}
Expand Down
Loading