Commit graph

173 commits

Author SHA1 Message Date
MarcoFalke
4b75dcf0ec devtools: Make linter check LogPrint calls 2018-05-02 15:14:37 +02:00
MarcoFalke
07825088f9
Merge #12972: Add python3 script shebang lint
2bff472992 [contrib] convert test-security-check to python3 (John Newbery)
958bf40489 add lint tool to check python3 shebang (practicalswift)

Pull request description:

  base58.py can executed by python3

Tree-SHA512: 30511204feefd4ccd5b4bf698fb88e516633e692dc95d31fe957b1c0c4879de25906355b28a5a0522171887315c8464a611e601ff00540db172d5bd463ee13d9
2018-04-16 16:03:22 -04:00
practicalswift
643aad17fa Enable additional flake8 rules 2018-04-16 17:25:11 +02:00
practicalswift
f020aca297 Minor Python cleanups to make flake8 pass with the new rules enabled 2018-04-16 17:25:11 +02:00
John Newbery
2bff472992 [contrib] convert test-security-check to python3 2018-04-14 02:13:42 +08:00
practicalswift
958bf40489 add lint tool to check python3 shebang 2018-04-14 02:13:24 +08:00
MarcoFalke
3cf76c23fb
Merge #12933: doc: Refine header include policy
fad0fc3c9a Refine travis check for duplicate includes (MarcoFalke)

Pull request description:

  Since there is no harm in having "duplicate" includes and it makes it obvious what are the dependencies of each file, without having to do static analysis or jumping between files, I'd suggest to revert the travis check for duplicate includes.

  Generally, I think that enforcing minor style preferences should not be done via travis. The cost of maintaining and the burden on other developers is too high. C.f discussion in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r180142594

Tree-SHA512: 97ab0e769d457ccfb873fff6c99613f8b944cd7ef95bfdccb0e1bbe8f5df1f16548c658fa03af42516f806546e75646d338a061e7b057619490235d311ca21f1
2018-04-11 10:45:47 -04:00
practicalswift
1499fdc350 Add shell script linting: Check for shellcheck warnings in shell scripts 2018-04-11 15:41:18 +02:00
MarcoFalke
fad0fc3c9a
Refine travis check for duplicate includes
This partially reverts commit c36b720d00.
2018-04-10 15:12:42 -04:00
Wladimir J. van der Laan
ebd786b72a
Merge #12852: [doc] devtools: Setup ots git integration
fa385c3 [doc] devtools: Setup ots git integration (MarcoFalke)

Pull request description:

  Document the simple steps on how to set up ots git integration.

