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

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

相关推荐
一只栖枝3 分钟前
华为 HCIE 大数据认证中 Linux 命令行的运用及价值
大数据·linux·运维·华为·华为认证·hcie·it
wuicer2 小时前
ubuntu 20.04 安装anaconda以及安装spyder
linux·运维·ubuntu
小晶晶京京4 小时前
day34-LNMP详解
linux·运维·服务器
fengyehongWorld5 小时前
Linux crontab定时任务
linux·运维
碎像6 小时前
Linux上配置环境变量
linux·运维·服务器
sunflower_w7 小时前
linux I2C核心、总线与设备驱动
linux·运维·服务器
myzzb7 小时前
基于uiautomation的自动化流程RPA开源开发演示
运维·python·学习·算法·自动化·rpa
网硕互联的小客服9 小时前
Apache 如何支持SHTML(SSI)的配置方法
运维·服务器·网络·windows·php
落日漫游9 小时前
K8s核心组件全解析
运维·docker·运维开发
Demisse12 小时前
[Linux] Linux文件系统基本管理
linux·运维·服务器