jenkins插件之Warnings

Warnings插件,收集静态分析工具报告的编译器警告或问题,并将结果可视化。它内置了对许多编译器的支持(cpp,clang,java等)和工具(spotbugs,pmd,checkstyle,eslint,phpstan,.)

安装

Dashboard -->> 系统管理 -->> 插件管理 -->> Available plugins 搜索 Warnings, 点击安装

项目配置

CheckStyle分析

PHPCS产生 分析报告

Dashboard -->> 项目名称 -->> 配置 -->> Build Steps

选择 Run with timeout 或者 Run shell
安装phpcs

shell 复制代码
#安装phpcs
if command -v docker exec -u root phpfpm82 /tmp/composer/vendor/bin/phpcs >/dev/null 2>&1; then echo '开始执行phpCodeSniffer'; else docker exec -u root phpfpm composer global require --dev squizlabs/php_codesniffer; fi

#执行phpcs生成分析报告
docker exec phpfpm /tmp/composer/vendor/bin/phpcs --standard=PSR12 --report-checkstyle=/workpath/checkstyle-result.xml /workpath/app || true
#这里的true是为了避免jenkins因构建错误而结束构建,你需要根据实际情况确定是否要这么做,
#我这里只需要报告,后续通过checkStyle可视化看是否需要修复,所以我保留了true

#替换生成文件中项目路径
sed -i 's/www/jenkins_home/g' /workpath/checkstyle-result.xml

CheckStyle将报告可视化

Dashboard -->> 项目名称 -->> 配置 -->> 构建后步骤

选择 Record compiler warnings and static analysis results

工具选择 CheckStyle
Report File Pattern 填写 checkstyle-result.xml ,注意此处文件需要和phpcs生成的报告文件名称一致,路径会自动检测
Encoding of Report Files 填写 UTF-8

其他静态检测报告后续补充

相关推荐
云空1 小时前
《DeepSeek 网页/API 性能异常(DeepSeek Web/API Degraded Performance):网络安全日志》
运维·人工智能·web安全·网络安全·开源·网络攻击模型·安全威胁分析
Elastic 中国社区官方博客1 小时前
使用真实 Elasticsearch 进行高级集成测试
大数据·数据库·elasticsearch·搜索引擎·全文检索·jenkins·集成测试
没有名字的小羊2 小时前
Cyber Security 101-Build Your Cyber Security Career-Security Principles(安全原则)
运维·网络·安全
千夜啊2 小时前
Nginx 运维开发高频面试题详解
运维·nginx·运维开发
存储服务专家StorageExpert3 小时前
答疑解惑:如何监控EMC unity存储系统磁盘重构rebuild进度
运维·unity·存储维护·emc存储
chian-ocean4 小时前
从理论到实践:Linux 进程替换与 exec 系列函数
linux·运维·服务器
敖行客 Allthinker5 小时前
从 UTC 日期时间字符串获取 Unix 时间戳:C 和 C++ 中的挑战与解决方案
linux·运维·服务器·c++
JunLan~5 小时前
Docker 部署 GLPI(IT 资产管理软件系统)
运维·docker·容器
慕雪华年7 小时前
【Linux】opencv在arm64上提示找不到libjasper-dev
linux·运维·opencv
_Eden_8 小时前
Keepalived高可用集群企业应用实例一
运维·服务器