[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint.mk: catch "see @xref{}"
From: |
Jim Meyering |
Subject: |
Re: [PATCH] maint.mk: catch "see @xref{}" |
Date: |
Tue, 17 Apr 2012 09:43:27 +0200 |
Akim Demaille wrote:
> Hi Jim!
>
> Le 16 avr. 2012 à 23:03, Jim Meyering a écrit :
>
>> +2012-04-16 Akim Demaille <address@hidden>
>> + and Jim Meyering <address@hidden>
>
> Thanks for granting me, but I'm not even the "see" and
> the "@xref" that remain are from my hand :)
>
>> +see_also_re_ = (?:see(?:\s+also)?|also(?:\s+see)?)
>
> I don't see what it buys to have the second
> part. "also see @xref" is just a longer "see @xref",
> which is caught by the first one. With respect
> to "also @xref", if you think this is wrong (and
> I concur), then (?:also|see) should suffice.
>
>> +bad_xref_re_ ?= (?:[\w,:;] +|$(see_also_re_)\s+)address@hidden
>> +bad_pxref_re_ ?= (?:[.!?]|$(see_also_re_))address@hidden
>> prohibit_undesirable_word_seq_RE_ ?= \
>> - /\bcan\s+not\b/gims
>> + /(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
>> prohibit_undesirable_word_seq_ = \
>> -e 'while ($(prohibit_undesirable_word_seq_RE_))'
>> \
>> $(perl_filename_lineno_text_)
Good catch. Thanks!
Here's the delta I've just merged:
diff --git a/top/maint.mk b/top/maint.mk
index 7293129..1c7af03 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -933,13 +933,12 @@ sc_prohibit_doubled_word:
# "can not"; this matches them even when the two words appear on different
# lines, but not when there is an intervening delimiter like "#" or "*".
# Similarly undesirable, "See @xref{...}", since an @xref should start
-# a sentence. Explicitly prohibit any prefix that is a combination of
-# "see" and "also". Also prohibit a prefix matching "\w+ +".
+# a sentence. Explicitly prohibit any prefix of "see" or "also".
+# Also prohibit a prefix matching "\w+ +".
# @pxref gets the same see/also treatment and should be parenthesized;
# presume it must *not* start a sentence.
-see_also_re_ = (?:see(?:\s+also)?|also(?:\s+see)?)
-bad_xref_re_ ?= (?:[\w,:;] +|$(see_also_re_)\s+)address@hidden
-bad_pxref_re_ ?= (?:[.!?]|$(see_also_re_))address@hidden
+bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)address@hidden
+bad_pxref_re_ ?= (?:[.!?]|(?:see|also))address@hidden
prohibit_undesirable_word_seq_RE_ ?= \
/(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
prohibit_undesirable_word_seq_ = \
And here's the full patch:
>From 48056176f45bdbad1c95f8ce87d19ec8384bb623 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Mon, 16 Apr 2012 20:21:51 +0200
Subject: [PATCH] maint.mk: expand syntax-check rule to catch @xref and @pxref
abuse
* top/maint.mk (prohibit_undesirable_word_seq_RE_): An @xref{...}
should start a sentence and should not be preceded by "see",
"see also", etc. Add heuristic for @pxref too.
---
ChangeLog | 7 +++++++
top/maint.mk | 9 ++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index c08ba76..479c360 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-16 Akim Demaille <address@hidden>
+ and Jim Meyering <address@hidden>
+
+ maint.mk: catch "see @xref{}" and similar
+ * top/maint.mk (prohibit_undesirable_word_seq_RE_): Also
+ prohibit "See also @xref{", "Also see @pxref{", and similar.
+
2012-04-16 Jim Meyering <address@hidden>
bootstrap: really use gnulib's po/Makefile.in.in
diff --git a/top/maint.mk b/top/maint.mk
index 2228a37..1c7af03 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -932,8 +932,15 @@ sc_prohibit_doubled_word:
# A regular expression matching undesirable combinations of words like
# "can not"; this matches them even when the two words appear on different
# lines, but not when there is an intervening delimiter like "#" or "*".
+# Similarly undesirable, "See @xref{...}", since an @xref should start
+# a sentence. Explicitly prohibit any prefix of "see" or "also".
+# Also prohibit a prefix matching "\w+ +".
+# @pxref gets the same see/also treatment and should be parenthesized;
+# presume it must *not* start a sentence.
+bad_xref_re_ ?= (?:[\w,:;] +|(?:see|also)\s+)address@hidden
+bad_pxref_re_ ?= (?:[.!?]|(?:see|also))address@hidden
prohibit_undesirable_word_seq_RE_ ?= \
- /\bcan\s+not\b/gims
+ /(?:\bcan\s+not\b|$(bad_xref_re_)|$(bad_pxref_re_))/gims
prohibit_undesirable_word_seq_ = \
-e 'while ($(prohibit_undesirable_word_seq_RE_))' \
$(perl_filename_lineno_text_)
--
1.7.10.208.gb4267
- [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Eric Blake, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Jim Meyering, 2012/04/16
- Re: [PATCH] maint.mk: catch "see @xref{}", Akim Demaille, 2012/04/17
- Re: [PATCH] maint.mk: catch "see @xref{}",
Jim Meyering <=
- Re: [PATCH] maint.mk: catch "see @xref{}", Karl Berry, 2012/04/16