Update default values to match 50/72 rule The 50/72 rule was laid out by tpope in 2008 (see www.tpope.net/node/106), and has gained wide acceptance in the git community. It makes sense to enforce it by default, since the values are configurable anyway. Change-Id: I472ddbd2caf7cd1036f8ce2953380445bca8712a
diff --git a/src/main/java/com/googlesource/gerrit/plugins/validators/CommitMessageLengthValidation.java b/src/main/java/com/googlesource/gerrit/plugins/validators/CommitMessageLengthValidation.java index 18f83eb..0a7070f 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/validators/CommitMessageLengthValidation.java +++ b/src/main/java/com/googlesource/gerrit/plugins/validators/CommitMessageLengthValidation.java
@@ -30,8 +30,8 @@ @Listen @Singleton public class CommitMessageLengthValidation implements CommitValidationListener { - private static final int DEFAULT_MAX_SUBJECT_LENGTH = 65; - private static final int DEFAULT_MAX_LINE_LENGTH = 70; + private static final int DEFAULT_MAX_SUBJECT_LENGTH = 50; + private static final int DEFAULT_MAX_LINE_LENGTH = 72; private static final int DEFAULT_LONG_LINES_THRESHOLD = 33; private static final boolean DEFAULT_REJECT_TOO_LONG = false; private static final String COMMIT_MESSAGE_SECTION = "commitmessage";
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md index b33ce93..51e7cd4 100644 --- a/src/main/resources/Documentation/config.md +++ b/src/main/resources/Documentation/config.md
@@ -3,14 +3,18 @@ The maximum lengths of the subject and message body can be configured in the standard Gerrit config file `gerrit.config`. +The defaults are 50 characters for the summary and 72 characters +for the description, as recommended by the +[git tutorial](https://kernel.googlesource.com/pub/scm/git/git/+/927a503cd07718ea0f700052043f383253904a56/Documentation/tutorial.txt#64) +and [expanded upon by Tim Pope](http://www.tpope.net/node/106). commitmessage.maxSubjectLength : Maximum length of the commit message's subject line. Defaults - to 65 if not specified or less than 0. + to 50 if not specified or less than 0. commitmessage.maxLineLength : Maximum length of a line in the commit message's body. Defaults - to 70 if not specified or less than 0. + to 72 if not specified or less than 0. commitmessage.longLinesThreshold : Percentage of commit message lines allowed to exceed the