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

#安装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. Jenkins安装推荐

    2024-05-25 18:13:18       31 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-05-25 18:13:18       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-25 18:13:18       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-25 18:13:18       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-25 18:13:18       18 阅读

热门阅读

  1. JVM-调优之-高内存占用问题排查

    2024-05-25 18:13:18       10 阅读
  2. OOM不会导致JVM退出

    2024-05-25 18:13:18       9 阅读
  3. 「Electron」Electron 应用程序详解

    2024-05-25 18:13:18       12 阅读
  4. 什么是UDP服务器?

    2024-05-25 18:13:18       8 阅读
  5. 根据标签名递归读取xml字符串中element

    2024-05-25 18:13:18       9 阅读
  6. 网络协议——有状态协议和无状态协议

    2024-05-25 18:13:18       10 阅读
  7. C#拼接xml

    2024-05-25 18:13:18       10 阅读
  8. xmlhttp中withcredential用法

    2024-05-25 18:13:18       11 阅读
  9. 使用HTTP客户端在Python中进行网页抓取——笔记

    2024-05-25 18:13:18       14 阅读
  10. Vue2常用的组件通信方式有几种

    2024-05-25 18:13:18       14 阅读
  11. STL源码看书笔记(1)——代码解析

    2024-05-25 18:13:18       9 阅读