Sign inSign up

bkcodecc/clangwarning_scan

By bkcodecc

•Updated about 5 years ago

Image
0

1.0K

bkcodecc/clangwarning_scan repository overview

⁠概述:

Clang编译器提供的警告信息,可在项目编译过程中扫描出代码警告

⁠目录结构:

docker: 镜像打包文件Dockerfile路径

src: 工具二进制路径

test: 测试的输入输出文件

⁠工具版本:

clangwarning: 1.0.0

⁠镜像打包:

打包命令:docker build -t clangwarning_scan:latest -f ./docker/Dockerfile .

⁠入参文件编写:

⁠input.json模版:

{ "scanType": "full", "openCheckers":[ { "checkerName": "unused-function" },{ "checkerName": "documentation" } ], "scanPath": "/usr/codecc/tool_scan" }

⁠input.json字段说明:
字段名说明举例
scanPath待扫描的路径,此处需使用绝对路径/data/project/code
scanType进行全量或增量检查full或increment
openCheckers打开的规则列表[{"checkerName":"no-multi-spaces","nativeChecker":true},{"checkerName":"no-empty-class-body","nativeChecker":true},{"checkerName":"chain-wrapping","nativeChecker":true}]

⁠镜像运行:

docker run -it clangwarning_scan:latest /bin/bash -c "/bin/bash##-c##"python3 ./src/clangwarning.py --input={input.json} --output={output.json}"

⁠结果描述:

⁠output.json模版:

{ "message":"scan complete", "code":0, "defects":[ { "line":"23", "checkerName":"unused-function", "description":" unused function 'rgb_use' ", "filePath":"/Users/bkdevops/Landun/workspace/SourceCode/ThirdPart/renderer.c" } ] }

⁠output.json字段说明:
字段名说明
defects告警列表
filePath文件路径
line文件行
checkerName规则名称
description规则描述
⁠附1:

以下为语言对应数字,如果项目存在多语言,则数字相加:

数字对应语言
1cs
2cpp
4java
8php
16objectivec
32python
64js
128ruby
512go
1024swift
4096kotlin
⁠附2 规则对应表
规则名规则描述适用语言
annotationKotlin
chain-wrappingKotlin
colon-spacingKotlin
comma-spacingKotlin
comment-spacingKotlin
curly-spacingKotlin
dot-spacingKotlin
double-colon-spacingKotlin
enum-entry-name-caseKotlin
final-newlineKotlin
import-orderingKotlin
indentKotlin
keyword-spacingKotlin
max-line-lengthKotlin
modifier-orderKotlin
multiline-if-elseKotlin
no-blank-line-before-rbraceKotlin
no-consecutive-blank-linesKotlin
no-empty-class-bodyKotlin
no-empty-first-line-in-method-blockKotlin
no-line-break-after-elseKotlin
no-line-break-before-assignmentKotlin
no-multi-spacesKotlin
no-semiKotlin
no-trailing-spacesKotlin
no-unit-returnKotlin
no-unused-importsKotlin
no-varKotlin
no-wildcard-importsKotlin
op-spacingKotlin
package-nameKotlin
parameter-list-wrappingKotlin
paren-spacingKotlin
range-spacingKotlin
spacing-around-angle-bracketsKotlin
spacing-between-declarations-with-annotationsKotlin
spacing-between-declarations-with-commentsKotlin
string-templateKotlin
unary-op-spacingKotlin

Tag summary

Content type

Image

Digest

Size

187.8 MB

Last updated

about 5 years ago

docker pull bkcodecc/clangwarning_scan