Skip to content

Commit

Permalink
Clean up code style documentation and add missing --attach-inlines flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingranade committed Dec 21, 2015
1 parent 680f4b5 commit 5b3da41
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .astylerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project, CONTRIBUTING.md, doc/CODE_STYLE.txt
# These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project and doc/CODE_STYLE.txt

# "One True Brace Style"
--style=1tbs

# Attach brackets to class and struct inline function definitions.
--attach-inlines

# 4 spaces per indentation level and per tab stop
--indent=spaces=4

Expand Down
11 changes: 1 addition & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ There are a couple of guidelines we suggest sticking to:

## Code Style

Current policy is to only update code to the standard style when changing a substantial portion of it, but **please** do this in a separate commit. Blocks of code can be passed through astyle
to ensure that their formatting is correct:

astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-preprocessor --indent-switches --indent-col1-comments --min-conditional-indent=0 --pad-oper --unpad-paren --pad-paren-in --add-brackets --convert-tabs

These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project, CONTRIBUTING.md, doc/CODE_STYLE.txt

For example, from vi, set marks a and b around the block, then:

:'a,'b ! astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-switches --indent-preprocessor --indent-col1-comments --min-conditional-indent=0 --pad-oper --add-brackets --convert-tabs
Current policy is to only update code to the standard style when changing a substantial portion of it, but **please** do this in a separate commit. See doc/CODE_STYLE.txt for details

## Translations

Expand Down
3 changes: 2 additions & 1 deletion Cataclysm-DDA.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@
{
"options_c++":
{
"comment" : "These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project, CONTRIBUTING.md, doc/CODE_STYLE.txt",
"comment" : "These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project and doc/CODE_STYLE.txt",
"additional_options":
[
"--style=1tbs",
"--attach-inlines"
"--indent=spaces=4",
"--align-pointer=name",
"--max-code-length=100",
Expand Down
6 changes: 3 additions & 3 deletions doc/CODE_STYLE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Note that versions of astyle before 2.05 will handle many c++11 constructs incor

Blocks of code can be passed through astyle to ensure that their formatting is correct:

astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-preprocessor --indent-switches --indent-col1-comments --min-conditional-indent=0 --pad-oper --unpad-paren --pad-paren-in --add-brackets --convert-tabs
astyle --style=1tbs --attach-inlines --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-preprocessor --indent-switches --indent-col1-comments --min-conditional-indent=0 --pad-oper --unpad-paren --pad-paren-in --add-brackets --convert-tabs

These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project, CONTRIBUTING.md, doc/CODE_STYLE.txt
These options are mirrored in .astylerc, Cataclysm-DDA.sublime-project and doc/CODE_STYLE.txt

For example, from vi, set marks a and b around the block, then:
:'a,'b ! astyle --style=1tbs --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-preprocessor --indent-switches --indent-col1-comments --min-conditional-indent=0 --pad-oper --unpad-paren --pad-paren-in --add-brackets --convert-tabs
:'a,'b ! astyle --style=1tbs --attach-inlines --indent=spaces=4 --align-pointer=name --max-code-length=100 --break-after-logical --indent-classes --indent-preprocessor --indent-switches --indent-col1-comments --min-conditional-indent=0 --pad-oper --unpad-paren --pad-paren-in --add-brackets --convert-tabs

Here's an example that illustrates the most common points of style.

Expand Down

0 comments on commit 5b3da41

Please sign in to comment.