Tree-SHA512: 1b9f99bfaa6cd9dc581243d3a3584301645e95450acc3b5898dcdb53849569de16bb8ef2676b18f6b8dd402de10aee80119e15c1b28cef36f17ad121cbba2ba3
2018-04-10 15:29:10 +02:00
MarcoFalke
fa385c3a8b
[doc] devtools: Setup ots git integration 2018-04-09 08:23:24 -04:00
practicalswift
c36b720d00 Add Travis check for duplicate includes
This enforces parts of the project header include guidelines (added by @sipa in #10575).
2018-04-09 09:18:49 +02:00
Wladimir J. van der Laan
3190785c11
Merge #12891: [logging] add lint-logs.sh to check for newline termination.
d207207 [logging] add lint-logs.sh to check for newline termination. (John Newbery)
5c21e6c [logging] Comment all continuing logs. (John Newbery)

Pull request description:

  Check that all calls to LogPrintf() are terminated by a newline,
  except those that are explicitly marked as 'continued' logs.

Tree-SHA512: fe5162b2b2df1e8a4c807da87584fa9af97a6b8377e4090fe0caa136d90bf29a487a123cde94569bdce7101fee3478196d99aa13f1212e24bfe5f41c773604fc
2018-04-08 11:04:49 +02:00
John Newbery
d207207fd3 [logging] add lint-logs.sh to check for newline termination.
Check that all calls to LogPrintf() are terminated by a newline,
except those that are explicitly marked as 'continued' logs.
2018-04-07 12:29:52 -04:00
practicalswift
d1b622b5a2 tests: Add check for test suite name uniqueness in lint-tests.sh 2018-04-06 16:29:14 +02:00
MarcoFalke
0c5f67b8e5
Merge #12757: Clarify include guard naming convention
3bcc0059b8 Add lint-include-guards.sh which checks include guard consistency (practicalswift)
8fd6af89a0 Fix missing or inconsistent include guards (practicalswift)
8af65d96f4 Document include guard convention (practicalswift)

Pull request description:

  * **Documentation**: Document include guard convention
  * **Fix**: Fix missing or inconsistent include guards
  * **Regression test**: Add `lint-include-guards.sh` which checks include guard consistency

Tree-SHA512: 8171878f60fd08ccbea943a11e835195750592abb9d7ab74eaa4265ae7fac523b1da9d31ca13d6ab73dd596e49986bfb7593c696e5f39567c93e610165bc2acc
2018-04-01 18:30:21 -04:00
MarcoFalke
9beded5860
Merge #12719: tests: Add note about test suite naming convention in developer-notes.md
db983beba6 tests: Add lint-tests.sh which checks the test suite naming convention (practicalswift)
5fd864fe8a tests: Rename test suits not following the test suite naming convention (practicalswift)
7b4a296a71 tests: Add note about test suite naming convention (practicalswift)

Pull request description:

  Changes:
  * Add note about test suite naming convention
  * Fix exceptions
  * Add regression test

  Rationale:
  * Consistent naming of test suites makes programmatic test running of specific tests/subsets of tests easier
  * Explicit is better than implicit

  Before this commit:

  ```
  $ contrib/devtools/lint-tests.sh
  The test suite in file src/test/foo_tests.cpp should be named
  "foo_tests". Please make sure the following test suites follow
  that convention:

  src/test/blockchain_tests.cpp:BOOST_FIXTURE_TEST_SUITE(blockchain_difficulty_tests, BasicTestingSetup)
  src/test/prevector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup)
  src/wallet/test/coinselector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(coin_selection_tests, WalletTestingSetup)
  src/wallet/test/crypto_tests.cpp:BOOST_FIXTURE_TEST_SUITE(wallet_crypto, BasicTestingSetup)
  $
  ```

  After this commit:

  ```
  $ contrib/devtools/lint-tests.sh
  $
  ```

Tree-SHA512: 7258ab9a6b9b8fc1939efadc619e2f2f02cfce8034c7f2e5dc5ecc769aa12e17f6fb8e363817feaf15c026c5b958b2574525b8d2d3f6be69658679bf8ceea9e9
2018-04-01 18:28:22 -04:00
MarcoFalke
fa5825d610
Merge #12284: Remove assigned but never used local variables. Enable Travis checking for unused local variables.
ea04bf7862 Enable flake8 warning F841 ("local variable 'foo' is assigned to but never used") (practicalswift)
169f3e8637 Remove assigned but never used local variables (practicalswift)

Pull request description:

  Remove assigned but never used local variables. Enable Travis checking for unused local variables.

Tree-SHA512: d6052ec9044c5d1f03d874ea3c8addd5a156779213ef9200f89d3ae53230f2fd1691aff405c3dae14178e5ef09912c4432e92f606ef4a5220ed9daa140cdee81
2018-04-01 18:24:30 -04:00
MarcoFalke
5e53b80b02
Merge #12820: contrib: Fix check-doc script regexes
0c17e27630 init: Remove help text for non-existent -fuzzmessagestest arg (MarcoFalke)
136084470c contrib: Fix check-doc script regexes (MarcoFalke)

Pull request description:

  Fixup the regexes to properly find all used args. The regex should now match all of the getter and setter methods of the `ArgsManager`. See https://dev.visucore.com/bitcoin/doxygen/class_args_manager.html#pub-methods

  Before:
  ```
  Args used        : 159
  Args documented  : 188
  Args undocumented: 0
  Args unknown     : 29
  ```

  After:
  ```
  Args used        : 183
  Args documented  : 188
  Args undocumented: 0
  Args unknown     : 5
  ```

Tree-SHA512: 1a7fb7ea55b2f6030358a1055d8f2c19b31f69d0603be0b009e6e603564014b4e2bb824357c9d43d0fba3ce7159b7c4e7eaa60b3f962053d94f73d0e626294fc
2018-03-30 11:40:16 -04:00
Wladimir J. van der Laan
252c1b0fae
Merge #12829: Python3 fixup
f50975b [contrib] fixup symbol-check.py Python3 support (John Newbery)
5de2b18 [contrib] fixup security-check.py Python3 support (John Newbery)

Pull request description:

  security-check.py and symbol-check.py were broken by #11881. Fix them.

Tree-SHA512: 86de3d6dc3292b1ae4cc04c2d7d7dbbf39c9270551d7b224b8d8b19e3184c30c897dbf823200403706d06bb405c0decad5cfd690cb2c0312992a235a4ffcf6bf
2018-03-29 22:34:25 +02:00
practicalswift
ea04bf7862 Enable flake8 warning F841 ("local variable 'foo' is assigned to but never used") 2018-03-29 18:21:03 +02:00
practicalswift
169f3e8637 Remove assigned but never used local variables 2018-03-29 17:47:12 +02:00
John Newbery
f50975b136 [contrib] fixup symbol-check.py Python3 support 2018-03-28 16:58:42 -04:00
John Newbery
5de2b18c67 [contrib] fixup security-check.py Python3 support 2018-03-28 15:46:54 -04:00
MarcoFalke
05120ee755 contrib: Remove unused import string 2018-03-28 14:35:28 -04:00
MarcoFalke
136084470c contrib: Fix check-doc script regexes 2018-03-28 14:13:29 -04:00
John Newbery
bc6fdf2d15 Change all python files to use Python3 2018-03-26 16:49:33 -04:00
practicalswift
3bcc0059b8 Add lint-include-guards.sh which checks include guard consistency 2018-03-22 19:41:16 +01:00
practicalswift
db983beba6 tests: Add lint-tests.sh which checks the test suite naming convention 2018-03-19 08:54:08 +01:00
MarcoFalke
d8d9162f5b
Merge #12572: [script] lint-whitespace: find errors more easily
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
2018-03-11 17:30:04 -04:00
Wladimir J. van der Laan
17c44b208f
Merge #12098: [scripts] lint-whitespace: add param to check last N commits
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
2018-03-06 23:17:26 +01:00
Wladimir J. van der Laan
14475e2dcd
Merge #12097: [scripts] lint-whitespace: use perl instead of grep -P
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
2018-03-06 23:09:40 +01:00
Akio Nakamura
0fbed98e42 [script] lint-whitespace: improve print linenumber
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.
2018-03-01 16:03:38 +09:00
MarcoFalke
dcfe218626
Merge #12308: contrib: Add support for out-of-tree builds in gen-manpages.sh
526e28220a contrib: Add support for out-of-tree builds in gen-manpages.sh (Wladimir J. van der Laan)

Pull request description:

  This adds support for setting the environment variable `BUILDDIR` to point to executables that are outside the source directory.

  E.g. to invoke the tool when the build is in $PWD/build:

  ```bash
  BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
  ```

  This avoids having to manually copy the generated manpages after they end up in the build instead of source path, when setting TOPDIR instead.

Tree-SHA512: 8dc6dd7a47a0c014ae7d27f0ac9d86f69238ec6bac8a3007b975bb88c9f37014755c716c5e62604dd91baad2f8a41fd1544cdca3ba4b59bc76602e6593f4a4a7
2018-02-18 18:04:57 -05:00
MarcoFalke
fafbf7f74e
devtools: Exclude patches from lint-whitespace 2018-02-15 14:39:04 -05:00
Wladimir J. van der Laan
526e28220a contrib: Add support for out-of-tree builds in gen-manpages.sh
This adds support for setting the environment variable `BUILDDIR`
to point to executables that are outside the source directory.

E.g. to invoke the tool when the build is in $PWD/build:

```bash
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
```
2018-01-31 11:27:36 +01:00
practicalswift
a9d0ebc262 Enable flake8 warnings for all currently non-violated rules 2018-01-29 23:22:58 +01:00
practicalswift
0b9207efbe Enable flake8 warning for "list comprehension redefines 'foo' from line N" (F812) 2018-01-29 20:23:58 +01:00
Sjors Provoost
8dbf740f80
[scripts] lint-whitespace: check last N commits or unstaged changes
Get usage instructions:
.lint-whitespace.sh -?
2018-01-08 12:10:07 +01:00
Sjors Provoost
40b17f5f91
[scripts] lint-whitespace: use perl instead of grep -P
MacOS does not support 'grep -P' out of the box. This change makes
it easier for developers to check for whitespace problems locally.
2018-01-05 14:41:01 +01:00
MarcoFalke
c991b304de
Merge #12075: [scripts] Add missing univalue file to copyright_header.py
415f86c6ae [scripts] Add missing univalue file to copyright_header.py (fanquake)

Pull request description:

  This needs to be added so that PRs like #12062 don't modify the subtree.

Tree-SHA512: 3642bdb0c8271ae700857a79fa5800b0c26c4b3f126d4406f224293817fb74d498fa1fc581d576ae747fbbb6952d4369fc4ab823ab48fd0946c1e8ccbe93cee6
2018-01-03 06:03:03 -09:00
Akira Takizawa
595a7bab23 Increment MIT Licence copyright header year on files modified in 2017 2018-01-03 02:26:56 +09:00
fanquake
415f86c6ae
[scripts] Add missing univalue file to copyright_header.py 2018-01-02 10:20:50 +08:00
practicalswift
d60b320740 Add Travis check for unused Python imports 2017-12-10 11:49:43 +01:00
Pieter Wuille
c17f11f7b4
Merge #10773: Shell script cleanups
13a81b19d Add quotes to variable assignment (as requested by @TheBlueMatt) (practicalswift)
683b9d280 Fix valid path output (practicalswift)
193c2fb4c Use bash instead of POSIX sh. POSIX sh does not support arrays. (practicalswift)
80f5f28d3 Fix incorrect quoting of quotes (the previous quotes had no effect beyond unquoting) (practicalswift)
564a172df Add required space to [[ -n "$1" ]] (previously [[ -n"$1" ]]) (practicalswift)
1e44ae0e1 Add error handling: exit if cd fails (practicalswift)
b9e79ab41 Remove "\n" from echo argument. echo does not support escape sequences. (practicalswift)
f6b3382fa Remove unused variables (practicalswift)

Pull request description:

  Shell script cleanups:
  * Add required space to `[ -n ]`.
  * Avoid quote within quote.
  * Exit if `cd` fails.
  * Remove `\n` which is not handled by `echo`.
  * ~~Remove redundant `$` in arithmetic variable expression.~~
  * ~~Use `$(command)` instead of legacy form `` `command` ``.~~
  * Arrays are not supported in POSIX `sh`. Use `bash` when arrays are used.
  * ~~`[ foo -a bar ]` is not well defined, use `[ foo ] && [ bar ]` instead.~~
  * ~~`[ foo -o bar ]` is not well defined, use `[ foo ] || [ bar ]` instead.~~

Tree-SHA512: 80f6ded58bce625b15b4da30d69d2714c633e184e62b21ed67d2c58e2ebaa08b4147593324012694d02bf4f1f252844cdff2fd1cf5e817ddb07e2777db7a6390
2017-12-04 15:52:11 -08:00
MarcoFalke
6e4e98ee8c
Merge #11394: Perform a weaker subtree check in Travis
487aff421 Check subtree consistency in Travis (Pieter Wuille)
e1d0cc23a Improve git-subtree-check.sh (Pieter Wuille)

Pull request description:

  Apparently many of our subtrees get modified by PRs in this repository, without getting noticed.

  To improve upon this:
  * Make git-subtree-check.sh capable of doing a weaker consistency check (that doesn't need access to external repositories), but which should be sufficient to detect unintended changes. It can be fooled by a fake subtree merge commit, but that would hopefully be obvious to reviewers.
  * Make Travis invoke this subtree check for each of our subtrees.

  Note that Travis is currently expected to fail on this PR, as 2 out of 4 subtrees (`src/secp156k1` and `src/univalue` have been modified directly in master).

Tree-SHA512: 465b680392d3daf38a8c1dda77d6f74b1d1c23324c378774777fb95aa673e119a8f7e3ccc124e41d97b5ac8975f3d79f3015797d2d309666582394364917ec4e
2017-11-09 17:06:20 -05:00
MarcoFalke
fa0025dc3c Revert "Remove unused variable in shell script"
This partially reverts commit ab8e8b97a3
2017-11-09 16:49:25 -05:00
Wladimir J. van der Laan
23e9074e0a
Merge #10771: Remove unused variables in shell scripts
ab8e8b9 Remove unused variables in shell scripts. (practicalswift)

Pull request description:

  Remove unused variables in shell scripts. Use `_` where we don't care about the result.

Tree-SHA512: 35049e79ee432c805f061456c32902a92811b5214d50ce6770b22d1442cc5999ed53cfe05bb2347f6995ca33c707a0f3fe92d5829c0385c4a3e254953924cbc4
2017-11-09 21:20:20 +01:00
practicalswift
193c2fb4c8 Use bash instead of POSIX sh. POSIX sh does not support arrays. 2017-10-18 17:10:23 +02:00
Pieter Wuille
e1d0cc23a9 Improve git-subtree-check.sh
We have several pieces of information about subtrees:
1) What their current directory contents is
2) What their directory contents was at the time of the last subtree merge
3) What the directory contents of the upstream project is in the commit referred to by the subtree merge.

Normally, all 3 should be identical. git-subtree-check.sh so far only compared (1) with (3) however.

Fix this by comparing all three, and give some more useful diff output in the case of mismatch.

The added benefit is that (1) and (2) can be compared without needing to see the upstream repository.
2017-10-11 11:40:57 -07:00