phpcq/author-validation

检查特定文件中所有作者是否在版权头部被提及。

1.5.2 2022-12-28 10:47 UTC

README

Build Status Latest Version tagged Latest Version on Packagist Installations via composer per month

验证PHP文件、composer.json、bower.json或packages.json中的作者信息。

这有助于确保在所有PHP文件、composer.jsonbower.jsonpackages.json中提及的所有作者(从git历史记录)。

用法

composer.jsonrequire-dev部分添加

"phpcq/author-validation": "~1.0"

调用二进制文件

./vendor/bin/check-author.php

可选地传递要检查的路径

./vendor/bin/check-author.php /path/to/some/repository/also/with/subdir

配置

可选地可以传递到配置文件的路径(默认为.check-author.yml),该文件将被使用。

# Example .check-author.yml

# Map multiple authors to a single one (aliasing of contributors).
mapping:
  # original: alias
  "John Doe <john@example.org>": "John Doe <jd@example.org>"
  # or original: [multiple aliases]
  "John Doe <john@example.org>": ["John Doe <jd@example.org>", "Acme Inc <info@example.org>"]
  # or
  "John Doe <john@example.org>":
    - "John Doe <jd@example.org>"
    - "Acme Inc <info@example.org>"

# Ignore commits from these authors (equivalent to cmd line parameter --ignore=...)
ignore:
  - Build Bot <bot@example.org>

# If present, scan only these and not the whole base dir (equivalent to cmd line arguments).
# Values must either be absolute paths or relative to the current directory.
include:
  - src

# Paths to exclude from scanning (equivalent to cmd line parameter --exclude=...)
exclude:
  - Foo.php
  - /tests/*
  - */languages

# Enforce copy-left author for certain files.
copy-left:
  "John Doe <jd@example.org>": "/library"
  # or
  "John Doe <jd@example.org>": ["/library", "File.php"]
  # or
  "John Doe <jd@example.org>":
    - "File.php"
    
# Add additional author metadata. It is used by some comparator handlers when outputting diff format.
# Author metadata of the config file is prioritized over extracted metadata from the files.

metadata:
  "John Doe <jd@example.org>":
    role:     "Translator"
    homepage: "http:/www.example.org"