sonarqube笔记之--代码注释行的量度

本文介绍了SonarQube中关于代码注释的度量,包括评论行数、密度、公共API注释以及未文档化的API。通过示例代码展示如何计算注释密度,并解释了哪些类型的注释被纳入统计。
摘要由CSDN通过智能技术生成
在sonarqube中,关于文档方面的度量有以下方面:

1 sonarqube中的代码注释行的概念(comment lines):

Absolute number of comment lines. This metric is calculated differently for
each programming language.
For instance, in Java, all Javadocs (class, method, property) plus all single
or multicomment lines and all commented-out code are counted as comment
lines. Other comments, such as empty comment lines and header
comments, aren’t counted.
也就是说,comment lines包括所有的类,方法,属性上的注释,包括单行或者多行的,
以及注释调的代码行,而空的注释行和头文件注释,是不算的

2
注释的密度(Density of
Comment Lines))

Comment Lines / ( Lines of Code + Comment Lines ) * 100 也就是注释的代码行/注释的代码行和总的代码行

3
Public API: 不同语言不同计算方法,其中java中
Public Classes + Public Methods + Public Properties,就是上面三者上的注释数量,但不包括final static的
4 P
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值