Repository navigation
Adopt a C++ style so the lint check can pass #28
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| # C++ formatting for bolt-cppml, checked by the Lint Code Base workflow | ||
| # (clang-format) together with CPPLINT.cfg (cpplint). | ||
| # | ||
| # Google style, which is what cpplint verifies, with the indentation and line | ||
| # length this code base already uses. | ||
| BasedOnStyle: Google | ||
| Language: Cpp | ||
| Standard: c++17 | ||
|
|
||
| # Four-space indentation; access specifiers sit one space in, as cpplint expects. | ||
| IndentWidth: 4 | ||
| AccessModifierOffset: -3 | ||
| ContinuationIndentWidth: 4 | ||
| ConstructorInitializerIndentWidth: 4 | ||
|
|
||
| # Keep in step with "linelength" in CPPLINT.cfg. | ||
| ColumnLimit: 120 | ||
|
|
||
| # "Type* name", never derived from the surrounding code. | ||
| DerivePointerAlignment: false | ||
| PointerAlignment: Left | ||
|
|
||
| # Only short functions defined inside a class stay on one line. | ||
| AllowShortFunctionsOnASingleLine: Inline | ||
| AllowShortIfStatementsOnASingleLine: Never | ||
| AllowShortLoopsOnASingleLine: false | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # cpplint configuration for bolt-cppml, used by the Lint Code Base workflow. | ||
| # The matching formatter settings are in .clang-format. | ||
| set noparent | ||
|
|
||
| # Keep in step with ColumnLimit in .clang-format. | ||
| linelength=120 | ||
|
|
||
| # Header guards are derived from the path below include/, for example | ||
| # include/bolt/bolt.hpp -> BOLT_BOLT_HPP_. | ||
| root=include | ||
|
|
||
| # The code is C++17 and uses the standard threading and time headers | ||
| # (<mutex>, <thread>, <chrono>, <system_error>, ...). cpplint's build/c++11 | ||
| # check rejects those headers outright, so it cannot be satisfied. | ||
| filter=-build/c++11 | ||
|
|
||
| # Source files carry no per-file copyright line; the licence is in LICENSE. | ||
| filter=-legal/copyright | ||
|
|
||
| # Non-const reference parameters are allowed. The Google style guide dropped | ||
| # this rule in 2020 and current cpplint releases no longer check it. | ||
| filter=-runtime/references |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Formatter enforces the wrong indentation
IndentWidthenforces four-space indentation instead of the two spaces required by the Code Style Guidelines. Contributors cannot follow both the formatter and the documented rule.Learn more
The repository's Code Style Guidelines require two-space indentation. The new formatter instead establishes four spaces as the repository-wide formatting policy, so running it preserves or creates violations of that requirement.
Example: Formatting a function body indents its statements by four spaces, while the contributor guideline requires two.
Recommended fix: Set
IndentWidthto 2, adjustAccessModifierOffsetto preserve the intended access-specifier placement, and reformat the affected files. If changing the repository policy is intended, explicitly reconcile the contributor guideline with that policy.Was this helpful? React with 👍 or 👎 to provide feedback.