Skip to content

Commit

Permalink
style: enhanced clarity coding style configs (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Apr 25, 2024
1 parent ab20fca commit 462b309
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
31 changes: 29 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Maintain consistent coding style across the entire project.

# This is a configuration file for clang-format.
# This is a configuration file for clang-format. The rules here are applied to all code in the
# entire project, including all the C++ example demo programs, and the main C demo project and
# library. The rules are still work in progress and subject to change. I still need to think
# about this.

# C Language specifics.
Language: Cpp
Expand All @@ -13,6 +16,24 @@ ColumnLimit: 100
IndentWidth: 4
UseTab: Never

# Align consecutive assignments.
# const char *foo = "bar";
# const int bar = 1;
# const double baz = 2.0;
AlignConsecutiveAssignments: true

# Align consecutive declarations.
# const char *foo = "bar";
# const int bar = 1;
# const double baz = 2.0;
AlignConsecutiveDeclarations: false

# Align escaped newlines for the left.
AlignEscapedNewlinesLeft: true

# Don't allow this rule.
AllowShortFunctionsOnASingleLine: false

# Braces to surrounding context.
BraceWrapping:
AfterClass: true
Expand All @@ -26,5 +47,11 @@ BreakBeforeBraces: Custom
# Update namespace comments.
FixNamespaceComments: true

# These settings are the same as Python black.
# Align pointer to the right.
PointerAlignment: Right

# Same as Black for Python.
SpacesBeforeTrailingComments: 2

# Allow this rule.
SortIncludes: true
7 changes: 3 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Maintain consistent coding style across the entire project.

# This is a configuration file for EditorConfig.

# The settings for JavaScript, Python and C/C++ files are mirrored by language in .prettierrc,
# .eslintrc, .flake8, .pylintrc, pyproject.toml and .clang-format. Keep them in sync.
# This is a configuration file for EditorConfig. The settings for JavaScript, Python and C/C++
# files are mirrored by languages in .prettierrc, .eslintrc, .flake8, .pylintrc, pyproject.toml and
# .clang-format files that is shared accros all my codebase projects. Keep them in sync.

root = true

Expand Down

0 comments on commit 462b309

Please sign in to comment.