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

Feature Request?: Include Checkstyle Modules from other files #9188

Closed
lars-sh opened this issue Jan 16, 2021 · 2 comments
Closed

Feature Request?: Include Checkstyle Modules from other files #9188

lars-sh opened this issue Jan 16, 2021 · 2 comments

Comments

@lars-sh
Copy link

lars-sh commented Jan 16, 2021

I would like to define one checkstyle definition and use it for multiple projects. That's no problem. In addition I would like to allow defining additional rules per project.

In other words: I'd like to include/import project-specific checks into a checkstyle definition.

Is there an already existing functionality to accomplish that?
If not, please handle this as feature request.

Example Configuration of what I have in mind:
The following global configuration references two additional checkstyle definitions.

<module name="Checker">
	<module name="IncludeCheckstyleModule">
		<property name="single" value="false" />
		<property name="path" value="single-module.xml" />
	</module>
	
	<module name="TreeWalker">
		<module name="IncludeCheckstyleModule">
			<property name="path" value="multiple-modules.xml" />
		</module>
	</module>
</module>

The first is just a single module (the XML root) to be included:

<module name="NewlineAtEndOfFile">
	<property name="lineSeparator" value="lf" />
</module>

The second includes all the children of the XML root element. This is probably the more useful way.

<module>
	<module name="RightCurly" />
	<module name="FinalClass" />
</module>
@romani
Copy link
Member

romani commented Jan 19, 2021

you might want to have something like #991 (comment)
already existing feature of xml/dtd (attention that it is disabled by default due to security issue)

related discussions:
#6942
#2873

@lars-sh
Copy link
Author

lars-sh commented Feb 18, 2021

The mentioned idea is more or less a workaround, but I'm fine with it for now.
Many thanks for helping me out on this.

@lars-sh lars-sh closed this as completed Feb 18, 2021
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