We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
getModuleConfigsByIds
Identified at checkstyle/checkstyle#11585 ,
$ cat TestClass.java import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_ALONE; import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_BREAK_BEFORE; import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_SAME; import org.junit.jupiter.api.Test; import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; public class TestClass extends AbstractGoogleModuleTestSupport { private static final String[] MODULES = new String[] { "RightCurlySame", "RightCurlyAlone" }; @Override protected String getPackageLocation() { return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; } @Test public void testRightCurlyAlone() throws Exception { final String[] expected = { "20:17: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 17), "32:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), "79:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_BREAK_BEFORE, "}", 27), "97:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), "108:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), }; final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); // violation final String filePath = getPath("InputRightCurlyOther.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(checkConfig, filePath, expected, warnList); } } $ cat TestConfig.xml <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> <module name="Checker"> <property name="charset" value="UTF-8"/> <module name="TreeWalker"> <module name="com.github.sevntu.checkstyle.checks.design.CheckstyleTestMakeupCheck" /> </module> </module> $ java -jar checkstyle-9.1-sevntu-1.40.0-all.jar -c TestConfig.xml TestClass.java Starting audit... [ERROR] TestClass.java:33:41: DefaultConfiguration was not assigned by an allowed create configuration method. [CheckstyleTestMakeup] Audit done. Checkstyle ends with 1 errors.
No violations should be printed.
The text was updated successfully, but these errors were encountered:
I am holding off on approving for some of test restructuring to be merged to come back and see if parts of the test code can be made a bit simpler.
Sorry, something went wrong.
A new version will be coming to the main repo. I made a simplified: final Configuration checkConfig = getModuleConfigById(MODULES);
final Configuration checkConfig = getModuleConfigById(MODULES);
We should just add getModuleConfigById as an approved method.
getModuleConfigById
No branches or pull requests
Identified at checkstyle/checkstyle#11585 ,
No violations should be printed.
The text was updated successfully, but these errors were encountered: