本文整理汇总了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")