当前位置:网站首页>手把手系列---安装SpotBugs、并快速上手使用
手把手系列---安装SpotBugs、并快速上手使用
2022-06-29 06:39:00 【最佳听众!】
手把手系列
前言
在使用FindBugs的时候,发现适用Idea的FindBugs已经在2016年的时候停止维护了, 不再兼容IDEA2020,
于是有了这期,包含了如何去安装spotBugs,以及如何去使用spotBugs。
提示:以下是本篇文章正文内容
一、SpotBugs是什么?
官网介绍:SpotBugs是一个使用静态分析来查找Java代码中的错误的工具,SpotBugs 需要 JRE(或 JDK)1.8.0 或更高版本才能运行。但是,它可以分析为从1.0到1.9的任何Java版本编译的程序。
静态分析:检查Java字节码(.class文件)是否存在错误。
二、SpotBugs 的下载
1.在线安装(三步)



点击install 安装
2.网页下载
登陆官网(官网会自动匹配相对应的版本,前提是启动idea)
https://plugins.jetbrains.com/plugin/14014-spotbugs/versions
百度云下载到本地
链接:https://pan.baidu.com/s/1QRqFWJISn1ZIjShzxaxeKg
提取码:9xwt
用Install Plugin from Disk安装本地包,然后重启。
三、使用SpotBugs
常用配置SpotBugS



spotbugs主要包括10大类bug
1.Bad practice(90余种)不良的实践,违反常识性的或者必要的代码惯例,比如重写了equals却没有重写hashcode。
2.Correctness (150余种) 此处的代码有可能在运行时导致错误,与预期不符,比如空指针错误。
3.Experimental(9种)spotbugs在此处不适用,大概是匹配模式不太适用于此处。
4.Internationalization(2种)原文是:code flaws having to do with internationalization and locale,没有遇到过类似的错误。
5.Malicious code vulnerability(17种)代码具有被恶意代码攻击的风险。比如返回一个可变类型引用并保存在对象字段中。
6.Multithreaded correctness(46种)线程安全,比如可能造成死锁的代码。
7.Bogus random noise(4种)并不是软件中的实际错误。
8.Performance(37种)性能不好的代码,比如在迭代中使用“+”连接字符串。
9.Security(11种)使用了不安全的外部输入,可能导致远程控制的漏洞。
10.Dodgy(87种)导致自身混乱的代码
使用
1选择相对应的包或者类
2查看结果,并对结果分析
总结
合理的使用工具,能帮助我们大大的简化工作难度,SpotBugs的使用能够让我们的代码更加规范化。
如果觉得有帮助可以点赞收藏支持一下,如果能关注一下就再好不过了ヾ(≧▽≦*)o
边栏推荐
猜你喜欢

Use of parameter in Simulink for AUTOSAR SWC

Listen to textarea input through Keyup to change button style

Reflection modification final

matlab simulink 电网扫频仿真和分析

施努卡:什么是视觉定位系统 视觉定位系统的工作原理

Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2

1032 Sharing

Roblox剑九之剑二

Schnuka: what is visual positioning system? How visual positioning system works

软件测试面试如何正确谈论薪资?
随机推荐
Autosar SWC在Simulink中Parameter的使用
Is virtual DOM really the fastest?
golang 修改 结构体切片的值
How to authorize subordinates?
What tools do testers need to know
感知健康生活 赋能无界连接 ——为OpenHarmony 3.1生态构建贡献芯海力量
KingbbaseES V8R6集群维护案例之---集群之间数据迁移
软件测试鸾音鹤信
358. K 距离间隔重排字符串 排序
蓝桥杯——最小框架
Vibration signal generation and processing based on MATLAB Doppler effect
Blue Bridge Cup -- Analysis of the second batch of test questions of the 13th session
498. 对角线遍历(模拟)
部署Prometheus-server服务 system管理
Fluent imitates uiswitch
A hybrid model of machine learning notes time series
SAP UI5 初学 ( 一 )、简介
Some examples.
项目中 if else 的代替写法
DataTables screen error Popup