Skip to content
Closed
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
94 changes: 94 additions & 0 deletions .github/workflows/rocpdsna-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: rocpdsna Formatting
run-name: rocpdsna-formatting

on:
workflow_dispatch:
push:
branches:
- develop
- sna-develop
paths:
- '.github/workflows/rocpdsna-formatting.yml'
- 'projects/rocpdsna/**'
- '!projects/rocpdsna/build/**'
- '!projects/rocpdsna/docs/graphs/**'
pull_request:
paths:
- '.github/workflows/rocpdsna-formatting.yml'
- 'projects/rocpdsna/**'
- '!projects/rocpdsna/build/**'
- '!projects/rocpdsna/docs/graphs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:

clang-format:
name: C/C++ Formatting (clang-format-18)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
projects/rocpdsna
.github/workflows

- name: Install clang-format-18
run: |
sudo apt-get update
sudo apt-get install -y clang-format-18

- name: Run clang-format
working-directory: projects/rocpdsna
run: |
set -e
mapfile -t FILES < <(find source include tests -type f \
\( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.cc' \))
echo "Checking ${#FILES[@]} files"
OUT=$(clang-format-18 -output-replacements-xml "${FILES[@]}")
REPLACEMENTS=$(echo "${OUT}" | grep -c '<replacement ' || true)
if [ "${REPLACEMENTS}" -ne 0 ]; then
echo "::error::Code not formatted. Detected ${REPLACEMENTS} replacements."
clang-format-18 -i "${FILES[@]}"
git diff
exit 1
fi
echo "All ${#FILES[@]} files are correctly formatted."

cmake-format:
name: CMake Formatting (gersemi)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
projects/rocpdsna
.github/workflows

- name: Install gersemi
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install gersemi==0.25.1

- name: Run gersemi
working-directory: projects/rocpdsna
run: |
set -e
mapfile -t FILES < <(find . -type f \
! -path './build/*' \
! -path './external/*' \
! -path './_deps/*' \
\( -name 'CMakeLists.txt' -o -name '*.cmake' -o -name '*.cmake.in' \))
echo "Checking ${#FILES[@]} files"
if ! gersemi --check "${FILES[@]}"; then
echo "::error::CMake files not formatted. Run gersemi -i to fix."
gersemi --diff "${FILES[@]}"
exit 1
fi
echo "All ${#FILES[@]} files are correctly formatted."
148 changes: 148 additions & 0 deletions projects/rocpdsna/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# clang-format v18
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: TopLevel
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 90
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentExternBlock: AfterExternBlock
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...
83 changes: 83 additions & 0 deletions projects/rocpdsna/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
# Clang-Tidy configuration for rocstorage
# https://clang.llvm.org/extra/clang-tidy/

Checks: >
-*,
bugprone-*,
clang-analyzer-*,
cppcoreguidelines-*,
misc-*,
modernize-*,
performance-*,
readability-*,
-modernize-use-trailing-return-type,
-readability-magic-numbers,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-avoid-c-arrays,
-modernize-avoid-c-arrays,
-readability-identifier-length,
-bugprone-easily-swappable-parameters,
-misc-include-cleaner

WarningsAsErrors: ''

HeaderFilterRegex: '.*/rocstorage/(include|source)/.*\.hpp$'

CheckOptions:
# Naming conventions (snake_case style)
- key: readability-identifier-naming.ClassCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberPrefix
value: 'm_'
- key: readability-identifier-naming.ProtectedMemberPrefix
value: 'm_'
- key: readability-identifier-naming.ConstantCase
value: lower_case
- key: readability-identifier-naming.EnumConstantCase
value: lower_case
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.TypeAliasCase
value: lower_case
- key: readability-identifier-naming.TypeAliasSuffix
value: '_t'
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.TypedefSuffix
value: '_t'

# Modernize settings
- key: modernize-use-override.IgnoreDestructors
value: true
- key: modernize-use-nullptr.NullMacros
value: 'NULL'

# Performance settings
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
- key: performance-unnecessary-value-param.AllowedTypes
value: 'std::shared_ptr;std::unique_ptr'

# Readability settings
- key: readability-function-cognitive-complexity.Threshold
value: 50
- key: readability-braces-around-statements.ShortStatementLines
value: 1

# Misc settings
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: true
...
55 changes: 55 additions & 0 deletions projects/rocpdsna/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Edit files
*~

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Python cache files
*.pyc

# Documentation artifacts
/_build
_toc.yml

# Common Build folders
/build*
/rocprof-sys-build

/.vscode
/.cache
/.clangd
/.claude
/.cursor

/compile_commands.json

Loading
Loading