use of com.cflint.config.CFLintConfiguration in project CFLint by cflint.
the class TestArrayNewChecker method setUp.
@Before
public void setUp() throws Exception {
final CFLintConfiguration conf = CFLintConfig.createDefaultLimited("ArrayNewChecker");
cfBugs = new CFLint(conf);
}
use of com.cflint.config.CFLintConfiguration in project CFLint by cflint.
the class CFLint method scan.
public void scan(final File folderOrFile) {
if (getBugs().getFileFilter() != null && !getBugs().getFileFilter().includeFile(folderOrFile)) {
return;
}
if (folderOrFile.isDirectory()) {
final CFLintConfiguration saveConfig = configuration;
try {
for (final File file : folderOrFile.listFiles()) {
if (file.getName().toLowerCase().startsWith(".cflintrc")) {
try {
System.out.println("read config " + file);
CFLintConfiguration newConfig = file.getName().toLowerCase().endsWith(".xml") ? ConfigUtils.unmarshal(new FileInputStream(file), CFLintConfig.class) : ConfigUtils.unmarshalJson(new FileInputStream(file), CFLintConfig.class);
configuration = new CFLintChainedConfig(newConfig, configuration);
} catch (Exception e) {
System.err.println("Could not read config file " + file);
}
}
}
for (final File file : folderOrFile.listFiles()) {
scan(file);
}
} finally {
configuration = saveConfig;
}
} else if (!folderOrFile.isHidden() && FileUtil.checkExtension(folderOrFile, allowedExtensions)) {
final String src = FileUtil.loadFile(folderOrFile);
try {
process(src, folderOrFile.getAbsolutePath());
} catch (final Exception e) {
printException(e);
if (logError) {
System.out.println("Logging Error: " + FILE_ERROR);
fireCFLintException(e, FILE_ERROR, folderOrFile.getAbsolutePath(), null, null, null, null);
}
}
}
}
Aggregations