mikulas / lattecs

Latte 模板编码标准验证器

v0.3.1 2014-07-31 10:10 UTC

This package is auto-updated.

Last update: 2024-09-21 04:05:23 UTC


README

Build Status

Latte 模板的编码标准验证器。

用法

composer require --dev mikulas/lattecs
php vendor/bin/lattecs app/

跳过某些规则的示例 config.neon

skip:
	- Mikulas.LatteCS.Rules.BlockAnnotation.TwoStars
php vendor/bin/lattecs --config config.neon app/

当前规则集

  • 每个块的定义必须包含带有正确格式化 @param 注释的 {** *} 文档注释
    • 同一行关闭的块不需要有注释(如标题或脚本块)
  • 强制块内容缩进

示例

➜  lattecs git:(master) ✗ php bin/lattecs tests/fixtures/
tests/fixtures/invalid_param.latte
  line 5: Invalid annotation '@param xoxo', expected '@param type $name'

tests/fixtures/invalid_param_dollar.latte
  line 5: Invalid annotation '@param string basePath', variable name must start with '$'

tests/fixtures/missing.latte
  line 3: Block #content is not properly annotated

tests/fixtures/missing_params.latte
  line 5: Block #content is annotated, but no @param was specified.

tests/fixtures/missing_star.latte
  line 5: Lattedoc does not start with two stars but it should

许可协议

MIT 许可协议 (MIT)

版权所有 © 2014 Mikulas Dite

特此授予任何获得此软件及其相关文档副本(以下简称“软件”)的个人免费使用权,不受任何限制,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许软件的接收者进行上述行为,前提是遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任负责,无论这些责任是基于合同、侵权或其他法律依据,无论这些责任源于、源于或与软件或其使用或其他方式有关。