dash/test/lint
pasta 96685be685
Merge #5167: refactor(stats): modernize statsd::StatsdClient, make global unique_ptr
cc998abec1 fmt: apply `clang-format-diff.py` suggestions (Kittywhiskers Van Gogh)
0401c581eb stats: `const`-ify variables and arguments (Kittywhiskers Van Gogh)
9f96723774 stats: stop using error codes, switch over to `bool` (Kittywhiskers Van Gogh)
1a81979c1e stats: initialize socket after we have a valid socket address (Kittywhiskers Van Gogh)
dbbfc8d766 stats: use `Socks` wrapper, use `CService` to generate our `sockaddr` (Kittywhiskers Van Gogh)
2def905044 stats: move init logic into constructor (Kittywhiskers Van Gogh)
4bc727cd6c stats: clean up randomization code, move `FastRandomContext` inward (Kittywhiskers Van Gogh)
840241eefd stats: cleanup error logging, improve code sanity (Kittywhiskers Van Gogh)
85890ddb13 docs: add copyright notice to source file, update notice in header (Kittywhiskers Van Gogh)
a9d1b1494d stats: move `_StatsdClientData` variables into `StatsdClient` (Kittywhiskers Van Gogh)
30c30c1397 stats: fetch all arguments needed when constructing `g_stats_client` (Kittywhiskers Van Gogh)
5133d88415 stats: s/statsClient/g_stats_client/g (Kittywhiskers Van Gogh)
f81951dd00 stats: make `statsClient` a `std::unique_ptr`, denote as global variable (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  Support for transmitting stats to a Statsd server has been courtesy of Statoshi ([repo](https://github.com/jlopp/statoshi)), implemented Dec, 2020 by [dash#2515](https://github.com/dashpay/dash/pull/2515) but since then, it hasn't gotten much attention aside from benefiting from codebase-wide changes and the occasional compiler appeasement. This pull request aims to give our statistics code some TLC.

  Changes include:

  * Limiting initialization to solely during construction and moving the responsibility of fetching arguments outside of `statsd::StatsdClient`.
  * Using the RAII `Socks` wrapper as early as possible (we still need to construct a raw socket ourselves but this is done in the initializer and control is moved to the wrapper and everywhere else, the wrapper is used)
  * Utilizing existing networking code to generate the socket address
    * This lets us trivially allow IPv6 connections as the responsibility to construct it safely is moved to `CService`.
  * Using `std::string` and our string manipulation capabilities (replacing `snprintf` with `strprintf`), replacing platform-specific types (replacing `short` with `uint16_t`).

  ## Breaking Changes

  None observed.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  PastaPastaPasta:
    utACK [cc998ab](cc998abec1)
  UdjinM6:
    utACK cc998abec1

Tree-SHA512: 433c92160d6ac7ebb8582ada3cbb65ead7913618266b773619a528c90dfe0e286aafa46dc3b0bca62f246938e5948a732080e2cddba942d3627f007ca6efcc1f
2024-09-11 11:17:52 -05:00
..
check-doc.py Merge bitcoin/bitcoin#26717: test: Improve check-doc.py pattern 2024-06-13 10:06:12 -05:00
commit-script-check.sh Merge bitcoin/bitcoin#21749: test: Bump shellcheck version 2024-04-23 22:41:10 +07:00
git-subtree-check.sh Merge #20813: scripted-diff: Bump copyright headers 2024-04-10 03:19:34 +07:00
lint-all.sh Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts 2024-05-16 02:09:38 +07:00
lint-assertions.py Merge bitcoin/bitcoin#24856: lint: Converting lint-assertions.sh to lint-assertions.py 2024-06-06 22:58:31 -05:00
lint-circular-dependencies.sh feat: broadcast dsq messages using the inventory system 2024-09-10 09:23:22 -05:00
lint-cppcheck-dash.sh feat: have cppcheck linter respect CACHE_DIR env variable 2024-08-11 15:02:32 +07:00
lint-files.py chore: dashify file list exception for liner 2024-05-16 02:10:16 +07:00
lint-format-strings.sh Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts 2024-05-16 02:09:38 +07:00
lint-git-commit-check.sh Merge #20071: ci, lint: Remove usage of TRAVIS_COMMIT_RANGE 2024-01-27 22:44:49 -06:00
lint-include-guards.sh Merge bitcoin/bitcoin#19160: multiprocess: Add basic spawn and IPC support 2024-07-27 13:04:24 +07:00
lint-includes.sh merge bitcoin#24301: header-only Boost 2024-08-13 22:53:48 +07:00
lint-locale-dependence.sh Merge #18673: scripted-diff: Sort test includes 2023-08-29 22:00:59 -05:00
lint-logs.sh Merge #17829: scripted-diff: Bump copyright of files changed in 2019 2023-12-06 11:40:14 -06:00
lint-python-dead-code.sh
lint-python-mutable-default-parameters.py Merge bitcoin/bitcoin#24800: lint: convert lint-python-mutable-default-parameters.sh to Python 2024-01-02 11:17:47 -06:00
lint-python-utf8-encoding.sh Merge #20813: scripted-diff: Bump copyright headers 2024-04-10 03:19:34 +07:00
lint-python.sh Merge #20813: scripted-diff: Bump copyright headers 2024-04-10 03:19:34 +07:00
lint-shell-locale.sh
lint-shell.sh Merge #20697: ci: Fix COMMIT_RANGE variable value for PRs 2024-03-27 00:48:27 +07:00
lint-spelling.sh Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts 2024-05-16 02:09:38 +07:00
lint-submodule.py Merge bitcoin/bitcoin#24803: lint: convert submodule linter test to Python 2024-01-13 19:32:31 -06:00
lint-tests.py Merge bitcoin/bitcoin#24815: lint: convert lint-tests.sh to python 2024-01-13 19:32:31 -06:00
lint-whitespace.sh Merge #20813: scripted-diff: Bump copyright headers 2024-04-10 03:19:34 +07:00
README.md Merge #20567: test: Add option to git-subtree-check to do full check, add help 2023-12-06 11:40:14 -06:00
run-lint-format-strings.py stats: cleanup error logging, improve code sanity 2024-09-11 14:33:55 +00:00
spelling.ignore-words.txt Merge bitcoin/bitcoin#24762: lint: Start to use py lint scripts 2024-05-16 02:09:38 +07:00

This folder contains lint scripts.

check-doc.py

Check for missing documentation of command line options.

commit-script-check.sh

Verification of scripted diffs. Scripted diffs are only assumed to run on the latest LTS release of Ubuntu. Running them on other operating systems might require installing GNU tools, such as GNU sed.

git-subtree-check.sh

Run this script from the root of the repository to verify that a subtree matches the contents of the commit it claims to have been updated to.

Usage: test/lint/git-subtree-check.sh [-r] DIR [COMMIT]
       test/lint/git-subtree-check.sh -?
  • DIR is the prefix within the repository to check.
  • COMMIT is the commit to check, if it is not provided, HEAD will be used.
  • -r checks that subtree commit is present in repository.

To do a full check with -r, make sure that you have fetched the upstream repository branch in which the subtree is maintained:

To do so, add the upstream repository as remote:

git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git

lint-all.sh

Calls other scripts with the lint- prefix.