Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Marc Würth
@ravage84
@fede-moya:matrix.org thank you for your effort and reaching out on us.
It was me, who sent the request.
How can we make sure, it stays up to date? We more or less regularly update PHPMD (& the underlying PDepend).
Marc Würth
@ravage84
@fede-moya:matrix.org teh PHPMD plugin seems to work. Thanks!
Federico Moyá
@fede-moya:matrix.org
[m]
@ravage84 Great news I'm happy to hear that. So in order to keep it updated the best would be for you folks to open prs with the updates. https://github.com/codeclimate/codeclimate-phpmd I can commit to review those PRs and merged them and I can also commit to complete those reviews relatively fast. Sounds good ?
porokhovnichenko
@porokhovnichenko
Hello everyone, feel so happy to find this community! I hope to find an answer to my question here - when constructor promotion property is used and it's body is empty, something like: public function __construct( private int $id) {} I get a message "Avoid unused parameter such as '$id'". Is it expected behavior for PHP 8.0.10 and phpmd 2.10.2? I am confused with this a bit, I didn't expect to see the message.
Kyle
@kylekatarnls
Hello, is it phpmd 2.10.2 from phar or from composer? If composer, can you also check the pdepend version?
porokhovnichenko
@porokhovnichenko
@kylekatarnls Hello, 2.10.2 from composer, pdepend version is 2.10.0.
Tobias van Beek
@tvbeek
@porokhovnichenko I suspect it is the same problem as: phpmd/phpmd#884 can you verify it with the dev-master composer version?
porokhovnichenko
@porokhovnichenko
@tvbeek Thanks for your interest, yes, it looks the same. And with dev-master I still get the same message about unused parameter.
porokhovnichenko
@porokhovnichenko
@tvbeek But if I install pdepend from composer with dev-master version it is not reproduced any more
Kyle
@kylekatarnls
Yes, sorry, both are needed, PDepend will expose a util to tell if a parameter is promoted, and PHPMD use it to whitelist in the unused-parameter rule.
We'll release PDepend, then a new PHPMD version that will take the last PDepend one too.
porokhovnichenko
@porokhovnichenko
Thanks a lot to all of you!
Ghost
@ghost~53183ebc5e986b0712efd14f
Hello
I've a warning at the class level: The class MyClass has an overall complexity of ....
Is there a way to deactive only the warning of the class, but not on the method of a class
Ghost
@ghost~53183ebc5e986b0712efd14f
?
Tobias van Beek
@tvbeek
@wonzbak you can suppress a specific rule, see: https://phpmd.org/documentation/suppress-warnings.html
I think that will be enough for your case (or change the code 😉)
Ghost
@ghost~53183ebc5e986b0712efd14f
Yes I would like change the code, but suppress warning is always a question of time,
I finaly add the warning: @SuppressWarnings(PHPMD.ExcessiveClassComplexity) at the class level, instead of the wrong one CyclomaticComplexity
thx for the response
Haris S
@deiks
Hi, anyone around? :)
Is it possible to throw syntax errors with phpmd? I'm getting these 6 types: cleancode, codesize..., but I made one syntax issue intentionally but it didn't report. Thanks
Tobias van Beek
@tvbeek

@deiks that is not an option that is provided by PHPMD

I have a oneliner in the CI of my projects, maybe it can help you: (this is with all the files in src)

find src/ -type f -name '*.php' -exec php -l {} \; | (! grep -v "No syntax errors detected" )
Haris S
@deiks
Aha, I see. Thank you, thought that maybe there's an option in phpmd. But there's always workaround :D
Haris S
@deiks
Hi, is it possible to suppress warnings globally without adding into comment in every file. For example: Avoid using static access to class
Tobias van Beek
@tvbeek

You can create a custom ruleset where you don't add that rule, see: https://phpmd.org/documentation/creating-a-ruleset.html

Example from a ruleset that I have:

    <rule ref="rulesets/cleancode.xml">
        <exclude name="StaticAccess" />
    </rule>
Haris S
@deiks
Thanks, will try it!
Anyway, will that make a conflict with existing or I have to exclude cleancode and include custom ruleset without StaticAccess
Haris S
@deiks
Sorted, thanks!

Just if u can explain what does this do..

NPath complexity
Cyclomatic Complexity

I can see some reports on that but I don't understand what's wrong

Marc Würth
@ravage84

@deiks

Just if u can explain what does this do..

NPath complexity
Cyclomatic Complexity

I can see some reports on that but I don't understand what's wrong

Consult the documenttion: https://phpmd.org/rules/codesize.html#npathcomplexity

Ahmad El-Bardan
@ABSAhmad
Hey, I just saw that the latest release 2.11.1 does not have a PHAR attached to the release and also is not listed on the website as a release. Is this a bug or is it manual work that someone just needs to do when they have some time? As far as I can tell Github Actions should do it automatically but it seems like it was skipped for some reason (I can't find the reason). Just wanted to confirm it's a bug before opening an issue :)
Tobias van Beek
@tvbeek
@ABSAhmad Thanks for saying. There is something wrong with the automated process and I forgot to do it manual. I just added it.
Ahmad El-Bardan
@ABSAhmad
@tvbeek Great, thank you! :)
Jasurbek Yuldoshev
@laziest-coder
Hi everyone! I have been trying to create custom rule to check if open brace of class is in next line or in same line, if it is in same line, I would like to throw a violation message, can someone help me?
Volodymyr Panivko
@sveneld
@laziest-coder I think it's better to check via PHP_CodeSniffer, it works with php token and designed for checking coding standards
Marc Würth
@ravage84
@laziest-coder I agree with @sveneld . PHPCS is the apprpriate tool to check for coding style issues, not PHPMD.
Marc Würth
@ravage84
grafik.png
Today, I received a phishing mail for @phpmd.org
I hope you guys are doing well
Jasurbek Yuldoshev
@laziest-coder
Thank you @sveneld @ravage84 , I ended up using PHP_CodeSniffer as you guys recommended, turns out that it has tons of built-in features.
Anders Jenbo
@AJenbo
A shocking amount of people use codesniffer for other things then code style :/
@laziest-coder i would suggest also trying out https://github.com/FriendsOfPHP/PHP-CS-Fixer/ for code style related checks and automatic fixes.
Marc Würth
@ravage84
@AJenbo a shocking amount of people use the wrong tools for the wrong job, in computer stuff but also real life.... :laughing:
vic131
@vic131

Hi,
I’m collaborating in a opensource project :

https://bitbucket.org/AliasAPI/damnp/src/master/etc/phpmd/run_phpmd.sh

And i am finding trouble configuring phpmd in the most sensitive way possible, so it would detected every generally undesired line of code. If anyone has any tips, it would be very welcome. Thanks in advance

Marc Würth
@ravage84
@vic131 , have you read the PHPMD documentation?
May be this helps, too: