aboutsummaryrefslogtreecommitdiff
path: root/test/lint
AgeCommit message (Collapse)Author
2018-11-15rpc: Documentation fixupsMarcoFalke
2018-11-14lint: Must use RPCHelpMan to generate the RPC docsMarcoFalke
2018-11-07tests: Add Python dead code linter (vulture)practicalswift
2018-11-05Merge #14350: Add WalletLocation classWladimir J. van der Laan
65f3672f3b82a6fa30e5171f85bc8d8a29e0797e wallet: Refactor to use WalletLocation (João Barbosa) 01a4c095c87500650663341533f000c6b613e9da wallet: Add WalletLocation utility class (João Barbosa) Pull request description: Advantages of this change: - avoid resolving wallet absolute path and name repetitively and in multiple places; - avoid calling `GetWalletDir` in multiple places; - extract these details from the actual wallet implementation. The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory. Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2018-11-04scripted-diff: Move util files to separate directory.Jim Posen
-BEGIN VERIFY SCRIPT- mkdir -p src/util git mv src/util.h src/util/system.h git mv src/util.cpp src/util/system.cpp git mv src/utilmemory.h src/util/memory.h git mv src/utilmoneystr.h src/util/moneystr.h git mv src/utilmoneystr.cpp src/util/moneystr.cpp git mv src/utilstrencodings.h src/util/strencodings.h git mv src/utilstrencodings.cpp src/util/strencodings.cpp git mv src/utiltime.h src/util/time.h git mv src/utiltime.cpp src/util/time.cpp sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj -END VERIFY SCRIPT-
2018-10-26Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) ↵practicalswift
(uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...)
2018-10-25wallet: Refactor to use WalletLocationJoão Barbosa
2018-10-16Add ignored word: mutpracticalswift
2018-10-16Revert "qa: Fix codespell error and have lint-spelling error instead of warn"practicalswift
This reverts commit e413c2ddd1240d7bacd1837fa49d25781fe6e5fa.
2018-10-08Merge #13649: test: allow arguments to be forwarded to flake8 in lint-python.shMarcoFalke
854c85ae90 test: allow arguments to be forwarded to flake8 in lint-python.sh (James O'Beirne) Pull request description: In order to use `lint-python.sh` from within various in-editor linting frameworks (e.g. [ALE](https://github.com/w0rp/ale), [flycheck](https://github.com/flycheck/flycheck)), we need to allow its arguments to be forwarded to the wrapped flake8 invocation. For what it's worth, here's my bitcoin-specific ALE vim config for doing so (requires this changeset): ```vim $ grep python /home/james/src/bitcoin/.exrc let g:ale_python_flake8_executable="/home/james/src/bitcoin/test/lint/lint-python.sh" ``` Tree-SHA512: 0d5500238ea5fde26ee9c21f6518a3a3dc8409c77ad1271ff7e7a94ef45a8c8d2e1b8ad3df3075dd4062ee0fff534625b1bc79613f869cd3c2d9260814ffc7ee
2018-09-26Merge #14282: [wallet] Remove -usehdMarcoFalke
7ac911afe7 [docs] Add release notes for removing `-usehd` (John Newbery) 25548b2958 [wallet] Remove -usehd (John Newbery) Pull request description: `-usehd` is no longer used (except to tell the user that they've set it incorrectly for the wallet that they're loading). Remove it (in the same spirit as #14272) Tree-SHA512: 5bdcd2bb9bb8504a01343595bcd1bd433d97b730255152c725103c1ac3fa3a9d9e5220a4c29d4c72307cf803e1c09d31080f83603c23dc77263846e17b1826f0
2018-09-24test: allow arguments to be forwarded to flake8 in lint-python.shJames O'Beirne
2018-09-23Make fs::path::string() always return utf-8 stringChun Kuan Lee
2018-09-20[wallet] Remove -usehdJohn Newbery
2018-09-19init: Remove deprecated args from hidden argsMarcoFalke
2018-09-13Merge #14179: qa: Fixups to "Run all tests even if wallet is not compiled"MarcoFalke
fa8433e379 qa: Remove unneded import_deterministic_coinbase_privkeys overwrite, add comments (MarcoFalke) e413c2ddd1 qa: Fix codespell error and have lint-spelling error instead of warn (MarcoFalke) Pull request description: Currently the functional tests require the wallet module to be compiled into the Bitcoin Core executable. For example the premine (or datadir cache) to speed up tests when run in parallel would mine a bunch of blocks and store the private keys to sign the coinbase tx outputs in a wallet. There is no need to have the overhead of the whole wallet module by using keys that are deterministic for all runs. Note that this change most likely requires the `./test/cache/` to be cleared. Tree-SHA512: 9ce26036b0e10f0f888f66a1e50be6a357343f9ffb302ae24a7bb3df2f083a31702ef308b738a03b08a1b623aeddac5d6563dc1b15078c0357b7dafad7808ec3
2018-09-13qa: Fix codespell error and have lint-spelling error instead of warnMarcoFalke
2018-09-12logging: Replace LogPrint macros with regular functionsMarcoFalke
2018-09-11Merge #13734: gui: Drop boost::scoped_array and use wchar_t API explicitly ↵Wladimir J. van der Laan
on Windows bb6ca65f9890e8280ace32de5a37774e14705859 gui: get special folder in unicode (Chun Kuan Lee) 1c5d22585384c8bb05a27a04eab5c57b31d623fb Drop boost::scoped_array (Chun Kuan Lee) Pull request description: Drop boost::scoped_array and simplify the code. `TCHAR` should be defined as `wchar_t` if `UNICODE` is defined. So we can use `.toStdWString().c_str()` to get wchar_t C-style string. Fix #13819 Tree-SHA512: 3fd4aa784129c9d1576b01e6ee27faa42d793e152d132f2dde504d917dad3a8e95e065fcbc54a3895d74fb6b2a9ed4f5ec67d893395552f585e225486a84a454
2018-09-06Merge #12490: [Wallet] [RPC] Remove deprecated wallet rpc features from ↵MarcoFalke
bitcoin_server f7e9e70468 [rpc] Remove deprecated sigrawtransaction rpc method. (John Newbery) 90c834089a [RPC] Remove warning about wallet addresses in createmultisig() (John Newbery) df905e390e [rpc] Remove deprecated validateaddress usage. (John Newbery) Pull request description: The following rpc features were deprecated in V0.17: - `validateaddress` returning wallet information about an address - `signrawtransaction` This PR fully removes those features. It can be merged once V0.17 has been branched from master. Tree-SHA512: 28293d218cf7e348632081e362f8775f243d091f49aed54c354f017d4a12ae92b87b99f81ee592a1bbf4aebd5d8cd5119278141edde7a0399ff82917ed68b9f6
2018-09-05Merge #13954: Warn (don't fail!) on spelling errors. Fix typos reported by ↵MarcoFalke
codespell. f8a81f73ac lint: Add spell check linter (codespell) (practicalswift) ada356208e Fix typos reported by codespell (practicalswift) Pull request description: * Check for common misspellings using `codespell`. * Fix recently introduced typos reported by `codespell`. Tree-SHA512: 9974c0e640b411c7d0ebc5b45de253c19bac7fe3002cd98601ff8da8db584224c2fd7d331aee3df612c9f2cfef540d647a9b4c5a1a73fd208dc93ce4bf9e5e3e
2018-09-05Merge #14115: lint: Make all linters work under the default macOS dev ↵MarcoFalke
environment (build-osx.md) 341f7c7b0e macOS fix: Check for correct version of flake8 to avoid spurious warnings. The brew installed flake8 version is Python 2 based and does not work. (practicalswift) 908a559f33 macOS fix: Add excludes for checks added in the newer shellcheck version installed by brew (practicalswift) ec4d57bbb3 macOS fix: Work around empty (sub)expression error when using BSD grep (practicalswift) b57d7d92fe macOS fix: Avoid mapfile due to ancient version of bash shipped with macOS (practicalswift) Pull request description: The linters are thoroughly tested under Ubuntu which is what we use in Travis. When reading #14041 I understood that some developers were experiencing problems when running the linters on their local machines. Assuming these local machines were running macOS I installed a fresh macOS VM, followed the instructions in `build-osx.md` and ran the linters. This PR contains the changes needed to make `lint-all.sh` run as expected. Ideally the linters would continuously run also under a Travis macOS environment to make sure we catch these kind of issues before merge. Tree-SHA512: b39c9a970d14d27db1fb592539923c0bc676b5217f415d02fda3f17bf54d46faa172376e8a3ecab07ca68a3acba9aebe00b2b1b2161b2a36b85fbb672e7efb5c
2018-09-04lint: Add spell check linter (codespell)practicalswift
2018-09-04Fix typos reported by codespellpracticalswift
2018-09-04Merge #14128: lint: Make sure we read the command line inputs using utf-8 ↵Wladimir J. van der Laan
decoding in python 5d62dcf9cfb5c0b2511c10667ed47ec3b3610d72 lint: Make sure we read the command line inputs using utf-8 decoding in python (Chun Kuan Lee) Pull request description: Make sure we read the command line inputs using utf-8 decoding in python occurred from travis cron job: contrib/verify-commits/verify-commits.py should run with utf-8, otherwise it would raise UnicodeDecodeError `UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 744: ordinal not in range(128)` Tree-SHA512: 90e4ad57fdbbbecb0a21fc2d2b03a04f5ef125e54124719ef36e5a85326930b732b47534757a7c3a8730096f3947b009ec898191928b5c2d38f9f4b3e37db48d
2018-09-02lint: Make sure we read the command line inputs using utf-8 decoding in pythonChun Kuan Lee
2018-08-31Merge #14088: tests: Don't assert(...) with side effectsWladimir J. van der Laan
ca1a093127c11bb2aea10bf96c38dbfb40f8d170 Add regression test: Don't assert(...) with side effects (practicalswift) 4c3c9c38699360f93d3c52a01a90ff15ee5e1a62 Don't assert(...) with side effects (practicalswift) Pull request description: Don't `assert(...)` with side effects. From the developer notes: > **Assertions should not have side-effects** > > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand These assertions were introduced quite recently (in #14069 which was merged two days ago) and since this is a recurring thing (see #13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect. Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
2018-08-31macOS fix: Check for correct version of flake8 to avoid spurious warnings. ↵practicalswift
The brew installed flake8 version is Python 2 based and does not work.
2018-08-31macOS fix: Add excludes for checks added in the newer shellcheck version ↵practicalswift
installed by brew
2018-08-31macOS fix: Work around empty (sub)expression error when using BSD greppracticalswift
2018-08-31macOS fix: Avoid mapfile due to ancient version of bash shipped with macOSpracticalswift
2018-08-29Merge #13671: Remove the boost/algorithm/string/case_conv.hpp dependencyWladimir J. van der Laan
b193d5a443bfd994936ad21b807b2bb37756ef2c Removes the Boost case_conv.hpp dependency. (251) 7a208d9fade56e2347891daff2f6b903923c9d50 Implements custom tolower and toupper functions. (251) e2ba043b8d852d3f465bc293d6e494c8c6f75dfd Implements ParseNetwork unit test. (251) Pull request description: This pull request removes the `boost/algorithm/string/case_conv.hpp` dependency from the project. `boost/algorithm/string/case_conv.hpp` is included for the `boost::to_lower` and `boost::to_upper` template functions. We can replace the calls to these functions with straightforward alternative implementations that use the C++ Standard Library, because the functions are called with `std::string` objects that use standard 7-bit ASCII characters as argument. The refactored implementation should work without the explicit `static_cast<unsigned char>` cast and `unsigned char` lambda return type. Both have been added defensively and to be explicit. Especially in case of the former, behaviour is undefined (potentially result in a crash) if the `std::toupper` argument is not an `unsigned char`. A potential alternative, maybe even preferred, implementation to address the `boost::to_lower` function call in `ParseNetwork(std::string)` could have been: ```c++ if (net == "ipv4" || net == "IPv4") return NET_IPV4; if (net == "ipv6" || net == "IPv6") return NET_IPV6; ``` This alternative implementation would however change the external behaviour of `ParseNetwork(std::string)`. This pull requests includes a unit test to validate the implementation of `ParseNetwork(std::string)` prior and after the removal of the `case_conv.hpp` dependency. `boost/algorithm/string/case_conv.hpp` has been removed from the `EXPECTED_BOOST_INCLUDES` in `test/lint/lint-includes.sh` because it is no longer required. Tree-SHA512: d803ae709f2368a3efb223097384a722436955bce0c44a1a5cffd0abb3164be0cce85ba0e9ebd9408166df3f1a95ea0c0d29e3a2534af2fae206c0419d67fde9
2018-08-28Removes the Boost case_conv.hpp dependency.251
This commit removes the `boost/algorithm/string/case_conv.hpp` dependency from the project. It replaces the `boost::to_lower` and `boost::to_upper` functions with custom functions that are locale independent and ASCII deterministic.
2018-08-28Add regression test: Don't assert(...) with side effectspracticalswift
2018-08-27[rpc] Remove deprecated sigrawtransaction rpc method.John Newbery
2018-08-28add unicode compatible file_lock for WindowsChun Kuan Lee
boost::interprocess::file_lock cannot open the files that contain characters which cannot be parsed by the user's code page on Windows. This commit add a new class to handle those specific file for Windows.
2018-08-27use export LC_ALL=C.UTF-8Julian Fleischer
2018-08-25Merge #13707: tests: Add usage note to check-rpc-mappings.pyWladimir J. van der Laan
03a2d680101a9fee47c6fd818df7585cfc93ac06 Tests: add usage note to check-rpc-mappings.py (Mason Simon) Pull request description: This test would previously fail without a user-friendly warning message, if invoked with no arguments. Test plan: ``` bitcoin @_@$ python3 test/lint/check-rpc-mappings.py Usage: test/lint/check-rpc-mappings.py ROOT-DIR bitcoin @_@$ echo $? 1 bitcoin @_@$ python3 test/lint/check-rpc-mappings.py . * Checking consistency between dispatch tables and vRPCConvertParams bitcoin @_@$ echo $? 0 ``` Tree-SHA512: 0b7a94125d18ba5dbf3c3281a4af60718d2e495bf7645d7c2a3e1a2a1d80cffcea1383c90247186728037f1f2b38de75d0f59ccf7f792d69edd33884f3698c07
2018-08-21test: Add lint to prevent SIGNAL/SLOT connect styleJoão Barbosa
2018-08-13Merge #13054: tests: Enable automatic detection of undefined names in Python ↵MarcoFalke
tests scripts. Remove wildcard imports. 68400d8b96 tests: Use explicit imports (practicalswift) Pull request description: Enable automatic detection of undefined names in Python tests scripts. Remove wildcard imports. Wildcard imports make it unclear which names are present in the namespace, confusing both readers and many automated tools. An additional benefit of not using wildcard imports in tests scripts is that readers of a test script then can infer the rough testing scope just by looking at the imports. Before this commit: ``` $ contrib/devtools/lint-python.sh | head -10 ./test/functional/feature_rbf.py:8:1: F403 'from test_framework.util import *' used; unable to detect undefined names ./test/functional/feature_rbf.py:9:1: F403 'from test_framework.script import *' used; unable to detect undefined names ./test/functional/feature_rbf.py:10:1: F403 'from test_framework.mininode import *' used; unable to detect undefined names ./test/functional/feature_rbf.py:15:12: F405 bytes_to_hex_str may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:17:58: F405 CScript may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:25:13: F405 COIN may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:26:31: F405 satoshi_round may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:26:60: F405 COIN may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:30:41: F405 satoshi_round may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util ./test/functional/feature_rbf.py:30:68: F405 COIN may be undefined, or defined from star imports: test_framework.mininode, test_framework.script, test_framework.util $ ``` After this commit: ``` $ contrib/devtools/lint-python.sh | head -10 $ ``` Tree-SHA512: 3f826d39cffb6438388e5efcb20a9622ff8238247e882d68f7b38609877421b2a8e10e9229575f8eb6a8fa42dec4256986692e92922c86171f750a0e887438d9
2018-08-13tests: Use explicit importspracticalswift
2018-08-10Make format string linter understand basic template parameter syntaxpracticalswift
2018-08-08Merge #13780: 0.17: Pre-branch maintenanceWladimir J. van der Laan
3fc20632a3ad30809356a58d2cf0ea4a4ad4cec3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot) 2b6a2f4a28792f2fe9dc1be843b1ff1ecae35e8a Regenerate manpages (DrahtBot) eb7daf4d600eeb631427c018a984a77a34aca66e Update copyright headers to 2018 (DrahtBot) Pull request description: Some trivial maintenance to avoid having to do it again after the 0.17 branch off. (The scripts to do this are in `./contrib/`) Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-07Add linting of WalletLogPrintf(...) format stringspracticalswift
2018-08-07build: Add format string linterpracticalswift
This linter checks that the number of arguments passed to each variadic format string function matches the number of format specifiers in the format string.
2018-08-04Drop boost::scoped_arrayChun Kuan Lee
2018-08-02fix locale for lint-shellJulian Fleischer
2018-07-27Update copyright headers to 2018DrahtBot
2018-07-22Removes Boost predicate.hpp dependency251
This is a squashed commit that squashes the following commits: This commit removes the `boost/algorithm/string/predicate.hpp` dependenc from the project by replacing the function calls to `boost::algorithm::starts_with` `boost::algorithm::ends_with` and `all` with respectively C++11' `std::basic_string::front`, `std::basic_string::back`, `std::all_of` function calls This commit replaces `boost::algorithm::is_digit` with a locale independent isdigi function, because the use of the standard library's `isdigit` and `std::isdigit functions is discoraged in the developer notes
2018-07-21Removes the boost/algorithm/string/join dependency251
This commit removes the `boost/algorithm/string/join` dependency from the project by replacing `boost::algorithm::join` with a simple helper function.