Re: How to get value of a variable in SonarQube (custom-rules )?

61 views
Skip to first unread message
Message has been deleted

G. Ann Campbell

unread,
Apr 26, 2018, 8:33:01 AM4/26/18
to SonarQube
Hi,

Please don't cross-post here and on StackOverflow.


Ann

On Thursday, 26 April 2018 05:14:31 UTC-4, r.sher...@gmail.com wrote:
Hi,

I started working on sonar custom-rule recently so i am new to it. While programming was not able to access the "value" of a "variable".

e.g. Consider this simple example
// Input program file
public void myMethod()
{
String a = "Name";
                String b ="Address"
                myMethod2(b);
        }

How do i get the value and name of variable "a" and "b" for above example.

I have tried using LiteralTree but i am only able to get the value and using Identifier Tree i am only able to get the name of the identifier.
How do i get the name and the value of a variable/identifier?

Tibor Blenessy

unread,
Apr 26, 2018, 8:40:57 AM4/26/18
to G. Ann Campbell, SonarQube
I answered you on SonarQube 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/fa8b0850-d0bb-43f0-96f7-9df8d3a285ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Tibor Blenessy | SonarSource

Language Analyzer Developer

https://sonarsource.com 

Tibor Blenessy

unread,
Apr 26, 2018, 8:48:45 AM4/26/18
to G. Ann Campbell, SonarQube
I mean stackoverflow :)  
Reply all
Reply to author
Forward
0 new messages