0fbed98e42 [script] lint-whitespace: improve print linenumber (Akio Nakamura)
Pull request description:
Before this PR, the linenumber infomaition is output if trailing-space or tab code was found, but the output occurence is only per a file.
This PR separates the output timing of file name and line number.
As a result, users will find where they need to fix more easily.
example:
0) git diff
```
diff --git a/dummy.txt b/dummy.txt
index c0ce4d776..aebbdb88d 100644
--- a/dummy.txt
+++ b/dummy.txt
@@ -1,2 +1,2 @@
-1
-2
+1
+ 2
@@ -8,2 +8,2 @@
-8
-9
+ 8
+9
```
1) before this PR - Is there "9 " in second line? It may lead to be misunderstood.
```
This diff appears to have added new lines with trailing whitespace.
The following changes were suspected:
diff --git a/dummy.txt b/dummy.txt
@@ -1,2 +1,2 @@
+1
+9
```
2) after this PR
```
This diff appears to have added new lines with trailing whitespace.
The following changes were suspected:
diff --git a/dummy.txt b/dummy.txt
@@ -1,2 +1,2 @@
+1
@@ -8,2 +8,2 @@
+9
```
Tree-SHA512: 2fd52e3c982786f86cfe10aa2578589bc9c502bcad9b85111467840d726143330c23968cde5483ee0f563893c8381044b80e8c22a7c8eca56fc73c548b9a9496
8dbf740f8 [scripts] lint-whitespace: check last N commits or unstaged changes (Sjors Provoost)
Pull request description:
E.g. before you push three commits to Github and upset Travis, check if you didn't make any whitespace mistakes:
```sh
contrib/devtools/lint-whitespace.sh 3
```
This is slightly more convenient than doing:
```sh
TRAVIS_COMMIT_RANGE=HEAD~3...HEAD contrib/devtools/lint-whitespace.sh
```
Tree-SHA512: 5d9c1ae978ccbe59477e8cf53391e9bd697d2da87f417a2519264af560d4768138e0b2d320dd497a1f1e704e18ab279d724f523b57c17a80ccd753133a5445bf
40b17f5f9 [scripts] lint-whitespace: use perl instead of grep -P (Sjors Provoost)
Pull request description:
MacOS does not support `grep -P` out of the box. This change makes
it easier for developers to check for whitespace problems locally.
Based on [this](https://stackoverflow.com/a/16658690) and [this](https://serverfault.com/a/504387) Stack Exchange answer.
Tested with:
```sh
export TRAVIS_COMMIT_RANGE='fe78c9a...62e0453'
contrib/devtools/lint-whitespace.sh
This diff appears to have added new lines with tab characters instead of spaces.
The following changes were suspected:
diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp
@@ -0,0 +1,110 @@
+ num.setint64(n);
```
Tree-SHA512: 37c342a0ca2580289cf326a278a051a7c21ba918d6b2143fd9987f159fab85f1de3d770fcf532a642cd5d1957afc8595678128196e102dc473924758f133db7f
Before this PR, the linenumber infomaition is output if trailing-space
or tab code was found, but the output occurence is only per a file.
This PR separates the output timing of file name and line number.
As a result, users will find where they need to fix more easily.
Lint checks should not test these, they are historical documents,
and we don't want to encourage silly changes to them to satisfy
a checker.
Hopefully makes travis pass again on master.
Tree-SHA512: 37e6716c4fd5e8a4e579f9b84042e6b0ac224836b6c851cd1ca3f7d46611ffd3003bed0ae08dd0457f69d6eaa485a0d21c631e7ef16b14bdb0f2f78ea700332d
This adds a new CHECK_DOC check that looks for newly introduced trailing
whitespace. Existing trailing whitespace (of which there is plenty!)
will not trigger an error.
This is written in a generic way so that new lint-*.sh scripts can be
added to contrib/devtools/, as I'd like to contribute additional lint
checks in the future.