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

Confiruration xml inclusion/import #6132

Closed
dzharikhin opened this issue Sep 29, 2018 · 4 comments
Closed

Confiruration xml inclusion/import #6132

dzharikhin opened this issue Sep 29, 2018 · 4 comments

Comments

@dzharikhin
Copy link

dzharikhin commented Sep 29, 2018

Let's assume we have several different projects supported by different teams inside one company.
There are common checkstyle rules for all, and there are specific cases per each project
If we had url http://checkstyle-repo/shared-config.xml, which provides something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!-- shared config -->
<module name="Checker">
    <module name="TreeWalker">
        <module name="MissingOverride"/>
        <module name="LineLength">
            <property name="max" value="120"/>
        </module>
    </module>
</module>

we could use something like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<import resource="http://checkstyle-repo/shared-config.xml" />
<module name="Checker">
    <module name="TreeWalker">
        <module name="AvoidStarImport"/>
        <module name="LineLength">
            <property name="max" value="150"/>
        </module>
    </module>
</module>

assuming the result

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
    <module name="TreeWalker">
        <module name="MissingOverride"/>
        <module name="AvoidStarImport"/>
        <module name="LineLength">
            <property name="max" value="150"/>
        </module>
    </module>
</module>

What is the point? if we decided to add new common check, we just change one file and provide it to all the consumers instead of editing each configuration

Are there any pitfalls on this feature?
If it's ok, I'm going to try to implement it.
Looks pretty easy - requires changes in ConfigLoader and DTD

p.s. I found no issues on subj, but if exists - I'm sorry

@rnveach
Copy link
Member

rnveach commented Sep 29, 2018

@dzharikhin We need more information on what you mean. I don't understand it at all. Please provide as many examples as you can.
Do you mean you want to extend/copy an existing XML in a new one?

@dzharikhin
Copy link
Author

Oh, sorry, I edited original description to be more clear, thanks

@dzharikhin dzharikhin changed the title Confiruration xml inclusion Confiruration xml inclusion/import Sep 29, 2018
@rnveach
Copy link
Member

rnveach commented Oct 2, 2018

@dzharikhin It sounds like you are talking about #2873 , creating inheritance for the configurations and possibly #991 , multiple configuration files.

@dzharikhin
Copy link
Author

yep, that's it! thanks! So, I'm gonna close the issue and move in those topics

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

No branches or pull requests

2 participants