Skip to content

createChecker() should have an option to set user defined checker properties.  #13392

@Vyom-Yadav

Description

@Vyom-Yadav

protected final Checker createChecker(Configuration moduleConfig)
throws Exception {
final String name = moduleConfig.getName();
return createChecker(moduleConfig, findModuleCreationOption(name));
}

final Configuration config = createRootConfig(moduleConfig);
checker.configure(config);

Usual flow is:

final DefaultConfiguration checkConfig = createModuleConfig(RegexpHeaderCheck.class);                   
checkConfig.addProperty("headerFile", getPath("InputRegexpHeaderHead.header"));                         
Checker checker = createChecker(checkConfig);                                                           
checker.setCharset("US-ASCII");                                                                         

This causes a problem, AbstractHeaderCheck is already contextualized at createChecker and setting checker.setCharset("US-ASCII"); afterward just sets it for checker, and children modules are not contextualized.

This is really error-prone and should either be documented or fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions