Bug 412514 - Have system to easily create validation rules for source code
Summary: Have system to easily create validation rules for source code
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-08 11:04 EDT by Maxence Vanbésien CLA
Modified: 2013-07-18 12:09 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxence Vanbésien CLA 2013-07-08 11:04:12 EDT
With the current API, it is not trivial to be able to create functional validation rules that are specific to a given context. (For instance, have a warning in a Catch block when empty or not a call to a logger when developing eclipse plugins).

Here, on one side, we have AST, and on the other one, we have API for defining markers.

The objective would be to combine the two to have an efficient framework to do so (as it is done for EMF validation, for instance).

A first implementation of such framework has been designed & hosted on GitHub: https://github.com/awltech/eclipse-ast-validation/wiki/Quick-Start-Guide

If you feel this is interesting, & if you need more information, feel free to comment the ticket, I'll be following it.

Maxence Vanbésien
Worldline
mvaawl@gmail.com
Comment 1 Stephan Herrmann CLA 2013-07-09 06:17:46 EDT
Thanks for letting us know about your work.

Before looking into your implementation here's a quick question:
Have you considered an approach based on a CompilationParticipant instead of a
separate builder? If you look at BuildContext & ReconcileContext there are methods
for attaching CategorizedProblem's. Those may not be perfectly convenient for your
purpose, I don't know. My feeling is that this approach could be more light-weight
than the builder-based approach.
Comment 2 Maxence Vanbésien CLA 2013-07-09 07:20:06 EDT
Hi Stephan, 

At first, thx for this quick feedback.
To be honest with you, I didn't know about such API around Compilation Units. I've browsed quickly the javadoc of the classes you mentioned, and I agree on the fact that it looks more integrated than the usage of builders, even though I don't see yet how to condition the execution per project (currently, you can choose whether to enable the feature on a specific project, by applying the builder or not.)

I prototype with the approach you propose & let you know.

Thx again, 

Maxence
mvaawl@gmail.com
Comment 3 Maxence Vanbésien CLA 2013-07-18 12:05:21 EDT
Hello Stephan, 

I had a quick look at the proposal you made, and it appears that we can use such participants.

I added the support of such in the implementation of the tool, but I kept the Builder-based implementation, for people who would like to execute the process in a more manual way.

When you are able to look into the source code, don't hesitate to come back to me for any information.

Thx for such judicious advice. ;)

Maxence Vanbésien
Worldline
mvaawl@gmail.com
Comment 4 Maxence Vanbésien CLA 2013-07-18 12:09:57 EDT
Sorry for double post, but I have one more general question.
More than the tool proposed here, we have some other that we also would like to submit to the Eclipse community, at least for review.

Is the creation of such tickets sufficient & relevant; or is there another dedicated process for submission of new projects ?

Thx, 

Maxence
Worldline
mvaawl@gmail.com