Skip to content

Checkstyle and includes/excludes on Windows #97

Open

Description

@jodastephen

Using Eclipse Neon 4.6.1, m2e-code-quality 1.0.0.201608091842 and Eclipse-CS 7.2.0.201611082205, I cannot get the <includes> and <excludes> elements to work properly on Windows.

Looking at the code, it seems to route these via CheckstyleUtil in convertAntStylePatternToCheckstylePattern() (added here). This performs normalization based on the system's file separator, but as far as I can see, the Eclipse-CS plugin always uses forward slash. Weirdly, the test case looks like it would only work on Windows.

Based on my testing, if the converted form of the <includes> variable is not accepted by Eclipse-CS, the previous setting is retained. This can mask problems during testing.

This simple include does not work in m2e-code-quality, but does work on the command line:

<includes>com/opengamma/**</includes>

I suspect that what is happening is that the pattern is converted to com\opengamma\.*, but Eclipse-CS rejects it. The fix would probably be to normalize to forward slash in CheckstyleUtil.

The only workaround is as follows:

<includes>**/opengamma/**</includes>

which somehow manages to work in both Eclipse-CS and the command line. Note that I can find no workaround that matches com/opengamma, but fortunately I don't need that in this case.

Activity

  1. ArloL commented on Dec 1, 2016

    @ArloL
    Contributor

    Hi @jodastephen,

    thanks for taking the time to write this report. Since I have stopped using the plugin I am currently not really motivated to try and fix it myself. But I would love to help you fix it yourself if that is alright with you.

    Would you be able to test your assumption with the forward slash? Setting up a working development environment should be quite easy if you are familiar with the Eclipse Installer. m2e-code-quality is listed under the GitHub projects. Be sure to switch to the develop stream.

    image

  2. jodastephen commented on Jan 18, 2017

    @jodastephen
    ContributorAuthor

    Thanks for the reply. I spent two hours this morning trying to setup the environment, but got nowhere. Eclipse Oomph is a nice idea, but I've never actually got it to do anything useful. In this case once you've found the hidden setup page pictured above, the git repo won't clone. And if you try to install the project separately without Oomph, you get hundreds of errors. Unfortunately, I don't have the time or patience to spend trying to get an environment up and running to look into this issue further, sorry.

  3. ArloL commented on Jan 26, 2017

    @ArloL
    Contributor

    Thanks for trying and letting me know that there is a problem with oomph on Windows. I could reproduce your problem and will look into it.

  4. ArloL commented on Feb 21, 2017

    @ArloL
    Contributor

    Hi @jodastephen,

    I have looked into the problem and found a few issues with the setup. I have updated the steps in the README. If possible could you try these and see if it works for you? That would be really cool :) Thanks!

  5. crussellgh commented on Jul 4, 2017

    @crussellgh

    Hi,

    Is there any update on this issue? I see that there is a PR waiting with a possible fix.

  6. sellersj commented on Jul 25, 2017

    @sellersj

    Hi @ArloL

    Is there any plan to merge the referenced pull request?

  7. ArloL commented on Jul 26, 2017

    @ArloL
    Contributor

    Hi @crussellgh and @sellersj, I would love to merge the PR but someone has to actually test it. I have not looked at it in detail since like I described above

    I have stopped using the plugin I am currently not really motivated to try and fix it myself

    Understandably but sadly @jodastephen does not have the time to test his PR. If someone were willing to show that his proposed change actually works I am more than willing to merge.

  8. crussellgh commented on Aug 1, 2017

    @crussellgh

    Hi @ArloL,

    There is a quite a steep learning curve trying to get the plugin built, but I finally managed to build it in the end.

    I built the plugin with @jodastephen's changes using the Mars target (I wasn't able to get the Oxygen target to build due to missing features??) and tested it in Eclipse Oxygen.

    It fixes my problem and the generated sources in my target folder are now excluded properly by Checkstyle.

  9. ArloL commented on Aug 2, 2017

    @ArloL
    Contributor

    Hi @crussellgh,

    glad you got it working somehow. Please let me know if I can update the README in any way that would have helped you along the way. Like I said in a comment before I am more than willing to help you get the stuff working and then document that so that it becomes easier for newcomers over time. It takes me a lot of time to wrap my head around everything too. The project ownership was given to me without a lot of discussion so I am just trying to make the best of it! I am by no means an expert in building Eclipse extensions.

    Did you also try the Development environment instructions?

    I am assuming you tried it on a Windows machine?

  10. crussellgh commented on Aug 2, 2017

    @crussellgh

    Hi @ArloL,

    I followed the instructions for the most part.

    I wasn't able to get the targets to build using the Mars RCP/RAP version of Eclipse because it insisted on trying to fetch PMD from the old Sourceforge update site instead of the new one.

    Using Oxygen RCP/RAP Eclipse, it went to the correct PMD site. I am not that familiar with plugin development so I have no idea where the Mars IDE was picking up the old update site.

    The other stumbling block was it took me a bit to find the HTTPS anonymous option for the repo. You need to click a "Show other variables" checkbox and then it gives you the option to change it.

    For testing the plugin itself, I did an Export and created an update site so I could install the plugin into an Oxygen JEE install of Eclipse (I wasn't able to get the dropins folder to work).

    I did do the testing on a Windows machine. I don't have easy access to a Unix box here to try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions