Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 21 13:30
    oowekyala commented #3971
  • May 21 11:38
    oowekyala commented #2435
  • May 21 11:25
    oowekyala edited #3976
  • May 21 11:24
    oowekyala opened #3976
  • May 20 13:19
    SCWells72 commented #3952
  • May 20 12:59

    adangel on 7.0.x

    [core] Support #text and #comme… [core] Improve support for #tex… [html] Document XPath 2.0 only … and 23 more (compare)

  • May 20 12:58

    github-actions[bot] on gh-pages

    Update documentation https://g… (compare)

  • May 20 12:42
    oowekyala edited #3898
  • May 20 12:42
    adangel closed #3964
  • May 20 12:42
    adangel closed #3960
  • May 20 12:42
    adangel closed #3874
  • May 20 12:42
    adangel closed #3955
  • May 20 12:42
    adangel closed #3874
  • May 20 12:42
    adangel closed #1445
  • May 20 12:42

    adangel on master

    [core] Support #text and #comme… [core] Improve support for #tex… [html] Document XPath 2.0 only … and 19 more (compare)

  • May 20 12:26
    pmd-test commented #3945
  • May 20 12:14
    adangel synchronize #3945
  • May 20 09:39
    oowekyala commented #3975
  • May 20 09:39
    oowekyala commented #3975
  • May 20 08:54
    pmd-test commented #3958
MartGit
@MartGit
@adangel Yes I have a lot of Deprecated warnings in my project that I'm not sure when and how to fix those deprecations. I'm on 6.38 version. Is there a good document to guide on how to fix those deprecation warnings?
Andreas Dangel
@adangel
What kind of deprecation warnings do you get? If it is about rules, then we usually print out the replacement within the deprecation warning. If it is about java code ( - then I'd like to know more about your use case - beacuse then you seem to use pmd directly somehow) we usually have some note in the javadoc, what to do. See also the old release notes where we describe the deprecations for each release.
MartGit
@MartGit
@adangel I mostly get this deprecation warnings when I try to use the visitAll method:
warning: [deprecation] visitAll(List<? extends Node>,RuleContext) in AbstractXmlRule has been deprecated
protected void visitAll(List<? extends Node> nodeList, RuleContext ctx) {
warning: [deprecation] visitAll(List<? extends Node>,RuleContext) in AbstractXmlRule has been deprecated
super.visitAll(nodes, ctx);
warning: [deprecation] visitAll(List<? extends Node>,RuleContext) in AbstractXmlRule has been deprecated
protected void visitAll(List<? extends Node> nodeList, RuleContext ctx) {
warning: [deprecation] visitAll(List<? extends Node>,RuleContext) in AbstractXmlRule has been deprecated
super.visitAll(nodes, ctx);
Andreas Dangel
@adangel
you might just implement void apply(List<? extends Node> nodes, RuleContext ctx) instead of visitAll
MartGit
@MartGit
Thanks @adangel . Do you also know how I can fix this one?:
warning: [deprecation] AbstractApexUnitTestRule in net.sourceforge.pmd.lang.apex.rule has been deprecated
public final class ApexTestClassNamingConventionRule extends AbstractApexUnitTestRule {
Andreas Dangel
@adangel
Directly extend AbstractApexRule. Have a look at the impl of AbstractApexUnitTestRule to see whether you need anything from there. We probably will delete this base class (but not before pmd 7) - it makes it actually harder to share code between rules, because of single inheritance.
MartGit
@MartGit
Thanks again @adangel. Now I get this deprecation warning on AbstractApexRule:
warning: [deprecation] visit(AbstractApexNodeBase,Object) in AbstractApexRule has been deprecated
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
MartGit
@MartGit
Hello @adangel I'm trying to write a custom rule for a visual force page file. I extended the AbstractVfRule but my methods are not getting executed at all. Can you suggest any solution to this?
Andreas Dangel
@adangel
Hi @MartGit - do you have your project on github or somewhere? It's hard to give suggestions without knowing exactly, what you are trying to do...
See https://github.com/pmd/pmd/blob/master/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfCsrfRule.java for an example of a rule which visits a "apex:page"
MartGit
@MartGit
Hi @adangel I'm sorry if my explanation isn't clear enough. This is a project for my company that isn't public so as much as I would like to show you the code, I can't share it. The vf issue is resolved though. However, I was wondering if pmd supports html and if yes, what will be the abstract rule for html? If I can get an example like the one for vf that you provided above, that would be great. Thanks!
Andreas Dangel
@adangel
Hi, glad to hear the the vf issues is resolved. For your html question: See pmd/pmd#3521 - in short: no, html is not a supported language. Supported languages: https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#supported-languages
MartGit
@MartGit
Hi @adangel I got an error while testing Javascript file containing annotations. Do you know if PMD supports this version of Javascript? If not, any idea on when or what version can support this? The error I got is
java.lang.IllegalArgumentException: There is no Node adapter class registered for the Node class: class org.mozilla.javascript.ast.XmlPropRef
Andreas Dangel
@adangel
Hi @MartGit - we use rhino and whatever this supports should be supported by PMD as well. The error message "no Node adapter class registered" indicates, that this is already supported by rhino, but PMD is not able to use it. Could you please create a new issue with a proper code sample on https://github.com/pmd/pmd/issues ? Thanks!
MartGit
@MartGit
@adangel thanks for the response. Will create the issue asap!
MartGit
@MartGit
Hi @adangel I created the issues pmd/pmd#3703 for this. Any ideas on how to track the version of the fix?
wakingrufus
@wakingrufus:matrix.org
[m]
i know this is a long shot, but is anyone aware of an issue present in pmd 6.19.0 where subsequent runs on the same source would duplicate violations in the xml output?
Alfusainey Jallow
@Alfusainey
Hi, is there a way to tell CPD to find cross clones? E.g I have a directory call snippets and another directory call repos. I want CPD to find clones of the snippets directory inside of the repos directory and not report clones found within the snippets directory or the repos directory. Is this possible?
the command i use is: run.sh cpd --minimum-tokens 100 --files snippets --files repos --language py --format xml > cpd_results.xml
this is reporting clones found within the snippets directory and the reposdirectory. Instead, I want CPD to report only those clones found between snippets and repos
Andreas Dangel
@adangel
not sure. Maybe you can filter the report afterwards?
Alfusainey Jallow
@Alfusainey
ok, thanks. yeah, that's my plan if CPD doesn't have support for this
Alfusainey Jallow
@Alfusainey
i have another question: For Python and Javascript, does CPD detect only exact clones i.e cases where the code fragments are 100% similar?
from my testing so far, it looks like it reports only exact clones
Jim Krueger
@jakrueger
Wondering if someone can help me with what I think is a potential bug. I am using PMD to analyze our Ecmascript. One problem I notice is in our report we get the following error message:
Error while processing myfile.js
at net.sourceforge.pmd.SourceCodeProcessor.processSourceCodeWithoutCache(SourceCodeProcessor.java:127)
...
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid operator: 164
at net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptTreeBuilder.createNodeAdapter(EcmascriptTreeBuilder.java:172)
First, the line number 164 is not correct, this file only has 127 lines (but I think I've heard in the past that this can be due to the compiler for some reason, not sure but not my main concern).
My concern is that the javascript looks like this:
$('body').on('shipping', function (e, basket) {
toggleForm(basket.shipping.selectedShippingMethod.formEnabled);
Jim Krueger
@jakrueger
This javascript is valid (i.e. in our software is works fine and I think according to ECMA standards it should be fine) However, for some reason the function part of this is getting caught as an "invalid operator". Wondering if anyone has seen something like this before? If this is a bug where is the best place for me to file it?
nimaje
@nimaje
where does it say anything about a line number of the processed file? I only see 'Invalid operator: 164', reads to me like pmd sees 164 somewhere where it expects an operator or pmd tries to use 164 as an operator for some other reason, can you try to create a small reproducer? maybe via something like binary search
Jim Krueger
@jakrueger
I don't have the number "164" anywhere in the code, I guess I was assuming it was a line number. So what I posted above is actually the reduced reproducer, if I remove the function you see there it works fine, there is something about that function that is not getting properly processed.
nimaje
@nimaje
those two lines? there is a closing ) and a cloasing } missing, is that ok in ecmascript?
Jim Krueger
@jakrueger
Sorry, I missed the ending " });"
nimaje
@nimaje
yeah, that could be a bug, the bugs link on the website leads to https://github.com/pmd/pmd/issues
Jim Krueger
@jakrueger
@nimaje Thank you!
jzochowskiSEI
@jzochowskiSEI
Hello everyone. Is there any plans for PMD to move to apache commons-io 2.7 or above? I would like to leverage this tool for my Azure DevOps pipeline but there are known vulnerabilities on the current static version 2.6
Devam Parikh
@Devamparikh
Hey there, I want to contribute here. I have read some issues and discussions, you guys are planning to migrate Junit4 to Junit5. I want to help in migrating Junit4 to Junit5. Can someone please create some good-first-issue so that I can work on it? Thanks :)
nimaje
@nimaje
why not opening an issue about migrating to junit5 yourself and saying that you want to work on it?
Devam Parikh
@Devamparikh
I have commented on simmiler type of issue for that.
I am kind of beginner so I want to work on some good first issues which would be better for me if I start small and if you guys can guide along.
Andreas Dangel
@adangel
@jzochowskiSEI Thanks for asking. commons-io 2.7 requires at least java8, so we can only upgrade it for pmd7. Are you referring to https://github.com/advisories/GHSA-gwrp-pvrq-jmwv ?
Andreas Dangel
@adangel
@Devamparikh Thanks for the offer. Since you mention, you want a good first issue, I'd suggest to start with a bug fix. This allows you to configure your dev environment and see a bit of code of PMD. Good first issues are always fixing false positives or negatives, such as pmd/pmd#3874 , so I'd start with that
Devam Parikh
@Devamparikh
Of course I would like to do that too, can I have a little help from you @adangel? I want to be part of GSoC2202 and work on the Eclipse JKube project "Migrate to JUnit5 Testing Framework from JUnit4", so it would be helpful to give me a chance to get ahead in Migrate To JUnit5. Can we do that?
Devam Parikh
@Devamparikh
A small portion of Migrate to JUnit5 will do if you like.
Andreas Dangel
@adangel
You can give it a try, but I won't have much time to support you...
Devam Parikh
@Devamparikh
Can you assign me any testcase class remains to be convected in any file? I have debugging skills, I'm able to debug.
Devam Parikh
@Devamparikh
Hey @adangel would you assign me any good first issue related to this?
Maikel Steneker
@maikelsteneker
Hi all, apologies in advance if I could have found this out on my own. I'm upgrading my project of Java rules to use the latest PMD version, and I'm getting lots of deprecation warnings, primarily on the addViolation method from AbstractRule. currently, I'm extending the AbstractJavaRule base class and overriding the visit method. this gets an Object data parameter that I pass into addViolation. perhaps I need to override another method to accomplish the same thing? any pointers would be appreciated
Maikel Steneker
@maikelsteneker
ah, I think I figured it out. I simply had to replace addViolation(data, ...) by asCtx(data).addViolation(...). not sure how I missed this initially :)
Andreas Dangel
@adangel
yes, in PMD 7, the violations will be collected via the RuleContext - in PMD6 you still need to cast the data parameter to RuleContext (which asCtx does).