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

[phpunit-bridge] default to not failing on deprecations #442

Merged
1 commit merged into from
Aug 10, 2018
Merged

[phpunit-bridge] default to not failing on deprecations #442

1 commit merged into from
Aug 10, 2018

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jul 23, 2018

Q A
License MIT

Until now, I've been advocating that peoples' CI should fail whenever a deprecation is reported.
But when a vendor throws a deprecation, sometime, it's not your fault and you can't do anything about it (except contributing back to the project, which is good for OSS!)

Talking on Slack, @greg0ire convinced me we can do this change: by setting SYMFONY_DEPRECATIONS_HELPER to 999999 by default, we make ppls' CI green (when they don't raise more than 1M deprecations.)
And it still makes the deprecation report visible on the tests' output so that ppl still have some incentive to fix them.

Fixes symfony/symfony#27936

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

@ChangePlaces
Copy link

But seeing deprecations reported in methods of your code is scary, and prompts urgent WTF'ing. I'd advocate the average developer doesn't care for deprecations in code that isn't theirs and for that reason, this should be disabled by default, with a note in the testing docs detailing how to opt it.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

I like this. I've seen many of my build failing (on travis cron) because of this. I think it make sense to update the default value.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link
Contributor

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Thank you for making that change! ❤️

@stof
Copy link
Member

stof commented Jul 24, 2018

@nicolas-grekas I see 1 WTF effect for this: it might make it impossible to configure this in the phpunit.xml (as this putenv runs before PHPUnit loads the config), depending on how PHPUnit handles overrides.
Should we rather change the default in the listener instead ?

@nicolas-grekas
Copy link
Member Author

Configuring the bridge via phpunit.xml is not supported, the bridge runs too early.
See symfony/symfony#28028 btw.

@Tobion
Copy link
Member

Tobion commented Jul 26, 2018

I'd prefer if this new default is handled in https://github.com/symfony/symfony/blob/0eea07752211f464818a54efc7907e8ca4c617a6/src/Symfony/Bridge/PhpUnit/bootstrap.php#L39 so that it also behaves like this when not using the simple-phpunit wrapper.

@nicolas-grekas
Copy link
Member Author

But that would be a BC break. I also think having a stricter default is a better practice. And requiring people to opt-in for less strict config (via their own wrapper or a real env var) encourages ownership IMHO.

@nicolas-grekas
Copy link
Member Author

ping @symfony/deciders

@Tobion
Copy link
Member

Tobion commented Aug 6, 2018

As the recommended default, wouldn't it be cleaner and more self-explaining to have an explicit config value for this like pass-and-show instead of some random number.

@nicolas-grekas
Copy link
Member Author

That'd be a new feature, thus not actionable until 4.2. And personally, I prefer the number, because it hints it exists and can be changed: lowering this number up to zero is a best practice IMHO.

@ChangePlaces
Copy link

Where is this best practice declared so people can read up on it?

@nicolas-grekas
Copy link
Member Author

@ChangePlaces I looked at the doc, it's not explicit so we could improve (it's implicit because that's the default, but I suppose that's not enough.) Would you mind sending a PR to improve that §?

@ChangePlaces
Copy link

I don't think I'm the best person to submit a PR as I fail to see it as a best practice myself

@alcaeus
Copy link
Contributor

alcaeus commented Aug 10, 2018

@nicolas-grekas what (or who) is needed to get this merged?

@nicolas-grekas
Copy link
Member Author

One more vote from any @symfony/deciders

@dunglas
Copy link
Member

dunglas commented Aug 10, 2018

I would prefer a new config option too. This one looks like a hack, and should’nt be in the official recipe if we can provide something nicer.
Also, shouldn’t we use $_SERVER instead of getenv for consistency?

@nicolas-grekas
Copy link
Member Author

A new option will not be applicable until 4.2. I can wait personally, and I also prefer strict mode so I'm also fine closing. But that's not what others would prefer... Let's move on ?

@nicolas-grekas
Copy link
Member Author

Oh and about $_SERVER, the bridge only uses getenv()

@nicolas-grekas
Copy link
Member Author

About the future, see symfony/symfony#28048

@ghost ghost merged commit 54939f7 into symfony:master Aug 10, 2018
ghost pushed a commit that referenced this pull request Aug 10, 2018
@greg0ire
Copy link
Contributor

Also, I think a logical follow-up would be to make a BC-breaking PR to use s/0/999999/ on this line, correct?

https://github.com/symfony/symfony/blob/f96753b9ab497a42f7a76188e2de4911b50f5407/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php#L40

@nicolas-grekas
Copy link
Member Author

Nope, there's no logical BC break.

@greg0ire
Copy link
Contributor

Sorry, what do you mean with "logical BC-break"? I think a user having suddenly the bridge no longer make their test suite fail where it used to fail is entitled to call that a BC-break, aren't they? Would you do that PR on the stable branch? Or did I misunderstand your answer?

@nicolas-grekas
Copy link
Member Author

I mean we cannot change that line 40 you linked: that'd be a BC break and we just don't allow us to do that.
This PR is on a recipe so that only new project will get the new default config. No BC break either, all is well :)

@greg0ire
Copy link
Contributor

greg0ire commented Aug 10, 2018

Thanks for the clarification, I'm trying to address some concerns voiced on doctrine/doctrine-website#200

This pull request was closed.
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.

RFC: change deprecation error handler to use weak_vendors mode by default
9 participants