Commit Graph

36 Commits

Author SHA1 Message Date
Ian Jackson ce8b0184ec clippy: Suppress needless_pass_by_value in tests
Rationale: same as for useless_vec, as in 01cb7ee0a1.

Prompted by reading a commit where someone did makework to get rid of
an occurrence of this warning.
2023-08-23 10:34:00 +01:00
Nick Mathewson 9db1cc430a add_warning: Change missing_docs,unreachable_pub to warn
Part of #951.  See comments for explanation of why this is important.
2023-08-04 07:43:16 -04:00
Ian Jackson 01cb7ee0a1 clippy: in tests, allow clippy::useless_vec
This is a perf issue, only.  If tests are too slow, we will notice and
ca speed them up.  We should optimise for clarity and convenience,
rather than speed.

Forbidding this can result in churn between vec![] and [] as tests are
updated and changed.
2023-07-10 13:49:51 +01:00
Ian Jackson 43bf89d540 clippy: globally allow clippy::needless_raw_string_hashes
Rationale: no-one writes these by default without thinkinh.  If they
are unnecessary, then either the string must have had " in it
before (in which case it might do again), or it is near other strings
which *do* need it.

And having it does no harm; indeed IMO it can increase clarity.

Alternative to !1388's
  Fix new "needless_raw_string_hashes" lint from clippy +nightly
2023-07-10 13:49:51 +01:00
Nick Mathewson 7e2fa11065 add_warning: Tolerate clippy::missing_panics_doc
As of current nightly, this lint now includes expect()s,
which makes it trigger way more than we'd like.

See discussion on #950.
2023-07-06 14:29:40 -04:00
Ian Jackson 802200e238 lints: Promote clippy::print_stderr and clippy::print_stdout
These are available in our MSRV now, so we don't need to handle
specially.  We can just add them to the standard lint block.

(Lint block in every crate will be updated automatically in the next
commit.)
2023-06-21 12:14:10 +01:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
This warning kind of snuck up on us! (See #748)  For now, let's
disable it.  (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)

Closes #748.
2023-01-27 08:27:47 -05:00
Emil Engler 79097484de
shell: use /usr/bin/env instead of absolute paths
This commit changes the shebang in all shell scripts from absolute
paths (such as `/bin/bash` or `/usr/bin/python3`) to the `/usr/bin/env`
binary with the accompanying interpreter as it's argument.

The reason for this are as follows:
- NixOS cannot work with absolute paths
- BSD systems install their packages in /usr/local/bin
2023-01-25 18:35:53 +01:00
Nick Mathewson e4ca2459db add_warnings: ignore clippy::result_large_err
This is a temporary workaround for #587 until we get it fixed for
real.
2022-11-03 11:05:14 -04:00
Nick Mathewson 0cb886a098 add_warnings: work with more non-GNU finds.
We were doing `find -name '*.rs'`, but `find . -name '*.rs'` (with the .)
is more standard.
2022-11-03 11:03:43 -04:00
Ian Jackson 82ad9eea5f Allow "clippy::single_char_pattern" in tests.
This lint exists for perf reasons, and this is rarely relevant in
tests.

Using double quoted str is generally cognitively less burdensome.
2022-10-12 13:50:29 +01:00
FAMASoon 4cfdeca0f1 format python script in maint 2022-08-17 02:15:35 +09:00
Ian Jackson b7c03943f1 maint/add_warning: Fix parsing of --check
Previously this would eat the first filename!
2022-06-24 14:23:38 +01:00
Ian Jackson 23c352b96b clippy: Consolidate many lints in maint/add_warning
Found these by disabling the nightly dbg macro special case.  Now, we
have a mechanism for globally adding suppressions to tests, we can use
that instead.
2022-06-24 14:23:38 +01:00
Ian Jackson bebf013bef maint/add_warning: Add two lints via add_warning as a test case 2022-06-24 14:23:38 +01:00
Ian Jackson 72515abf91 maint/add_warning: Add ability maintain test lint blocks 2022-06-24 14:23:38 +01:00
Ian Jackson 76ff330610 maint/add_warning: Scan all files by default, but insist only in some
This will allow us to have add_warning manage test lint blocks.

We have to stop printing all the filenames because there are too
many.  Filenames still come out on error of course.
2022-06-24 14:23:34 +01:00
Ian Jackson 13e27919c5 clippy: Supresss clippy::significant_drop_in_scrutinee
As per the linked discussion.
2022-06-23 19:14:54 +01:00
Ian Jackson 28dea73523 lints: Scheme for allowing us to name nightly lints
As per
  https://gitlab.torproject.org/tpo/core/arti/-/issues/501
2022-06-23 19:14:11 +01:00
Ian Jackson 2730bed5bd maint/add_warning: Convert remaining asserts 2022-05-31 19:16:09 +01:00
Ian Jackson 6c52fa675b maint/add_warning: Introduce ImproperFile and convert one assert 2022-05-31 19:14:19 +01:00
Ian Jackson 7e96664140 maint/add_warning: Use python3 argparse 2022-05-31 19:03:38 +01:00
Ian Jackson 47a10fa84c maint/add_warning: Add "how to fix" to error message
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/557#note_2808879
2022-05-31 18:54:08 +01:00
Ian Jackson 89b4a59048 maint/add_warning: Provide --check mode 2022-05-31 18:54:08 +01:00
Ian Jackson c2939b5f74 maint/add_warning: Change shebang to python3
"python" sometimes means Python 2.
2022-05-31 18:53:49 +01:00
Ian Jackson 00f82a7f4d maint/add_warning: Use .tmp~ for temp filename, not .bak
"bak" ought to be a backup file, with the old contents, which this
most definitely isn't.
2022-05-31 18:53:47 +01:00
Ian Jackson 2814fd99c1 lints: Add let_unit_value allow to add_warning
add_warning can now add allows.  This one was agreed in some other MR
for one crate.  Allow it everywhere.
2022-05-31 14:52:09 +01:00
Ian Jackson a8f3423107 lints: Add two missing ones to add_warning
These were in some crates, but not all.  Put them in add_warning
where they will propagate everywhere.
2022-05-31 14:52:09 +01:00
Ian Jackson 47a209fb31 lints: maint/add_warning: New marker-based mode
We don't process the in-script lint block, just paste it in, now.
This is less complicated.

This reverts/replaces
  "maint/add_warnings: Make it add the markers for its future self"
2022-05-31 13:00:31 +01:00
Ian Jackson 3ae7244f91 maint/add_warnings: Make it add the markers for its future self
We'll run this in a moment.  Then we'll revert it.
2022-05-31 13:00:31 +01:00
Ian Jackson ea5caf9ac2 lints: maint/add_warning: Improve ordering
The crates we have aren't consistent.  But changing this means the
deltas resulting from the script are smaller.
2022-05-31 13:00:31 +01:00
Ian Jackson a8331c588e maint/add_warnings: Tidy up, and add some commentary
This puts the actually-used lint list at the top.

No functional change.
2022-05-31 13:00:31 +01:00
Nick Mathewson f7009e238a add_warning: remove clone_on_ref_ptr
See !352
2022-03-01 15:38:46 -05:00
Ian Jackson d3ab2bb636 maint/add_warning: Remove duplicate argv0 from usage message 2022-02-18 11:46:06 +00:00
Ian Jackson 1c301230e4 rename *.py scripts to bare name
Update all references.  There are three remaining hits for
  git-grep '\.py\b'
all of which are scripts in "little-t-tor", not here in arti.
2022-02-18 11:46:06 +00:00