use of net.htmlparser.jericho.Element in project CFLint by cflint.
the class CFLint method checkForDisabled.
/*
* Check for <!--- CFLINT-DISABLE ---> in the tag hierarchy
*/
protected boolean checkForDisabled(final Element element, final String msgcode) {
Element elem = element;
while (elem != null) {
final Element prevSibling = getPreviousSibling(elem);
if (prevSibling != null && prevSibling.getName().equals("!---")) {
final Pattern p = Pattern.compile(".*---\\s*CFLINT-DISABLE\\s+(.*)\\s*---.*");
final Matcher m = p.matcher(prevSibling.toString().toUpperCase().trim());
if (m.matches()) {
// No message codes in CFLINT-DISABLE
if (m.group(1).trim().length() == 0) {
if (verbose) {
System.out.println("Skipping disabled " + msgcode);
}
return true;
}
// check for matching message codes in CFLINT-DISABLE
for (String skipcode : m.group(1).split(",")) {
skipcode = skipcode.trim();
if (msgcode.equals(skipcode)) {
if (verbose) {
System.out.println("Skipping disabled " + msgcode);
}
return true;
}
}
}
}
elem = elem.getParentElement();
}
return false;
}
use of net.htmlparser.jericho.Element in project CFLint by cflint.
the class CFLint method processStack.
public void processStack(final List<Element> elements, final String space, final Context context) throws ParseException, IOException {
Element commentElement = null;
for (final Element elem : elements) {
if (elem.getName().equals("!---")) {
commentElement = elem;
} else {
final Context subContext = context.subContext(elem);
if (commentElement != null) {
applyRuleOverrides(subContext, commentElement);
commentElement = null;
}
process(elem, space, subContext);
}
}
}
Aggregations