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

[tor-commits] [stem/master] Expanding comments for exception style check



commit 411f8ccb508ae5eb941f5b8008909e4f1254374c
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun May 5 18:00:11 2013 -0700

    Expanding comments for exception style check
    
    Just adding a bit more of an explanation to the new style check. I'm a little
    tempted to make the second conditional "',' in content" so it'll catch
    exceptions by other names, but that might be too loose.
---
 test/util.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/util.py b/test/util.py
index 10a5459..f87ecb3 100644
--- a/test/util.py
+++ b/test/util.py
@@ -224,6 +224,7 @@ def get_stylistic_issues(paths):
   * two space indentations
   * tabs are the root of all evil and should be shot on sight
   * standard newlines (\\n), not windows (\\r\\n) nor classic mac (\\r)
+  * checks that we're using 'as' for exceptions rather than a comma
 
   :param list paths: paths to search for stylistic issues
 
@@ -280,6 +281,14 @@ def get_stylistic_issues(paths):
         elif content != content.rstrip():
           file_issues.append((index + 1, "line has trailing whitespace"))
         elif content.lstrip().startswith("except") and content.endswith(", exc:"):
+          # Python 2.6 - 2.7 supports two forms for exceptions...
+          #
+          #   except ValueError, exc:
+          #   except ValueError as exc:
+          #
+          # The former is the old method and no longer supported in python 3
+          # going forward.
+
           file_issues.append((index + 1, "except clause should use 'as', not comma"))
 
       if file_issues:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits