All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.plugins.CFLintScannerAdapter Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.plugins;

import java.util.HashMap;
import java.util.Map;

import com.cflint.BugList;

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.script.CFScriptStatement;
import net.htmlparser.jericho.Element;

/**
 * Lint Rule Plugins can extend this adapter instead of implementing all the methods of CFLintScanner
 *  (and CFLintStructureListener)
 * 
 * @author eberlyrh
 *
 */
public class CFLintScannerAdapter implements CFLintScanner,CFLintStructureListener {

	Map params = new HashMap();
	public CFLintScannerAdapter() {
		super();
	}

	public void expression(CFExpression expression, Context context, BugList bugs){}

	public void element(Element element, Context context, BugList bugs){}

	public void expression(CFScriptStatement expression, Context context, BugList bugs){}
	
	public void setParameter(String name, String value){
		if(name != null){
			params.put(name.toLowerCase(), value);
			params.put(name, value);
		}
	}

	public String getParameter(String name){
		if(name != null){
			return params.get(name.toLowerCase());
		}
		return null;
	}

	public int currentLine(final CFExpression expression, final Context context) {
		return expression.getLine() + context.startLine() - 1;
	}

	public Map getParams() {
		return params;
	}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void startFile(String fileName, BugList bugs) {}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void endFile(String fileName, BugList bugs) {}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void startComponent(Context context, BugList bugs) {}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void endComponent(Context context, BugList bugs) {}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void startFunction(Context context, BugList bugs) {}

	/**
	 * Default implementation does nothing
	 */
	@Override
	public void endFunction(Context context, BugList bugs) {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy