Repository: redpen-cc/redpen (java)

Issue:
Document validators should be located under `cc.redpen.validator.document`
Just like `section` or `sentence` validators, validators overriding `validate(Document document)` should be located under `cc.redpen.validator.document`.

Currently, some validators (e.g. `FrequentSentenceStartValidator`) are located under `cc.redpen.validator.section`.

Pull request:
move package of document validators which closes #769
I'm worried that this PR is unacceptable because the PR brings backward incompatibility.

Patch:
diff --git a/redpen-core/src/main/java/cc/redpen/validator/section/FrequentSentenceStartValidator.java b/redpen-core/src/main/java/cc/redpen/validator/document/FrequentSentenceStartValidator.java
similarity index 98%
rename from redpen-core/src/main/java/cc/redpen/validator/section/FrequentSentenceStartValidator.java
rename to redpen-core/src/main/java/cc/redpen/validator/document/FrequentSentenceStartValidator.java
index 4f348b3d..de7cda33 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/section/FrequentSentenceStartValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/document/FrequentSentenceStartValidator.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.model.Document;
 import cc.redpen.model.Paragraph;
@@ -80,4 +80,4 @@ public class FrequentSentenceStartValidator extends Validator {
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/redpen-core/src/main/java/cc/redpen/validator/section/GappedSectionValidator.java b/redpen-core/src/main/java/cc/redpen/validator/document/GappedSectionValidator.java
similarity index 97%
rename from redpen-core/src/main/java/cc/redpen/validator/section/GappedSectionValidator.java
rename to redpen-core/src/main/java/cc/redpen/validator/document/GappedSectionValidator.java
index b95bcf74..168e15f9 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/section/GappedSectionValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/document/GappedSectionValidator.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.model.Paragraph;
 import cc.redpen.model.Document;
diff --git a/redpen-core/src/main/java/cc/redpen/validator/section/UnexpandedAcronymValidator.java b/redpen-core/src/main/java/cc/redpen/validator/document/UnexpandedAcronymValidator.java
similarity index 99%
rename from redpen-core/src/main/java/cc/redpen/validator/section/UnexpandedAcronymValidator.java
rename to redpen-core/src/main/java/cc/redpen/validator/document/UnexpandedAcronymValidator.java
index ccb6f8af..3be5edfc 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/section/UnexpandedAcronymValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/document/UnexpandedAcronymValidator.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.RedPenException;
 import cc.redpen.model.Document;
diff --git a/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java b/redpen-core/src/main/java/cc/redpen/validator/document/WordFrequencyValidator.java
similarity index 99%
rename from redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java
rename to redpen-core/src/main/java/cc/redpen/validator/document/WordFrequencyValidator.java
index 5a568f62..a64fb2d4 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/document/WordFrequencyValidator.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.RedPenException;
 import cc.redpen.model.Document;
@@ -159,4 +159,4 @@ public class WordFrequencyValidator extends SpellingDictionaryValidator {
             });
         }
     }
-}
\ No newline at end of file
+}
diff --git a/redpen-core/src/main/java/cc/redpen/validator/document/package-info.java b/redpen-core/src/main/java/cc/redpen/validator/document/package-info.java
new file mode 100644
index 00000000..470b44e0
--- /dev/null
+++ b/redpen-core/src/main/java/cc/redpen/validator/document/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * DocumentValidators are provided.
+ */
+package cc.redpen.validator.document;
diff --git a/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages.properties b/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages.properties
new file mode 100644
index 00000000..b87f848a
--- /dev/null
+++ b/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages.properties
@@ -0,0 +1,4 @@
+UnexpandedAcronymValidator.UnexpandedAcronym=The expanded form of the acronym {0} is not present in the document.
+FrequentSentenceStartValidator.SentenceStartTooFrequent={0}% of sentences start with "{1}".
+WordFrequencyValidator.WordUsedTooFrequently=The word "{0}" comprises {1}% of all words. Expected around {2}%.
+GappedSectionValidator=The section "{0}" (level {1}) is misplaced. It should have level of {2}.
diff --git a/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages_ja.properties b/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages_ja.properties
new file mode 100644
index 00000000..e874f4a5
--- /dev/null
+++ b/redpen-core/src/main/resources/cc/redpen/validator/document/error-messages_ja.properties
@@ -0,0 +1,1 @@
+GappedSectionValidator=\u7BC0 "{0}" \uFF08\u30EC\u30D9\u30EB {1}\uFF09\u306E\u914D\u7F6E\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u30EC\u30D9\u30EB {2} \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
diff --git a/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages.properties b/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages.properties
index 8271e886..46b18f98 100644
--- a/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages.properties
+++ b/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages.properties
@@ -2,10 +2,6 @@ SectionLengthValidator=The number of characters in the section ({0}) exceeds the
 ParagraphNumberValidator=The number of paragraphs exceeds the maximum of {0}.
 ParagraphStartWithValidator=Found invalid beginning of paragraph "{0}".
 DuplicatedSectionValidator=Found duplicated section (starts from line {0}).
