Closed tkdlqm2 closed 2 years ago
cpplint's feedback 생략 리스트
Found C system header after other header
Do not include .cpp files from other packages
Lines should be <= 80 characters long
Use int16/int64/etc, rather than the C type long
Consider using rand_r(...) instead of rand(...) for improved thread safety
cpplint script 사용법
[소스코드]
def run_cpplint(target_list):
for i in range(0,len(target_list)):
result = target_list[i].find("./build")
if result != -1:
continue
result = target_list[i].find("./external")
if result != -1:
continue
result = target_list[i].find("./shadow")
if result != -1:
continue
result = target_list[i].find("./testlibs")
if result != -1:
continue
result = target_list[i].find("./tests")
if result != -1:
continue
result = target_list[i].find("./interfaces")
if result != -1:
continue
command_target = "cpplint --quiet --linelength=500 --filter=-build/include_order,-build/include_subdir,-legal/copyright,-build/namespaces,-runtime/int,-readability/todo,-runtime/printf,-readability/casting,-runtime/references,-runtime/threadsafe_fn,-build/include " + target_list[i]
exec_shell_cmd(command_target)
[실행]
스크립트 파일은 blockchain-sim/cpplint.py 에 위치함.
python cpplint.py
[정상종료]
Run cpplint ...
Success cpplint ...
[에러 발생 시]
에러 재현은 라인에 문자열 수를 50으로 제한 시켜놓고 실행함.
Run cpplint ...
./BLEEPemul/emulation/transaction.cpp:0: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:23: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:25: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:30: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:31: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:42: Lines should be <= 50 characters long [whitespace/line_length] [2]
./BLEEPemul/emulation/transaction.cpp:51: Lines should be <= 50 characters long [whitespace/line_length] [2]
Done processing ./BLEEPemul/emulation/transaction.cpp
Total errors found: 7
error while executing 'cpplint --quiet --linelength=50 --filter=-build/include_order,-build/include_subdir,-legal/copyright,-build/namespaces,-runtime/int,-rea
BLEEP을 open source화 시키기 위해서는 BLEEP에서 개발한 라이브러리 모듈들의 소스코드들을 대상으로 lint를 진행하여서 좀 더 코드를 스타일을 통일 시키기 위한 작업임.