Skip to content

Commit

Permalink
Merge branch 'white-space-config' into clean-master
Browse files Browse the repository at this point in the history
  • Loading branch information
ashgillman committed May 25, 2021
2 parents 42240de + 922031d commit a101b6d
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
Language : Cpp
# BasedOnStyle : GNU
AlwaysBreakAfterReturnType: TopLevelDefinitions
AlwaysBreakTemplateDeclarations: true
BraceWrapping:
SplitEmptyFunction: false
ColumnLimit: 130
IndentPPDirectives: AfterHash
PointerAlignment: Left
SortIncludes: false
SortUsingDeclarations: false
SpaceBeforeParens: ControlStatements
Standard: Cpp11
...
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# currently empty attributes (using pre-commit)
[attr]cppfiles
[attr]cfiles
[attr]pyfiles
*.cpp cppfiles
*.cxx cppfiles
*.h cppfiles
*.inl cppfiles
*.txx cppfiles
*.c cfiles
*.py pyfiles
*.v -text -diff
*.s -text -diff
*.scn -text -diff
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: git://github.com/doublify/pre-commit-clang-format
rev: master
hooks:
- id: clang-format
files: \.(c|cc|cxx|cpp|h|hpp|hxx|inl|txx)
8 changes: 8 additions & 0 deletions documentation/devel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Information specific for developers

Please check files here for information/code practices for developers.

- Do read our [contribution guidelines](../../CONTRIBUTING.md)
- Set your editor settings appropriately: [instructions](editor-settings.md)
- Install git hooks for serious development: [instructions](git-hooks.md)
- Read the documentation, including the STIR developers guide
5 changes: 5 additions & 0 deletions documentation/devel/editor-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Developer documentation: editor settings

White-spaces and indentation with multiple developers are a pain. Please adhere to
our white-space policy, which we try to enforce via [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
Check that site for integration with your editor/IDE.
28 changes: 28 additions & 0 deletions documentation/devel/git-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Developer documentation: how to install (software for) git hooks

You first need to have Python and pip

## Install [pre-commit](https://pre-commit.com)
See https://pre-commit.com/#install but the following might work.

pip install pre-commit

If this fails with a permission error, try adding `--user` to the command.

If that fails with a message about `PyYAML` and `distutils`, try

pip install --ignore-installed PyYAML

## Install clang-format
### debian/Ubuntu
sudo apt install clang-format
### MacOS
brew install clang-format
### Others
search the internet and tell us

## Enable pre-commit hooks
```sh
cd /whereever/STIR
pre-commit install
```

0 comments on commit a101b6d

Please sign in to comment.