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

Move away form blacklist terminology #5896

Closed
wants to merge 5 commits into from
Closed

Conversation

mocsy
Copy link

@mocsy mocsy commented Aug 12, 2020

changelog: Move away form blacklist terminology

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthiaskrgr (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 12, 2020
@flip1995
Copy link
Member

Moderating note: I think we all know what discussions this type of PR can introduce, so I want to ask everyone to stay civil and have a productive discussion about this. (I really don't want to lock this PR)


cc @rust-lang/clippy

Do we want to do this? Recently all internal uses of black/white-list were renamed in the compiler. No user facing things were renamed though. This would definitely be user facing, both the lint name and the configuration name.

We have precedent for renaming a lint, because it could be offending to some people: #3521

@flip1995 flip1995 added the S-needs-discussion Status: Needs further discussion before merging or work can be started label Aug 12, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Aug 12, 2020

Yea this definitely needs a renaming scheme, other than that lgtm

@ghost
Copy link

ghost commented Aug 12, 2020

It's got to be done without breaking peoples config/code. The warnings should be emitted if the old name is used with instructions for using the new name. Don't crash with an error. #3803 shows how this can be done.

@yaahc
Copy link
Member

yaahc commented Aug 12, 2020

Do we want to do this? Recently all internal uses of black/white-list were renamed in the compiler. No user facing things were renamed though. This would definitely be user facing, both the lint name and the configuration name.

Yes imo

@matthiaskrgr
Copy link
Member

FTR this is the similar pr that was merged into rustc recently: rust-lang/rust@1e567c1

I also have not objections to merging this :) , but we should definitely have some kind of deprecation message! (As far as I can see there is none as of this version of this PR..?)

@phansch
Copy link
Member

phansch commented Aug 13, 2020

I'm also supportive of merging this (once the lint renaming handling has been added)

@Ryan1729
Copy link
Contributor

It's got to be done without breaking peoples config/code. The warnings should be emitted if the old name is used with instructions for using the new name. Don't crash with an error. #3803 shows how this can be done.

I was curious about what changes in #3803 were relevant to ensuring these qualities. As far as I can tell, only the following files are relevant:

Hopefully that helps anyone else who would otherwise find themselves reading the entire diff.

@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-needs-discussion Status: Needs further discussion before merging or work can be started S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 13, 2020
@flip1995
Copy link
Member

Alright, let's move forward with the renaming!

@mocsy 2 things have to be done:

  1. Register the lint as renamed (use register_renamed for this)
  2. Register the old configuration option as renamed. (See in utils/conf.rs how this was done with cyclomatic_complexity and do the same for this lint)

Each of the two steps require tests to be added. For 1. we already have a test file IIRC. For 2. add tests similar to the tests for cognitive_complexity linked above by @Ryan1729.

@mocsy
Copy link
Author

mocsy commented Aug 13, 2020

Alright, let's move forward with the renaming!

@mocsy 2 things have to be done:

  1. Register the lint as renamed (use register_renamed for this)
  2. Register the old configuration option as renamed. (See in utils/conf.rs how this was done with cyclomatic_complexity and do the same for this lint)

Each of the two steps require tests to be added. For 1. we already have a test file IIRC. For 2. add tests similar to the tests for cognitive_complexity linked above by @Ryan1729.

All right, I'll do these steppes.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

There are tests missing for the old configuration name and the renaming of the lint.

Also some test files are still named *blacklist*, it would be great if you could rename them also.

@@ -17,33 +17,33 @@ declare_clippy_lint! {
/// ```rust
/// let foo = 3.14;
/// ```
pub BLACKLISTED_NAME,
pub DISALLOWED_NAME,
Copy link
Member

Choose a reason for hiding this comment

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

Let's rename it properly:

Suggested change
pub DISALLOWED_NAME,
pub DISALLOWED_NAMES,

Copy link
Author

Choose a reason for hiding this comment

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

I believe it's the lint definition which is in singular:

#![warn(clippy::blacklisted_name)]

not the toml entry:

blacklisted-names = ["toto", "tata", "titi"]

which is in plural.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but it should be in plural, as per our lint naming conventions (point 3)

@flip1995
Copy link
Member

r? @flip1995

@mocsy
Copy link
Author

mocsy commented Aug 25, 2020

There are tests missing for the old configuration name and the renaming of the lint.

Also some test files are still named *blacklist*, it would be great if you could rename them also.
These are done, please confirm this approach is good.

@mocsy mocsy requested a review from flip1995 August 25, 2020 10:02
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

There is still a test missing for the renamed configuration option (or did I miss this test?)

LL | fn test(foo: ()) {}
| ^^^
LL | #![warn(clippy::blacklisted_name)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_name`
Copy link
Member

Choose a reason for hiding this comment

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

Please include the rename tests in tests/ui/rename.rs

Copy link
Author

Choose a reason for hiding this comment

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

Okay, shall I remove tests/ui/blacklisted_name then?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, after you have one #[warn(clippy::blacklisted_name)] in the rename test file you can remove this.

@bors
Copy link
Collaborator

bors commented Sep 13, 2020

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

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@ghost ghost mentioned this pull request Sep 22, 2020
@flip1995
Copy link
Member

ping from triage @mocsy. Anything I can help you with to get this over the finish line?

@giraffate
Copy link
Contributor

@flip1995 2 weeks have passed with no activity from previous ping, so this PR should be closed according to Rust triage procedure.

@flip1995 flip1995 closed this Oct 25, 2020
@flip1995
Copy link
Member

@rustbot modify labels: -S-waiting-on-author +S-inactive-closed

@rustbot rustbot added S-inactive-closed Status: Closed due to inactivity and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Oct 25, 2020
bors added a commit that referenced this pull request Jul 29, 2022
…shearth

Remove "blacklist" terminology

Picking up where #5896 left off, this renames the `blacklisted_name` lint to `disallowed_names` (pluralised for compliance with naming conventions).  The old name is still available though is deprecated (both in the lint name, and in the TOML configuration file).

This has been proposed/requested a few times, most recently in #7582 where `@xFrednet` suggested pinging the Clippy team when a PR was created hence...

cc: `@rust-lang/clippy`

changelog: [`disallowed_names`] lint replaces `blacklisted_name`
@jonboh
Copy link
Contributor

jonboh commented Oct 10, 2023

@rustbot label -S-inactive-closed

@rustbot rustbot removed the S-inactive-closed Status: Closed due to inactivity label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.