moodlehq/moodle-cs
Composer 安装命令:
composer require moodlehq/moodle-cs
包简介
Moodle Coding Sniffer rules
README 文档
README
Information
This repository contains the Moodle Coding Style configurations, written as PHP CodeSniffer rulesets.
Two coding styles are included:
moodle- the main ruleset for the Moodle Coding Stylemoodle-extra- extended ruleset which includes recommended best practices- extends the main
moodleruleset
- extends the main
Currently this only includes the configuration for PHP Coding style, but this may be extended to include custom rules for JavaScript, and any other supported languages or syntaxes.
Installation
Using Composer (recommended)
You can install these coding style rules using Composer to make them available globally across your system.
This will install the correct version of phpcs, with the Moodle rules, and their dependencies.
composer global config minimum-stability dev composer global require moodlehq/moodle-cs
Configuration
Typically configuration is not required. Recent versions of Moodle (3.11 onwards) include a configuration file for the PHP CodeSniffer, which will set the standard when run within a Moodle directory.
Additional configuration can be generated automatically to have PHP CodeSniffer ignore any third-party library code. This can be generated by running:
npx grunt ignorefiles
Using the moodle-extra coding style
The recommended way of configuring PHP CodeSniffer to use the moodle-extra coding style is to provide an additional configuration file.
For Moodle 3.11 onwards you can create a file named .phpcs.xml with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <ruleset name="MoodleCore"> <rule ref="./phpcs.xml"/> <rule ref="moodle-extra"/> </ruleset>
This will load the phpcs.xml file (generated by npx grunt ignorefiles), and apply the moodle-extra configuration on top.
Moodle 3.10 and earlier
The easiset way to have PHP CodeSniffer pick up your preferred style, you can create a file named phpcs.xml with the following contents:
<?xml version="1.0" encoding="UTF-8"?> <ruleset name="MoodleCore"> <rule ref="moodle"/> </ruleset>
If you wish to use the moodle-extra coding style, then you can use the following content:
<?xml version="1.0" encoding="UTF-8"?> <ruleset name="MoodleCore"> <rule ref="moodle-extra"/> </ruleset>
Note: Third-party library code will not be ignored with these versions of Moodle.
moodlehq/moodle-cs 适用场景与选型建议
moodlehq/moodle-cs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.22M 次下载、GitHub Stars 达 26, 最近一次更新时间为 2022 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「style」 「moodle」 「standard」 「phpcs」 「codesniffer」 「sniff」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moodlehq/moodle-cs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moodlehq/moodle-cs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moodlehq/moodle-cs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for using the CssToInlineStyles translator by tijsverkoyen
Fixing php code style
Adds the EDTF data type to Wikibase
Pumukit Lms Bundle.
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
CodeSniffer ruleset for the ZettaCMS coding standard
统计信息
- 总下载量: 3.22M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 27
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-02-28