@Override public String toString() { return innerElement.toString(); }
@Override public String toString() { return innerElement.toString(); }
/** * Register any overrides from comment elements before functions/components. * * @param context * The current context. * @param commentElement * The CFML comment element */ protected void applyRuleOverrides(final Context context, final Element commentElement) { if (commentElement != null && CF.COMMENT.equals(commentElement.getName())) { final String mlText = commentElement.toString(); final Pattern pattern = Pattern.compile(".*\\s*@CFLintIgnore\\s+([\\w,_]+)\\s*.*", Pattern.DOTALL); final Matcher matcher = pattern.matcher(mlText); if (matcher.matches()) { final String ignoreCodes = matcher.group(1); context.ignore(Arrays.asList(ignoreCodes.split(",\\s*"))); } } }
/** * Register any overrides from comment elements before functions/components. * * @param context * The current context. * @param commentElement * The CFML comment element */ protected void applyRuleOverrides(final Context context, final Element commentElement) { if (commentElement != null && CF.COMMENT.equals(commentElement.getName())) { final String mlText = commentElement.toString(); final Pattern pattern = Pattern.compile(".*\\s*@CFLintIgnore\\s+([\\w,_]+)\\s*.*", Pattern.DOTALL); final Matcher matcher = pattern.matcher(mlText); if (matcher.matches()) { final String ignoreCodes = matcher.group(1); context.ignore(Arrays.asList(ignoreCodes.split(",\\s*"))); } } }
if (prevSibling != null && prevSibling.getName().equals(CF.COMMENT)) { final Pattern p = Pattern.compile(".*---\\s*CFLINT-DISABLE\\s+(.*)\\s*---.*"); final Matcher m = p.matcher(prevSibling.toString().toUpperCase().trim()); if (m.matches()) {
if (prevSibling != null && prevSibling.getName().equals(CF.COMMENT)) { final Pattern p = Pattern.compile(".*---\\s*CFLINT-DISABLE\\s+(.*)\\s*---.*"); final Matcher m = p.matcher(prevSibling.toString().toUpperCase().trim()); if (m.matches()) {
/** * Determine the line numbers of the <!--- @CFLintIgnore CFQUERYPARAM_REQ ---> tags * Both the current and the next line are included. * * @param element the element object * @return the line numbers of any @@CFLintIgnore annotations. */ private List<Integer> determineIgnoreLines(final Element element) { final List<Integer> ignoreLines = new ArrayList<>(); for (Element comment : element.getChildElements()) { if ("!---".equals(comment.getName()) && comment.toString().contains("@CFLintIgnore") && comment.toString().contains("CFQUERYPARAM_REQ")) { int ignoreLine = comment.getSource().getRow(comment.getEnd()); ignoreLines.add(ignoreLine); ignoreLines.add(ignoreLine + 1); ignoreLines.add(comment.getSource().getRow(comment.getBegin())); } else { ignoreLines.addAll(determineIgnoreLines(comment)); } } return ignoreLines; }
/** * Determine the line numbers of the <!--- @CFLintIgnore CFQUERYPARAM_REQ ---> tags * Both the current and the next line are included. * * @param element the element object * @return the line numbers of any @@CFLintIgnore annotations. */ private List<Integer> determineIgnoreLines(final Element element) { final List<Integer> ignoreLines = new ArrayList<>(); for (Element comment : element.getChildElements()) { if ("!---".equals(comment.getName()) && comment.toString().contains("@CFLintIgnore") && comment.toString().contains("CFQUERYPARAM_REQ")) { int ignoreLine = comment.getSource().getRow(comment.getEnd()); ignoreLines.add(ignoreLine); ignoreLines.add(ignoreLine + 1); ignoreLines.add(comment.getSource().getRow(comment.getBegin())); } else { ignoreLines.addAll(determineIgnoreLines(comment)); } } return ignoreLines; }
@Override public void element(final Element element, final Context context, final BugList bugs) { if (element.getName().equals(CF.CFARGUMENT)) { final String name = element.getAttributeValue(CF.NAME) != null ? element.getAttributeValue(CF.NAME) : ""; ArgInfo argInfo = new ArgInfo(); argInfo.casedName=name; argInfo.argumentLineNo=context.startLine(); argInfo.argumentOffset=element.getAttributeValue(CF.NAME) != null ? element.getAttributes().get(CF.NAME).getValueSegment().getBegin() : element.getBegin(); argInfo.type=element.getAttributeValue(CF.TYPE); currentArgs.put(name.toLowerCase(), argInfo); final String code = element.getParentElement().toString(); if (isUsed(code, name.toLowerCase())) { argInfo.used=true; } } }
@Override public void element(final Element element, final Context context, final BugList bugs) { if (element.getName().equals(CF.CFARGUMENT)) { final String name = element.getAttributeValue(CF.NAME) != null ? element.getAttributeValue(CF.NAME) : ""; ArgInfo argInfo = new ArgInfo(); argInfo.casedName=name; argInfo.argumentLineNo=context.startLine(); argInfo.argumentOffset=element.getAttributeValue(CF.NAME) != null ? element.getAttributes().get(CF.NAME).getValueSegment().getBegin() : element.getBegin(); argInfo.type=element.getAttributeValue(CF.TYPE); currentArgs.put(name.toLowerCase(), argInfo); final String code = element.getParentElement().toString(); if (isUsed(code, name.toLowerCase())) { argInfo.used=true; } } }
visitor.visitElementStart(elem); if (elem.getName().equalsIgnoreCase("cfset") || elem.getName().equalsIgnoreCase("cfreturn")) { final String cfscript = elem.toString().substring(elem.getName().length() + 1, elem.toString().length() - 1).trim(); if (cfscript.length() > 0 && visitor.visitPreParseExpression("TAG", cfscript)) { final CFExpression expression = parseCFExpression(cfscript, visitor); final int uglyNotPos = elem.toString().lastIndexOf("<>"); int endPos = elem.getStartTag().getEnd() - 1; final int nextPos = elem.toString().indexOf(">", uglyNotPos + 2); if (nextPos > 0 && nextPos < elem.getEndTag().getBegin()) { endPos = nextPos; final String cfscript = elem.toString().substring(elem.getName().length() + 1, endPos); if (cfscript.length() > 0 && visitor.visitPreParseExpression("TAG", cfscript)) { final CFExpression expression = parseCFExpression(cfscript, visitor);
@Override public void element(final Element element, final Context context, final BugList bugs) { if (element.getName().equals(CF.CFARGUMENT)) { final String name = element.getAttributeValue(CF.NAME); final boolean required = CFTool.toBoolean(element.getAttributeValue(CF.REQUIRED)); final String defaultExpr = element.getAttributeValue(CF.DEFAULT); final String code = element.getParentElement().toString(); final boolean checked = isCheck(code, name); if (!required && defaultExpr == null && !checked) { element.getSource().getRow(element.getBegin()); element.getSource().getColumn(element.getBegin()); context.addMessage("ARG_DEFAULT_MISSING", name); } } }
@Override public void element(final Element element, final Context context, final BugList bugs) { if (element.getName().equals(CF.CFARGUMENT)) { final String name = element.getAttributeValue(CF.NAME); final boolean required = CFTool.toBoolean(element.getAttributeValue(CF.REQUIRED)); final String defaultExpr = element.getAttributeValue(CF.DEFAULT); final String code = element.getParentElement().toString(); final boolean checked = isCheck(code, name); if (!required && defaultExpr == null && !checked) { element.getSource().getRow(element.getBegin()); element.getSource().getColumn(element.getBegin()); context.addMessage("ARG_DEFAULT_MISSING", name); } } }
bldr.setExpression(((CFScriptStatement) expression).Decompile(0)); } else if (elem != null) { bldr.setExpression(elem.toString().replaceAll("\r\n", "\n"));
bldr.setExpression(((CFScriptStatement) expression).Decompile(0)); } else if (elem != null) { bldr.setExpression(elem.toString().replaceAll("\r\n", "\n"));