-
Notifications
You must be signed in to change notification settings - Fork 46
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
Ignore line or array specific key declaration #147
Comments
Nope it is not possible to ignore a specific line of code in this moment. |
Hi @sidz, Thanks for the quick reply. Ok, so I didn't miss something :) |
You can ignore every instance by using intval(10) instead of just 10. It's not ideal as you wouldn't know by looking at intval(10) that it's used to ignore a check for phpmnd. Sounds a good feature request though :) |
Yes and also it adds unneeded function calls. I also tried to use string, the Drupal form API is enough permissive to do that, but I don't want to do that too. Typing is more and more enforced and changing the values type just to satisfy a code quality tool is a non-sense in my opinion. Thanks for your feedback :) |
Yeah agreed. I think the same about comments to ignore lines tbh. The array key whitelist is not a bad idea. There is also a check in phpmnd for numeric strings which is good to enable as well. Which stops just hiding numbers by converting to a string |
I like the feature to ignore specific array keys :) I see how it could be useful |
I would love to add this tool to my default workflow but it runs against 30+ projects and being able to "exempt" individual lines would be absolutely crucial. The array keys bit is not a deal-breaker for me, especially since you could always do this: $weight = 10; // @phpmnd-ignore-line
$data = [
'weight' => $weight,
]; I would like to put forth a bounty on the line exemption comment feature - anyone willing to match? @exussum12 Can you provide a fair amount or expected time to implement? |
Hello,
First, thanks for the tool!
I have added it to my development stack, and use it against Drupal contrib modules that I maintain.
Is there a way to ignore a specific line with a comment? Like PHPStan, PHPCS, etc. do.
And is there a way to ignore numbers in keyed array for specific keys?
Because in Drupal, forms are declared with arrays and I think it would be an overburden to have to declare a constant for each weight or size of every element of each form.
Example of form https://git.drupalcode.org/project/qwantsearch/-/blob/8.x-1.x/src/Form/Settings.php#L124
Also, there are still procedural parts in Drupal, such as for declaring custom tables https://git.drupalcode.org/project/i18n_sso/-/blob/8.x-1.x/i18n_sso.install#L40. Ok we can create an interface and call it in the procedural parts.
So would it be possible to have a new option to have a way to ignore array keys:
Thanks for any reply.
Best regards,
The text was updated successfully, but these errors were encountered: