Commit Graph

25 Commits

Author SHA1 Message Date
fanquake d873ff96e5
refactor: cleanups post unsubtree'ing univalue
Mostly changes to remove src/univalue exceptions from the various linters,
and the required code changes to make them happy. As well as minor doc
changes.
2022-06-15 12:56:44 +01:00
Jon Atack eb8aab759f logging: add LogPrintfCategory to log unconditionally with category
prefixing the output with the passed category name.

- add documentation
- add a unit test
- update lint-logs.py
- update lint-format-strings.py
2022-06-08 14:02:54 +02:00
Jon Atack 433b525694 Add LogPrintLevel to lint-format-strings, drop LogPrint-vs-LogPrintf section in dev notes
that was added in 2015 by commit b8c06ef40 in PR 7003, as that potential issue
would now be caught by the test/lint/lint-format-strings.py script run by the CI
2022-06-07 15:56:26 +02:00
MacroFake fad0abf539
lint: Fix lint-circular-dependencies.py file list 2022-04-30 11:16:44 +02:00
Eunoia 267684ee34 lint: convert format strings linter test to python 2022-04-13 21:32:20 +00:00
MarcoFalke fa82e890e7
Move lint script and data file to avoid lint- prefix
This is needed for the next commit
2022-04-04 16:58:07 +02:00
MarcoFalke 3c565302aa
Merge bitcoin/bitcoin#24409: Always output license/copyright info with `-version`
5a89bed410 contrib: address gen-manpages feedback from #24263 (fanquake)
2618fb8d15 Output license info when binaries are passed -version (fanquake)
4c3e3c5746 refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp (fanquake)

Pull request description:

  Addresses a review comment from #24263, and addresses the [comment](https://github.com/bitcoin/bitcoin/pull/24263#issuecomment-1030582925) where it was pointed out that we are inconsistent with emitting  our copyright. After this change, the copyright is always emitted with `-version`, rather than `-help`, i.e:
  ```bash
  bitcoind -version

  Bitcoin Core version v22.99.0-fc1f355913f6-dirty
  Copyright (C) 2009-2022 The Bitcoin Core developers

  Please contribute if you find Bitcoin Core useful. Visit
  <https://bitcoincore.org/> for further information about the software.
  The source code is available from <https://github.com/bitcoin/bitcoin>.

  This is experimental software.
  Distributed under the MIT software license, see the accompanying file COPYING
  or <https://opensource.org/licenses/MIT>
  ```

  The info is also added to binaries other than `bitcoind`/`bitcoin-qt`. This change also prevents duplicate copyright info appearing in the `bitcoind` man page.

ACKs for top commit:
  laanwj:
    Tested ACK 5a89bed410

Tree-SHA512: 0ac2a1adf9e9de0c3206f35837008e3f93eaf15b193736203d71609273f0887cca20b8a90972cb9f941ebd62b330d61a0cbb5fb1b7a7f2dbc715ed8a0c1569d9
2022-02-23 09:39:42 +01:00
fanquake 5b8f2484ba
lint: remove no-longer used exceptions from lint-format-strings.py 2022-02-22 15:51:27 +00:00
fanquake 4c3e3c5746
refactor: shift CopyrightHolders() and LicenseInfo() to clientversion.cpp 2022-02-22 15:36:19 +00:00
Andrew Chow e2f02aa59e Refactor: Copy CWallet signals and print function to LegacyScriptPubKeyMan
This commit does not change behavior.
2020-01-23 16:35:08 -05:00
Jeffrey Czyz f9abf4ab6d Add logging for CValidationInterface events
This could help debug issues where there may be race conditions at play,
such as #12978.

Fixes #12994.
2020-01-03 11:49:21 -08:00
Andrew Chow f201ba59ff Refactor: Split up CWallet and LegacyScriptPubKeyMan and classes
This moves CWallet members and methods dealing with keys to a new
LegacyScriptPubKeyMan class, and updates calling code to reference the new
class instead of CWallet.

Most of the changes are simple text replacements and variable substitutions
easily verified with:

    git log -p -n1 -U0 --word-diff-regex=.

The only nontrivial chunk of code added is the new LegacyScriptPubKeyMan class
declaration, but this code isn't new and is just selectively copied and moved
from the previous CWallet class declaration. This can be verified with:

    git log -p -n1 --color-moved=dimmed_zebra src/wallet/scriptpubkeyman.h src/wallet/wallet.h

or

    git diff HEAD~1:src/wallet/wallet.h HEAD:src/wallet/scriptpubkeyman.h

This commit does not change behavior.
2019-10-25 19:20:24 -04:00
Ben Woosley b21680baf5
test/contrib: Fix invalid escapes in regex strings
Flagged by flake8 v3.6.0, as W605, plus a few others identified
incidentally, e.g. 59ffecf66cf4d08c4b431e457b083878d66a3fd6.

Note that r"\n" matches to "\n" under re.match/search.
2019-09-03 14:38:38 -04:00
Hennadii Stepanov 753f7cccce
scripted-diff: Make translation bilingual
-BEGIN VERIFY SCRIPT-
sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h
sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h
sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src)
echo Hard cases - multiline strings.
sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp
sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp
sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp
sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp
echo Special case.
sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py
-END VERIFY SCRIPT-
2019-07-24 16:33:20 +03:00
MarcoFalke fa64b947bb
util: No translation of `Bitcoin Core` in the copyright 2019-06-27 15:06:46 -04:00
MarcoFalke 4952a95358
Merge #15534: [test] lint-format-strings: open files sequentially (fix for OS X)
21be609b49 In lint-format-strings, open files sequentially (Glenn Willen)

Pull request description:

  In lint-format-strings, we use python argparse to read our file arguments. In
  this mode, argparse opens all the files simultaneously. On OS X, where the
  default filehandle limit is 128, this causes the lint to fail. Instead, ask
  argparse for our filename arguments as strings, and open them one at a time
  using 'with open'.

Tree-SHA512: 4c7dabf98818a7c5d83ab10c61b89a26957fe399e39e933e30c561cb45c5e8ba6f6aedcde8343da0c32ee340289a8897db6a33708e35ee381334ee27e3f4d356
2019-03-05 09:40:23 -05:00
Glenn Willen 21be609b49 In lint-format-strings, open files sequentially
In lint-format-strings, we use python argparse to read our file arguments. In
this mode, argparse opens all the files simultaneously. On OS X, where the
default filehandle limit is 128, this causes the lint to fail. Instead, ask
argparse for our filename arguments as strings, and open them one at a time
using 'with open'.
2019-03-04 17:10:11 -08:00
MarcoFalke faa7cdf764
scripted-diff: Update copyright in ./test
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./test/
-END VERIFY SCRIPT-
2019-03-02 10:58:35 -05:00
MarcoFalke fa0e65b772
scripted-diff: test: Remove brackets after assert
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/assert ?\((.+)\)(( )*)?(#.*)?$/assert \1\3\3\4/g' $(git grep -l --extended-regexp 'assert ?\(' test)
-END VERIFY SCRIPT-
2019-03-02 10:51:35 -05:00
Luke Dashjr 57281199b8 lint/format-strings: Correctly exclude escaped percent symbols 2018-12-14 15:43:52 +00:00
Jim Posen 2068f089c8 scripted-diff: Move util files to separate directory.
-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-11-04 22:46:07 -08:00
MarcoFalke fae3fbd61a
logging: Replace LogPrint macros with regular functions 2018-09-12 11:28:01 -04:00
practicalswift 4441ad677a Make format string linter understand basic template parameter syntax 2018-08-10 17:28:59 +02:00
practicalswift bcd4b0f5cd Add linting of WalletLogPrintf(...) format strings 2018-08-07 14:57:54 +02:00
practicalswift a3e4556949 build: Add format string linter
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-07 14:07:21 +02:00