本文整理匯總了Python中cpplint.ProcessFile方法的典型用法代碼示例。如果您正苦於以下問題:Python cpplint.ProcessFile方法的具體用法?Python cpplint.ProcessFile怎麽用?Python cpplint.ProcessFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cpplint
的用法示例。
在下文中一共展示了cpplint.ProcessFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process_cpp
# 需要導入模塊: import cpplint [as 別名]
# 或者: from cpplint import ProcessFile [as 別名]
def process_cpp(self, path, suffix):
"""Process a cpp file."""
_cpplint_state.ResetErrorCounts()
cpplint.ProcessFile(str(path), _cpplint_state.verbose_level)
_cpplint_state.PrintErrorCounts()
errors = _cpplint_state.errors_by_category.copy()
if suffix == 'h':
self.cpp_header_map[str(path)] = errors
else:
self.cpp_src_map[str(path)] = errors
示例2: run
# 需要導入模塊: import cpplint [as 別名]
# 或者: from cpplint import ProcessFile [as 別名]
def run(self):
try:
import cpplint as cl
cl_state = cl._cpplint_state
error_count = 0
for dir in self.CPPLINT_DIRS:
print("Processing {}".format(dir))
cl_state.ResetErrorCounts()
filenames = list(pathlib.Path(dir).glob('**/*.h')) + \
list(pathlib.Path(dir).glob('**/*.cpp'))
for filename in filenames:
cl.ProcessFile(str(filename), cl_state.verbose_level)
cl_state.PrintErrorCounts()
error_count += cl_state.error_count
print('')
if error_count > 0:
raise RuntimeError("Codestyle check by cpplint failed")
except ImportError:
warnings.warn("Stylecheck by cpplint failed because cpplint "
"is not installed as a Python module")