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

Warn when publishing breaking release with deprecated members #3959

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Jun 28, 2023

Fixes: #2914

Open questions:

  • should this be a warning or a hint?
  • is the syntactic analysis good enough, or should we do a resolution on the code?
  • could this be implemented as a lint, that could then be added conditionally before running the dart analyze validation?

@sigurdm sigurdm requested a review from jonasfj June 28, 2023 11:56
d.dir('lib', [
d.file(
'test_pkg.dart',
"@Deprecated('Stop using this please') int i = 1;",
Copy link
Member

Choose a reason for hiding this comment

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

Why should this be a problem?

Yes, in theory a major version bump is a good opportunity to remove deprecated stuff.

But it's also entirely possible that my package contains multiple kinds of deprecated stuff, what if I want to keep sonme of the deprecated stuffs and remove other deprecated stuff.

In general, unless there is a pressing reason to remove something that's been deprecated, I would suggest not doing so.
You could do things like /// @nodoc in dartdoc documentation comments, to exclude the deprecated bits from documentation, so it doesn't pollute.

Would be nice if there was also a way to hide it from auto-completion.


Yes, in many cases it makes sense to cleanup when doing a major version bump, such that deprecated stuff disappears. But for large complex packages it's entirely possible that some deprecated stuff sticks around because it's low cost to keep, and removing it only causes friction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - good points...

Maybe we can lower this to a "hint"... I still think there is some value to extract here (the associated issue seems quite popular)...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WDYT @jonasfj ? Should we make this a hint or close the issue as wontfix?

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind shipping it as a hint.

Are we sure this shouldn't just be a "lint" or diagnostic in the analyzer?
We run an analyzes run before publishing, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm - maybe that would work...

@pq what do you say? Would we like to be linted not to have deprecated members if the version is x.0.0 ?

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.

When publishing a breaking change version, give me warnings about public API marked @deprecated
2 participants