Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
Today
Total
관리 메뉴

킹드래곤 짹짹 개발노트

cppcheck html report 사용법 본문

C++

cppcheck html report 사용법

킹드래곤 2018. 12. 5. 18:47

이전 글에서는 cppcheck 설치, 빌드 방법을 알아보았습니다.

이번 글에서는 cppcheck-htmlreport 의 사용 방법에 대해서 정리합니다.

cppcheck html report 사용법

cppcheck-htmlreport 는 cppcheck 가 설치되면 함께 설치됩니다.

설치 위치 : /usr/bin/cppcheck-htmlreport


Github 에서 다운로드한 소스에도 포함되어 있습니다.

소스 위치 : /cppcheck dir/htmlreport/cppcheck-htmlreport


cppcheck-htmlreport 는 cppcheck의 결과를 보기좋게 HTML 문서로 만들어줍니다.

cppcheck 의 결과는 sa_result.xml 과 같이 xml 문서로 출력됩니다.

xml 문서를 텍스트 뷰어로 보기에는 무리가 있습니다.

사용 방법은 help 를 참고합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ ./cppcheck-htmlreport --help
Usage: cppcheck-htmlreport [options]
 
Options:
  -h, --help            show this help message and exit
  --title=TITLE         The title of the project.
  --file=FILE           The cppcheck xml output file to read defects from.
                        Default is reading from stdin.
  --report-dir=REPORT_DIR
                        The directory where the HTML report content is
                        written.
  --source-dir=SOURCE_DIR
                        Base directory where source code files can be found.
  --source-encoding=SOURCE_ENCODING
                        Encoding of source code.
cs

$ cppcheck-htmlreport --file=./sa_result.xml --source-dir=./armv8_a --report-dir=./report

cppcheck-htmlreport 의 버그??

serverity="error" 가 1개도 없을 경우에는 statistics 에 아무런 항목이 표시되지 않습니다.

cppcheck-htmlreport 파일을 열어서 아래 부분을 수정합니다.

수정할 소스 코드의 위치는 파일의 거의 끝부분의 671 line 입니다.

위의 break -> continue 로 수정 후에 파일을 저장합니다.

그럼 정상적으로 cppcheck result > statistics 에 통계항목이 표시됩니다.


'C++' 카테고리의 다른 글

cppcheck 설치, 빌드  (0) 2018.12.05