mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
In cpplint, permit Dodxygen C++ annotations, which come after members, e.g.
int var; //!< Brief description after the member or int var; ///< Brief description after the member Cf. http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html#memberdoc Currently, cpplint accepts comments after members, cf. http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Implementation_Comments#Implementation_Comments and it accepts also the doxygen comments of the type "///" (followed by a new line) and "/// " (followed by a comment). Only the Doxygen annotations, which come after members are rejected, which is fixed by this patch. Review URL: https://codereview.appspot.com/14607044 Patch from Tobias Burnus <burnus@net-b.de>.
This commit is contained in:
parent
2aa5998d82
commit
6d8d983b11
5
cpplint/cpplint.py
vendored
5
cpplint/cpplint.py
vendored
|
@ -2627,10 +2627,15 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
|
||||||
# //----------------------------------------------------------
|
# //----------------------------------------------------------
|
||||||
# or are an empty C++ style Doxygen comment, like:
|
# or are an empty C++ style Doxygen comment, like:
|
||||||
# ///
|
# ///
|
||||||
|
# or C++ style Doxygen comments placed after the variable:
|
||||||
|
# ///< Header comment
|
||||||
|
# //!< Header comment
|
||||||
# or they begin with multiple slashes followed by a space:
|
# or they begin with multiple slashes followed by a space:
|
||||||
# //////// Header comment
|
# //////// Header comment
|
||||||
match = (Search(r'[=/-]{4,}\s*$', line[commentend:]) or
|
match = (Search(r'[=/-]{4,}\s*$', line[commentend:]) or
|
||||||
Search(r'^/$', line[commentend:]) or
|
Search(r'^/$', line[commentend:]) or
|
||||||
|
Search(r'^!< ', line[commentend:]) or
|
||||||
|
Search(r'^/< ', line[commentend:]) or
|
||||||
Search(r'^/+ ', line[commentend:]))
|
Search(r'^/+ ', line[commentend:]))
|
||||||
if not match:
|
if not match:
|
||||||
error(filename, linenum, 'whitespace/comments', 4,
|
error(filename, linenum, 'whitespace/comments', 4,
|
||||||
|
|
|
@ -2202,9 +2202,19 @@ class CpplintTest(CpplintTestBase):
|
||||||
self.TestLint('//////', '')
|
self.TestLint('//////', '')
|
||||||
self.TestLint('////// x', '')
|
self.TestLint('////// x', '')
|
||||||
self.TestLint('/// x', '')
|
self.TestLint('/// x', '')
|
||||||
|
self.TestLint('///< x', '') # After-member Doxygen comment
|
||||||
|
self.TestLint('//!< x', '') # After-member Doxygen comment
|
||||||
self.TestLint('///', '') # Empty Doxygen comment
|
self.TestLint('///', '') # Empty Doxygen comment
|
||||||
self.TestLint('////x', 'Should have a space between // and comment'
|
self.TestLint('////x', 'Should have a space between // and comment'
|
||||||
' [whitespace/comments] [4]')
|
' [whitespace/comments] [4]')
|
||||||
|
self.TestLint('//!<x', 'Should have a space between // and comment'
|
||||||
|
' [whitespace/comments] [4]')
|
||||||
|
self.TestLint('///<x', 'Should have a space between // and comment'
|
||||||
|
' [whitespace/comments] [4]')
|
||||||
|
self.TestLint('//!<', 'Should have a space between // and comment'
|
||||||
|
' [whitespace/comments] [4]')
|
||||||
|
self.TestLint('///<', 'Should have a space between // and comment'
|
||||||
|
' [whitespace/comments] [4]')
|
||||||
|
|
||||||
# Test a line preceded by empty or comment lines. There was a bug
|
# Test a line preceded by empty or comment lines. There was a bug
|
||||||
# that caused it to print the same warning N times if the erroneous
|
# that caused it to print the same warning N times if the erroneous
|
||||||
|
|
Loading…
Reference in New Issue
Block a user