用于 Drupal 项目的 SonarQube

2023-06-22php开发问题
13

本文介绍了用于 Drupal 项目的 SonarQube的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

目前我使用的是最新版本 5.0 的 SonarQube.

Currently i am using SonarQube with latest version 5.0 .

我正在使用 SonarQube 扫描带有 PHP 插件的 PHP 项目.

I am using SonarQube for scanning PHP projects with PHP plugin.

现在有一些关于 SonarQube 和 PHP 插件的查询.

Now there some queries which i having regarding SonarQube and PHP Plugin.

  1. 为什么 SonarQube 人弃用了旧的 PHP 插件,该插件比以前的插件更具可配置性.
  2. 是否可以使用 SonarQube 分析 Drupal 项目.

预先感谢您的回答.

推荐答案

在对 SonarQube 编码标准做了大量研究之后,我得出了以下结论.

After doing so much research for SonarQube Coding Standards i came to following conclusion.

请在下面找到我对我之前提出的问题的评论.

please find below my comments for the questions that i asked previously.

  1. 出于一些安全原因,SonarQube 人修改了插件并从 PHP 插件中删除了配置部分.但是,配置部分是 JAVA(SonarQube 5.0 版)的配置部分

  1. Because of some security reasons, SonarQube guys modified the plugin and removed the configuration part from PHP plugin. However, the configuration part is till present for JAVA(SonarQube version 5.0)

是的,我们可以使用 SonarQube 扫描 Drupal 项目.这在 SonarQube 5.1 版之后是可能的,他们为 Drupal 项目提供了单独的质量配置文件.分析时将该配置文件设置为默认值.

Yes, We can scan Drupal projects with SonarQube. This is possible after SonarQube version 5.1 where they have provided a separate Quality profile for Drupal Projects. set that profile as default while analyzing.

此外,您还必须在项目属性文件中使用文件后缀.

Also you have to used file suffixes within your project properties file.

sonar.php.file.suffixes= file extensions that you have to scan

PHP 插件扫描的默认扩展名是 php,php3,php4,php5,phtml,inc作为 Drupal 包含扩展名为 .moudle 和 .install 的文件.要使 Sonar 能够分析这些文件,您必须在上述密钥中添加相同的内容.

Default extensions scanned by PHP Plugins are php,php3,php4,php5,phtml,inc As Drupal Contains files with extension such as .moudle and .install. To enable Sonar to analyze these files, you have to add the same in above mentioned key.

您还可以使用 Dashboard 启用此功能,您可以在其中全局设置 PHP 插件中的相同属性.

You can also enable this using Dashboard where you can globally set the same properties within PHP plugin.

如果您不想使用声纳,还有另一种选择.我正在使用 Coder(Drupal 的静态代码分析工具)并将其与 Jenkins 集成.通过 ANT/Phing,我正在触发静态代码分析并生成各种报告并显示在 Jenkins Dashboard 中.

There is one more alternative, if you don't want to use Sonar. I am using Coder(Static code analysis tool for Drupal) and integrating the same with Jenkins. Through ANT/Phing i am triggering the static code analysis and generate various reports and displayed in Jenkins Dashboard.

这篇关于用于 Drupal 项目的 SonarQube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17