Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Kyle
@kylekatarnls
Both gave the same output:
file.php:7       Avoid excessively long variable names like $ennvbnvbnvbnvbnfeffwwwwwwwwfvbnvbnbvnvbnvnvbnv. Keep variable name length under 20.
Please provide a code chunk that can show the regression (that we can run on both 2.7.0 and 2.8.0-beta.1 and give a different result)
Ideally a unit test we can add directly in the project.
kierandelaney
@kierandelaney
Ah, I am sorry, when I reverted to the older version we were testing against, it was 2.6.1
Kyle
@kylekatarnls
Thanks, I will download it and retry.
kierandelaney
@kierandelaney
We skipped 2.7.0 because the released PHAR did not work with PHP7.2
Kyle
@kylekatarnls
Sorry but still no output for the LongVariable rule using your code and PHPMD 2.6.1.
kierandelaney
@kierandelaney
Sigh I am so sorry for wasting your time - I understand the issue now. Our test case has never worked, but we thought it did because we do see errors inside functions (despite not using classes).
Kyle
@kylekatarnls
Yes in fact most rules (but not all) are based on symbols (classes, interfaces, functions, etc.)
kierandelaney
@kierandelaney
So phpmd/phpmd#681 is pretty much our issue and we failed to understand that was a limitation. More or less everything is wrapped in a function on our side so we do in fact see PHPMD lints very often and convinced ourselves it worked everywhere.
So actually there is no regression.
Kyle
@kylekatarnls
And so they ignore pure inline PHP code.
kierandelaney
@kierandelaney
But we do now understand a bit more how PHPMD works.
Sorry - I will update our test case so we are not being dumb in future.
Thanks so much for your help.
@tvbeek thanks for your help as well, you were right and I should have read your message more clearly. :)
Tobias van Beek
@tvbeek
No problem, still thanks for reporting. We really like feedback on the beta.
kierandelaney
@kierandelaney
As it stands - it is doing what we expected and we have finally been able to bin PHP@7.1 on the CLI side.
Kyle
@kylekatarnls
The only advice I can give you for now is using functions/classes as often as you can, it's not only to help static analyzers, it also help re-usability of the code and encapsulation.
kierandelaney
@kierandelaney
Yeah we do mostly, which is why we've never noticed it not working on inline code as we have so little of it :D
Thanks again everyone, it is so good to see this project reinvigorated!
Kyle
@kylekatarnls
You're welcome
Marc Würth
@ravage84
@kierandelaney could your problem have been prevented with improved documentation?
kierandelaney
@kierandelaney
@ravage84 I think so. I am happy to contribute, is a PR the best way to do that?
Kyle
@kylekatarnls
kierandelaney
@kierandelaney
:thumbsup:
Kyle
@kylekatarnls
Thanks to @tvbeek PHAR download is available again: https://phpmd.org/static/latest/phpmd.phar
kierandelaney
@kierandelaney
Just so you guys are aware, the phpmd.org/static/latest link resolves to a phar reporting PHPMD 2.6.1snapshot201907052340 as it's version id.
The version for 2.8.0 direct from the github release resolves to PHPMD 2.7.0snapshot201912240943.
So neither report 2.8.0, but the 'latest' on phpmd is not.
I saw some discussion around this in a PR that I now can't find, so apologies if I missed something, just a heads up in case.
Kyle
@kylekatarnls
The issue is there: phpmd/phpmd#715
The version number is wrong as I copied 2.8.0-beta.2 to 2.8.0 and the version bump is not in, but all features are in.
About the phar download I will check
Kyle
@kylekatarnls
Yes, seems like I sort in the wrong order:
Kyle
@kylekatarnls
Number shows PHPMD 2.7.0snapshot201912240943 but this snapshot is 2.8.0, we'll release a 2.8.1 for disambiguation.
Kyle
@kylekatarnls
https://phpmd.org/static/latest/phpmd.phar fixed (you can add a timestamp to be sure your browser don't cache the URL: https://phpmd.org/static/latest/phpmd.phar?20191227130225 for instance)
kierandelaney
@kierandelaney
Fast turn around! :sunglasses:
Rafael Neris Cruz
@rafaelneris
Hello.
I'm having problems with PHPMD using PHP 7.4 when using typed properties. Has someone working at this?
Kyle
@kylekatarnls
Yes, it will be fixed when pdepend/pdepend#414 will be merged
So with the release 2.7.0 of PDepend (dependency of PHPMD)
Meanwhile you can run composer require pdepend/pdepend:dev-feature/typed-properties
To add the fixed version of pdepend in your composer.json
Narjes-b
@Narjes-b
Hello! am using phpmd, and I noticed that the .pdepend folder grew to 68 GB!! is it safe to delete all the content of this folder? is there a way to fix this problem?
Kyle
@kylekatarnls
It's just a cache. As far as I know, there is no problem to delete it.
Roman Ryzik
@RomanRyzik
Hello!
I have trouble with codesize ruleset. When I run "vendor/bin/phpmd app text codesize" it outputs nothing. In custom ruleset it outputs "Cannot load source file for class: ". Other rulesets works great. What can cause the issue? I use php 7.3.7 and laravel 7
Marc Würth
@ravage84
@RomanRyzik does it work on some other code?
@RomanRyzik can you produce a reproducable sample?
Masafumi Koba
@ybiquitous

Hello, I have a question about exclude-pattern. I want to prevent a rule from applying to test/**/*.php files as follows:

<ruleset name="My ruleset">
  <rule ref="rulesets/controversial.xml/CamelCaseMethodName">
    <exclude-pattern>tests/</exclude-pattern>
  </rule>
</ruleset>

Can I do this via the latest PHPMD version?