phpcq / author-validation
Check if all authors of a particular file are mentioned in the copyright header.
Fund package maintenance!
discordier
dmolineus
Installs: 42 554
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 3
Open Issues: 3
Requires
- php: ^5.6 || ^7.1
- ext-json: *
- ext-posix: *
- bit3/git-php: ^1.5
- cache/doctrine-adapter: ^1.0
- doctrine/cache: ^1.5
- phpspec/php-diff: ^1.0
- sebastian/phpcpd: ^3.0 || ^4.1 || ^5.0 || ^6.0
- symfony/console: ^3.0 || ^4.0 || ^5.0
- symfony/finder: ^3.0 || ^4.0 || ^5.0
- symfony/process: ^3.0 || ^4.0 || ^5.0
- symfony/yaml: ^3.0 || ^4.0 || ^5.0
Requires (Dev)
- phpcq/all-tasks: ^1.3
README
Validate the author information within PHP files, composer.json, bower.json or packages.json.
This is useful to ensure that all authors (from git history) mentioned in all PHP files, the composer.json
,
bower.json
and packages.json
.
Usage
Add to your composer.json
in the require-dev
section:
"phpcq/author-validation": "~1.0"
Call the binary:
./vendor/bin/check-author.php
Optionally pass a path to check:
./vendor/bin/check-author.php /path/to/some/repository/also/with/subdir
Configuration
Optionally you can pass the path to a config file (defaults to .check-author.yml) which shall be used.
# 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"