本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.SeverityLevel.IGNORE属性的典型用法代码示例。如果您正苦于以下问题:Java SeverityLevel.IGNORE属性的具体用法?Java SeverityLevel.IGNORE怎么用?Java SeverityLevel.IGNORE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.SeverityLevel
的用法示例。
在下文中一共展示了SeverityLevel.IGNORE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endElement
@Override
public void endElement(String uri,
String localName,
String qName) throws SAXException {
if (qName.equals(MODULE)) {
final Configuration recentModule =
configStack.pop();
// get severity attribute if it exists
SeverityLevel level = null;
if (containsAttribute(recentModule, SEVERITY)) {
try {
final String severity = recentModule.getAttribute(SEVERITY);
level = SeverityLevel.getInstance(severity);
}
catch (final CheckstyleException ex) {
// [email protected][IllegalInstantiation] SAXException is in the overridden
// method signature
throw new SAXException(
"Problem during accessing '" + SEVERITY + "' attribute for "
+ recentModule.getName(), ex);
}
}
// omit this module if these should be omitted and the module
// has the severity 'ignore'
final boolean omitModule = omitIgnoredModules
&& level == SeverityLevel.IGNORE;
if (omitModule && !configStack.isEmpty()) {
final DefaultConfiguration parentModule =
configStack.peek();
parentModule.removeChild(recentModule);
}
}
}
示例2: addError
@Override
public void addError(AuditEvent event) {
if (event.getSeverityLevel() != SeverityLevel.IGNORE) {
final String fileName = event.getFileName();
if (fileName == null || !fileMessages.containsKey(fileName)) {
synchronized (writerLock) {
writeFileError(event);
}
}
else {
final FileMessages messages = fileMessages.get(fileName);
messages.addError(event);
}
}
}
示例3: addError
/**
* Print an Emacs compliant line on the error stream.
* If the column number is non zero, then also display it.
* @see AuditListener
**/
@Override
public void addError(AuditEvent event) {
final SeverityLevel severityLevel = event.getSeverityLevel();
if (severityLevel != SeverityLevel.IGNORE) {
final String errorMessage = formatter.format(event);
errorWriter.println(errorMessage);
}
}
示例4: testAddIgnored
@Test
public void testAddIgnored() throws Exception {
final XMLLogger logger = new XMLLogger(outStream, true);
logger.auditStarted(null);
final LocalizedMessage message =
new LocalizedMessage(1, 1,
"messages.properties", "key", null, SeverityLevel.IGNORE, null,
getClass(), null);
final AuditEvent ev = new AuditEvent(this, "Test.java", message);
logger.addError(ev);
logger.auditFinished(null);
verifyXml(getPath("ExpectedXMLLoggerEmpty.xml"), outStream);
}
示例5: addError
@Override
public void addError(AuditEvent evt) {
if (evt.getSeverityLevel() != SeverityLevel.IGNORE) {
Metric metric = new Metric("checkstyle:" + evt.getSourceName());
Finding finding = new Finding(evt.getLine(), evt.getLine(), evt.getColumn(), evt.getColumn());
Long metricCount = metricCountExtractor.extractMetricCount(evt);
metrics.addFinding(metric, finding, metricCount);
}
}
示例6: endElement
@Override
public void endElement(String uri,
String localName,
String qName) throws SAXException {
if (qName.equals(MODULE)) {
final Configuration recentModule =
configStack.pop();
// get severity attribute if it exists
SeverityLevel level = null;
if (containsAttribute(recentModule, SEVERITY)) {
try {
final String severity = recentModule.getAttribute(SEVERITY);
level = SeverityLevel.getInstance(severity);
}
catch (final CheckstyleException ex) {
// [email protected][IllegalInstantiation] SAXException is in the overridden
// method signature
throw new SAXException(
"Problem during accessing '" + SEVERITY + "' attribute for "
+ recentModule.getName(), ex);
}
}
// omit this module if these should be omitted and the module
// has the severity 'ignore'
final boolean omitModule = omitIgnoredModules
&& level == SeverityLevel.IGNORE;
if (omitModule && !configStack.isEmpty()) {
final DefaultConfiguration parentModule =
configStack.peek();
parentModule.removeChild(recentModule);
}
}
}