Final updates for a beta release
This commit is contained in:
parent
507bfaff53
commit
b95ced53e3
|
|
@ -16,19 +16,19 @@
|
|||
<allow pkg="org.xml.sax"/>
|
||||
|
||||
<!-- The local ones -->
|
||||
<allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="selected"/>
|
||||
<allow class="java.security.MessageDigest" local-only="selected"/>
|
||||
<allow pkg="org.apache.commons.cli" local-only="selected"/>
|
||||
<allow pkg="org.apache.tools.ant" local-only="selected"/>
|
||||
<allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="true"/>
|
||||
<allow class="java.security.MessageDigest" local-only="true"/>
|
||||
<allow pkg="org.apache.commons.cli" local-only="true"/>
|
||||
<allow pkg="org.apache.tools.ant" local-only="true"/>
|
||||
|
||||
<subpackage name="api">
|
||||
<allow pkg="java.beans"/>
|
||||
<allow pkg="java.lang.reflect"/>
|
||||
<allow pkg="java.text"/>
|
||||
<allow class="com.puppycrawl.tools.checkstyle.grammars.CommentListener"
|
||||
local-only="selected"/>
|
||||
local-only="true"/>
|
||||
<allow class="com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaTokenTypes"
|
||||
local-only="selected"/>
|
||||
local-only="true"/>
|
||||
</subpackage>
|
||||
|
||||
<subpackage name="checks">
|
||||
|
|
|
|||
|
|
@ -1,25 +1,72 @@
|
|||
<?xml encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- Add the following to any file that is to be validated against this DTD:
|
||||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Import Control 1.0//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_0.dtd">
|
||||
-->
|
||||
|
||||
<!--
|
||||
The root element of the configuration file.
|
||||
-->
|
||||
<!ELEMENT import-control ((allow|disallow)*,subpackage*)>
|
||||
|
||||
<!--
|
||||
pkg - The root package to be checked. For example "com.puppycrawl".
|
||||
-->
|
||||
<!ATTLIST import-control
|
||||
pkg NMTOKEN #REQUIRED>
|
||||
pkg NMTOKEN #REQUIRED>
|
||||
|
||||
<!--
|
||||
Represents a subpackage of the parent element.
|
||||
-->
|
||||
<!ELEMENT subpackage ((allow|disallow)*,subpackage*)>
|
||||
|
||||
<!--
|
||||
name - The name of the subpackage. For example if the name is "tools"
|
||||
and the pa the parent is "com.puppycrawl", then it corresponds to the
|
||||
package "com.puppycrawl.tools".
|
||||
-->
|
||||
<!ATTLIST subpackage
|
||||
name NMTOKEN #REQUIRED>
|
||||
|
||||
<!--
|
||||
Represents attributes for a guard which can either allow or disallow
|
||||
access.
|
||||
|
||||
pkg - The fully qualified name of the package to guard. Cannot be
|
||||
specified in conjunction with "class".
|
||||
|
||||
class - The fully qualified name of the class to guard. Cannot be
|
||||
specified in conjunction with "pkg".
|
||||
|
||||
exact-match - Only valid with "pkg". Specifies whether the package
|
||||
name matching should be exact. For example, the pkg
|
||||
"com.puppycrawl.tools" will match the import
|
||||
"com.puppycrawl.tools.checkstyle.api.*" when the option is not set,
|
||||
but will not match is the option is set.
|
||||
|
||||
local-only - Indicates that the guard is to apply only to the current
|
||||
package and not to subpackages.
|
||||
|
||||
-->
|
||||
<!ENTITY % attlist.guard "
|
||||
pkg NMTOKEN #IMPLIED
|
||||
exact-match (selected) #IMPLIED
|
||||
exact-match (true) #IMPLIED
|
||||
class NMTOKEN #IMPLIED
|
||||
local-only (selected) #IMPLIED">
|
||||
local-only (true) #IMPLIED">
|
||||
|
||||
<!--
|
||||
Represents a guard that will allow access.
|
||||
-->
|
||||
<!ELEMENT allow EMPTY>
|
||||
<!ATTLIST allow
|
||||
%attlist.guard;>
|
||||
|
||||
<!--
|
||||
Represents a guard that will disallow access.
|
||||
-->
|
||||
<!ELEMENT disallow EMPTY>
|
||||
<!ATTLIST disallow
|
||||
%attlist.guard;>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
<import-control pkg="com">
|
||||
<allow class="some.class"/>
|
||||
<disallow class="another.class" local-only="selected"/>
|
||||
<disallow class="another.class" local-only="true"/>
|
||||
<allow pkg="some.pkg"/>
|
||||
<disallow pkg="another.pkg" local-only="selected"/>
|
||||
<disallow pkg="and.another.pkg" exact-match="selected"/>
|
||||
<disallow pkg="another.pkg" local-only="true"/>
|
||||
<disallow pkg="and.another.pkg" exact-match="true"/>
|
||||
<subpackage name="puppycrawl">
|
||||
<disallow pkg="some.pkg"/>
|
||||
<disallow class="some.class"/>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<allow class="java.awt.Image"/>
|
||||
<allow class="java.awt.Button.ABORT"/>
|
||||
<allow class="java.io.File" local-only="selected"/>
|
||||
<allow class="java.io.File" local-only="true"/>
|
||||
<subpackage name="imports">
|
||||
<allow pkg="javax.swing"/>
|
||||
</subpackage>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<allow class="java.awt.Image"/>
|
||||
<allow class="java.io.File" local-only="selected"/>
|
||||
<allow class="java.io.File" local-only="true"/>
|
||||
<subpackage name="imports">
|
||||
<disallow class="java.awt.Image" local-only="selected"/>
|
||||
<allow pkg="javax.swing" exact-match="selected"/>
|
||||
<allow pkg="java.io" exact-match="selected" local-only="selected"/>
|
||||
<disallow class="java.awt.Image" local-only="true"/>
|
||||
<allow pkg="javax.swing" exact-match="true"/>
|
||||
<allow pkg="java.io" exact-match="true" local-only="true"/>
|
||||
</subpackage>
|
||||
</import-control>
|
||||
|
|
|
|||
|
|
@ -313,39 +313,17 @@
|
|||
<section name="ImportControl">
|
||||
<subsection name="Description">
|
||||
<p>
|
||||
Check that controls what packages can be imported in each
|
||||
package. Useful for ensuring that application layering rules
|
||||
are not violated, especially on large projects.
|
||||
Controls what can be imported in each package. Useful for
|
||||
ensuring that application layering rules are not violated,
|
||||
especially on large projects.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The following DTD is for a import control XML document.
|
||||
The DTD for a import control XML document is at <a
|
||||
href="http://www.puppycrawl.com/dtds/import_control_1_0.dtd">http://www.puppycrawl.com/dtds/import_control_1_0.dtd</a>. It
|
||||
contains documentation on each of the elements and attributes.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!ELEMENT import-control ((allow|disallow)*,subpackage*)>
|
||||
|
||||
<!ATTLIST import-control
|
||||
pkg NMTOKEN #REQUIRED>
|
||||
|
||||
<!ELEMENT subpackage ((allow|disallow)*,subpackage*)>
|
||||
|
||||
<!ATTLIST subpackage
|
||||
name NMTOKEN #REQUIRED>
|
||||
|
||||
<!ELEMENT allow EMPTY>
|
||||
|
||||
<!ATTLIST allow
|
||||
pkg NMTOKEN #REQUIRED>
|
||||
|
||||
<!ELEMENT disallow EMPTY>
|
||||
|
||||
<!ATTLIST disallow
|
||||
pkg NMTOKEN #REQUIRED>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The check validates a XML document when it loads the document.
|
||||
To validate against the above DTD, include the following
|
||||
|
|
@ -391,9 +369,9 @@
|
|||
</source>
|
||||
|
||||
<p>
|
||||
For an example import control file, look at the file called
|
||||
"import-control.xml" which is part of the Checkstyle
|
||||
distribution.
|
||||
For an example import control file, look at the file called <a
|
||||
href="http://cvs.sourceforge.net/viewcvs.py/checkstyle/checkstyle/import-control.xml?view=markup">import-control.xml</a>
|
||||
which is part of the Checkstyle distribution.
|
||||
</p>
|
||||
</subsection>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue