Skip to content

Commit

Permalink
iox-#1 Add basic CI and issue templates
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <[email protected]>
  • Loading branch information
mossmaurice committed Jun 3, 2022
1 parent dcfc0d1 commit 9eb7124
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# for complete code formatting of codebase please type:
# "find . -type f -regex '.*\.\(inl\|cpp\|h\|hpp\|cc\|c\|cxx\)' -exec clang-format -style=file -i {} \;"
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false # If false, a function declaration's or function definition's parameters will either all be on the same line or will have one line each.
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 120
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++14
TabWidth: 4
UseTab: Never
...
144 changes: 144 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# NOTE: following checks are disabled, because they have duplicates in other group:
#
# - readability-magic-numbers (duplicate of cppcoreguidelines-avoid-magic-numbers)
# - hicpp-no-malloc (duplicate of cppcoreguidelines-no-malloc)
# - hicpp-member-init (duplicate of cppcoreguidelines-pro-type-member-init)
# - performance-move-const-arg (duplicate of hicpp-move-const-arg)
# - bugprone-use-after-move (duplicate of hicpp-move-const-arg)

Checks: '
-*,
readability-*,
clang-analyzer-*,
cert-*,
bugprone-*,
cppcoreguidelines-*,
concurrency-*,
performance-*,
hicpp-*,
-bugprone-use-after-move,
-bugprone-easily-swappable-parameters,
-bugprone-branch-clone,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-not-null-terminated-result,
-concurrency-mt-unsafe,
-readability-named-parameter,
-readability-avoid-const-params-in-decls,
-readability-else-after-return,
-readability-redundant-access-specifiers,
-readability-magic-numbers,
-readability-function-size,
-readability-static-accessed-through-instance,
-readability-qualified-auto,
-readability-uppercase-literal-suffix,
-readability-implicit-bool-conversion,
-readability-convert-member-functions-to-static,
-readability-inconsistent-declaration-parameter-name,
-readability-container-size-empty,
-readability-simplify-boolean-expr,
-readability-make-member-function-const,
-readability-const-return-type,
-readability-function-cognitive-complexity,
-readability-use-anyofallof,
-hicpp-named-parameter,
-hicpp-avoid-c-arrays,
-hicpp-no-array-decay,
-hicpp-signed-bitwise,
-hicpp-vararg,
-hicpp-no-malloc,
-hicpp-member-init,
-hicpp-use-auto,
-hicpp-uppercase-literal-suffix,
-hicpp-use-equals-default,
-hicpp-deprecated-headers,
-cert-env33-c,
-performance-move-const-arg,
-performance-no-int-to-ptr,
-performance-unnecessary-value-param,
-performance-for-range-copy,
-clang-analyzer-core.uninitialized.UndefReturn,
-clang-analyzer-optin.cplusplus.VirtualCall,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-type-const-cast,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-init-variables,
-hicpp-move-const-arg,
-hicpp-invalid-access-moved'

## Those warnings should be enabled
## They are disabled since they require a heavy API refactoring and when we enable it we clutter the code with // NOLINT comments
# -bugprone-easily-swappable-parameters
#
## the LineThreshold, StatementThreshold, BranchThreshold contains random number
## here we have to do some heavy refactoring
# -readability-function-size
# -readability-function-cognitive-complexity
#
## is it working correctly? produces hard to understand warning
# -clang-analyzer-core.uninitialized.UndefReturn
# -clang-analyzer-optin.cplusplus.VirtualCall
#
###########################################
#### A lot of code changes but easy effort:
###########################################
# -readability-qualified-auto
# -readability-convert-member-functions-to-static
# -readability-container-size-empty
# -readability-simplify-boolean-expr
# -readability-const-return-type
# -readability-use-anyofallof
# -cppcoreguidelines-avoid-magic-numbers
# -cppcoreguidelines-init-variables
# -hicpp-use-auto
# -readability-qualified-auto
# -hicpp-uppercase-literal-suffix
# -readability-uppercase-literal-suffix
# -readability-implicit-bool-conversion
# -bugprone-branch-clone
# -hicpp-use-equals-default
# -hicpp-deprecated-headers
# -cppcoreguidelines-prefer-member-initializer
# -readability-convert-member-functions-to-static
# -cppcoreguidelines-pro-type-const-cast
# -cppcoreguidelines-pro-type-member-init
# -bugprone-implicit-widening-of-multiplication-result
# -readability-inconsistent-declaration-parameter-name
# -performance-for-range-copy
# -readability-make-member-function-const

