diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-07-05 16:40:34 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2016-09-23 12:22:15 +0000 |
commit | 7b5437939280b0788b4caa4a83f9193cfe8f97e7 (patch) | |
tree | f17f86d9dfa88b9cada7a0708e52f3d5f0855d60 /git-hooks | |
parent | 471da8d402b5d7b5cf3a1d95b29e06edfd141699 (diff) |
Do not complain about 2 trailing spaces in md files
Markdown uses two trailing spaces for non-paragraph line breaks.
Change-Id: Ib5330fbd9cd4718a45afa62966be46c55a9db338
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/sanitize-commit | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index 93fd6f7..3c8222e 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -537,6 +537,7 @@ my $in_plus; my $conflict_fail; my $tabs_check; my $ws_check; +my $allow_2spaces; my $tsv_check; my $eof_check; my $ctlkw_check; @@ -609,6 +610,9 @@ while (<DIFF>) { if ($tsv_check) { styleFail("Mixing spaces with TABs") if (/^ +\t|\t +/); } else { + if ($allow_2spaces) { + s/(?<=\S) (?=\r?\n$)//; + } styleFail("Trailing whitespace") if (s/[ \t]+\r?\n$//); styleFail("Space indent followed by a TAB character") if (/^ +\t/); styleFail("TAB character in non-leading whitespace") if (/\S *\t/); @@ -665,6 +669,7 @@ while (<DIFF>) { $ws_check = !defined($cfg{style}) && !$foreign && ($file !~ /\.(ts|diff|patch)$|^\.gitmodules$/); $tsv_check = $ws_check && ($file =~ /((^|\/)objects\.map$|\.tsv$)/); $tabs_check = $ws_check && !$tsv_check && !defined($cfg{tabs}) && ($file !~ /((^|\/)Makefile\b|debian[.\/]rules|\.(plist(\.[^.\/]+)?|def|spec|changes|[xn]ib|storyboardc?|go)(?:\.in)?$)/); + $allow_2spaces = $ws_check && ($file =~ /\.md$/); $ctlkw_check = $tabs_check && $clike; $eof_check = !$is_bin && ($file !~ /\.plist(\.[^.\/]+)?$/); # Xcode consistently forgets the trailing newline # .ts files usually contain languages other than English |