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
support xml includes #10356
Comments
Can you review #3605 As some hacking on ENTITY is working for Android team. Be aware that it is disabled by default https://checkstyle.org/config_system_properties.html#Enable_External_DTD_load |
nope, same error and I copied their code. tasks.withType<Checkstyle>().configureEach {
configProperties = mapOf("checkstyle.enableExternalDtdLoad" to true)
isShowViolations = true
reports {
html.required.set(false)
xml.required.set(false)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2016 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<property name="severity" value="warning"/>
<property name="charset" value="UTF-8"/>
<module name="FileTabCharacter">
<property name="severity" value="error"/>
</module>
<module name="NewlineAtEndOfFile">
<property name="severity" value="error"/>
</module>
<module name="RegexpSingleline">
<property name="severity" value="error"/>
<property name="format" value="[ \t]+$"/>
<property name="message" value="Trailing whitespace"/>
</module> |
same error with 8.44 (just being sure) |
This remark did make it work for me. 👍 |
@vellotis, if you share minimalistic example it would be awesome. |
Sure. Files are in the same directory.
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd" [
<!ENTITY common SYSTEM "checkstyle-common.xml">
]>
<module name="Checker">
&common;
<module name="LineLength">
<property name="max" value="120"/>
</module>
</module>
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd" [
<!ENTITY common SYSTEM "checkstyle-common.xml">
]>
<module name="Checker">
&common;
<module name="LineLength">
<property name="max" value="140"/>
</module>
</module> So, now we have separate checkstyle configurations for main and test sources that reuse a common part of the XML. Build needs to be started with |
@vellotis , thanks a lot for example. Here is my mofigication of your example to be more reusable by CLI.
|
@xenoterracide , is this example resolve your issue ?
I am not sure how this works in general and is standard java xml parser support this. But I am ok extend our config loading to support some features in xml. But we need some guidance/help from community on this. |
Just to add to the conversation (don't have more knowledge), it seems Not saying some support can't be added, but just saying it comes with risk. |
I want includes to work.
both the
ENTITY
and thexi:include
would be nice. If it should work now, could you please add a howto to the documentation under configuration?I know there are security implications, I'm not certain if you can disable the truly remote while allowing local file imports. Maybe it's something that you could enable with the API, so it could become a setting for gradle/maven etc, pre-parsing.
How it works Now:
it doesn't, do you actually need me to run the checkstyle script?
Is your feature request related to a problem? Please describe.
it would be useful to be able to include additional files, this way I could, for example, have my
test.xml
includemain.xml
so I don't have to repeat myself for the majority of my config when I only need a few changesDescribe the solution you'd like
I do question if this is how this should work, I've got all of them at the root, but it's possible they should be the nested modules.
Additional context
override.xml
for adding overrides for just one moduletest.xml
main.xml
The text was updated successfully, but these errors were encountered: