[gobject-introspection] giscanner: make some warnings errors



commit 0af20939c8e2deaf1d1f06e069594d53acf65d2f
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Tue Aug 13 23:16:41 2013 +0200

    giscanner: make some warnings errors
    
    GTK-Doc comment block fixer tool will refuse to rewrite source
    files that generated errors (indicating a source->parse tree->source
    would result in information being lost), but will happily continue
    on warnings (which do not result in information being lost).

 giscanner/annotationparser.py                      |   46 ++++++++++----------
 tests/scanner/annotationparser/gi/identifier.xml   |    6 +-
 tests/scanner/annotationparser/gi/parameter.xml    |    4 +-
 tests/scanner/annotationparser/gi/tag.xml          |    2 +-
 .../scanner/annotationparser/gi/tag_deprecated.xml |    2 +-
 tests/scanner/annotationparser/gi/tag_returns.xml  |    6 +-
 tests/scanner/annotationparser/gi/tag_since.xml    |    2 +-
 .../scanner/annotationparser/gi/tag_stability.xml  |    2 +-
 8 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 45b2e66..e37fbe8 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -1119,9 +1119,9 @@ class GtkDocCommentBlockParser(object):
             try:
                 comment_block = self.parse_comment_block(comment, filename, lineno)
             except Exception:
-                warn('unrecoverable parse error, please file a GObject-Introspection '
-                     'bug report including the complete comment block at the '
-                     'indicated location.', Position(filename, lineno))
+                error('unrecoverable parse error, please file a GObject-Introspection bug'
+                      'report including the complete comment block at the indicated location.',
+                      Position(filename, lineno))
                 continue
 
             if comment_block is not None:
@@ -1325,9 +1325,9 @@ class GtkDocCommentBlockParser(object):
                     if not identifier_warned:
                         identifier_warned = True
                         marker = ' ' * column_offset + '^'
-                        warn('identifier not found on the first line:\n%s\n%s' %
-                             (original_line, marker),
-                             position)
+                        error('identifier not found on the first line:\n%s\n%s' %
+                              (original_line, marker),
+                              position)
                 continue
 
             ####################################################################
@@ -1356,9 +1356,9 @@ class GtkDocCommentBlockParser(object):
                     if not returns_seen:
                         returns_seen = True
                     else:
-                        warn("encountered multiple 'Returns' parameters or tags for "
-                             "'%s'." % (comment_block.name, ),
-                             position)
+                        error('encountered multiple "Returns" parameters or tags for "%s".' %
+                              (comment_block.name, ),
+                              position)
 
                     tag = GtkDocTag(TAG_RETURNS, position)
 
@@ -1379,11 +1379,11 @@ class GtkDocCommentBlockParser(object):
                          (param_name, original_line, marker),
                          position)
                     param_name = '...'
-                elif param_name in comment_block.params.keys():
-                    column = result.start('parameter_name') + column_offset
-                    warn("multiple '@%s' parameters for identifier '%s':\n%s\n%s" %
-                         (param_name, comment_block.name, original_line, marker),
-                         position)
+
+                if param_name in comment_block.params.keys():
+                    error('multiple "@%s" parameters for identifier "%s":\n%s\n%s' %
+                          (param_name, comment_block.name, original_line, marker),
+                          position)
 
                 parameter = GtkDocParameter(param_name, position)
 
@@ -1518,9 +1518,9 @@ class GtkDocCommentBlockParser(object):
                     if not returns_seen:
                         returns_seen = True
                     else:
-                        warn("encountered multiple 'Returns' parameters or tags for "
-                             "'%s'." % (comment_block.name, ),
-                             position)
+                        error('encountered multiple return value parameters or tags for "%s".' %
+                              (comment_block.name, ),
+                              position)
 
                     tag = GtkDocTag(TAG_RETURNS, position)
 
@@ -1537,9 +1537,9 @@ class GtkDocCommentBlockParser(object):
                     continue
                 else:
                     if tag_name_lower in comment_block.tags.keys():
-                        warn("multiple '%s:' tags for identifier '%s':\n%s\n%s" %
-                             (tag_name, comment_block.name, original_line, marker),
-                             position)
+                        error('multiple "%s:" tags for identifier "%s":\n%s\n%s' %
+                              (tag_name, comment_block.name, original_line, marker),
+                              position)
 
                     tag = GtkDocTag(tag_name_lower, position)
 
@@ -1654,9 +1654,9 @@ class GtkDocCommentBlockParser(object):
                                                                            False)
         if success and annotations:
             marker = ' ' * (start_pos + column_offset) + '^'
-            warn('ignoring invalid multiline annotation continuation:\n%s\n%s' %
-                 (original_line, marker),
-                 position)
+            error('ignoring invalid multiline annotation continuation:\n%s\n%s' %
+                  (original_line, marker),
+                  position)
 
     def _parse_annotation_options_list(self, position, column, line, options):
         '''
diff --git a/tests/scanner/annotationparser/gi/identifier.xml 
b/tests/scanner/annotationparser/gi/identifier.xml
index b8de9c8..dd8ee17 100644
--- a/tests/scanner/annotationparser/gi/identifier.xml
+++ b/tests/scanner/annotationparser/gi/identifier.xml
@@ -20,7 +20,7 @@
       <description>Above identifier is not on the first line.</description>
     </docblock>
     <messages>
-      <message>2: Warning: Test: identifier not found on the first line:
+      <message>2: Error: Test: identifier not found on the first line:
  * This is not a valid section identifier
    ^</message>
     </messages>
@@ -44,7 +44,7 @@
       </identifier>
     </docblock>
     <messages>
-      <message>2: Warning: Test: identifier not found on the first line:
+      <message>2: Error: Test: identifier not found on the first line:
 
 ^</message>
     </messages>
@@ -97,7 +97,7 @@ The application class handles ...</description>
  */</input>
   <parser>
     <messages>
-      <message>2: Warning: Test: identifier not found on the first line:
+      <message>2: Error: Test: identifier not found on the first line:
  * gnm_cell_set_expr_and_value: Stores (WITHOUT COPYING) the supplied value, and
    ^</message>
     </messages>
diff --git a/tests/scanner/annotationparser/gi/parameter.xml b/tests/scanner/annotationparser/gi/parameter.xml
index 809b9d8..e17f590 100644
--- a/tests/scanner/annotationparser/gi/parameter.xml
+++ b/tests/scanner/annotationparser/gi/parameter.xml
@@ -60,7 +60,7 @@
       </parameters>
     </docblock>
     <messages>
-      <message>4: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
+      <message>4: Error: Test: multiple "@param1" parameters for identifier "test_multiple_parameters":
  * @param1: first parameter again
     ^</message>
     </messages>
@@ -95,7 +95,7 @@
       <description>Annotations spanning multiple lines are not valid</description>
     </docblock>
     <messages>
-      <message>4: Warning: Test: ignoring invalid multiline annotation continuation:
+      <message>4: Error: Test: ignoring invalid multiline annotation continuation:
  * (transfer full): first parameter
    ^</message>
     </messages>
diff --git a/tests/scanner/annotationparser/gi/tag.xml b/tests/scanner/annotationparser/gi/tag.xml
index d7eca81..d116841 100644
--- a/tests/scanner/annotationparser/gi/tag.xml
+++ b/tests/scanner/annotationparser/gi/tag.xml
@@ -31,7 +31,7 @@
       </tags>
     </docblock>
     <messages>
-      <message>7: Warning: Test: ignoring invalid multiline annotation continuation:
+      <message>7: Error: Test: ignoring invalid multiline annotation continuation:
  * (transfer full): something
    ^</message>
     </messages>
diff --git a/tests/scanner/annotationparser/gi/tag_deprecated.xml 
b/tests/scanner/annotationparser/gi/tag_deprecated.xml
index fbd342b..dcbb219 100644
--- a/tests/scanner/annotationparser/gi/tag_deprecated.xml
+++ b/tests/scanner/annotationparser/gi/tag_deprecated.xml
@@ -95,7 +95,7 @@
       </tags>
     </docblock>
     <messages>
-      <message>5: Warning: Test: multiple 'Deprecated:' tags for identifier 'test_multiple_tags':
+      <message>5: Error: Test: multiple "Deprecated:" tags for identifier "test_multiple_tags":
  * Deprecated: 2.0
    ^</message>
     </messages>
diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml 
b/tests/scanner/annotationparser/gi/tag_returns.xml
index 2f76e02..ea8c012 100644
--- a/tests/scanner/annotationparser/gi/tag_returns.xml
+++ b/tests/scanner/annotationparser/gi/tag_returns.xml
@@ -156,7 +156,7 @@ parameter is encountered.</description>
       <message>8: Warning: Test: "@returns" parameter unexpected at this location:
  * @returns: something else
     ^</message>
-      <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for 
'test_multiple_returns_tag_and_parameter'.</message>
+      <message>8: Error: Test: encountered multiple "Returns" parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
 </test>
@@ -189,7 +189,7 @@ parameter is encountered.</description>
       </tags>
     </docblock>
     <messages>
-      <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for 
'test_multiple_returns_tag_and_parameter'.</message>
+      <message>8: Error: Test: encountered multiple return value parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
 </test>
@@ -222,7 +222,7 @@ parameter is encountered.</description>
       </tags>
     </docblock>
     <messages>
-      <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for 
'test_multiple_returns_tag_and_parameter'.</message>
+      <message>8: Error: Test: encountered multiple return value parameters or tags for 
"test_multiple_returns_tag_and_parameter".</message>
     </messages>
   </parser>
 </test>
diff --git a/tests/scanner/annotationparser/gi/tag_since.xml b/tests/scanner/annotationparser/gi/tag_since.xml
index 78ce786..048cb4d 100644
--- a/tests/scanner/annotationparser/gi/tag_since.xml
+++ b/tests/scanner/annotationparser/gi/tag_since.xml
@@ -97,7 +97,7 @@ tags is wrong...</description>
       </tags>
     </docblock>
     <messages>
-      <message>5: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
+      <message>5: Error: Test: multiple "Since:" tags for identifier "test_multiple_tags":
  * Since: 2.0: one of these "Since:"
    ^</message>
     </messages>
diff --git a/tests/scanner/annotationparser/gi/tag_stability.xml 
b/tests/scanner/annotationparser/gi/tag_stability.xml
index ec87b02..ad3ca68 100644
--- a/tests/scanner/annotationparser/gi/tag_stability.xml
+++ b/tests/scanner/annotationparser/gi/tag_stability.xml
@@ -136,7 +136,7 @@
       </tags>
     </docblock>
     <messages>
-      <message>5: Warning: Test: multiple 'Stability:' tags for identifier 'test_multiple_tags':
+      <message>5: Error: Test: multiple "Stability:" tags for identifier "test_multiple_tags":
  * Stability: Private
    ^</message>
     </messages>


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