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

Add support for @infection-ignore-all annotation #1468

Merged
merged 11 commits into from Jan 12, 2021

Conversation

sanmai
Copy link
Member

@sanmai sanmai commented Jan 10, 2021

See #1231

This PR:

  • Adds a possibility to ignore an entire statement by commenting it with @infection-ignore-all
  • Covered by an E2E test
  • Covered by unit tests
  • Doc PR: PR description can be used verbatim

Give this example Infection won't mutate or even look at anything inside this function:

/** @infection-ignore-all */
public function doSomethingNastyButCostlyToRefactor() {

}

Likewise, given this annotation Infection won't consider anything in this loop:

/** @infection-ignore-all */
foreach ($foo as $bar) {
    // 
}

@maks-rafalko maks-rafalko added this to the 0.21.0 milestone Jan 10, 2021
@maks-rafalko
Copy link
Member

LGTM

@sanmai sanmai enabled auto-merge (squash) January 10, 2021 07:01
@sanmai sanmai requested review from maks-rafalko and removed request for maks-rafalko January 11, 2021 03:41
@sanmai
Copy link
Member Author

sanmai commented Jan 11, 2021

@maks-rafalko This should auto-merge upon approval.

Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

👍

let's see how automerging works

@maks-rafalko
Copy link
Member

image

hm... it says there was an error, but no information about it

@sanmai sanmai disabled auto-merge January 11, 2021 23:20
@sanmai sanmai enabled auto-merge (squash) January 11, 2021 23:21
@sanmai
Copy link
Member Author

sanmai commented Jan 12, 2021

Can't get it working too.

@sanmai sanmai disabled auto-merge January 12, 2021 00:21
@sanmai sanmai merged commit ab7b999 into infection:master Jan 12, 2021
@sanmai sanmai deleted the pr/2021-01/ignore-fix-1231 branch January 12, 2021 00:21
@maks-rafalko
Copy link
Member

@sanmai are you able to create a PR for docs please?

@sanmai
Copy link
Member Author

sanmai commented Jan 14, 2021

Where do you think will be the best place to put it?

@maks-rafalko
Copy link
Member

Probably, somewhere in the Usage article. There we have information about other annotations like @codeCoverageIgnore.

@sanmai
Copy link
Member Author

sanmai commented Jan 18, 2021

I'm not exactly sure these @codeCoverageIgnore annotations work as advertised, looking at the code. Let me check that they do, and if they don't we'll remove them and replace with @infection-ignore-all in this very section.

sanmai added a commit to sanmai/infection that referenced this pull request May 4, 2021
@sanmai sanmai mentioned this pull request May 4, 2021
4 tasks
sanmai added a commit that referenced this pull request May 4, 2021
Since we have a very explicit annotation `@infection-ignore-all` (added in #1468) that, again, very explicit on the purpose, and works not only for methods, but for most kinds of statements, let's remove `@codeCoverageIgnore` ignorer, that not only implicit (you may only want to ignore a piece of code temporarily, and only ignore) but also messes up the metrics (hides otherwise-uncovered mutations).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants