Commit Graph

67 Commits

Author SHA1 Message Date
Greg Pfeil 4946316537 Appease ShellCheck
ShellCheck has started failing in CI. My guess is that the ubuntu-latest runner
now uses a `/bin/sh` that is actually Bash.

- excludes checksec.sh, as it’s not our code
- fixes lints in other files
2022-12-06 10:46:43 -07:00
Ben Woosley dd84f66600 doc: Correct spelling errors in comments
And ci script output.

Identified via test/lint/lint-spelling

(cherry picked from commit bitcoin/bitcoin@9b0e16226e)

Zcash: Only the change to `test/lint/lint-shell.sh`
2022-08-20 03:15:12 +00:00
Hennadii Stepanov c23889a150 script: Enable SC2001 rule for Gitian scripts
(cherry picked from commit bitcoin/bitcoin@17f81e9648)
2022-08-20 03:15:12 +00:00
Hennadii Stepanov f620206f03 script: Enable SC2155 rule for Gitian scripts
Also pwd command is replaced with $PWD variable everywhere for
consistency.

(cherry picked from commit bitcoin/bitcoin@61bb21b418)
2022-08-20 03:15:12 +00:00
Hennadii Stepanov fa3abe8819 script: Enable SC2006 rule for Gitian scripts
(cherry picked from commit bitcoin/bitcoin@577682d9e8)
2022-08-20 03:15:12 +00:00
Jack Grigg 0f84499556 lint: Disable some ShellChecks on Gitian descriptors
These trigger because our Gitian descriptors are out-of-sync with
upstream.
2022-08-20 03:15:12 +00:00
Hennadii Stepanov 3cf26a1c4f script: Lint Gitian descriptors with ShellCheck
(cherry picked from commit bitcoin/bitcoin@14aded46df)

Zcash: Applies CI change to GitHub Actions workflow.
2022-08-20 03:15:12 +00:00
Jack Grigg 3dd142d605 lint: Fix ShellCheck lints in Zcash scripts 2022-08-20 03:15:12 +00:00
Hennadii Stepanov 8294e51681 Enable ShellCheck rules
Enabled ShellCheck rules:
  SC1087
  SC2001
  SC2004
  SC2005
  SC2006
  SC2016
  SC2028
  SC2048
  SC2066 (note that IFS already contains only a line feed)
  SC2116
  SC2166
  SC2181
  SC2206
  SC2207
  SC2230
  SC2236

(cherry picked from commit bitcoin/bitcoin@1ac454a384)

Zcash: Applies more of this commit. It was partially backported in
zcash/zcash#4827, and is also partially backported here for the scripts
we actually have.
2022-08-20 03:13:52 +00:00
Jack Grigg 1f94372b86 lint: Fix shell lints 2022-08-19 22:40:02 +00:00
Wladimir J. van der Laan 49deefbc9d test: Add crc32c exception to various linters and generation scripts
(cherry picked from commit bitcoin/bitcoin@3a037d0067)

Zcash:
- Excludes linters and scripts we don't have.
- Re-adds leveldb to lint-includes.sh because of a false positive.
2022-07-16 11:47:21 +00:00
Wladimir J. van der Laan 6dcb678f3f test: Add crc32c to subtree check linter
(cherry picked from commit bitcoin/bitcoin@84ff1b2076)

Zcash: Excluding CI script change.
2022-07-16 12:02:08 +01:00
Jim Posen 9a7e2c153d 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/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 -e 's/"util\.h"/"util\/system\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
git checkout HEAD -- src/secp256k1 # exclude secp256k1, which has its own "util.h"
sed -i -e 's/"utilmoneystr\.h"/"util\/moneystr\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utilstrencodings\.h"/"util\/strencodings\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/"utiltime\.h"/"util\/time\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i -e 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i -e 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i -e 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i -e 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i -e 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i -e 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i -e 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i -e 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i -e 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i -e 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
-END VERIFY SCRIPT-
2022-07-01 17:50:09 -06:00
Matt Corallo 8164dc35d7 Fix -Wthread-safety-analysis warnings. Change the sync.h primitives to std from boost.
Commit 1.

This code was written by @TheBlueMatt in the following branch:
* https://github.com/TheBlueMatt/bitcoin/commits/2017-08-test-10923

This commit message was written by me (@practicalswift) who also squashed
@TheBlueMatt's commits into one and tried to summarize the changes made.

Commit 2.

Remove boost include. Remove boost mentions in comments.

(cherry picked from commit bitcoin/bitcoin@7e319d6393)
2022-05-14 01:25:08 +00:00
Kris Nuttycombe 730d245cea
Merge pull request #5952 from str4d/fix-cargo-patch-lint
lint: Fix cargo patches linter when no patches are present
2022-05-12 07:24:32 -06:00
Jack Grigg 7b17b6f666 lint: Fix cargo patches linter when no patches are present 2022-05-12 11:19:52 +00:00
Kris Nuttycombe 15d1bb6ce9 scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020
-BEGIN VERIFY SCRIPT-
grep -l "Copyright" $(grep -L "The Zcash developers" $(git diff --name-only --diff-filter=ACM 6a08c225674df23f1c7f214bcb94732dba688d39..a960e896dd4c0b6d96db3d5ebbb1caa6c92a9f39 -- src/ test/ zcutil/ qa/)) | xargs -I {} sed -i"" -e "s#\(\(.*\)Copyright (c) .* The Bitcoin Core developers\)#\1\n\2Copyright (c) 2020-2022 The Zcash developers#" {}
-END VERIFY SCRIPT-
2022-05-11 17:32:39 -06:00
Jack Grigg b2b178bd21 lint: Add check that every Cargo patch has a matching replacement
We canonicalize git URLs when linting Cargo patches, because Cargo
treats `path/to/repo` and `path/to/repo.git` identically (and similarly
it strips a trailing slash), so we allow `.cargo/config.offline` and
`Cargo.toml` to mismatch in this way to minimise lints.
2022-04-07 02:14:52 +00:00
Daira Hopwood a92e249e4b Fix an incorrect preprocessor symbol.
Also repair the lint-includes-guards.sh script that was checking for the incorrect symbol.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-29 20:18:16 +01:00
Kris Nuttycombe 399ed5b4d7 Do not strip quotes when verifying mnemonic seed. 2021-11-07 10:16:22 -07:00
Kris Nuttycombe 8bf4ec3b4a Require backup of the emergency recovery phrase.
After 4.5.2, all wallets will be populated with an emergency
recovery phrase, and all future addresses will be derived from
the associated seed. To prevent potential loss of funds, we
require that the user explicitly invoke the `walletconfirmbackup`
RPC method to verify that they have backed up this seed.
2021-10-29 13:38:36 -06:00
Homu dea50714f9 Auto merge of #4892 - str4d:boosted, r=str4d
Replace boost::variant and boost::optional with standard library

Includes a commit cherry-picked from https://github.com/bitcoin/bitcoin/pull/20419.

Closes #4821. Closes #4822.
2020-12-17 02:42:55 +00:00
Jack Grigg 8a1803b21a lint: Remove boost::variant and boost::optional from allowed includes 2020-12-16 22:59:35 +00:00
Dimitris Apostolou f459e43dc9
Update links 2020-12-13 11:24:44 +02:00
Jack Grigg e03667b608 lint: Remove boost/foreach.hpp from allowed includes 2020-11-23 23:24:05 +00:00
MarcoFalke 1ffd2d5fad util: Replace boost::signals2 with std::function
Zcash: Added missing imports that were being implicitly included.
2020-11-23 23:07:15 +00:00
Jack Grigg e6b1d44170 lint: Re-exclude subtrees from lint-include-guards.sh
These are external libraries, and it does not make sense to maintain an
otherwise-meaningless diff from upstream.

