SonarQube代码扫描工具

SonarQube(社区版)

SonarQube是一个用于代码质量管理的开放平台,通过插件机制,SonarQube可以集成不同的测试工具,代码分析工具,以及持续集成工具,例如Hudson/Jenkins等。

sonarqube的七个维度检测代码质量:

  • 复杂度分布:代码复杂度过高将难以理解
  • 重复代码:程序中包含大量复制、粘贴的代码而导致代码臃肿,sonar可以展示源码中重复严重的地方
  • 单元测试统计:统计并展示单元测试覆盖率,开发或测试可以清楚测试代码的覆盖情况
  • 代码规则检查:检查代码是否符合规 范
  • 注释率:若代码注释过少,特别是人员变动后,其他人接手比较难接手;若过多,又不利于阅读
  • 潜在的 Bug :检测潜在的 bug
  • 结构与设计:找出循环,展示包与包、类与类之间的依赖、检查程序之间耦合度

1、关于代码增量扫描

sonarqube在5.2版本后把增量代码扫描模式给去除掉了。
详情参考:
We do not currently support incremental analysis as it can result in less accurate scanning results. This has come up quite regularly, especially in the context of branches and pull requests, and internally there is a lot of discussion around this, but I don’t think we have anything to share at this time.
https://community.sonarsource.com/t/incremental-analysis/4672/10

2、Clean as You Code

2.1 What is Clean as You Code?

Clean as You Code is an approach to Code Quality that eliminates a lot of the challenges that come with traditional approaches. As a developer, you focus on maintaining high standards and taking responsibility specifically in the New Code you’re working on. SonarQube gives you the tools that let you set high standards and take pride in knowing that your code meets those standards.

2.2 Focus on New Code

With Clean as You Code, your focus is always on New Code (code that has been added or changed according to your New Code definition) and making sure the code you write today is clean and safe.
The New Code definition can be set at different levels (global, project, and starting in [Developer Edition](https://redirect.sonarsource.com/editions/developer.html" \t "http://10.10.69.153:9000/documentati

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SuperGloo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值