Search in sources :

Example 1 with ParameterNumberCheck

use of com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck in project checkstyle by checkstyle.

the class SuppressWarningsFilterTest method createChecker.

@Override
public Checker createChecker(Configuration checkConfig) throws Exception {
    final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration");
    final DefaultConfiguration checksConfig = createCheckConfig(TreeWalker.class);
    final DefaultConfiguration holderConfig = createCheckConfig(SuppressWarningsHolder.class);
    holderConfig.addAttribute("aliasList", "com.puppycrawl.tools.checkstyle.checks.sizes." + "ParameterNumberCheck=paramnum");
    checksConfig.addChild(holderConfig);
    final DefaultConfiguration memberNameCheckConfig = createCheckConfig(MemberNameCheck.class);
    memberNameCheckConfig.addAttribute("id", "ignore");
    checksConfig.addChild(memberNameCheckConfig);
    final DefaultConfiguration constantNameCheckConfig = createCheckConfig(ConstantNameCheck.class);
    constantNameCheckConfig.addAttribute("id", "");
    checksConfig.addChild(constantNameCheckConfig);
    checksConfig.addChild(createCheckConfig(ParameterNumberCheck.class));
    checksConfig.addChild(createCheckConfig(IllegalCatchCheck.class));
    final DefaultConfiguration uncommentedMainCheckConfig = createCheckConfig(UncommentedMainCheck.class);
    uncommentedMainCheckConfig.addAttribute("id", "ignore");
    checksConfig.addChild(uncommentedMainCheckConfig);
    checksConfig.addChild(createCheckConfig(JavadocTypeCheck.class));
    checkerConfig.addChild(checksConfig);
    if (checkConfig != null) {
        checkerConfig.addChild(checkConfig);
    }
    final Checker checker = new Checker();
    final Locale locale = Locale.ROOT;
    checker.setLocaleCountry(locale.getCountry());
    checker.setLocaleLanguage(locale.getLanguage());
    checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
    checker.configure(checkerConfig);
    checker.addListener(new BriefUtLogger(stream));
    return checker;
}
Also used : Locale(java.util.Locale) JavadocTypeCheck(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck) Checker(com.puppycrawl.tools.checkstyle.Checker) ParameterNumberCheck(com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck) DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) BriefUtLogger(com.puppycrawl.tools.checkstyle.BriefUtLogger) IllegalCatchCheck(com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck)

Aggregations

BriefUtLogger (com.puppycrawl.tools.checkstyle.BriefUtLogger)1 Checker (com.puppycrawl.tools.checkstyle.Checker)1 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)1 IllegalCatchCheck (com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck)1 JavadocTypeCheck (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck)1 ParameterNumberCheck (com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck)1 Locale (java.util.Locale)1