Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport useful lints from upstream #4829

Merged
merged 46 commits into from
Nov 9, 2020
Merged

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Oct 27, 2020

Cherry-picked from the following upstream PRs:

Several of the lints fail for our current codebase; these will be addressed in a
subsequent PR.

@str4d str4d added C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. A-CI Area: Continuous Integration labels Oct 27, 2020
@str4d str4d requested a review from daira October 27, 2020 12:37
@str4d
Copy link
Contributor Author

str4d commented Oct 27, 2020

Once I've checked for any further relevant backports, I'll apply the following patch (so that GitHub doesn't get confused about commit ordering) EDIT: Done.

@str4d
Copy link
Contributor Author

str4d commented Oct 27, 2020

I'll rebase this once #4831 is merged (which conflicts with this).

@zkbot
Copy link
Contributor

zkbot commented Oct 27, 2020

☔ The latest upstream changes (presumably #4831) made this pull request unmergeable. Please resolve the merge conflicts.

Philip Kaufmann and others added 24 commits October 27, 2020 23:05
- ensure header namespaces and end comments are correct
- add missing header end comments
- ensure minimal formatting (add newlines etc.)
Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.
This adds a new CHECK_DOC check that looks for newly introduced trailing
whitespace. Existing trailing whitespace (of which there is plenty!)
will not trigger an error.

This is written in a generic way so that new lint-*.sh scripts can be
added to contrib/devtools/, as I'd like to contribute additional lint
checks in the future.
Lint checks should not test these, they are historical documents,
and we don't want to encourage silly changes to them to satisfy
a checker.

Hopefully makes travis pass again on master.

Tree-SHA512: 37e6716c4fd5e8a4e579f9b84042e6b0ac224836b6c851cd1ca3f7d46611ffd3003bed0ae08dd0457f69d6eaa485a0d21c631e7ef16b14bdb0f2f78ea700332d
MacOS does not support 'grep -P' out of the box. This change makes
it easier for developers to check for whitespace problems locally.
Get usage instructions:
.lint-whitespace.sh -?
Before this PR, the linenumber infomaition is output if trailing-space
or tab code was found, but the output occurence is only per a file.
This PR separates the output timing of file name and line number.
As a result, users will find where they need to fix more easily.
This enforces parts of the project header include guidelines (added by @sipa in #10575).
This partially reverts commit c36b720.
Zcash: Only the lint-* scripts we have backported.
Zcash: Only for lint-* scripts we have backported from upstream.
@str4d
Copy link
Contributor Author

str4d commented Oct 27, 2020

Rebased.

@str4d
Copy link
Contributor Author

str4d commented Oct 28, 2020

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented Oct 28, 2020

⌛ Trying commit 32fe883 with merge 43ac206...

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flushing comments.

contrib/devtools/test-security-check.py Show resolved Hide resolved
doc/developer-notes.md Outdated Show resolved Hide resolved
doc/developer-notes.md Outdated Show resolved Hide resolved
test/lint/lint-locale-dependence.sh Show resolved Hide resolved
test/lint/lint-locale-dependence.sh Outdated Show resolved Hide resolved
doc/developer-notes.md Outdated Show resolved Hide resolved
doc/developer-notes.md Show resolved Hide resolved
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK with suggestions.

test/lint/lint-include-guards.sh Show resolved Hide resolved
test/lint/lint-all.sh Show resolved Hide resolved
test/lint/lint-all.sh Outdated Show resolved Hide resolved
test/lint/lint-includes.sh Show resolved Hide resolved
test/lint/lint-python-utf8-encoding.sh Show resolved Hide resolved
test/lint/lint-includes.sh Outdated Show resolved Hide resolved

EXIT_CODE=0
for LOCALE_DEPENDENT_FUNCTION in "${LOCALE_DEPENDENT_FUNCTIONS[@]}"; do
MATCHES=$(grep -E "[^a-zA-Z0-9_\`'\"<>]${LOCALE_DEPENDENT_FUNCTION}(_r|_s)?[^a-zA-Z0-9_\`'\"<>]" <<< "${GIT_GREP_OUTPUT}" | \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't check for a call, so it gives false positives when the name of a library function is shadowed by a local variable name. This only happens in one case: trim in src/crypto/equihash.h, so it might be just as easy to rename that variable.

test/lint/lint-shell.sh Outdated Show resolved Hide resolved
test/lint/lint-whitespace.sh Outdated Show resolved Hide resolved
test/lint/lint-whitespace.sh Outdated Show resolved Hide resolved
@r3ld3v r3ld3v added this to the Core Sprint 2020-43 milestone Oct 28, 2020
@str4d
Copy link
Contributor Author

str4d commented Oct 28, 2020

Not sure why Homu didn't report back, but the try passed.

str4d and others added 4 commits November 9, 2020 17:15
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This instance is ok because it's guarded by a strict regex.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Either they don't violate the lints, or can be easily fixed.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
@str4d
Copy link
Contributor Author

str4d commented Nov 9, 2020

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Nov 9, 2020

📌 Commit 1e6d183 has been approved by str4d

@zkbot
Copy link
Contributor

zkbot commented Nov 9, 2020

⌛ Testing commit 1e6d183 with merge 84a5830...

@zkbot
Copy link
Contributor

zkbot commented Nov 9, 2020

☀️ Test successful - pr-merge
Approved by: str4d
Pushing 84a5830 to master...

@zkbot zkbot merged commit 84a5830 into zcash:master Nov 9, 2020
@str4d str4d deleted the backport-lints branch November 9, 2020 22:58
@str4d str4d added the S-committed Status: Planned work in a sprint label Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Continuous Integration C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. S-committed Status: Planned work in a sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.