WarningsAsErrors: '' # Treat all Checks from above as errors
HeaderFilterRegex: ''
FormatStyle: file
InheritParentConfig: false

CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.MethodCase, value: camelBack }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: m_ }
- { key: readability-identifier-naming.MemberCase, value: camelBack }
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-function-size.LineThreshold, value: 200 }
- { key: readability-function-size.StatementThreshold, value: 200 }
- { key: readability-function-size.BranchThreshold, value: 10 }
- { key: readability-function-size.ParameterThreshold, value: 3 }
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

## Required information

**Operating system:**
E.g. Ubuntu 18.04 LTS

**Compiler version:**
E.g. GCC 7.4.0

**Observed result or behaviour:**
A clear and precise description of the observed result.

**Expected result or behaviour:**
What do you expect to happen?

**Conditions where it occurred / Performed steps:**
Describe how one can reproduce the bug.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

## Brief feature description

Please describe in a few sentences what should be implemented

## Detailed information

E.g. a list of pros and cons of different considerations and how iceoryx and its user could benefit from it
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Pre-Review Checklist for the PR Author

1. [ ] Code is formatted with clang-format
1. [ ] Update the PR title
- Follow the same conventions as for commit messages
- Link to the relevant issue
1. [ ] Relevant issues are linked
1. [ ] Add sensible notes for the reviewer
1. [ ] All checks have passed
1. [ ] Assign PR to reviewer

## Notes for Reviewer
<!-- Items in addition to the checklist below that the reviewer should look for -->

## Checklist for the PR Reviewer

- [ ] Commits are properly organized and messages are according to the guideline
- [ ] Code according to our coding style and naming conventions
- [ ] Unit tests have been written for new behavior
- [ ] Copyright owner are updated in the changed files
- [ ] PR title describes the changes

## Post-review Checklist for the PR Author

1. [ ] All open points are addressed and tracked via issues

## References

- Closes **TBD**
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This workflow builds the repo

name: Build

# Triggers the workflow on push or pull request events but only for the main branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main, release* ]

jobs:
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cmake -B build && cmake --build build

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
install
clangd
.vscode
*.project
__pycache__
69 changes: 69 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) 2022 by Apex.AI Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.16)

# check if iceoryx is in CMAKE_PREFIX_PATH
find_package(iceoryx_hoofs QUIET)
find_package(iceoryx_posh QUIET)

# fetch iceoryx if not found
if(NOT iceoryx_hoofs_FOUND OR NOT iceoryx_posh_FOUND)
if(iceoryx_hoofs_FOUND)
message(FATAL_ERROR "iceoryx_hoofs was not found with 'find_package' but other parts were found!")
endif()
if(iceoryx_posh_FOUND)
message(FATAL_ERROR "iceoryx_posh was not found with 'find_package' but other parts were found!")
endif()

include(FetchContent)
FetchContent_Declare(
iceoryx
GIT_REPOSITORY https://github.com/eclipse-iceoryx/iceoryx.git
GIT_TAG v2.0.2
)
FetchContent_GetProperties(iceoryx)
if (NOT iceoryx_POPULATED)
message(STATUS "updating: iceoryx" )
FetchContent_Populate(iceoryx)
endif()

set(ICEORYX_WITH_FETCH_CONTENT true CACHE INTERNAL "")
set(iceoryx_SOURCE_DIR ${iceoryx_SOURCE_DIR} CACHE INTERNAL "")
set(iceoryx_BINARY_DIR ${iceoryx_BINARY_DIR} CACHE INTERNAL "")
endif()

if(ICEORYX_WITH_FETCH_CONTENT)
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_hoofs ${iceoryx_BINARY_DIR}/iceoryx_hoofs)
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_posh ${iceoryx_BINARY_DIR}/iceoryx_posh)

find_package(iceoryx_posh REQUIRED)
find_package(iceoryx_hoofs REQUIRED)
endif()

include(IceoryxPlatform)

project(iceoryx_project_template)

if(ICEORYX_WITH_FETCH_CONTENT)
message("
#############################################################
The project was build by obtaining iceoryx with FetchContent.
If you want to use an existing installation use
'-DCMAKE_PREFIX_PATH=/path/to/installed/iceoryx'!
#############################################################
")
endif()

0 comments on commit 9eb7124

Please sign in to comment.