Skip to content

Commit f403fce

Browse files
authored
Merge pull request #97 from rest-for-physics/lobis-pre-commit
Implement pre-commit checks and format files
2 parents 4ab6c30 + 716528b commit f403fce

25 files changed

+302
-271
lines changed

.cmake-format.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://cmake-format.readthedocs.io/en/latest/configuration.html
2+
3+
format:
4+
tab_size: 4
5+
separate_ctrl_name_with_space: true
6+
separate_fn_name_with_space: false

.github/workflows/validation.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defaults:
2121
jobs:
2222
framework-validation:
2323
uses: rest-for-physics/framework/.github/workflows/validation.yml@master
24-
24+
2525
libCheck:
2626
name: Validate library
2727
runs-on: ubuntu-latest
@@ -43,6 +43,10 @@ jobs:
4343
with:
4444
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_RAW=ON"
4545
branch: ${{ env.BRANCH_NAME }}
46+
- name: Verify pre-commit config files match
47+
run: |
48+
cd $GITHUB_WORKSPACE
49+
curl https://raw.githubusercontent.com/rest-for-physics/framework/master/scripts/validatePreCommitConfig.py | python
4650
- name: Cache framework installation
4751
id: rawlib-install-cache
4852
uses: actions/cache@v3

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: check-yaml
10+
- id: check-xml
11+
- id: requirements-txt-fixer
12+
- id: end-of-file-fixer
13+
exclude: external/.*$
14+
- id: mixed-line-ending
15+
exclude: external/.*$
16+
- id: trailing-whitespace
17+
exclude: external/.*$
18+
19+
- repo: https://github.com/pre-commit/mirrors-clang-format
20+
rev: v15.0.6
21+
hooks:
22+
- id: clang-format
23+
exclude: external/.*$
24+
25+
- repo: https://github.com/cheshirekow/cmake-format-precommit
26+
rev: v0.6.13
27+
hooks:
28+
- id: cmake-format
29+
additional_dependencies: [ pyyaml ]
30+
# - id: cmake-lint
31+
32+
- repo: https://github.com/psf/black
33+
rev: 22.12.0
34+
hooks:
35+
- id: black

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ if (NOT ${RESTLIB_DETECTOR} MATCHES "ON")
1111
list(REMOVE_ITEM deps detector)
1212
endif ()
1313

14-
COMPILELIB(deps)
14+
compilelib(deps)
1515

1616
file(GLOB_RECURSE MAC "${CMAKE_CURRENT_SOURCE_DIR}/macros/*")
17-
INSTALL(FILES ${MAC} DESTINATION ./macros/raw)
17+
install(FILES ${MAC} DESTINATION ./macros/raw)
1818

1919
file(GLOB_RECURSE MAC "${CMAKE_CURRENT_SOURCE_DIR}/examples/*")
20-
INSTALL(FILES ${MAC} DESTINATION ./examples/raw)
20+
install(FILES ${MAC} DESTINATION ./examples/raw)
2121

22-
ADD_LIBRARY_TEST()
22+
add_library_test()

