Enabled todo and namespace rules in style check

Modified cpplint.py to support
} // namespace foo {
  instead of
} // namespace foo

Review: https://reviews.apache.org/r/23599


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/df227820
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/df227820
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/df227820

Branch: refs/heads/master
Commit: df2278202648a3c614a9247339a5dfbc2bcd4cd4
Parents: db8235e
Author: Timothy Chen <[email protected]>
Authored: Thu Jul 31 12:11:51 2014 -0700
Committer: Adam B <[email protected]>
Committed: Thu Jul 31 12:22:49 2014 -0700

----------------------------------------------------------------------
 support/cpplint.patch  | 25 +++++++++++++++++++++++--
 support/cpplint.py     |  8 ++++----
 support/mesos-style.py |  2 ++
 3 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/df227820/support/cpplint.patch
----------------------------------------------------------------------
diff --git a/support/cpplint.patch b/support/cpplint.patch
index 4f1ec66..1dd69a0 100644
--- a/support/cpplint.patch
+++ b/support/cpplint.patch
@@ -1,5 +1,5 @@
---- support/cpplint.py.orig    2014-05-01 18:17:51.480890494 -0700
-+++ support/cpplint.py 2014-05-01 18:20:52.068887876 -0700
+--- support/cpplint.py.orig    2014-07-16 15:35:35.000000000 -0700
++++ support/cpplint.py 2014-07-16 15:57:34.000000000 -0700
 @@ -28,6 +28,8 @@
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -27,6 +27,27 @@
  
  def ParseNolintSuppressions(filename, raw_line, linenum, error):
    """Updates the global list of error-suppressions.
+@@ -1775,16 +1777,16 @@
+     if self.name:
+       # Named namespace
+       if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
+-                    r'[\*/\.\\\s]*$'),
++                    r'[\*/\.\\\s]* {$'),
+                    line):
+         error(filename, linenum, 'readability/namespace', 5,
+-              'Namespace should be terminated with "// namespace %s"' %
++              'Namespace should be terminated with "// namespace %s {"' %
+               self.name)
+     else:
+       # Anonymous namespace
+-      if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
++      if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]* {$', line):
+         error(filename, linenum, 'readability/namespace', 5,
+-              'Namespace should be terminated with "// namespace"')
++              'Namespace should be terminated with "// namespace {"')
+
+
+ class _PreprocessorInfo(object):
 @@ -1993,11 +1995,9 @@
        if access_match:
          classinfo.access = access_match.group(2)

http://git-wip-us.apache.org/repos/asf/mesos/blob/df227820/support/cpplint.py
----------------------------------------------------------------------
diff --git a/support/cpplint.py b/support/cpplint.py
index 90aa4ba..bfd3390 100644
--- a/support/cpplint.py
+++ b/support/cpplint.py
@@ -1777,16 +1777,16 @@ class _NamespaceInfo(_BlockInfo):
     if self.name:
       # Named namespace
       if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
-                    r'[\*/\.\\\s]*$'),
+                    r'[\*/\.\\\s]* {$'),
                    line):
         error(filename, linenum, 'readability/namespace', 5,
-              'Namespace should be terminated with "// namespace %s"' %
+              'Namespace should be terminated with "// namespace %s {"' %
               self.name)
     else:
       # Anonymous namespace
-      if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
+      if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]* {$', line):
         error(filename, linenum, 'readability/namespace', 5,
-              'Namespace should be terminated with "// namespace"')
+              'Namespace should be terminated with "// namespace {"')
 
 
 class _PreprocessorInfo(object):

http://git-wip-us.apache.org/repos/asf/mesos/blob/df227820/support/mesos-style.py
----------------------------------------------------------------------
diff --git a/support/mesos-style.py b/support/mesos-style.py
index fd12be9..d24cb11 100755
--- a/support/mesos-style.py
+++ b/support/mesos-style.py
@@ -12,6 +12,8 @@ import sys
 active_rules = ['build/class',
                 'build/deprecated',
                 'build/endif_comment',
+                'readability/todo',
+                'readability/namespace',
                 'runtime/vlog',
                 'whitespace/blank_line',
                 'whitespace/comma',

Reply via email to