whotrades/bitbucket-code-style

此包的最新版本(v1.0.2)没有可用的许可证信息。

用于在 atlassian bitbucket 集成代码风格检查的机器人(支持 phpcs 和 cpplint)

v1.0.2 2023-11-22 08:06 UTC

README

用于集成 phpcs 和 atlassian bitbucket 的脚本。该脚本检查 pull request 是否符合代码风格,并使用找到的错误评论。更多信息请参阅 https://habrahabr.ru/post/303348/

phpcs-bitbucket 工作原理

Схема работы phpcs-bitbucket

phpcs-bitbucket 工作结果

应用程序的工作结果是 atlassian bitbucket 中关于代码风格错误的评论 示例结果截图

安装和配置

  1. 克隆存储库
  2. 运行 composer install
  3. 将 configuration.ini-dist 重命名为 configuration.ini
  4. 在 configuration.ini 中指定您的 atlassian bitbucket 的链接和登录名密码,并指定检查标准

运行

可以通过两种方式运行应用程序

  1. 使用控制台:运行命令 php app.php <branch> <slug> <repo>(例如,对于存储库 https://example.com/projects/WT/repos/sparta/browse,slug 将等于 WT,而 repo - sparta
  2. 使用 HTTP 请求:index.php?slug=<slug>&branch=<branch>&repo=<repo>

与 pull request 集成

在 atlassian stash 中添加 webhook,指定 phpcs-bitbucket 中的 index.php 的链接,并带有参数 index.php?branch=${refChange.refId}&repo=${project.key}&slug=${repository.slug}