mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #13954: Warn (don't fail!) on spelling errors. Fix typos reported by 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
This commit is contained in:
parent
b0a1f2b0ad
commit
41494eea70
@ -6,4 +6,5 @@
|
|||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
|
travis_retry pip install codespell
|
||||||
travis_retry pip install flake8==3.5.0
|
travis_retry pip install flake8==3.5.0
|
||||||
|
@ -29,7 +29,7 @@ License: GNU-All-permissive-License
|
|||||||
Files: src/qt/res/icons/proxy.png
|
Files: src/qt/res/icons/proxy.png
|
||||||
src/qt/res/src/proxy.svg
|
src/qt/res/src/proxy.svg
|
||||||
Copyright: Cristian Mircea Messel
|
Copyright: Cristian Mircea Messel
|
||||||
Licese: public-domain
|
License: public-domain
|
||||||
|
|
||||||
|
|
||||||
License: Expat
|
License: Expat
|
||||||
|
@ -78,7 +78,7 @@ static void SetMaxOpenFiles(leveldb::Options *options) {
|
|||||||
// do not interfere with select() loops. On 64-bit Unix hosts this value is
|
// do not interfere with select() loops. On 64-bit Unix hosts this value is
|
||||||
// also OK, because up to that amount LevelDB will use an mmap
|
// also OK, because up to that amount LevelDB will use an mmap
|
||||||
// implementation that does not use extra file descriptors (the fds are
|
// implementation that does not use extra file descriptors (the fds are
|
||||||
// closed after being mmaped).
|
// closed after being mmap'ed).
|
||||||
//
|
//
|
||||||
// Increasing the value beyond the default is dangerous because LevelDB will
|
// Increasing the value beyond the default is dangerous because LevelDB will
|
||||||
// fall back to a non-mmap implementation when the file count is too large.
|
// fall back to a non-mmap implementation when the file count is too large.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Press "Ok" button in message box dialog.
|
* Press "Ok" button in message box dialog.
|
||||||
*
|
*
|
||||||
* @param text - Optionally store dialog text.
|
* @param text - Optionally store dialog text.
|
||||||
* @param msec - Number of miliseconds to pause before triggering the callback.
|
* @param msec - Number of milliseconds to pause before triggering the callback.
|
||||||
*/
|
*/
|
||||||
void ConfirmMessage(QString* text = nullptr, int msec = 0);
|
void ConfirmMessage(QString* text = nullptr, int msec = 0);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Add a callback to be executed. Callbacks are executed serially
|
* Add a callback to be executed. Callbacks are executed serially
|
||||||
* and memory is release-acquire consistent between callback executions.
|
* and memory is release-acquire consistent between callback executions.
|
||||||
* Practially, this means that callbacks can behave as if they are executed
|
* Practically, this means that callbacks can behave as if they are executed
|
||||||
* in order by a single thread.
|
* in order by a single thread.
|
||||||
*/
|
*/
|
||||||
void AddToProcessQueue(std::function<void ()> func);
|
void AddToProcessQueue(std::function<void ()> func);
|
||||||
|
@ -527,7 +527,7 @@ public:
|
|||||||
explicit BitStreamReader(IStream& istream) : m_istream(istream) {}
|
explicit BitStreamReader(IStream& istream) : m_istream(istream) {}
|
||||||
|
|
||||||
/** Read the specified number of bits from the stream. The data is returned
|
/** Read the specified number of bits from the stream. The data is returned
|
||||||
* in the nbits least signficant bits of a 64-bit uint.
|
* in the nbits least significant bits of a 64-bit uint.
|
||||||
*/
|
*/
|
||||||
uint64_t Read(int nbits) {
|
uint64_t Read(int nbits) {
|
||||||
if (nbits < 0 || nbits > 64) {
|
if (nbits < 0 || nbits > 64) {
|
||||||
|
@ -79,7 +79,7 @@ void* Arena::alloc(size_t size)
|
|||||||
|
|
||||||
// Create the used-chunk, taking its space from the end of the free-chunk
|
// Create the used-chunk, taking its space from the end of the free-chunk
|
||||||
const size_t size_remaining = size_ptr_it->first - size;
|
const size_t size_remaining = size_ptr_it->first - size;
|
||||||
auto alloced = chunks_used.emplace(size_ptr_it->second + size_remaining, size).first;
|
auto allocated = chunks_used.emplace(size_ptr_it->second + size_remaining, size).first;
|
||||||
chunks_free_end.erase(size_ptr_it->second + size_ptr_it->first);
|
chunks_free_end.erase(size_ptr_it->second + size_ptr_it->first);
|
||||||
if (size_ptr_it->first == size) {
|
if (size_ptr_it->first == size) {
|
||||||
// whole chunk is used up
|
// whole chunk is used up
|
||||||
@ -92,7 +92,7 @@ void* Arena::alloc(size_t size)
|
|||||||
}
|
}
|
||||||
size_to_free_chunk.erase(size_ptr_it);
|
size_to_free_chunk.erase(size_ptr_it);
|
||||||
|
|
||||||
return reinterpret_cast<void*>(alloced->first);
|
return reinterpret_cast<void*>(allocated->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arena::free(void *ptr)
|
void Arena::free(void *ptr)
|
||||||
|
@ -76,7 +76,7 @@ class ExampleTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
"""Override test parameters for your individual test.
|
"""Override test parameters for your individual test.
|
||||||
|
|
||||||
This method must be overridden and num_nodes must be exlicitly set."""
|
This method must be overridden and num_nodes must be explicitly set."""
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
# Use self.extra_args to change command-line arguments for the nodes
|
# Use self.extra_args to change command-line arguments for the nodes
|
||||||
|
@ -993,7 +993,7 @@ class FullBlockTest(BitcoinTestFramework):
|
|||||||
assert_equal(get_legacy_sigopcount_block(b73), MAX_BLOCK_SIGOPS + 1)
|
assert_equal(get_legacy_sigopcount_block(b73), MAX_BLOCK_SIGOPS + 1)
|
||||||
self.send_blocks([b73], success=False, reject_code=16, reject_reason=b'bad-blk-sigops', reconnect=True)
|
self.send_blocks([b73], success=False, reject_code=16, reject_reason=b'bad-blk-sigops', reconnect=True)
|
||||||
|
|
||||||
# b74/75 - if we push an invalid script element, all prevous sigops are counted,
|
# b74/75 - if we push an invalid script element, all previous sigops are counted,
|
||||||
# but sigops after the element are not counted.
|
# but sigops after the element are not counted.
|
||||||
#
|
#
|
||||||
# The invalid script element is that the push_data indicates that
|
# The invalid script element is that the push_data indicates that
|
||||||
|
@ -15,8 +15,8 @@ class LongpollThread(threading.Thread):
|
|||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
# query current longpollid
|
# query current longpollid
|
||||||
templat = node.getblocktemplate()
|
template = node.getblocktemplate()
|
||||||
self.longpollid = templat['longpollid']
|
self.longpollid = template['longpollid']
|
||||||
# create a new connection to the node, we can't use the same
|
# create a new connection to the node, we can't use the same
|
||||||
# connection from two threads
|
# connection from two threads
|
||||||
self.node = get_rpc_proxy(node.url, 1, timeout=600, coveragedir=node.coverage_dir)
|
self.node = get_rpc_proxy(node.url, 1, timeout=600, coveragedir=node.coverage_dir)
|
||||||
@ -31,11 +31,11 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
|
|||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.")
|
self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.")
|
||||||
self.nodes[0].generate(10)
|
self.nodes[0].generate(10)
|
||||||
templat = self.nodes[0].getblocktemplate()
|
template = self.nodes[0].getblocktemplate()
|
||||||
longpollid = templat['longpollid']
|
longpollid = template['longpollid']
|
||||||
# longpollid should not change between successive invocations if nothing else happens
|
# longpollid should not change between successive invocations if nothing else happens
|
||||||
templat2 = self.nodes[0].getblocktemplate()
|
template2 = self.nodes[0].getblocktemplate()
|
||||||
assert(templat2['longpollid'] == longpollid)
|
assert(template2['longpollid'] == longpollid)
|
||||||
|
|
||||||
# Test 1: test that the longpolling wait if we do nothing
|
# Test 1: test that the longpolling wait if we do nothing
|
||||||
thr = LongpollThread(self.nodes[0])
|
thr = LongpollThread(self.nodes[0])
|
||||||
|
@ -109,7 +109,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
|||||||
def test_orphan_tx_handling(self, base_tx, resolve_via_block):
|
def test_orphan_tx_handling(self, base_tx, resolve_via_block):
|
||||||
node = self.nodes[0] # convenience reference to the node
|
node = self.nodes[0] # convenience reference to the node
|
||||||
|
|
||||||
# Create a root transaction that we withold until all dependend transactions
|
# Create a root transaction that we withold until all dependent transactions
|
||||||
# are sent out and in the orphan cache
|
# are sent out and in the orphan cache
|
||||||
SCRIPT_PUB_KEY_OP_TRUE = b'\x51\x75' * 15 + b'\x51'
|
SCRIPT_PUB_KEY_OP_TRUE = b'\x51\x75' * 15 + b'\x51'
|
||||||
tx_withhold = CTransaction()
|
tx_withhold = CTransaction()
|
||||||
|
@ -89,7 +89,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||||||
sync_blocks([self.nodes[0], self.nodes[2]], timeout=5)
|
sync_blocks([self.nodes[0], self.nodes[2]], timeout=5)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# node2 must remain at heigh 0
|
# node2 must remain at height 0
|
||||||
assert_equal(self.nodes[2].getblockheader(self.nodes[2].getbestblockhash())['height'], 0)
|
assert_equal(self.nodes[2].getblockheader(self.nodes[2].getbestblockhash())['height'], 0)
|
||||||
|
|
||||||
# now connect also to node 1 (non pruned)
|
# now connect also to node 1 (non pruned)
|
||||||
|
@ -89,7 +89,7 @@ class PSBTTest(BitcoinTestFramework):
|
|||||||
# Unless we allow it to convert and strip signatures
|
# Unless we allow it to convert and strip signatures
|
||||||
self.nodes[0].converttopsbt(signedtx['hex'], True)
|
self.nodes[0].converttopsbt(signedtx['hex'], True)
|
||||||
|
|
||||||
# Explicilty allow converting non-empty txs
|
# Explicitly allow converting non-empty txs
|
||||||
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
|
new_psbt = self.nodes[0].converttopsbt(rawtx['hex'])
|
||||||
self.nodes[0].decodepsbt(new_psbt)
|
self.nodes[0].decodepsbt(new_psbt)
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ def create_tx_with_script(prevtx, n, script_sig=b"", amount=1, script_pub_key=CS
|
|||||||
"""Return one-input, one-output transaction object
|
"""Return one-input, one-output transaction object
|
||||||
spending the prevtx's n-th output with the given amount.
|
spending the prevtx's n-th output with the given amount.
|
||||||
|
|
||||||
Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend ouput.
|
Can optionally pass scriptPubKey and scriptSig, default is anyone-can-spend output.
|
||||||
"""
|
"""
|
||||||
tx = CTransaction()
|
tx = CTransaction()
|
||||||
assert(n < len(prevtx.vout))
|
assert(n < len(prevtx.vout))
|
||||||
|
6
test/lint/lint-spelling.ignore-words.txt
Normal file
6
test/lint/lint-spelling.ignore-words.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
cas
|
||||||
|
hights
|
||||||
|
mor
|
||||||
|
objext
|
||||||
|
unselect
|
||||||
|
useable
|
15
test/lint/lint-spelling.sh
Executable file
15
test/lint/lint-spelling.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 The Bitcoin Core developers
|
||||||
|
# Distributed under the MIT software license, see the accompanying
|
||||||
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
#
|
||||||
|
# Warn in case of spelling errors.
|
||||||
|
# Note: Will exit successfully regardless of spelling errors.
|
||||||
|
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
|
IGNORE_WORDS_FILE=test/lint/lint-spelling.ignore-words.txt
|
||||||
|
if ! codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=${IGNORE_WORDS_FILE} $(git ls-files -- ":(exclude)build-aux/m4/" ":(exclude)contrib/seeds/*.txt" ":(exclude)depends/" ":(exclude)doc/release-notes/" ":(exclude)src/leveldb/" ":(exclude)src/qt/locale/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/"); then
|
||||||
|
echo "^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in ${IGNORE_WORDS_FILE}"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user