1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

- extracted example from real checkers

This commit is contained in:
Alena Laskavaia 2010-03-18 14:33:13 +00:00
parent 5cc82d793a
commit bad558e232
9 changed files with 142 additions and 15 deletions

View file

@ -62,19 +62,6 @@
id="org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"
name="Suggested parenthesis around expression">
</problem>
</checker>
<checker
class="org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker"
id="org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker"
name="NamingConventionFunctionChecker">
<problem
category="org.eclipse.cdt.codan.core.categories.CodeStyle"
defaultEnabled="false"
defaultSeverity="Info"
id="org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionProblem"
messagePattern="Bad function name &quot;{0}&quot; (pattern /{1}/)"
name="Name convention for function">
</problem>
</checker>
</extension>
</plugin>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.codan.examples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Thu Mar 18 10:08:06 EDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Code Analysis Checker Examples
Bundle-SymbolicName: org.eclipse.cdt.codan.examples;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.examples.Activator
Bundle-Vendor: CDT
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.codan.core.cxx;bundle-version="1.0.0",
org.eclipse.cdt.codan.core;bundle-version="1.0.0",
org.eclipse.cdt.core;bundle-version="5.2.0",
org.eclipse.core.resources;bundle-version="3.6.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.cdt.codan.core.checkers"
id="org.eclipse.cdt.codan.core.internal.checkers">
<checker
class="org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionChecker"
id="org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionChecker"
name="NamingConventionFunctionChecker">
<problem
category="org.eclipse.cdt.codan.core.categories.CodeStyle"
defaultEnabled="false"
defaultSeverity="Info"
id="org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"
messagePattern="Bad function name &quot;{0}&quot; (pattern /{1}/)"
name="Name convention for function">
</problem>
</checker>
</extension>
</plugin>

View file

@ -0,0 +1,50 @@
package org.eclipse.cdt.codan.examples;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.codan.examples"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View file

@ -8,7 +8,7 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
package org.eclipse.cdt.codan.examples.checkers;
import java.util.regex.Pattern;
@ -30,7 +30,7 @@ public class NamingConventionFunctionChecker extends AbstractCIndexChecker
implements ICheckerWithParameters {
private static final String DEFAULT_PATTERN = "^[a-z]"; // name starts with english lowercase letter //$NON-NLS-1$
public static final String PARAM_KEY = "pattern"; //$NON-NLS-1$
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$
private static final String ER_ID = "org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$
/*
* (non-Javadoc)