[gnumeric] help: improve function doc sanity checks.



commit 34dfbb5c5dc3049c81255f3e71cbb224ddf8388e
Author: Morten Welinder <terra gnome org>
Date:   Sun Jun 13 17:27:53 2010 -0400

    help: improve function doc sanity checks.

 ChangeLog  |    5 +++++
 NEWS       |    1 +
 src/func.c |   36 +++++++++++++++++++++++++++++-------
 3 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2d84822..bd2ea0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-06-13  Morten Welinder  <terra gnome org>
 
+	* src/func.c (copy_hash_table_to_ptr_array): Don't test perl
+	samples.
+	(gnm_func_sanity_check1): Check for unwanted space after colon and
+	for unwanted period at end.
+
 	* src/wbc-gtk.c (cb_sheet_visibility_change): Set visibility of
 	both label and page.  Fixes #621463.
 
diff --git a/NEWS b/NEWS
index ca569d0..86f762a 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ Morten:
 	* SFTEST: improve extreme-case precision.
 	* Fix RANDLEVY.
 	* Fix hidden-sheet problem.  [#621463]
+	* Improve help text sanity checks.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.5
diff --git a/src/func.c b/src/func.c
index ab7b7f9..e17ad60 100644
--- a/src/func.c
+++ b/src/func.c
@@ -77,11 +77,19 @@ copy_hash_table_to_ptr_array (gpointer key, gpointer value, gpointer array)
 {
 	Symbol *sym = value;
 	GnmFunc *fd = sym->data;
-	if (sym->type == SYMBOL_FUNCTION && fd->name != NULL) {
-		gnm_func_load_if_stub ((GnmFunc *) fd);
-		if (fd->help != NULL)
-			g_ptr_array_add (array, fd);
-	}
+
+	if (sym->type != SYMBOL_FUNCTION)
+		return;
+
+	if (fd->name == NULL ||
+	    strcmp (fd->name, "perl_adder") == 0 ||
+	    strcmp (fd->name, "perl_date") == 0 ||
+	    strcmp (fd->name, "perl_sed") == 0)
+		return;
+
+	gnm_func_load_if_stub ((GnmFunc *) fd);
+	if (fd->help != NULL)
+		g_ptr_array_add (array, fd);
 }
 
 static int
@@ -505,15 +513,29 @@ gnm_func_sanity_check1 (GnmFunc const *fd)
 				g_printerr ("%s: Invalid NAME record\n",
 					    fd->name);
 				res = 1;
+			} else if (h->text[nlen + 1] == ' ') {
+				g_printerr ("%s: Unwanted space in NAME record\n",
+					    fd->name);
+				res = 1;
+			} else if (h->text[strlen (h->text) - 1] == '.') {
+				g_printerr ("%s: Unwanted period in NAME record\n",
+					    fd->name);
+				res = 1;
 			}
 			break;
-		case GNM_FUNC_HELP_ARG:
-			if (strchr (h->text, ':') == NULL) {
+		case GNM_FUNC_HELP_ARG: {
+			const char *aend = strchr (h->text, ':');
+			if (aend == NULL) {
 				g_printerr ("%s: Invalid ARG record\n",
 					    fd->name);
 				res = 1;
+			} else if (aend[1] == ' ') {
+				g_printerr ("%s: Unwanted space in ARG record\n",
+					    fd->name);
+				res = 1;
 			}
 			break;
+		}
 		case GNM_FUNC_HELP_EXAMPLES:
 			if (h->text[0] == '=') {
 #if 0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]