Task #4383
closed
Fix GNU-style indentation of braces
Added by Junxiao Shi about 7 years ago.
Updated over 4 years ago.
Description
GNU-style indentation of braces is not longer permitted in code-style.
This issue is to fix existing code of such violations.
You may find violations in a repository with this script:
find -name '*.hpp' -or -name '*.cpp' -exec awk '
BEGIN {
indent = "*"
}
indent != "*" {
if (substr($0, 1, length(indent) + 3) == indent " {") {
print FILENAME " " (FNR - 1) " " lastline
print FILENAME " " FNR " " $0
}
indent = "*"
}
$1 ~ /^(if|else|for|while|do|try)$/ {
split($0, a, $1)
indent = a[1]
lastline = $0
}
' {} +
Junxiao Shi wrote:
GNU-style indentation of braces is not longer permitted in code-style.
That applies to new and updated code. It doesn't mean we need to actively "fix" all existing code.
Yes. #1403-2 mandates every touched file to conform to code style, but in the past the reviewer has asked to separate code style fixes into its own commit. This issue is created so that those commits have an issue to associate with.
- Category deleted (
Build)
- Start date deleted (
11/16/2017)
- Tags changed from code-cleanup to CodeCleanup
- Status changed from New to Closed
- % Done changed from 0 to 100
I don't think we have any code that still uses GNU-style indentation. Let's close this.
- Tags changed from CodeCleanup to code-cleanup
Also available in: Atom
PDF