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

Recent Scrutinizer Messages #3740

Closed
wants to merge 4 commits into from
Closed

Conversation

oleibman
Copy link
Collaborator

Get rid of them where possible.

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

Provide an explanation of why this change is needed, with links to any Issues (if appropriate).
If this is a bugfix or a new feature, and there are no existing Issues, then please also create an issue that will make it easier to track progress with this PR.

Copy link
Member

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

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

On a more general note, I feel nowaday PHPStan is way better than Scrutinizer static analyzer and we probably should not spend too much time on accommodating Scrutinizer false positives.

While Scrutinizer is still able to catch things that PHPStan cannot, so it makes sense to keep it, I don't think we should riddle our code with @scrutinizer ignore-type or similar. Instead we can ignore whole range of errors directly from Scrutinizer UI. Typically $drawing->setImageResource(/** @scrutinizer ignore-type */ $gdImage); is a false positive that clutter our code for nothing.

PS: A quick search shows ~732 @scrutinizer comments against ~78 @phpstan. The illustrates my point better than I imagined.

@@ -3442,7 +3442,7 @@ public function getHashCode()
* @param string $range Range to extract title from
* @param bool $returnRange Return range? (see example)
*
* @return ($range is non-empty-string ? ($returnRange is true ? array{0: string, 1: string} : string) : ($returnRange is true ? array{0: null, 1: null} : null))
* @return ($range is non-empty-string ? ($returnRange is true ? array{0: string, 1: string} : string) : ($returnRange is true ? array{0: null, 1: null} : null)) Scrutinizer does not understand this but it helps Phpstan
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @return ($range is non-empty-string ? ($returnRange is true ? array{0: string, 1: string} : string) : ($returnRange is true ? array{0: null, 1: null} : null)) Scrutinizer does not understand this but it helps Phpstan
* @return ($range is non-empty-string ? ($returnRange is true ? array{0: string, 1: string} : string) : ($returnRange is true ? array{0: null, 1: null} : null))

Don't think we should have those kind of comment that end up in end-user documentation.

@PowerKiKi
Copy link
Member

I gave you access to Scrutinizer:

image

@oleibman oleibman mentioned this pull request Sep 20, 2023
11 tasks
@oleibman oleibman marked this pull request as draft September 20, 2023 15:53
@oleibman
Copy link
Collaborator Author

@PowerKiKi converting to draft so that you can carry on with your work in #3743. As for the comments in the doc-block, I couldn't figure out how else to indicate that Scrutinizer cares but we consciously don't care (as opposed to we've never even looked at the message).

I agree that Phpstan is way better than Scrutinizer in its analysis.

@PowerKiKi
Copy link
Member

couldn't figure out how else to indicate that Scrutinizer cares but we consciously don't care

Now you should be able to do that on https://scrutinizer-ci.com/g/PHPOffice/PhpSpreadsheet/issues/master

@oleibman
Copy link
Collaborator Author

Superseded by #3743.

@oleibman oleibman closed this Sep 26, 2023
@oleibman oleibman deleted the scrutsrc1 branch September 26, 2023 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants