当前位置: 首页>>代码示例>>Java>>正文


Java SeverityLevel.IGNORE属性代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:37,代码来源:ConfigurationLoader.java

示例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);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:15,代码来源:XMLLogger.java

示例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);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:DefaultLogger.java

示例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);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:XMLLoggerTest.java

示例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);
  }
}
 
开发者ID:reflectoring,项目名称:coderadar,代码行数:9,代码来源:CoderadarAuditListener.java

示例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);
        }
    }
}
 
开发者ID:checkstyle,项目名称:checkstyle,代码行数:36,代码来源:ConfigurationLoader.java


注:本文中的com.puppycrawl.tools.checkstyle.api.SeverityLevel.IGNORE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。