Skip to content

Commit

Permalink
bumped and synchronised code-style definitions with GR4 (#186)
Browse files Browse the repository at this point in the history
* bumped and synchronised code-style definitions with GR4
* Minor improvements from review

Signed-off-by: Ralph J. Steinhagen <[email protected]>
Signed-off-by: Alexander Krimm <[email protected]>
Co-authored-by: Alexander Krimm <[email protected]>
  • Loading branch information
RalphSteinhagen and wirew0rm authored Jun 17, 2024
1 parent cbde0f5 commit 4a10a20
Show file tree
Hide file tree
Showing 13 changed files with 1,233 additions and 525 deletions.
237 changes: 16 additions & 221 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,225 +1,20 @@
# .clang-format for Qt Creator
#
# This is for clang-format >= 5.0.
#
# The configuration below follows the Qt Creator Coding Rules [1] as closely as
# possible. For documentation of the options, see [2].
#
# Use ../../tests/manual/clang-format-for-qtc/test.cpp for documenting problems
# or testing changes.
#
# In case you update this configuration please also update the qtcStyle() in src\plugins\clangformat\clangformatutils.cpp
#
# [1] https://doc-snapshots.qt.io/qtcreator-extending/coding-style.html
# [2] https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: AcrossEmptyLines
AlignConsecutiveDeclarations: AcrossEmptyLines
AlignEscapedNewlines: DontAlign
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllArgumentsOnNextLine: true
#PackConstructorInitializers: PCIS_CurrentLine # starting with clang 14
AllowAllConstructorInitializersOnNextLine: true
AllowShortLambdasOnASingleLine: All
BasedOnStyle: LLVM
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
# Do not add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE as this will indent lines in between.
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakString: 600
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Right
ReflowComments: true
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
TabWidth: 4
UseTab: Never
---
Language: Java
JavaImportGroups: [ 'java', 'javax', 'javafx', 'org', 'io', 'com', 'de.gsi' ]
AccessModifierOffset: -4
# 2000 is a workaround to keep "unlimited" column length, since 0 doesn't always work as expected.
# For the rationale behind the "unlimited" column length policy, please refer to CORE_DEVELOPMENT_GUIDELINE.md
ColumnLimit: 2000
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: DontAlign
AlignOperands: AlignAfterOperator
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortLambdasOnASingleLine: All
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
BreakBeforeBraces: Attach
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
# Do not add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE as this will indent lines in between.
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakString: 600
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Right
ReflowComments: true
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
AccessModifierOffset: -4
IndentRequiresClause: false
AllowShortCompoundRequirementOnASingleLine: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
MaxEmptyLinesToKeep: 1
AlwaysBreakTemplateDeclarations: true
PointerAlignment: Left
ReferenceAlignment: Left
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
TabWidth: 4
UseTab: Never

InsertBraces: true
8 changes: 1 addition & 7 deletions .restyled.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# Default Restyler Configuration: https://github.com/restyled-io/restyler/blob/main/config/default.yaml
exclude:
- "**/node_modules/**/*"
- "**/vendor/**/*"

remote_files: []

pull_requests: false # Open Restyle PRs?
request_review: none
labels: []
Expand All @@ -28,7 +22,7 @@ restylers_version: stable
restylers:
- clang-format:
image:
tag: v17
tag: v18
- cmake-format
- prettier-markdown
- prettier-yaml
Expand Down
54 changes: 37 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,59 @@
#Contributing to OpenDigitizer
# Contributing to GNU Radio

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to OpenDigitizer and its packages. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request.
The following is a set of guidelines for contributing. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request.

## Open an issue

For bugs, issues, or other discussion, please log a new issue in the GitHub repository.

GitHub supports [markdown](https://help.github.com/categories/writing-on-github/), so when filing bugs make sure you check the formatting before clicking submit.

## Other discussions

For general "how-to" and guidance questions about using GNU Radio to build and run applications, please have a look at the various
examples or if you cannot find anything that fits your use-case use GitHub's discussions forum.

## Contributing code and content

We welcome all forms of contributions from the community. Please read the following guidelines to maximise the chances of your PR being merged.

### DCO Signing

Any code contributions going into GNU Radio will become part of a LGPL-licensed, open source repository. It is therefore imperative that code submissions belong to the authors, and that submitters have the authority to merge that code into the public GNU Radio codebase.

For that purpose, we use the [Developer's Certificate of Origin](DCO.txt). It is the same document used by other projects. Signing the DCO states that there are no legal reasons to not merge your code.

To sign the DCO, suffix your git commits with a "Signed-off-by" line. When using the command line, you can use `git commit -s` to automatically add this line. If there were multiple authors of the code, or other types of stakeholders, make sure that all are listed, each with a separate Signed-off-by line.

### Communication
- Before starting work on a feature, check if there isn't already an examples in the 'samples' sub-module.
If not, then please open an issue on GitHub describing the proposed feature. We want to make sure any feature work goes smoothly.
We're happy to work with you to determine if it fits the current project direction and make sure no one else is already working on it.

- For any work related to setting up build, test, and CI for OpenDigitizer on GitHub, or for small patches or bug fixes, please open an issue
for tracking purposes, but we generally don't need a discussion prior to opening a PR.
- Before starting work on a feature, check if there isn't already an examples in the 'samples' sub-module.
If not, then please open an issue on GitHub describing the proposed feature. We want to make sure any feature work goes smoothly.
We're happy to work with you to determine if it fits the current project direction and make sure no one else is already working on it.

- For any work related to setting up build, test, and CI for GNU Radio on GitHub, or for small patches or bug fixes, please open an issue
for tracking purposes, but we generally don't need a discussion prior to opening a PR.

### Development process

Please be sure to follow the usual process for submitting PRs:

- Fork the repository
- Make sure it compiles w/o errors against the current release 'main' branch:
- Write and add a descriptive/meaningful JUnit test-case or [minimal working example]
- apply the default code formatter (to minimise future refactoring)
- Please check against the current [PMD](https://pmd.github.io/) [default rules](https://github.com/fair-acc/opencwm-java/blob/master/rules.xml), [FindBugs](http://findbugs.sourceforge.net/) or similar QA code checker (N.B. other/further code improvements are welcome)
- Create a pull request
- Make sure your PR title is descriptive
- Include a link back to an open issue in the PR description
- Fork the repository
- Make sure it compiles w/o errors against the current release 'main' branch:
- Write and add a descriptive/meaningful unit-test-case
- apply the default code formatter (to minimise future refactoring)
- Please check against common sanitizers, the CI/CD pipeline, or similar other QA code checker (N.B. other/further code improvements are welcome)
- Create a pull request
- Make sure your PR title is descriptive
- Include a link back to an open issue in the PR description

We reserve the right to close PRs that are not making progress. Closed PRs can be reopened again later and work can resume.

### Contributor License Agreement
By contributing your code to OpenDigitizer you grant us a non-exclusive,

By contributing your code to GNU Radio you grant us a non-exclusive,
irrevocable, worldwide, royalty-free, sublicenseable, transferable
license under all of Your relevant intellectual property rights
(including copyright, patent, and any other rights), to use, copy,
Expand Down Expand Up @@ -65,5 +84,6 @@ ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.

## Code of Conduct
To ensure an inclusive community, contributors and users in the OpenDigitizer

To ensure an inclusive community, contributors and users in the GNU Radio
community should follow the [code of conduct](./CODE_OF_CONDUCT.md).
Loading

0 comments on commit 4a10a20

Please sign in to comment.