定制 efabrica/neon-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

efabrica/neon-checker

最新稳定版本:0.3.1

Composer 安装命令:

composer require efabrica/neon-checker

包简介

Finds all neons in selected paths and try them decode

README 文档

README

This library helps to find errors in neon files, it can be used in CI tools.

Installation

Neon checker requires PHP 7.1.0 or newer. You can install it via Composer. This project is not meant to be run as a dependency, so install it globally:

composer global require efabrica/neon-checker

or as stand alone project

mkdir /var/www/neon-checker
cd /var/www/neon-checker
composer require efabrica/neon-checker

Usage

This library contains two commands. For both commands return code is count of errors found, so you can use them in CI tools.

echo $?
1

validate

neon-checker validate <dirs>...

Note: For more information, run neon-checker validate --help

The result of command looks like this:

Errors found: 1

With verbose output you will get:

Errors found: 1

Error: Unexpected ',' on line 23, column 10.
File: neons/subdir/test2.neon:23

And with very verbose there will be also part of file content with error.

Content:
18: 							b:
19: 								c:
20: 									d"
21: 
22: aaa:
23: 	<error>bbb: ccc, ddd</error>
24: 
25: 	a:
26: 		b:
27: 			c:
28: 				d"

disallowed

neon-checker disallowed [--disallowed-keys DISALLOWED-KEYS] [--disallowed-values DISALLOWED-VALUES] [--] <dirs>...

With this command, you can disallow some keys and / or values in neon configs.

For example:

To disallow key http:frames e.g.

http:
    frames: someValue
neon-checker disallowed app/config/ --disallowed-keys="http:frames"

To disallow concrete value for this key e.g.

http:
    frames: yes

you can run command with option --disallowed-values

neon-checker disallowed app/config/ --disallowed-values="http:frames:yes"

At least one of options --disallowed-keys and --disallowed-values has to be set, they can be used multiple times and can be combined. For example:

neon-checker disallowed app/config/ --disallowed-keys="session:expiration" --disallowed-keys="php:date.timezone" --disallowed-values="http:frames:yes"

Output of command is simple:

Errors found: 4

Or more descriptive with verbose (-v) option:

Errors found: 4

File app/config/config.neon
contains these disallowed keys:
- session:expiration
- php:date.timezone
contains these disallowed values:
- http:frames:yes

File app/config/config.local.neon
contains these disallowed keys:
- php:date.timezone

统计信息

  • 总下载量: 2.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-26