examples/tdsAQS.rml

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2-
3-
<TRestManager name="TDS" title="Reading TDS rawdata" verboseLevel="info" >
4-
5-
<TRestRun name="TDSRun" title="Reading a TDS Scope file" verboseLevel="silent">
6-
<parameter name="experimentName" value="GEMMM"/>
7-
<parameter name="runNumber" value="preserve"/>
8-
<parameter name="runTag" value="preserve"/>
9-
<parameter name="runType" value="TDS"/>
10-
<parameter name="runDescription" value=""/>
11-
<parameter name="user" value="${USER}"/>
12-
<parameter name="verboseLevel" value="0"/>
13-
<parameter name="overwrite" value="on" />
14-
<parameter name="outputFileName" value="R[fRunNumber]_[fRunType]_[fParentRunNumber].root" />
15-
<parameter name="readOnly" value="false" />
16-
<parameter name="inputFormat" value="GEMMM[fRunNumber].raw.[fParentRunNumber]" />
17-
</TRestRun>
18-
19-
<TRestProcessRunner name="Processor" verboseLevel="info">
20-
<parameter name="eventsToProcess" value="0" />
21-
<parameter name="threadNumber" value="1"/>
22-
23-
<parameter name="inputAnalysisStorage" value="on"/>
24-
<parameter name="inputEventStorage" value="on"/>
25-
<parameter name="outputEventStorage" value="on"/>
26-
27-
<addProcess type="TRestRawTDSToSignalProcess" name="tdsRaw" value="ON" electronics="TDS"/>
28-
29-
</TRestProcessRunner>
30-
31-
<addTask command="Processor->RunProcess()" value="ON"/>
32-
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<TRestManager name="TDS" title="Reading TDS rawdata" verboseLevel="info">
3+
<TRestRun name="TDSRun" title="Reading a TDS Scope file" verboseLevel="silent">
4+
<parameter name="experimentName" value="GEMMM"/>
5+
<parameter name="runNumber" value="preserve"/>
6+
<parameter name="runTag" value="preserve"/>
7+
<parameter name="runType" value="TDS"/>
8+
<parameter name="runDescription" value=""/>
9+
<parameter name="user" value="${USER}"/>
10+
<parameter name="verboseLevel" value="0"/>
11+
<parameter name="overwrite" value="on"/>
12+
<parameter name="outputFileName" value="R[fRunNumber]_[fRunType]_[fParentRunNumber].root"/>
13+
<parameter name="readOnly" value="false"/>
14+
<parameter name="inputFormat" value="GEMMM[fRunNumber].raw.[fParentRunNumber]"/>
15+
</TRestRun>
16+
<TRestProcessRunner name="Processor" verboseLevel="info">
17+
<parameter name="eventsToProcess" value="0"/>
18+
<parameter name="threadNumber" value="1"/>
19+
<parameter name="inputAnalysisStorage" value="on"/>
20+
<parameter name="inputEventStorage" value="on"/>
21+
<parameter name="outputEventStorage" value="on"/>
22+
<addProcess type="TRestRawTDSToSignalProcess" name="tdsRaw" value="ON" electronics="TDS"/>
23+
</TRestProcessRunner>
24+
<addTask command="Processor-&gt;RunProcess()" value="ON"/>
3325
</TRestManager>
34-

inc/TRestRawBaseLineCorrectionProcess.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class TRestRawBaseLineCorrectionProcess : public TRestEventProcess {
5757
BeginPrintProcess();
5858

5959
RESTMetadata << "Smoothing window size: " << fSmoothingWindow << RESTendl;
60-
RESTMetadata << "Baseline correction applied to signals with IDs in range (" << fSignalsRange.X() << "," << fSignalsRange.Y() << ")" << RESTendl;
60+
RESTMetadata << "Baseline correction applied to signals with IDs in range (" << fSignalsRange.X()
61+
<< "," << fSignalsRange.Y() << ")" << RESTendl;
6162

6263
EndPrintProcess();
6364
}

inc/TRestRawFEUDreamToSignalProcess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class TRestRawFEUDreamToSignalProcess : public TRestRawToSignalProcess {
7373
bool get_zs_mode() const { return (((data)&0x400) >> 10); }
7474
int get_Feu_ID() const { return (((data)&0xFF)); }
7575
long int get_finetstp() const { return (((data)&0x0007)); }
76-
//#define GET_FINETSTP(word) (word & 0x0007)
76+
// #define GET_FINETSTP(word) (word & 0x0007)
7777
int get_sample_ID() const { return (((data)&0xFF8) >> 3); }
7878
int get_channel_ID() const { return (((data)&0x3F)); }
7979
int get_dream_ID() const { return (((data)&0xE00) >> 9); } // non-zS mode

inc/TRestRawSignalAnalysisProcess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ class TRestRawSignalAnalysisProcess : public TRestEventProcess {
7070
BeginPrintProcess();
7171

7272
RESTMetadata << "Baseline range : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y() << " ) "
73-
<< RESTendl;
73+
<< RESTendl;
7474
RESTMetadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y() << " ) "
75-
<< RESTendl;
75+
<< RESTendl;
7676
RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
7777
RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
7878
RESTMetadata << "Number of points over threshold : " << fPointsOverThreshold << RESTendl;

inc/TRestRawUSTCToSignalProcess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
#include "TRestRawToSignalProcess.h"
2929

30-
//#define V3_Readout_Format_Long
30+
// #define V3_Readout_Format_Long
3131
#define V4_Readout_Format
32-
//#define Incoherent_Event_Generation
32+
// #define Incoherent_Event_Generation
3333

3434
#ifdef V3_Readout_Format_Long
3535
#define DATA_SIZE 1048

pipeline/clang-format/clang-format.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,3 @@ if [ "-" = "$1" ] ; then
106106
}"' '"${file}"'
107107
done
108108
fi
109-

0 commit comments

Comments
 (0)