自动修复 Sonar 发现的问题 [英] Automate fixes for issues found by Sonar

查看:39
本文介绍了自动修复 Sonar 发现的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修复声纳在一个非常古老的 Java 项目(大约 8 岁)中发现的问题.这是一个巨大的项目,有很多被声纳捕获的错误代码.虽然它们是非常微不足道的修复,但有很多.有没有办法自动修复一系列类似的问题?就像我有大约 1200 个语句应该在单独的行上"一样,手动执行需要很长时间.我可以以某种方式自动进行这些修复吗?

I am working on fixing issues caught by sonar on a very old Java project(8 years old approximately ). It is a huge project with a lot of faulty code that is caught by sonar. Although they are very trivial fixes but there are a number of them. Is there a way to automatically fix a series of similar issues ? Like i have around 1200 cases of "statements should be on separate lines" , to do it manually would take ages. Can i automate these fixes somehow ?

推荐答案

我不认为我希望 Sonar 更改源.这是一个代码分析器.

I don't think I would want Sonar to change source. It's a code analyzer.

您可以将 IDE 配置为在保存时进行格式化并对所有受影响的源文件进行初始格式化,以便将语句放在单独的行中.

You could configure your IDE to format on save and do an initial format of all afflicted source files, so that it puts the satements on separate lines.

此外,您可能需要查看问题的重要性并更改/编辑质量配置文件.

Also, you might want to review the importance of the problem and change/edit the Quality Profile.

这篇关于自动修复 Sonar 发现的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