-UnexpandedAcronymValidator.UnexpandedAcronym=The expanded form of the acronym {0} is not present in the document.
-FrequentSentenceStartValidator.SentenceStartTooFrequent={0}% of sentences start with "{1}".
-WordFrequencyValidator.WordUsedTooFrequently=The word "{0}" comprises {1}% of all words. Expected around {2}%.
 SectionLevelValidator=The section "{0}" is too deep.
 VoidSectionValidator=The section is void.
 EmptySectionValidator=The section "{0}" is empty.
-GappedSectionValidator=The section "{0}" (level {1}) is misplaced. It should have level of {2}.
diff --git a/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages_ja.properties b/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages_ja.properties
index afc10edc..4e02fdc1 100644
--- a/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages_ja.properties
+++ b/redpen-core/src/main/resources/cc/redpen/validator/section/error-messages_ja.properties
@@ -5,4 +5,3 @@ DuplicatedSectionValidator=\u985E\u4F3C\u3059\u308B\u7BC0\uFF08"{0}"\u884C\u76EE
 SectionLevelValidator=\u7BC0"{0}"\u306E\u30EC\u30D9\u30EB\u304C\u6DF1\u3059\u304E\u307E\u3059
 VoidSectionValidator=\u7BC0\u306E\u5185\u5BB9\u304C\u7A7A\u3067\u3059\u3002
 EmptySectionValidator=\u7BC0 "{0}" \u306B\u4E2D\u8EAB\u304C\u3042\u308A\u307E\u305B\u3093\u3002
-GappedSectionValidator=\u7BC0 "{0}" \uFF08\u30EC\u30D9\u30EB {1}\uFF09\u306E\u914D\u7F6E\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u30EC\u30D9\u30EB {2} \u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002


Test patch:
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/document/FrequentSentenceStartValidatorTest.java
similarity index 98%
rename from redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java
rename to redpen-core/src/test/java/cc/redpen/validator/document/FrequentSentenceStartValidatorTest.java
index 3b7abb1c..24270da9 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/document/FrequentSentenceStartValidatorTest.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.RedPenException;
 import cc.redpen.model.Document;
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/GappedSectionValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/document/GappedSectionValidatorTest.java
similarity index 91%
rename from redpen-core/src/test/java/cc/redpen/validator/section/GappedSectionValidatorTest.java
rename to redpen-core/src/test/java/cc/redpen/validator/document/GappedSectionValidatorTest.java
index c8155167..d5095ca1 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/GappedSectionValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/document/GappedSectionValidatorTest.java
@@ -15,16 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
-import cc.redpen.RedPenException;
-import cc.redpen.config.Configuration;
-import cc.redpen.config.ValidatorConfiguration;
 import cc.redpen.model.Document;
-import cc.redpen.model.Section;
-import cc.redpen.model.Sentence;
 import cc.redpen.validator.ValidationError;
-import org.junit.Before;
 import org.junit.Test;
 
 import java.util.ArrayList;
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/document/UnexpandedAcronymValidatorTest.java
similarity index 99%
rename from redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java
rename to redpen-core/src/test/java/cc/redpen/validator/document/UnexpandedAcronymValidatorTest.java
index a170603a..3bf4837d 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/document/UnexpandedAcronymValidatorTest.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.RedPenException;
 import cc.redpen.config.Configuration;
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/document/WordFrequencyValidatorTest.java
similarity index 99%
rename from redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java
rename to redpen-core/src/test/java/cc/redpen/validator/document/WordFrequencyValidatorTest.java
index b0f1fded..eaec5a40 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/document/WordFrequencyValidatorTest.java
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package cc.redpen.validator.section;
+package cc.redpen.validator.document;
 
 import cc.redpen.RedPenException;
 import cc.redpen.config.Configuration;