Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b2a5bf79a4
Fetching contributors…

Cannot retrieve contributors at this time

361 lines (345 sloc) 10.794 kb
<?xml version="1.0"?>
<ruleset name="cdkinterfaces">
<description>
This ruleset checks for programming against implementations instead
of interfaces.
</description>
<rule name="MoleculeFieldType"
language="java"
message="Use the IMolecule interfaces instead of the Molecule implementation"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>2</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Type/ReferenceType/ClassOrInterfaceType[@Image='Molecule']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
Molecule mol = builder.newInstance(IMolecule.class);
// better:
// IMolecule mol = builder.newInstance(IMolecule.class);
]]>
</example>
</rule>
<rule name="AtomFieldType"
language="java"
message="Use the IAtom interfaces instead of the Atom implementation"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>2</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Type/ReferenceType/ClassOrInterfaceType[@Image='Atom']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
Atom mol = builder.newInstance(IAtom.class);
// better:
// IAtom mol = builder.newInstance(IAtom.class);
]]>
</example>
</rule>
<rule name="BondFieldType"
language="java"
message="Use the IBond interfaces instead of the Bond implementation"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>2</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//Type/ReferenceType/ClassOrInterfaceType[@Image='Bond']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
Bond mol = builder.newInstance(IBond.class);
// better:
// IBond mol = builder.newInstance(IBond.class);
]]>
</example>
</rule>
<rule name="InstanceOfMolecule"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='Molecule']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof Molecule) {}
// use instead:
// if (atomContainer instanceof IMolecule) {}
]]>
</example>
</rule>
<rule name="InstanceOfAtom"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='Atom']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof Atom) {}
// use instead:
// if (atomContainer instanceof IAtom) {}
]]>
</example>
</rule>
<rule name="InstanceOfPseudoAtom"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='PseudoAtom']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof PseudoAtom) {}
// use instead:
// if (atomContainer instanceof IPseudoAtom) {}
]]>
</example>
</rule>
<rule name="InstanceOfBond"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='Bond']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof Bond) {}
// use instead:
// if (atomContainer instanceof IBond) {}
]]>
</example>
</rule>
<rule name="InstanceOfLonePair"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='LonePair']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof LonePair) {}
// use instead:
// if (atomContainer instanceof ILonePair) {}
]]>
</example>
</rule>
<rule name="InstanceOfSingleElectron"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='SingleElectron']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof SingleElectron) {}
// use instead:
// if (atomContainer instanceof ISingleElectron) {}
]]>
</example>
</rule>
<rule name="InstanceOfIsotope"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='Isotope']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof Isotope) {}
// use instead:
// if (atomContainer instanceof IIsotope) {}
]]>
</example>
</rule>
<rule name="InstanceOfAtomType"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='AtomType']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof AtomType) {}
// use instead:
// if (atomContainer instanceof IAtomType) {}
]]>
</example>
</rule>
<rule name="InstanceOfElement"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='Element']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof Element) {}
// use instead:
// if (atomContainer instanceof IElement) {}
]]>
</example>
</rule>
<rule name="InstanceOfAtomContainer"
language="java"
message="Use instanceof against interfaces not implementations"
class="net.sourceforge.pmd.rules.XPathRule">
<description>
Programming against the CDK interfaces allows users to pick their favorite
implementation (nonotify, datadebug).
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//InstanceOfExpression/Type/ReferenceType/ClassOrInterfaceType[@Image='AtomContainer']
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
if (atomContainer instanceof AtomContainer) {}
// use instead:
// if (atomContainer instanceof IAtomContainer) {}
]]>
</example>
</rule>
</ruleset>
Jump to Line
Something went wrong with that request. Please try again.