|
| 1 | +<!-- Add the following to any file that is to be validated against this DTD: |
| 2 | + |
| 3 | +<!DOCTYPE import-control PUBLIC |
| 4 | + "-//Checkstyle//DTD ImportControl Configuration 1.4//EN" |
| 5 | + "https://checkstyle.org/dtds/import_control_1_4.dtd"> |
| 6 | +--> |
| 7 | + |
| 8 | +<!-- |
| 9 | + The root element of the configuration file. |
| 10 | +--> |
| 11 | +<!ELEMENT import-control ((allow|disallow)*,(subpackage|file)*)> |
| 12 | + |
| 13 | +<!-- |
| 14 | + pkg - The root package to be checked. For example "com.puppycrawl". |
| 15 | + |
| 16 | + regex - Root package name has to be interpreted as |
| 17 | + regular expression. |
| 18 | + |
| 19 | + strategyOnMismatch - Strategy in a case if matching allow/disallow rule |
| 20 | + was not found. Possible values: allowed, disallowed. |
| 21 | + If not defined explicitly, has "disallowed" value by default. |
| 22 | +--> |
| 23 | +<!ATTLIST import-control |
| 24 | + pkg CDATA #REQUIRED |
| 25 | + strategyOnMismatch (allowed|disallowed) #IMPLIED |
| 26 | + regex (true) #IMPLIED> |
| 27 | + |
| 28 | +<!-- |
| 29 | + Represents a subpackage of the parent element. |
| 30 | +--> |
| 31 | +<!ELEMENT subpackage ((allow|disallow)*,(subpackage|file)*)> |
| 32 | + |
| 33 | +<!-- |
| 34 | + name - The name of the subpackage. For example if the name is "tools" |
| 35 | + and the parent is "com.puppycrawl", then it corresponds to the |
| 36 | + package "com.puppycrawl.tools". If the regex attribute is "true" the |
| 37 | + name is interpreted as a regular expression. |
| 38 | + |
| 39 | + regex - Subpackage name has to be interpreted as |
| 40 | + regular expression. |
| 41 | + |
| 42 | + strategyOnMismatch - Strategy in a case if matching allow/disallow rule |
| 43 | + was not found. Possible values: allowed, disallowed, delegateToParent. |
| 44 | + If not defined explicitly, has "delegateToParent" value by default. |
| 45 | +--> |
| 46 | +<!ATTLIST subpackage |
| 47 | + name CDATA #REQUIRED |
| 48 | + strategyOnMismatch (delegateToParent|allowed|disallowed) #IMPLIED |
| 49 | + regex (true) #IMPLIED> |
| 50 | + |
| 51 | +<!-- |
| 52 | + Represents a file of the parent element. |
| 53 | +--> |
| 54 | +<!ELEMENT file (allow|disallow)*> |
| 55 | + |
| 56 | +<!-- |
| 57 | + name - The name of the file. |
| 58 | + If the regex attribute is "true" the name is interpreted as a regular expression. |
| 59 | + |
| 60 | + regex - File name has to be interpreted as regular expression. |
| 61 | +--> |
| 62 | +<!ATTLIST file |
| 63 | + name CDATA #REQUIRED |
| 64 | + regex (true) #IMPLIED> |
| 65 | + |
| 66 | +<!-- |
| 67 | + Represents attributes for an import rule which can either allow or |
| 68 | + disallow access. |
| 69 | + |
| 70 | + pkg - The fully qualified name of the package to allow/disallow. |
| 71 | + Cannot be specified in conjunction with "class". |
| 72 | + |
| 73 | + class - The fully qualified name of the class to allow/disallow. |
| 74 | + Cannot be specified in conjunction with "pkg". |
| 75 | + |
| 76 | + exact-match - Only valid with "pkg". Specifies whether the package |
| 77 | + name matching should be exact. For example, the pkg |
| 78 | + "com.puppycrawl.tools" will match the import |
| 79 | + "com.puppycrawl.tools.checkstyle.api.*" when the option is not set, |
| 80 | + but will not match if the option is set. |
| 81 | + |
| 82 | + local-only - Indicates that the rule is to apply only to the current |
| 83 | + package and not to subpackages. |
| 84 | + |
| 85 | + regex - Indicates that the class or package name has to be interpreted as |
| 86 | + regular expression. |
| 87 | +--> |
| 88 | +<!ENTITY % attlist.importrule " |
| 89 | + pkg CDATA #IMPLIED |
| 90 | + exact-match (true) #IMPLIED |
| 91 | + class CDATA #IMPLIED |
| 92 | + local-only (true) #IMPLIED |
| 93 | + regex (true) #IMPLIED"> |
| 94 | + |
| 95 | +<!-- |
| 96 | + Represents an import rule that will allow access. |
| 97 | +--> |
| 98 | +<!ELEMENT allow EMPTY> |
| 99 | +<!ATTLIST allow |
| 100 | + %attlist.importrule;> |
| 101 | + |
| 102 | +<!-- |
| 103 | + Represents an import rule that will disallow access. |
| 104 | +--> |
| 105 | +<!ELEMENT disallow EMPTY> |
| 106 | +<!ATTLIST disallow |
| 107 | + %attlist.importrule;> |
0 commit comments