Commit Graph

14 Commits

Author SHA1 Message Date
Shi Lei
2585a79e32 build-aux:check-spacing: Introduce a new rule to check misaligned stuff in parenthesises
This patch introduces a new rule to check misaligned stuff in parenthesis:
1. For misaligned arguments of function
2. For misaligned conditions of [if|while|switch|...]

There're too much misalignment, so it adds a temporary filter which
permits 'src/util' now. It _should_ be removed as soon as fixing all.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-24 10:02:40 +02:00
Shi Lei
a033182f04 build-aux:check-spacing: Add wrapper function of CheckCurlyBrackets
This patch adds CheckCurlyBrackets to simplify check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-24 10:02:40 +02:00
Shi Lei
6225626b6f build-aux:check-spacing: Add wrapper function of CheckWhiteSpaces
This patch adds CheckWhiteSpaces to simplify check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-24 10:02:40 +02:00
Shi Lei
c3875129d9 build-aux:check-spacing: Add wrapper function of KillComments
This patch adds KillComments to simplifies check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-24 10:02:40 +02:00
Shi Lei
e995904c56 build-aux:check-spacing: Add wrapper function of CheckFunctionBody
This patch adds CheckFunctionBody to simplifies check-spacing.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-24 10:02:40 +02:00
Shi Lei
11e1f11dd3 syntax-check: Check for incorrect indentation in function body
This patch add syntax-check rule for incorrect indentation and blank
first line in function body by changing check-spacing.pl.
For efficiency, it only checks the first line of function body.
But it's enough for most cases.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
2018-09-17 13:29:01 +02:00
Andrea Bolognani
90b17aef1a perl: Don't hardcode interpreter path
This is particularly useful on operating systems that don't ship
Perl as part of the base system (eg. FreeBSD) while still working
just as well as it did before on Linux.

In one case (src/rpc/genprotocol.pl) the interpreter path was
missing altogether.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2017-09-19 16:04:53 +02:00
Ján Tomko
3cc13e005d check-spacing: fix error message
The check for whitespace before comma or semicolon referred
to comma as colon.
2016-06-15 16:05:08 +02:00
Ján Tomko
cab2b44d8b check-spacing: use non-capturing groups 2016-06-15 15:48:33 +02:00
Ján Tomko
633daa4c57 check-spacing: remove virAssertCmpInt exception
The macro is now called testAssertEq and no longer
takes an operator as its argument.
2016-06-15 15:48:33 +02:00
Ján Tomko
a2762b93fd check-spacing: simplify keyword spacing check
We do not need a separate check forbidding whitespace
after the opening parenthesis after a keyword -
we forbid it after all of them.

The only allowed whitespace after an opening parenthesis
is a newline, tune the regex to reflect that.
2016-06-15 15:48:32 +02:00
Ján Tomko
cdf84bf1a8 check-spacing: rewrite regex for checking the closing parenthesis
Instead of matching multiple characters before the parenthesis,
only check for a single whitespace, which is much less cpu-intensive.

This only matches a few dozen of places where they are on an separate
line, filter out those with a separate regex.
2016-06-15 15:47:32 +02:00
Ján Tomko
b953e163ad check-spacing: rewrite whitespace check before (semi)colon
Instead of matching multiple characters, match any occurrence
preceded by a single whitespace and handle the exceptions
later.
2016-06-15 15:07:47 +02:00
Ján Tomko
4e1a7dbb31 Rename bracket-spacing.pl to check-spacing.pl
We test whitespace with lots of other characters now.
2016-06-15 15:07:47 +02:00