This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmd -d <filename or dir with path> -f <output format> -R <default rule or rule file with path> -reportfile <output file name with path> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpd --minimum-tokens <minimum token value that must be duplicated> --files <path to single file or directory> --language <name of language in which code is written> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void doMoreWork(Integer p1, Integer p1, Integer p3, Integer p4 ) { | |
System.log('function with excessive parameters'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpd.bat --minimum-tokens 5 --files "C:\Users\Rahul Malhotra\Documents\My Lightning Org\src\classes\test.cls" --language apex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="Custom Rules" | |
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> | |
<description> | |
My Custom rules | |
</description> | |
<!-- Using a single rule from a set of predefined rules --> | |
<rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:handler name="init" action="{!c.getContactsList}" value="{!this}" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to handle Lightning Event fired from this component itself. | |
handleRegisteredComponentEvent: function(component, event, helper) { | |
alert('Event handler at source component that fired the event.'); | |
event.stopPropagation(); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:handler name="totalIncomeComponentEvent" event="c:LightningComponentEvent" action="{!c.handleRegisteredComponentEvent}" phase="capture"></aura:handler> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:handler name="totalIncomeComponentEvent" event="c:LightningComponentEvent" action="{!c.handleTotalIncomeComponentEvent}" phase="capture"></aura:handler> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
// Function to handle Lightning Event | |
handleTotalIncomeComponentEvent : function(component, event, helper) { | |
alert('Event handler at the parent component'); | |
// Getting the value of totalIncome attribute of event using event.getParam() | |
var totalIncome = event.getParam('totalIncome'); | |
// Setting the totalIncome attribute of component with the event's totalIncome attribute value. | |
component.set('v.totalIncome', totalIncome); | |
event.stopPropagation(); | |
} |