This partially reverts commit 1e6d1837a0.
2020-11-09 23:06:21 +00:00
Sjors Provoost c0c05ebb34 doc: improve subtree check instructions 2020-11-09 23:06:21 +00:00
John Newbery 9069364e56 [linter] Strip trailing / in path for git-subtree-check
git-subtree-check fails if the directory is given with a trailing slash,
eg:

```
> test/lint/git-subtree-check.sh src/univalue/
ERROR: src/univalue/ is not a subtree
```

Shell autocompletes will add the trailing slash when autofilling the
path name, which will therefore cause the script to fail.

Just ignore any trailing slash.
2020-11-09 23:06:21 +00:00
MarcoFalke cff7e776bf Revert "Remove unused variable in shell script"
This partially reverts commit ab8e8b97a359e1c4f1bca8e1769021c95019f2c4
2020-11-09 23:06:21 +00:00
Pieter Wuille eb074fdb24 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.
2020-11-09 23:06:21 +00:00
practicalswift 52d9854034 Remove unused variables in shell scripts.
Zcash: Only the script we have.
2020-11-09 23:06:21 +00:00
isle2983 ccf31edf62 [copyright] add MIT license headers to .sh scripts where missing
Years are set according to 'git log' history

Zcash: Only the scripts we have that are missing the header.
2020-11-09 22:59:04 +00:00
str4d 1e6d1837a0
lint: Remove some subtrees from exclusion
Either they don't violate the lints, or can be easily fixed.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-11-09 20:06:45 +00:00
str4d 5b543b15eb
lint: Allow stoi in src/rpc/blockchain.cpp
This instance is ok because it's guarded by a strict regex.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-11-09 20:03:22 +00:00
str4d 9dbf535441
lints: Add a missing copyright header
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-11-09 17:17:08 +00:00
str4d 4b69b94bba
Small documentation fixes
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-11-09 17:15:46 +00:00
Jack Grigg 7c42009ddd lints: Match `export LC_ALL="C"` in lint-shell-locale
checksec.sh uses this format.
2020-10-28 13:19:27 +00:00
practicalswift 69d3d38445 Follow-up to #13454: Fix broken build by exporting LC_ALL=C 2020-10-28 13:14:39 +00:00
Jack Grigg 32fe88362b lints: Update expected Boost imports 2020-10-27 23:14:08 +00:00
Jack Grigg f318ab3776 lints: Use Zcash-specific include guards for new files 2020-10-27 23:05:19 +00:00
Kristaps Kaupe d89f31dc43 Make lint-includes.sh work from any directory 2020-10-27 23:05:19 +00:00
Julian Fleischer bdaccd0f06 Run all lint scripts
The description reads:

```
# This script runs all contrib/devtools/lint-*.sh files, and fails if any exit
# with a non-zero status code.
```

This runs all scripts and returns with a non-zero exit code if any failed.
2020-10-27 23:05:19 +00:00
practicalswift 1be9fa9aeb Remove no longer needed shellcheck suppressions 2020-10-27 23:05:19 +00:00
practicalswift 68393a4b73 Fix warnings introduced in shellcheck v0.6.0
Zcash: Only for shell scripts we have backported.
2020-10-27 23:05:19 +00:00
practicalswift 8ed37f5f40 Remove repeated suppression. Fix indentation. 2020-10-27 23:05:19 +00:00
Vidar Holen 37604a1990 refactor/lint: Add ignored suggestions to an array
This avoids duplicating the codes between command and comments.
2020-10-27 23:05:19 +00:00
João Barbosa 653f6dc7e7 qa: Ignore shellcheck warning SC2236
With shellcheck 0.6.0 the warning `SC2236 -  Use -n instead of ! -z` is raised.
This change adds that warning to the ignored list.
2020-10-27 23:05:19 +00:00
vim88 27f924108c Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. 2020-10-27 23:05:19 +00:00
practicalswift 5b11b94d27 macOS fix: Add excludes for checks added in the newer shellcheck version installed by brew 2020-10-27 23:05:19 +00:00