Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for file path in Inline Config Parser #10725

Closed
shashwatj07 opened this issue Aug 25, 2021 · 0 comments · Fixed by #10727
Closed

Add support for file path in Inline Config Parser #10725

shashwatj07 opened this issue Aug 25, 2021 · 0 comments · Fixed by #10727

Comments

@shashwatj07
Copy link
Contributor

shashwatj07 commented Aug 25, 2021

This deals with Inline Config for 3 special cases:

  1. final DefaultConfiguration checkConfig = createModuleConfig(ImportControlCheck.class);
    checkConfig.addProperty("file", getPath("InputImportControlOne.xml"));

    For Inline Config, this will be dealt with:

file = (file)ABCD.xml

This resolves to the absolute system path to the resource which is different for Linux and Windows.
Example:

C:\checkstyle\src\test\resources\com\puppycrawl\tools\checkstyle\checks\imports\importcontrol\ABCD.xml

  1. final DefaultConfiguration checkConfig = createModuleConfig(ImportControlCheck.class);
    checkConfig.addProperty("file", getResourcePath("InputImportControlOne.xml"));

    For Inline Config, this will be dealt with:

file = (file)(resource)ABCD.xml

This resolves to the relative Linux style path from package root.
Example:

/com/puppycrawl/tools/checkstyle/checks/imports/importcontrol/ABCD.xml

  1. final DefaultConfiguration checkConfig = createModuleConfig(ImportControlCheck.class);
    checkConfig.addProperty("file", getUriString("InputImportControlOne.xml"));

    For Inline Config, this will be dealt with:

file = (file)(uri)ABCD.xml

This resolves to the URI String according to
Example:

file:/C:/checkstyle/src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/importcontrol/ABCD.xml

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

Successfully merging a pull request may close this issue.

2 participants