user2440872
user2440872

Reputation: 49

Does Checkstyle provide quickfix possibilities?

I implemented an extension plugin for checkstyle.

Now I have the task to add quickfixes for some checkstyle errors in eclipse.

Example: Add a final modifier if a class is public.

After several hours of research, I decided to ask this question in several forums because I won't be the only one with this wish/problem.

According to the documentation of checkstyle http://checkstyle.sourceforge.net/, the plugin does not provide quickfixes for own implemented checks.

I did some research but I found nothing about how to add quickfixes for own checks.

Now the question: Is there a way to implement own quickfixes for eclipse?

I'm using version 5.6 of the checkstyle API and Eclipse 4.2.

Upvotes: 2

Views: 719

Answers (1)

Denim Datta
Denim Datta

Reputation: 3802

Refer to Extending the eclipse-cs plugin page.

From there you can download a sample Check.

The file is here under the name net.sf.eclipsecs.sample

In src\net\sf\eclipsecs\sample\checks there is one QuickFix Java code and in base directory, in plugin.xml the following line is present, which enables the quickfix.

    <!-- This plugin provides custom quickfixes for Checkstyle problems. -->
    <extension
          point="net.sf.eclipsecs.ui.checkstyleQuickfixProvider">
    </extension>

You can download and refer that sample for your query. Extending Check is described nicely there.

Upvotes: 2

Related Questions