Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce coding style #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Enforce coding style #39

wants to merge 3 commits into from

Conversation

DanielGuramulta
Copy link
Contributor

Enforce coding style on commits.

To prevent files mixing different coding styles

// example
if () {
    ...
}

if() {
    ...
}

we make Travis check the style of the files, being edited(patched) in the commit(commit range), and if something is not formatted according to the .clang-format files specifications, we fail the build.

For this to go through, we need:

  1. to discuss the coding style and code it into .clang-format
  2. format the existing code
  3. remove the test commit a3bc159

@DanielGuramulta DanielGuramulta requested a review from a team October 7, 2019 16:13
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be annoying as if sorts the included headers alphabetically. You usually want more flexibility on order of the included files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also specify include categories, which will provide some general rules on how the included headers will be sorted.

example:
IncludeCategories:
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:        2
  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
    Priority:        3
  - Regex:           '.*'
    Priority:        1

.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
CI/travis/clangformat.sh Outdated Show resolved Hide resolved
CI/travis/clangformat.sh Outdated Show resolved Hide resolved
@commodo
Copy link
Contributor

commodo commented Oct 8, 2019

Some commits could use some descriptions

- os: linux
env:
- OS_TYPE=clangformat
addons: { apt: { packages: ["clang-format-6.0"], sources: ["llvm-toolchain-xenial-6.0"] } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curios: would this work? addons: { apt: { packages: ["clang-format-6.0"], sources: ["llvm-toolchain-${TRAVIS_DIST}-6.0"] } }

also, is ther a generic llvm-toolchain-6.0 addon?
i would not add xenial if possible; otherwise, it's probably better to add dist: xenial back to make sure things stay consistent (sorry about that, if it happens)

@commodo
Copy link
Contributor

commodo commented Oct 9, 2019

commits could use a description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants