Comments (5)
If you execute it with --only-covered
do you still encounter the problem?
from infection.
Please see this workaround #1894 (comment) - you can disable mutation of attributes for now.
from infection.
Symfony/Doctrine mutators are a good idea for a good usage of them, I definitly agree about it, but the mutations on PHP Attributes are more global than just them: in my example, I used a custom PHP Attribute, not a Symfony/Doctrine or whatever library's from.
I'm not sure I'm valuable in front of Sebastian Bergmann to tell him that PHP Attributes must be covered 😅 but I really do think it should be on coverage side: like I said, PHP Attributes are impacting runtime behaviors, they're not just definitions. And I guess that as soon as coverage will tell you PHP Attributes are (or not) covered instead of being ignored, PHP Infection will automatically be ready to handle them. That's why I'm convinced it should be an enhancement on CodeCoverage's side.
from infection.
Thanks for your answers.
@maks-rafalko Thank you for the proposal to ignore via RegExp, but I'm using a forced global configuration file for PHP Infection across multiple projects to ensure they have the exact same standards quality, and I don't want to have some specific project ignorance here, I'm looking for a solution I can use globally. Nevertheless, that's good to know, and if I need that, I'll keep in mind!
@theofidry Using --only-covered
works like a charm! I'll add this to ignore all uncovered snippets on all my projects as I'm already checking the code coverage directly via PHPUnit's reports. I'll use your solution then.
I don't know if you guys want to get further on this, as the proposed solutions are only about ignoring PHP Attributes, but IMO, it makes perfect sense to mutate them and give it a try, as they have a direct impact on runtime. Is there any ideas or actions you got to make them declared as covered or something? or do you think it should be on PHP's CodeCoverage to stop ignoring them?
Thanks a lot again and have a good day!
from infection.
We didn't think a lot through it and didn't discuss it yet, but I agree - it would be very nice to mutate attributes properly, with coverage supported.
I had an idea to create symfony/doctrine related mutators to
- change validation rules
- remove validation rules
- change doctrine mappings
- etc.
Regarding where the issue is - on CodeCoverage or Infection side - I don't know, needs to be investigated. So any help would be appreciated :)
If it won't be supported on CodeCoverage side, the only one way I see is to do the same as we do for parameters: as soon as the method is executed - its attributes are "executed" as well, so are treated as covered. And we can get this information from the phpunit's reports we are using.
from infection.
Related Issues (20)
- Add new GitLab (Code Climate) code quality JSON logger.
- Release tag shows incorrect version HOT 2
- MulEqual with -1 cannot be fixed HOT 3
- Disable PHP Attribute mutations globally via config. HOT 2
- Attribute is removed when `public` is mutated to `protected`
- Compatibility with composer-bin-plugin HOT 3
- Incorrect --filter with PHPUnit 10 HOT 10
- E2E tests fails HOT 5
- Uncaught TypeError: PhpParser\Lexer\Emulative::__construct(): Argument #1 ($phpVersion) must be of type ?PhpParser\PhpVersion, array given HOT 4
- Alternative Badge SVG File as report for use in Gitlab and private Repositories HOT 9
- nikic/php-parser 5 support HOT 3
- Clean project ApiPlatform + PhpUnit 11 + PHP 8.3.x -> nikic/php-parser minimum version bump needed HOT 3
- Upgrade `php-cs-fixer` and add more rules
- Randomly failing test HOT 2
- Gitlab logger errors when run outside git repository HOT 2
- GPG key expired HOT 3
- Excluded sources are being processed for mutation
- Mutations should be skipped base on individual time, not total time HOT 9
- Fail to find testcase from Junit report (Pest) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infection.