Skip to content

Commit 57cd35b

Browse files
authored
GH Actions: Fix code formatter action (#51)
1 parent 53bae16 commit 57cd35b

21 files changed

+18
-36
lines changed

.github/workflows/format.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@ name: Clang format
33
on: [pull_request]
44

55
jobs:
6-
clang-format-8:
7-
runs-on: ubuntu-latest
6+
clang-format:
7+
runs-on: ubuntu-24.04
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
with:
1111
ref: ${{ github.event.pull_request.head.sha }}
12-
- name: Run clang-foramt on changed files
12+
- name: Run clang-format on changed files
1313
run: |
1414
set -x
15+
sudo apt install clang-format
16+
git config --global --add safe.directory '*'
1517
git fetch origin ${{ github.event.pull_request.base.ref }}
1618
git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
1719
BASE_COMMIT=$(git rev-parse ${{ github.event.pull_request.base.sha }})
18-
COMMIT_FILES=$(git diff --name-only ${BASE_COMMIT} | grep -i -v LinkDef)
19-
RESULT_OUTPUT=$(git-clang-format-8 --commit ${BASE_COMMIT} --diff --binary $(which clang-format-8) ${COMMIT_FILES})
20+
COMMIT_FILES=$(git diff --name-only "${BASE_COMMIT}" | grep -i -v LinkDef)
21+
RESULT_OUTPUT=$(git clang-format --commit "${BASE_COMMIT}" --diff --binary "$(which clang-format)" -- "${COMMIT_FILES}")
2022
if [ "$RESULT_OUTPUT" == "no modified files to format" ] || [ "$RESULT_OUTPUT" == "clang-format did not modify any files" ]; then
2123
exit 0
2224
else
23-
git-clang-format-8 --commit $BASE_COMMIT --diff --binary $(which clang-format-8)
25+
git clang-format --commit "$BASE_COMMIT" --diff --binary "$(which clang-format)"
2426
echo "$RESULT_OUTPUT"
2527
exit 1
26-
fi
28+
fi

src/Configuration.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void getValueSpecialization(void)
113113
vString = f.getValue<std::string>(s);
114114
}
115115

116-
//template void ConfigFile::getValue<float>(std::string, float&);
116+
// template void ConfigFile::getValue<float>(std::string, float&);
117117

118118
// http://stackoverflow.com/questions/4586768/how-to-iterate-a-boost-property-tree
119119
string indent(int level)
@@ -223,4 +223,3 @@ ConfigFileBrowser::Iterator ConfigFileBrowser::end()
223223
{
224224
return Iterator(this, ptPtr->end(), ptPtr->end());
225225
}
226-

src/Daemon.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,3 @@ Daemon::LoopStatus Daemon::doLoop()
278278

279279
// todo
280280
// boost exceptions?
281-

src/Exception.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ const char* Exception::what() const noexcept
3838

3939
} // namespace Common
4040
} // namespace AliceO2
41-

src/Iommu.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ bool isEnabled()
3333
} // namespace Iommu
3434
} // namespace Common
3535
} // namespace AliceO2
36-

src/LineBuffer.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,4 @@ int LineBuffer::getNextLine(std::string& nextLine)
112112
return 0;
113113
}
114114

115-
//void LineBuffer::appendString(const char *s) {}
116-
115+
// void LineBuffer::appendString(const char *s) {}

src/MemPool.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void* MemPool::getPage()
9191
int newIx = (lastPageIndexGet + 1 + i) % numberOfPages;
9292
if (!pageIsUsed[newIx].test_and_set()) {
9393
lastPageIndexGet = newIx;
94-
//printf("getPage() scan => %d\n",j);
94+
// printf("getPage() scan => %d\n",j);
9595
return pageTable[newIx];
9696
}
9797
j++;
@@ -109,7 +109,7 @@ void MemPool::releasePage(void* pagePtr)
109109
if (pagePtr == pageTable[pageIx]) {
110110
pageIsUsed[pageIx].clear();
111111
lastPageIndexRelease = pageIx;
112-
//printf("realeasePage() scan => %d\n",j);
112+
// printf("realeasePage() scan => %d\n",j);
113113
return;
114114
}
115115
j++;
@@ -120,4 +120,3 @@ int MemPool::getPageSize()
120120
{
121121
return pageSize;
122122
}
123-

src/Program.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ int Program::execute(int argc, char** argv)
141141

142142
} // namespace Common
143143
} // namespace AliceO2
144-

src/SimpleLog.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int SimpleLog::Impl::logV(SimpleLog::Impl::Severity s, const char* message, va_l
125125
} else if (s == Severity::Warning) {
126126
ix += snprintf(&buffer[ix], len - ix, "Warning - ");
127127
} else {
128-
//ix+=snprintf(&buffer[ix], len-ix, "");
128+
// ix+=snprintf(&buffer[ix], len-ix, "");
129129
}
130130
}
131131

@@ -410,4 +410,3 @@ void SimpleLog::Impl::rotate()
410410
}
411411

412412
/// \todo: thread to flush output every 1 second
413-

src/SuffixNumber.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ const std::vector<std::pair<std::string, const size_t>>& get()
5050
} // namespace _SuffixNumberTable
5151
} // namespace Common
5252
} // namespace AliceO2
53-

0 commit comments

Comments
 (0)