Static code analysis simply gives you suggestions of places to look at improving your code. It's nice to have a clear report here, but it isn't necessary to take care of every item.
This particular case, empty blocks in a trigger framework, I'd probably just ignore.
If you really do feel the need to resolve this, then I'd suggest using an abstract class to provide a default implementation for all of the trigger context methods so that you only need to include the methods in your concrete trigger handler classes that will have a non-empty body.
Given your interface
public interface TriggerHandler {
void beforeInsert(List<SObject> newItems);
void beforeUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems);
void beforeDelete(Map<Id, SObject> oldItems);
void afterInsert(Map<Id, SObject> newItems);
void afterUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems);
void afterDelete(Map<Id, SObject> oldItems);
void afterUndelete(Map<Id, SObject> oldItems);
Boolean isDisabled();
}
Implementing my suggestion would look something like this
// The "abstract" keyword allows us to inherit from this class, but not construct an
// instance of _this class_.
// I.e. DefaultTriggerHandler handler = new DefaultTriggerHandler(); is not allowed
public abstract class DefaultTriggerHandler implements TriggerHandler{
// A method with the "virtual" keyword can be overridden in child classes, but still
// allows us to provide a default implementation.
// If this were an "abstract" method, we would not be able to provide a default
// implementation (just a method signature).
// Abstract methods are also inherited, the big difference being that a child class
// must override _all_ of its parent's abstract methods
public virtual void beforeInsert(List<SObject> newItems){
system.debug('Using default implementation of beforeInsert, returning');
return;
}
// As another note, interface implementations must match the signature provided
// in the interface itself.
// The exception to this are the "virtual", "abstract", and "override" modifiers,
// which we can add to the signature (as we're doing here)
public virtual void beforeUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems){
system.debug('Using default implementation of beforeUpdate, returning');
return;
}
public virtual void beforeDelete(Map<Id, SObject> oldItems){
system.debug('Using default implementation of beforeDelete, returning');
return;
}
public virtual void afterInsert(Map<Id, SObject> newItems){
system.debug('Using default implementation of afterInsert, returning');
return;
}
public virtual void afterUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems){
system.debug('Using default implementation of afterUpdate, returning');
return;
}
public virtual void afterDelete(Map<Id, SObject> oldItems){
system.debug('Using default implementation of afterDelete, returning');
return;
}
public virtual void afterUndelete(Map<Id, SObject> oldItems){
system.debug('Using default implementation of afterUndelete, returning');
return;
}
public virtual Boolean isDisabled(){
return true;
}
}
// Interfaces are also inherited
// Since DefaultTriggerHandler implements TriggerHandler, AccountTriggerHandler
// implicitly implements that interface as well
// You can still explicitly add "implements TriggerHandler" to this class, it's just
// not strictly required.
public class AccountTriggerHandler extends DefaultTriggerHandler{
public override void beforeInsert(List<SObject> newItems){
system.debug('Using concrete implementation of beforeInsert');
// your logic here
return;
}
}
As the rule says, you have too many parameters. Consider passing in an entire record:
@AuraEnabled
public static updatestudentProgramDiscount(students_programs__c studentRecord) {
try {
update studentRecord;
} catch(Exception e) {
throw new AuraHandledException(e.getMessage());
}
}
Note: You should use Security.stripInaccessible to prevent invalid field access. Note also using an exception thrown to trigger the "catch"/"error" handler on the client.
Best Answer
Many fragments of you command look wrong when I compare to what I normally use and what is described here in the docs:https://pmd.github.io/pmd-6.3.0/pmd_userdocs_getting_started.html
E.g. there is no -ls parameter. You have to use -d as in Windows. I highly recommend to start with a simple command where no reports are written to boil down the problem to a specific fragment.