[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sonar-dev
Subject:    Re: [sonar-dev] Abstract syntax tree (AST)
From:       Miriam_Luján_Mares <mlujan () excentia ! es>
Date:       2012-05-28 14:03:48
Message-ID: CALxkyiYReSLOG9Q5Z-zNfietvr7VEpP-U_ARw+-jP+5EDkWjAA () mail ! gmail ! com
[Download RAW message or body]

Hi Freddy,
Thank you very much for your help. I am sorry because I did not explain a
lot of thinks but I only want to obtain information about source code to
calculate new metrics. For example, I want the number of methods of a
measured class that overrriden methods from a base class. For this reason,
I want to obtain the AST.
Thank you.

Regards,

 M=EDriam

2012/5/24 Freddy Mallet <freddy.mallet@gmail.com>

> Ok Miriam, so I won't get a more detail answer to my question but never
> mind :)
>
> From a Sonar plugin you can't currently access to the AST used to analyse
> java, C#, Cobol, C, ... source files. Some of those plugins allows to plu=
g
> some homemade rules but from those rules you can only log some violations
> and so you can't for instance feed a new metric.
>
> Which means that your plugin must embed its own parsers. On java side, yo=
u
> can use the Antlr checkstyle grammar which is also currently used by the
> Java Squid plugin :
> https://github.com/SonarSource/sonar/tree/master/plugins/sonar-squid-java=
-plugin
>
> Kind regards,
> Freddy
> -----
> twitter.com/FreddyMallet
> Sonar for Continuous Inspection
>
>
>
> On Thu, May 24, 2012 at 9:15 AM, Miriam Luj=E1n Mares <mlujan@excentia.es=
>wrote:
>
>> Hi Freddy,
>> I want to calculate a new metric. I need to parse the source code. If a
>> AST were calculated I could use it.
>> Therefore, I want an abstract syntax tree (AST) of the source code. I
>> want to know if the AST is available after the execution of the Squid
>> plugin and where is.
>>
>> Thank you and regards.
>>
>>  M=EDriam
>>
>>
>> 2012/5/23 Freddy Mallet <freddy.mallet@gmail.com>
>>
>>> Hi Miriam,
>>>
>>> You're already talking about a solution but what's your root need ? :)
>>>
>>> Kind regards,
>>> Freddy
>>> -----
>>> twitter.com/FreddyMallet
>>> Sonar for Continuous Inspection
>>>
>>>
>>>
>>> On Tue, May 22, 2012 at 5:29 PM, Miriam Luj=E1n Mares <mlujan@excentia.=
es>wrote:
>>>
>>>> Hi,
>>>>
>>>> I have been looking Squid plugin because I want an abstract syntax tre=
e
>>>> (AST) of the source code. I think that you save sonar metrics with the
>>>> information of the AST. I want to know if the AST is available after t=
he
>>>> execution of the Squid plugin.
>>>> Therefore, I have two options:
>>>>
>>>>  - If Ast exists my question is: how can I obtain the data?
>>>>  - Otherwise: How could I parse the source code again to obtain a new
>>>> AST?
>>>>
>>>> Regards.
>>>>
>>>>  M=EDriam
>>>>
>>>
>>>
>>
>

[Attachment #3 (text/html)]

Hi Freddy,<br>Thank you very much for your help. I am sorry because I 
did not explain a lot of thinks but I only want to obtain information 
about source code to calculate new metrics. For example, I want the 
number of methods of a measured class that overrriden methods from a 
base class. For this reason, I want to obtain the AST.<br>
Thank you.<br><br>Regards, <br><br> Míriam<br><br><div class="gmail_quote">2012/5/24 \
Freddy Mallet <span dir="ltr">&lt;<a href="mailto:freddy.mallet@gmail.com" \
target="_blank">freddy.mallet@gmail.com</a>&gt;</span><br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Ok Miriam, so I won&#39;t get a more detail answer to my \
question but never mind :)<div><br></div><div>From a Sonar plugin you can&#39;t \
currently access to the AST used to analyse java, C#, Cobol, C, ... source files. \
Some of those plugins allows to plug some homemade rules but from those rules you can \
only log some violations and so you can&#39;t for instance feed a new metric. </div>

<div><br></div><div>Which means that your plugin must embed its own parsers. On java \
side, you can use the Antlr checkstyle grammar which is also currently used by the \
Java Squid plugin : <a \
href="https://github.com/SonarSource/sonar/tree/master/plugins/sonar-squid-java-plugin" \
target="_blank">https://github.com/SonarSource/sonar/tree/master/plugins/sonar-squid-java-plugin</a></div>


<div><br></div><div>Kind regards,</div><div><div class="im">Freddy<br \
clear="all"><div><span \
style="font-size:13px;font-family:arial,sans-serif">-----</span></div><div><a \
href="https://twitter.com/FreddyMallet" style="font-family:arial,sans-serif" \
target="_blank">twitter.com/FreddyMallet</a></div>

<div><span style>Sonar for Continuous Inspection</span></div><br>
<br><br></div><div><div class="h5"><div class="gmail_quote">On Thu, May 24, 2012 at \
9:15 AM, Miriam Luján Mares <span dir="ltr">&lt;<a href="mailto:mlujan@excentia.es" \
target="_blank">mlujan@excentia.es</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Hi <span>Freddy, <br>I want to calculate a new metric. I \
need to parse the source code. If a AST were calculated I could use it.<br>Therefore, \
I want </span>an abstract  syntax tree (AST) of the source code. I want to know if \
the AST is  available after the execution of the Squid plugin and where \
is.<br><br>Thank you and regards.<br><br> Míriam<div><div><br><br><div \
class="gmail_quote">2012/5/23 Freddy Mallet <span dir="ltr">&lt;<a \
href="mailto:freddy.mallet@gmail.com" \
target="_blank">freddy.mallet@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Hi Miriam,<br><br>You&#39;re already talking about a solution \
but what&#39;s your root need ? :)<br><br>Kind regards,<br>


Freddy<br clear="all"><div><span \
style="font-size:13px;font-family:arial,sans-serif">-----</span></div> <div><a \
href="https://twitter.com/FreddyMallet" style="font-family:arial,sans-serif" \
target="_blank">twitter.com/FreddyMallet</a></div><div><span>Sonar for Continuous \
Inspection</span></div><div><div>

<br>
<br><br><div class="gmail_quote">On Tue, May 22, 2012 at 5:29 PM, Miriam Luján Mares \
<span dir="ltr">&lt;<a href="mailto:mlujan@excentia.es" \
target="_blank">mlujan@excentia.es</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">



Hi, <br><br>I have been looking Squid plugin because I want an abstract 
syntax tree (AST) of the source code. I think that you save sonar 
metrics with the information of the AST. I want to know if the AST is 
available after the execution of the Squid plugin. <br>
Therefore, I have two options:<br><br> - If Ast exists my question is: how can I \
obtain the data?<br> - Otherwise: How could I parse the source code again to obtain a \
new AST?<br><br>Regards.<br><br> Míriam<br> </blockquote></div><br><div></div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic