Thanks for this very cool contribution. I'm planning to start working again on adding Groovy as new language in a few weeks, I'll be sure of applying your patch then.
If you are "git" fluent, please feel free to simply fork our github repo and push your changes there:
I'm reviewing your patch - I cannot thank you again, this a great contribution. So far, so good, but I've stumbled upon a couple of copyrights claims which make me a bit queasy:
2006-05-17 - Matthias Hendler - added
Is this Matthias Hendler OK for you to release this code ? Do he needs to be credited for it also ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oh, an other question: as for as I see your support for PSQL should work for both CPD and PMD - but there is no example rule, nor any unit test... Would you mind providing those ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was the person who reversed engineered the .jjt file from the .jj files: Albert Tumanov is the project manager but I have not been in contact with him in over a year.
Unit Test
CPD
I cobbled an example together for the pldoc-cpd site (currently hosting the PLSQLLanguage code and using pmd-5.0.0- pldoc-cpd also reads code from the database) http://pldoc.sourceforge.net/maven-site/pldoc-cpd/
My normal PLDoc test is to point it at the test files and then an Oracle database: how big a test suite do you want?
PMD
I will have to think of a rule and will need a guidance on how to create one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
LGPL, hum, might be messy with our BSD style licensing :)
If you can, I suggest you place BSD header on all your classes, and add any contributor as author of the class. Send an email to any of them, informing them of your move and change of licence, asking them if they are OK with it. I don't expect any fuzz about that, and we should be legally covered.
Regarding unit test, a simple test should be enough, just to check the integration is working fine.
As an idea for a rule, I would suggest define a very simple rule that check that the prefix of table should, dunno, 'wp_' (like wordpress. The XPAth rule should be very easy to write and the SQL code to test will be "CREATE TABLE 'name_with_noprefix'.
Oh, btw, you should update the designer code to allow writing rule for PSQL. It should be quite easy and it will help you to write the rule :)
Again, I thank you for this great contribution - it will definitely be the "star feature" of the next release :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unit test for existing code (at the same level as the Ruby Language) added.
Integrating PLSQL into the main PMD code seems to require a parser that implements the Visitor pattern: this has been done and works for CPD-GUI, and Viewer: this code is not yet committed.
I have written to the PLDoc project manager asking him to address your concerns about licensing and copyright.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm must admit I'vers lost track on the work of this support for PSQL. Where do we stand on this feature ? Did we finaly clarify the licensing issue ? What about this pldoc dependency issue ? (Ie what can I do to help ? : ) )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I left it with the PLDoc owner - basically to release the .jjt file under BSD licence. I will chase him up tonight (CC'ed in).
As far as I recall, the last time that we spoke, I had CPD working (possibly with a Visitor-based parser). That was pretty robust as I ran it against the PLDoc test scripts and the system schemas of an Oracle database.
Technically, I got XML Rules to run last month, (PLSQLDesigner) DFA to process without dying horribly last week and got a couple of the simpler Java based rules to work last night.
I was going to look at checking the other interesting codesize rules (Cyclomatic Complexity, NPath etc.) tonight.
Problems Encountered:
Multiple PLSQL equivalents for Java's ASTClassOrInterface and ASTMethodDeclaration classes - coded against a trivial interface to work around it.
Getting the Scope working - I resorted to generating a state diagram for the different syntax elements.
Outstanding:
Search is still case sensitive - PLSQL is by default not case sensitive, defaulting unquoted names to upper case.
No junit test cases.
Performance - there is a lot of java.util.logging in the plagiarised code
Code is basically stolen from the Java language classes, then hacked to (hopefully) work.
I would appreciate a sanity check for my approach to coping with different languages : as a rule of thumb, I attempted to replace any net.sourceforge.pmd.lang.java classes in a top-level class (PMD,Designer, etc.) with an abstract class or an interface in net.sourceforge.pmd.lang.ast.
[
I also found bgastviewer invaluable, as it allowed me to examine the generated AST , whilst PLSQLDesigner was in pieces.
The top level class was kept separate (as PLSQLDesigner) so that I could minimise changes to Java-language classes before I had a working version.
]
I'm must admit I'vers lost track on the work of this support for PSQL. Where do we stand on this feature ? Did we finaly clarify the licensing issue ? What about this pldoc dependency issue ? (Ie what can I do to help ? : ) )
patches:274 PLSQL Language for PMD
Status: open
Labels: pmd
Created: Sat Jul 21, 2012 10:38 PM UTC by Stuart Turton
Last Updated: Sun Oct 07, 2012 01:34 PM UTC
Owner: Romain PELISSE
Add support for Oracle PLSQL - AST derived from PLDoc 1.3.2
PLSQL Language classes for PMD
Amended PMD classes to add PLSQL support
Patch generated as-of trunk 2012-07-21
Hi,
Thanks for this very cool contribution. I'm planning to start working again on adding Groovy as new language in a few weeks, I'll be sure of applying your patch then.
If you are "git" fluent, please feel free to simply fork our github repo and push your changes there:
https://github.com/pmd/pmd
(it will certainly speed up the patch acceptance process)
Thanks again !
I am incompetent in servera SCM
pmd forked, cloned locally, updated with the patch, staged, and committed.
Pull request created - "PMD-3546925 PLSQL Language for PMD"
Make that " i.. ncompetent in several SCM ..."
For the original jjtree file: see http://java.net/jira/browse/JAVACC-253
Hi Stuart,
I'm reviewing your patch - I cannot thank you again, this a great contribution. So far, so good, but I've stumbled upon a couple of copyrights claims which make me a bit queasy:
Is this Matthias Hendler OK for you to release this code ? Do he needs to be credited for it also ?
Oh, an other question: as for as I see your support for PSQL should work for both CPD and PMD - but there is no example rule, nor any unit test... Would you mind providing those ?
Copyright
The AST is derived from pldoc.sourceforge.net which is published under LGPL
http://pldoc.sourceforge.net/maven-site/license.html
I was the person who reversed engineered the .jjt file from the .jj files: Albert Tumanov is the project manager but I have not been in contact with him in over a year.
None of the other people on this page still contribute to the project: http://pldoc.sourceforge.net/maven-site/team-list.html
I presumed that the normal maven generated dependencies pages would be adequate: http://pldoc.sourceforge.net/maven-site/pldoc-cpd/dependencies.html
Unit Test
CPD
I cobbled an example together for the pldoc-cpd site (currently hosting the PLSQLLanguage code and using pmd-5.0.0- pldoc-cpd also reads code from the database)
http://pldoc.sourceforge.net/maven-site/pldoc-cpd/
My normal PLDoc test is to point it at the test files and then an Oracle database: how big a test suite do you want?
PMD
I will have to think of a rule and will need a guidance on how to create one.
Hi Stuart,
LGPL, hum, might be messy with our BSD style licensing :)
If you can, I suggest you place BSD header on all your classes, and add any contributor as author of the class. Send an email to any of them, informing them of your move and change of licence, asking them if they are OK with it. I don't expect any fuzz about that, and we should be legally covered.
Regarding unit test, a simple test should be enough, just to check the integration is working fine.
As an idea for a rule, I would suggest define a very simple rule that check that the prefix of table should, dunno, 'wp_' (like wordpress. The XPAth rule should be very easy to write and the SQL code to test will be "CREATE TABLE 'name_with_noprefix'.
Oh, btw, you should update the designer code to allow writing rule for PSQL. It should be quite easy and it will help you to write the rule :)
Again, I thank you for this great contribution - it will definitely be the "star feature" of the next release :)
Unit test for existing code (at the same level as the Ruby Language) added.
Integrating PLSQL into the main PMD code seems to require a parser that implements the Visitor pattern: this has been done and works for CPD-GUI, and Viewer: this code is not yet committed.
I have written to the PLDoc project manager asking him to address your concerns about licensing and copyright.
Hi all,
I'm must admit I'vers lost track on the work of this support for PSQL. Where do we stand on this feature ? Did we finaly clarify the licensing issue ? What about this pldoc dependency issue ? (Ie what can I do to help ? : ) )
I left it with the PLDoc owner - basically to release the .jjt file under BSD licence. I will chase him up tonight (CC'ed in).
As far as I recall, the last time that we spoke, I had CPD working (possibly with a Visitor-based parser). That was pretty robust as I ran it against the PLDoc test scripts and the system schemas of an Oracle database.
Technically, I got XML Rules to run last month, (PLSQLDesigner) DFA to process without dying horribly last week and got a couple of the simpler Java based rules to work last night.
I was going to look at checking the other interesting codesize rules (Cyclomatic Complexity, NPath etc.) tonight.
Problems Encountered:
Multiple PLSQL equivalents for Java's ASTClassOrInterface and ASTMethodDeclaration classes - coded against a trivial interface to work around it.
Getting the Scope working - I resorted to generating a state diagram for the different syntax elements.
Outstanding:
Search is still case sensitive - PLSQL is by default not case sensitive, defaulting unquoted names to upper case.
No junit test cases.
Performance - there is a lot of java.util.logging in the plagiarised code
Code is basically stolen from the Java language classes, then hacked to (hopefully) work.
I would appreciate a sanity check for my approach to coping with different languages : as a rule of thumb, I attempted to replace any net.sourceforge.pmd.lang.java classes in a top-level class (PMD,Designer, etc.) with an abstract class or an interface in net.sourceforge.pmd.lang.ast.
[
I also found bgastviewer invaluable, as it allowed me to examine the generated AST , whilst PLSQLDesigner was in pieces.
The top level class was kept separate (as PLSQLDesigner) so that I could minimise changes to Java-language classes before I had a working version.
]
More later ...
Sent from the road
On 15 Nov 2012, at 08:42, "Romain PELISSE" rpelisse@users.sf.net wrote:
It looks like this sf.net patch was merged as https://github.com/pmd/pmd/commit/1cdbc0ca0a63617aa343ccbe62922ea4a7000b24
and can be closed.
Yes, this has been merged into main PMD with version 5.1.0.