Prototype clang-format based code-formatting tool#2314
Open
Prototype clang-format based code-formatting tool#2314
Conversation
Tool-only import from branch clangformat-experimental
* let clang-format reside as non-dotfile in devel/ * Use 2-char indentation
use clang-format on %include oriented gut lines
Contributor
|
+1 for this. Even if there will be some pains in the beginning, I am sure that it will be super nice to have in the long run. We might consider expanding this kind of automated monitoring of quality and consistency. For instance:
Anyway, back on topic I have noticed that the OpenMC developers have a specific clang-format version pinned in the CI where it is used. Presumably this was caused by inconsistencies between different versions of clang-format. Just something to be aware of. For the beginning, we can probably just put a lower version number pinning on clang-format and hope that there won't be too many inconsistencies going forward (and that we can simply update the pinning and update a few components if there are). |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Free-form text area
Please describe what your PR is adding in terms of features or bugfixes:
After discussions with @Lomholy here is a prototype python-tool (in
devel/bin/mccode-clangformat). The tool implements “standardised indentation style” for components based on this set of clang-format settings:(And further in the python-layer indents
%and#lines inside%{…%}blocks.)Short term plans are to
basictests) to ensure the tool has been used on modified comp codeclang-formatindevel/bin/ mccode-create-conda-ymlPotential later improvements:
sharefiles (manually?) and later potentially integrated in CI?ColumnLimitof 160 is only present since there are very long in-line comments in critical places in the codebase. This should be handled manually in a case-by-case process later, after which we should be able to reduce the limit.For input / comments / reflections please add to the discussion @mads-bertelsen @farhi @g5t @tkittel @ebknudsen ?
PR Checklist for contributing to McStas/McXtrace
My contribution contains something else