asishs
(asish)
May 10, 2022, 9:58am
1
How to access Configuration from custom Java rule
such as
SensorContext context;
Configuration configuration;
@Override
public void visitMethod(MethodTree tree) {
boolean myFlag = configuration.getBoolean("myFlag").orElse(false);
context.reportIssue(this, tree, "some message");
super.visitMethod(tree);
}
Any code snippet will help to understand.
Quentin
(Quentin Jaquier)
May 13, 2022, 1:04pm
3
Hello @asishs
I don’t think it is currently possible, and in fact, I’m not sure it is the correct way to go. I would rather add a rule parameter to obtain such behavior.
Hope it helps.
Best,
Quentin
asishs
(asish)
May 16, 2022, 6:35am
5
Hi @Quentin ,
Yes, I have got it and successfully implemented.
Thank you.
system
(system)
Closed
May 23, 2022, 6:36am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.