Re: check the history source code comment
"caucabin caucabin" <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
@Oliver Burn
Thank you for your reply. If no this checker, i will create a checker
to check the comment that is a source code
My idea is :
I found the antlr( http://www.antlr.org/ , it is also used by
checkstyle ) is a java grammar parser, we can get the comment code and use
the antlr to parser it.
So the design is:
//because the antlr parser interface is java file, not the java Object
1.copy the java source code file to the system temp dir, and name is
tempcomment.java
2.get all comments in the source code
3.for(int i = 0 ; size = comments.size; i < size; i ++)
{
comment = comments[i];
// Maybe this operation is a performance issue for write the file
uncommit it in the tempcomment.java
boolean isjavacode = using the antlr to parse tempcomment.java ;
if(isjavacode )
{
add it to the check log
}
}
[ Show » <http://naboo.achievo.de:8080/browse/ATAG-26> ]
Robin Chen <http://naboo.achievo.de:8080/secure/ViewProfile.jspa?name=robc>
[2007-03-19 07:54:23 CET] The design is : //because the antlr parser
interface is java file, not the Object 1.copy the java source code to the
system temp dir, and name is tempcomment.java 2.get all comments in the
source code 3.for(int i = 0 ; size = comments.size; i < size; i ++) {
comment = comments[i]; // Maybe this operation is a performance issue for
write the file uncommit it in the tempcomment.java boolean isjavacode =
parse it in the antlr; if(isjavacode ) { add it in the check log } }
@*Srilakshmanan
*I think this is not the feature in CPD (copy and paste detector), because
it is a comment, and the CPD only check the source code.
Thanks
Robin
On 3/19/07, Oliver Burn <[email protected]> wrote:
>
> If you write your own custom Checkstyle check, anything is possible! :-)
>
> On 3/19/07, Srilakshmanan, Lakshman <[email protected]>
> wrote:
> >
> > Would it not be possible with a custom developed checkstyle check
> > module ?
> >
> >
> >
> >
> > http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-developed-checkstyle.html
> >
> >
> >
> >
> >
> > Thanks
> >
> > Lakshman
> > ------------------------------
> >
> > *From:* [email protected] [mailto:
> > [email protected]] * On Behalf Of *Oliver
> > Burn
> > *Sent:* Monday, 19 March 2007 5:10 PM
> > *To:* [email protected]
> > *Subject:* Re: [Checkstyle-user] check the history source code comment
> >
> >
> >
> > Ahh - in that case I still believe the answer is no.
> >
> > On 3/19/07, *Srilakshmanan, Lakshman* <[email protected]>
> > wrote:
> >
> > Hi,
> >
> >
> >
> > I believe caucabin was asking whether checkstyle could detect duplicate
> > code that are commented out. I believe what he is looking for will be the
> > feature in CPD (copy and paste detector) but to include line in comments as
> > well.
> >
> >
> >
> > Thanks
> >
> > Lakshman
> > ------------------------------
> >
> > *From:* [email protected] [mailto:[email protected]]
> > * On Behalf Of *Oliver Burn
> > *Sent:* Monday, 19 March 2007 4:58 PM
> > *To:* [email protected]
> > *Subject:* Re: [Checkstyle-user] check the history source code comment
> >
> >
> >
> > I am not sure I understand the question. If you are asking if Checkstyle
> > can check the the commented out code as if it was real code, the answer is
> > no.
> >
> > On 3/19/07, *caucabin caucabin* <[email protected]> wrote:
> >
> > In source code ,always see like this code:
> >
> >
> >
> > // int size = p_steps.size();
> > // for (int i = 0; i < size; i++)
> >
> > final int size = p_steps.size();
> > for (int i = 0; i < size; i++)
> >
> > The comment part is a history source code, we can get the history code
> > from the version control tool, and don't want to see it in the code. so if
> > have a checker to check this type comment?
> > could you give me some suggest ?
> >
> > Thanks
> >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > _______________________________________________
> > Checkstyle-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/checkstyle-user
> >
> >
> >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > _______________________________________________
> > Checkstyle-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/checkstyle-user
> >
> >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys-and earn cash
> >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Checkstyle-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/checkstyle-user
> >
> >
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user