pmd | An extensible multilanguage static code analyzer | Code Analyzer library
kandi X-RAY | pmd Summary
kandi X-RAY | pmd Summary
PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports many languages. It can be extended with custom rules. It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) and runs rules against them to find violations. Rules can be written in Java or using a XPath query. It supports Java, JavaScript, Salesforce.com Apex and Visualforce, Modelica, PLSQL, Apache Velocity, XML, XSL, Scala. Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in C/C++, C#, Dart, Fortran, Go, Groovy, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica, Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex, Scala, Swift, Visualforce and XML. In the future we hope to add support for data/control flow analysis and automatic (quick) fixes where it makes sense.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles a switch label
- Adds a FOR expression node
- Pushes a node on the stack
- Create ASTSqlStatement
- Adds a FOR expression node
- Pushes a node on the stack
- Implements the structure of ASTLabelledStatement
- Adds a FOR expression node
- Pushes a node on the stack
- On ASTExitStatement node
- Adds a FOR expression node
- Pushes a node on the stack
- Visits a FORINIT node
- Adds a FOR expression node
- Pushes a node on the stack
- Visit a FOR update node
- Adds a FOR expression node
- Pushes a node on the stack
- Visits an IF_LAST clause
- Adds a FOR expression node
- Pushes a node on the stack
- Updates the ASTLoop statement
- Adds a FOR expression node
- Pushes a node on the stack
- Wraps the AST node
- Adds a FOR expression node
- Pushes a node on the stack
- Visit an ASTElseClause node
- Adds a FOR expression node
- Pushes a node on the stack
- Updates the dataflow of an ELIF statement
- Adds a FOR expression node
- Pushes a node on the stack
- Visits a FORIF statement
- Adds a FOR expression node
- Pushes a node on the stack
- This is called when an ASTExpression is created
- Adds a FOR expression node
- Pushes a node on the stack
- Entry point for ASTExpression
- Adds a FOR expression node
- Pushes a node on the stack
- Add ASTStatement node
- Adds a FOR expression node
- Pushes a node on the stack
- Adds a RETURN_STATEMENT node
- Adds a FOR expression node
- Pushes a node on the stack
- Overrides the visitor to store data
- Adds a FOR expression node
- Pushes a node on the stack
- Add a structure to the AST
- Adds a FOR expression node
- Pushes a node on the stack
- Visit ASTVariableDeclarator
- Adds a FOR expression node
- Pushes a node on the stack
- Create a throw statement
- Adds a FOR expression node
- Pushes a node on the stack
- Updates the ASTLabelledStatement
- Adds a FOR expression node
- Pushes a node on the stack
- Create a new label
- Adds a FOR expression node
- Pushes a node on the stack
- Implements the ASTFetchStatement
- Adds a FOR expression node
- Pushes a node on the stack
- Overrides the visitor to create a structure node
- Adds a FOR expression node
- Pushes a node on the stack
- Overrides the visitor to visit an ASTWhileStatement node
- Adds a FOR expression node
- Pushes a node on the stack
- Create a break statement
- Adds a FOR expression node
- Pushes a node on the stack
- Process a continue statement
- Adds a FOR expression node
- Pushes a node on the stack
- Create a RETURN statement
- Adds a FOR expression node
- Pushes a node on the stack
- Visits a switch statement
- Adds a FOR expression node
- Pushes a node on the stack
- Add a continue_STATEMENT statement
- Adds a FOR expression node
- Pushes a node on the stack
- Visit ASTStatementExpression
- Adds a FOR expression node
- Pushes a node on the stack
pmd Key Features
pmd Examples and Code Snippets
[A.1] in DPDK instance-1 & instance 2, execute `show port 0 mac` to show current port MAC address. Note down the MAC address correctly. To set the MAC address of peer use command `set eth-peer (port_id) (peer_addr)`.
In non interactive
pmd {
ignoreFailures = false
ruleSets = [] // Remove defaults
ruleSetFiles = files("path/to/mandaroty/ruleset.xml")
}
def sourceSets = convention.getPlugin(org.gradle.api.plugins.JavaPluginConvention).sourceS
mvn pmd:pmd -Dformat=net.sourceforge.pmd.renderers.CodeClimateRenderer
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd (default-cli) on project hello-world: Execution default-cli of goal org.apache.mave
public class ConstantHelper {
public static final int TWO_BYTE_MAX_CP = 0x7FF;
}
if (value <= ConstantHelper.TWO_BYTE_MAX_CP) { // No PMD issue with this.
return 2;
}
default int
task checkPMDReport {
doLast {
def pmdReport = rootProject.file('reports/pmd/main.xml')
def rootNode = new XmlSlurper().parse("$pmdReport")
def bugsFound = rootNode.children().children().findAll({node -> nod
org.apache.maven.plugins
maven-pmd-plugin
3.12.0
false
true
true
${basedir}/PMD.xml
Proc Natl Acad Sci U S A
PNAS
0027-8424
The National Academy of Sciences
The coreceptor mutation
Sinma
Army
pmd -d "C:\refactoring-toy-example" -f csv -R rulesets/java/unusedcode.xml ^
-reportfile "C:\refactoring-toy-example\pmd-results.csv"
podTemplate(cloud: 'k8s-houston', label: 'api-hire-build',
containers: [
containerTemplate(name: 'maven', image: 'maven:3-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'pmd', image: 'stash.company.com
Community Discussions
Trending Discussions on pmd
QUESTION
in my problem RSS did not have a good load balance between CPU cores case the rx packets has been modified by insert tags between mac and ip so the dpdk could not recognize it.assume I want to load balance by way of round-robin, Multiple rx queues have been set up. in this question answer: How to disable RSS but still using multiple RX queues in DPDK? it says its possible to load balance in round robin fashion by using RTE_FLOW. what is the right way to do it grammatically ? I would like to know the API or structs for setting up the round-robin method here is my runtime environment infomation: 1)dpdk version: 19.11.9 2)nic PMD :ixgbe 3) fireware:825999 and XXV710 4) os version: ubuntu 16.04 kernel:4.4.0-186
...ANSWER
Answered 2022-Mar-26 at 02:47As per the question
RSS did not have a good load balance between CPU cores case the rx packets has been modified by insert tags between mac and ip
There are couple of items which needs to be clarified. so let me explain
- Certain Physical and virtual NIC exposes RSS via DPDK RX offload for fixed tuples like IP, Protocol, TCP|UDP|SCTP port number.
- Certain NIC allows to configure the hash reta algorithm to better suit to needs (example when the source destination IP address is fixed we can skip and use others).
- As I recollect from DPDK 18.11, RTE_FLOW is been introduced to support RSS on selected RX queues (example Q1,Q2,Q3 can be RSS for TCP packets while Q4,Q5 can be used for UDP). But again this is based on the either Inner or Outer IP+PORT number
- For DPDK version 19.11 onwards RTE_FLOW is been enhanced to support
RAW Pattern
. The intend of this feature is support Special protocol which by default the NIC does not understand like (VXLAN, GENEVE, RTP and other protocols). - For NIC like Fortville & Columbiaville (from Intel) allows loading of special firmware via DDP (Dynamic Device Personation) to configure special fabric headers or MPLS like headers (between ethernet and ip) to be parsed, lookup and used as seed for RSS (allowing better distribution).
- There are NIC which do support L2 layer but these would be limited SMAC, DMAC, VLAN1,VLAn2, MPLS only and not custom header.
Hence depending upon NIC, vendor, RSS support for L2 and firmware the ability calculating RSS on fields between varies in port init or RTE_FLOW specific configuration. For example RSS ETH supported on
- I40E is
I40E_INSET_DMAC | I40E_INSET_SMAC
- DPAA2 is
NH_FLD_ETH_TYPE and NET_PROT_ETH
- CNXK is
RSS_DMAC_INDEX
- OCTEONX2 is
FLOW_KEY_TYPE_VLAN and FLOW_KEY_TYPE_CH_LEN_90B
Hence for NIC ixgbe and XXV710
there is no ready support for the custom header
between ethernet and IP.
Alternatives:
- Use a smart NIC or FPGA: that is programmed to parse and RSS on your specific headers to RSS on multiple RX queue
- Work with Intel using XXV710 (Fortville): to create DDP which can parse your specific headers as RSS on multiple RX queue.
- Identify DPDK NIC: which can parse
RAW
header as defined 12.2.6.2. Once the support is added by the vendor you can create a simpletraffic spread tool
which will ensure traffic distribution across the desired RX queues in round robin fashion. - Use SW to support the missing hardware.
note: I am not recommending use of HW based static Round Robin as it will create 2 fold problem
- if it is pure DPDK BOND Round ROBIN you will not have any flow pinning
- If you use hash based pinning, there are chances elephant flow can pushed 1 or a few queues causing performance drops in cpu processing.
- My recommendation is to use EVENTDEV model with atomic mode, which ensure better cache locality (at a given instance same flows will fall onto worker thread) and almost linear performance performance. sample app
For option 4 (Software Model):
- Disable RSS in port_init function
- Use single RX queue to receive all the packet either custom rx thread.
- calculate the hash based on the desired header and update mbuf hash field.
- Use
rte_distributor
library to spread traffic based on the custom. - or use
rte_eventdev
with atomic model to spread the work load on multiple worker.
[Clarification from Comments]:
- I have asked relevant practitioners, they said modifying the pmd driver can solves my problem, its the only way?
[ANSWER] Since you are using custom header and not generic VLAN|IP|Port this suggestion is not correct. As you have clarified in question and comments you want to distribute like RSS for custom header.
- I haven't written any code about rte_flow distribution yet, i read the rte_flow example, don't see the code to configure round-robin
[ANSWER] as explained above not all nic support RSS and RAW. Since your current NIC is ixgbe and i40e
the function of parsing and executing RSS for custom header is unlikely. you can try option 2 (work with intel create new ddp) for i40e to achieve the same or implement in SW as suggested in option 4.
- im not ask for solution, I just want to know how to set up round robin by 'RTE_FLOW' Can you give me a few API
[ANSWER] normally one updates with code snippets or steps used for reproducing the error. But the current question is more like clarification. Please refer above.
QUESTION
I have a Gradle plugin that I want to deploy to Artifactory server with Gradle Artifactory Plugin.
The problem is that artifactoryDeploy
task publishes only build.info
meta-information and skips the actual artifacts. You can see it in the logs.
ANSWER
Answered 2022-Mar-19 at 09:33OK, I found the source of the problem. You should replace artifactoryDeploy
with artifactoryPublish
command.
QUESTION
I have a board with one ethernet interface (eth0) running Linux. I'm trying to forward all incoming traffic from eth0 to my PMD driver, using dpdk-l2fwd example application.
Here is what I've tried:
...ANSWER
Answered 2022-Feb-14 at 09:16[EDIT-1] clarification of using same interface for DPDK and Kernel routing
Answer> as discussed over comments please refer to DPDKD + kernel on same interface
Based on the information shared there are multiple questions to the single query I'm trying to bypass all traffic to the PMD I'm currently developing
. Addressing each one separately below
- question 1: using dpdk-l2fwd example application
Answer> DPDK application l2fwd application makes use of basic APi with almost no HW offloads. Based on your environment (I have a board with one ethernet interface (eth0)), the right set of parameters should be -p 0x1 --no-mac-updating -T 1
. This will configure the application to receive and transmit packet using single DPDK interface (that is eth0 on your board).
Note: DPDK Application can work with DPDK PMD both physical and virtual
- question 2: I tried to use net_tap, using the following command:
Answer> If the intend is to intercept the traffic from physical and then forward to tap interface, then one needs modify the eal arguments as ./build/l2fwd --vdev=net_tap0,iface="my_eth0" -- -p 0x3 -T 1 --no-mac-updating
. This will allow the application to probe physical NXP interface (eth0) and make use of Linux TAP interface as secondary interface. Thus any traffic from NXP and TAP will be cross connected such as NXP (eth0) <==> TAP (my_eth0)
- question 3: ./usertools/dpdk-devbind.py --status returns empty
Answer> Form the dpdk site supported NIC list NXP dpaa, dpaa2, enetc, enetfec, pfe
. Cross checking the kernel driver fsl_dpaa2_eth
I think it is safe to assume dpaa2 PMD is supported. As you have mentioned the NIC is not enumerated, it looks like there are certain caveats to such model revision, supported board, BSP package, vendor-sub vendor ID check etc. More details can be found Board Support Package, and DPAA2 NIC guide
Debug & Alternative solutions:
- To start with use the Kernel Driver to bring in packets
- Use extra logging and debug to identify why the NIC is shown in the application
Approach 1:
- Make sure the NIC is bind with kernel driver
fsl_dpaa2_eth
. - ensure NIC is connected and link is up with
ethtool eth0
- set to promiscous mode with
ifconfig eth0 promisc up
- start DPDK application with PCAP PMD,
./build/l2fwd --vdev=net_pcap0,iface=eth0 -- -p 1 --no-mac-updating -T 1
- Check packet are received and redirected to PCAP eth0 PMD by checking the statistics.
Approach 2:
- Ideally the NIC should be categorized under network device to be probed by debind.py.
- Check the device details using
lshw -c net -businfo
fornetwork
. - try checking with
lspci -Dvmmnnk [PCIe BUS:Slot:Function id]
for network details. - If above details does not show up as network device this might be reason for not getting listed.
- Suggestions or workaround: You can try to forcefully bind with igb_uio or vfio-pci (I am not much famialr with NXP SoC) by
dpdk-devbind -b vfio-pci [PCIe S:B:F]
. Then cross check withlspci -ks [PCIe S:B:F]
. Once successfully done, one can start dpdk l2fwd in PMD debug mode with./build/l2fwd -a [PCIe S:B:F] --log-level=pmd,8 -- -p 1 --no-mac-updating | more
. Thus by intercepting and interpreting the logs one can identify what is going
Note:
- It is assumed the application is build with static libraries and not dynamic. To build with static libraries use
make static
for l2fwd. - For the described use case recommended application is
basicfwd/skeleton
rather than l2fwd.
QUESTION
Does virt_to_pfn checks whether the page table is present or not. Below is the code which is failing with page fault.
...ANSWER
Answered 2022-Feb-28 at 13:46The results of virt_to_pfn(kaddr)
and virt_to_page(kaddr)
are valid if and only if virt_addr_valid(kaddr)
is true. That is only true if kaddr
is in the linear-mapped (lowmem) region of kernel virtual address space.
pfn_valid(virt_to_pfn(kaddr))
is not equivalent to virt_addr_valid(kaddr)
. virt_addr_valid(kaddr)
implies pfn_valid(virt_to_pfn(kaddr))
but pfn_valid(virt_to_pfn(kaddr))
does not imply virt_addr_valid(kaddr)
.
QUESTION
I'm using docker-compose
to launch a commandbox lucee container and a mysql contianer.
I'd like to change the web root of the lucee server, to keep all my non-public files hidden (server.json etc, cfmigrations resources folder)
I've followed the docs and updated my server.json
https://commandbox.ortusbooks.com/embedded-server/server.json/packaging-your-server
ANSWER
Answered 2022-Feb-24 at 15:19You're using a pre-warmed image
QUESTION
I want to create a custom Gradle plugin that will encapsulate Checkstyle and PMD configurations. So, other projects can just apply one custom plugin without bothering about any additional configurations.
I applied checkstyle
plugin.
ANSWER
Answered 2022-Feb-21 at 11:36You'd need to bundle the checkstyle.xml
within your plugin's resources
folder, so when you ship it, you can always access it from within the plugin code.
Basically, you need to put the config under src/main/resources/checkstyle.xml
of the plugin and then access it like this:
QUESTION
We've recently picked up PMD on our Salesforce project to help with our Apex code quality analysis. We've implemented a couple of rules, but have seen that most of the really valuable-looking rules (around performance, complexity, etc) are marked as deprecated.
Do people generally use continue to use deprecated rules (as they still work, even if they are no longer actively supported)? Or does deprecated in this sense mean that these may be broken/unreliable.
Does the prevalence of deprecated PMD rules mean that we should be looking for an alternative tool?
I'd really welcome your thoughts
...ANSWER
Answered 2022-Feb-17 at 12:52There are very few deprecated rules in the Apex module: https://pmd.github.io/latest/pmd_rules_apex.html
PMD rules are usually not deprecated without a replacement. For instance AvoidDmlStatementsInLoops is replaced by OperationWithLimitsInLoops, as documented. Sometimes several rules are consolidated into a single one, which is the case for those 3 performance rules. You might get the impression that many rules are deprecated, but no functionality is lost, and the newer rules are generally more easily extensible.
If you are seeing many deprecation warnings, it may be because you are referencing those rules through deprecated rulesets. For instance, if you write
QUESTION
I am unable to update my spring boot app to 2.6.0 from 2.5.7. It throws the following error.
...ANSWER
Answered 2021-Dec-07 at 19:14The problem is the password encoder. It is required to build the auto-configured UserDetailsService
that you inject in the contructor of the class.
You can break the cycle by making the bean factory method static
:
QUESTION
I'm running Jenkins maven task inside docker image. My task generates pmd.xml which is then parsed by Jenkins plugin.
The problem is that path inside docker image is different that Jenkins workspace. This results in PMD view to crash when redirecting to source. pmd.xml
with absolute paths looks like this:
ANSWER
Answered 2022-Jan-20 at 15:45I solved the problem by changing docker volume
mount point to Jenkins WORKSPACE
path.
QUESTION
I am using the eclipse-pmd plugin, and I am also using PMD via the following Gradle configuration:
...ANSWER
Answered 2021-Dec-28 at 19:53It turns out that the eclipse-pmd plugin (which I found in C:\Users\{username}\.p2\pool\plugins
) comes packaged with its own version of PMD, which in this case is 6.28.0.
This doesn't fully explain the discrepency, since the AvoidUncheckedExceptionsInSignatures
rule has been around since PMD 6.13.0, but I'm happy enough to blame the difference in versions for the difference in output.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pmd
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page