diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..61c19cd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,28 @@ +# +# Exclude these files from release archives. +# This will also make them unavailable when using Composer with `--prefer-dist`. +# If you develop for this repo using Composer, use `--prefer-source`. +# https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production +# https://blog.madewithlove.be/post/gitattributes/ +# +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/appveyor.yml export-ignore +/box.json export-ignore +/doc export-ignore +/phpcs.xml.dist export-ignore +/phpcs-ruleset.xml export-ignore +/tests export-ignore + +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +# +* text=auto + +# +# The above will handle all files NOT found below +# +*.md text +*.php text diff --git a/.travis.yml b/.travis.yml index ddbdc94..8b13987 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,13 @@ matrix: - php: 7.2 - php: 7.3 - php: 7.4 + - php: "nightly" -sudo: false + fast_finish: true + + allow_failures: + # Allow failures for unstable builds. + - php: "nightly" install: - composer install --no-interaction --prefer-source diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e544f1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [Unreleased] + +## [1.2.0] - 2020-04-04 + +### Added + +- Added changelog. + +### Fixed + +- Fixed vendor location for running from other folder from [@Erkens](https://github.com/Erkens). + +### Internal + +- Added a .gitattributes file from [@jrfnl](https://github.com/jrfnl), thanks for issue to [@ondrejmirtes](https://github.com/ondrejmirtes). +- Fixed incorrect unit tests from [@jrfnl](https://github.com/jrfnl). +- Fixed minor grammatical errors from [@jrfnl](https://github.com/jrfnl). +- Added Travis: test against nightly (= PHP 8) from [@jrfnl](https://github.com/jrfnl). +- Travis: removed sudo from [@jrfnl](https://github.com/jrfnl). +- Added info about installing like not a dependency. +- Cleaned readme - new organization from previous package. +- Added checklist for new version from [@szepeviktor](https://github.com/szepeviktor). diff --git a/README.md b/README.md index d95ff2a..446428d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # PHP Parallel Lint -[![Downloads this Month](https://img.shields.io/packagist/dm/grogy/php-parallel-lint.svg)](https://packagist.org/packages/grogy/php-parallel-lint) -[![Build Status](https://travis-ci.org/grogy/PHP-Parallel-Lint.svg?branch=master)](https://travis-ci.org/grogy/PHP-Parallel-Lint) -[![License](https://poser.pugx.org/grogy/php-parallel-lint/license.svg)](https://packagist.org/packages/grogy/php-parallel-lint) +[![Downloads this Month](https://img.shields.io/packagist/dm/php-parallel-lint/php-parallel-lint.svg)](https://packagist.org/packages/php-parallel-lint/php-parallel-lint) +[![Build Status](https://travis-ci.org/php-parallel-lint/PHP-Parallel-Lint.svg?branch=master)](https://travis-ci.org/php-parallel-lint/PHP-Parallel-Lint) +[![License](https://poser.pugx.org/php-parallel-lint/php-parallel-lint/license.svg)](https://packagist.org/packages/php-parallel-lint/php-parallel-lint) This tool checks syntax of PHP files faster than serial check with a fancier output. Running parallel jobs in PHP is inspired by Nette framework tests. @@ -23,11 +23,16 @@ This works from PHP 5.4 to 7.4 Just run the following command to install it: - composer require --dev grogy/php-parallel-lint + composer require --dev php-parallel-lint/php-parallel-lint -For colored output also install the suggested package `jakub-onderka/php-console-highlighter`: +When you cannot use tool as dependency then you can install as project. Command for it: - composer require --dev jakub-onderka/php-console-highlighter + composer create-project php-parallel-lint/php-parallel-lint /path/to/folder/php-parallel-lint + /path/to/folder/php-parallel-lint/parallel-lint # running tool + +For colored output also install the suggested package `php-parallel-lint/php-console-highlighter`: + + composer require --dev php-parallel-lint/php-console-highlighter ## Example output @@ -86,4 +91,4 @@ and then run this command in parallel lint folder, which creates `parallel-lint. Are you using original package? You can easy use this fork. Steps for upgrade are: composer remove --dev jakub-onderka/php-parallel-lint - composer require --dev grogy/php-parallel-lint + composer require --dev php-parallel-lint/php-parallel-lint diff --git a/composer.json b/composer.json index 04a713a..3c90b69 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "grogy/php-parallel-lint", + "name": "php-parallel-lint/php-parallel-lint", "description": "This tool check syntax of PHP files about 20x faster than serial check.", - "homepage": "https://github.com/grogy/PHP-Parallel-Lint", + "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", "license": "BSD-2-Clause", "require": { "php": ">=5.4.0", @@ -9,11 +9,11 @@ }, "require-dev": { "nette/tester": "^1.3 || ^2.0", - "jakub-onderka/php-console-highlighter": "~0.3", + "php-parallel-lint/php-console-highlighter": "~0.3", "squizlabs/php_codesniffer": "~3.0" }, "suggest": { - "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" + "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" }, "authors": [ { @@ -26,5 +26,9 @@ "./" ] }, - "bin": ["parallel-lint"] + "bin": ["parallel-lint"], + "replace": { + "jakub-onderka/php-parallel-lint": "*", + "grogy/php-parallel-lint": "*" + } } diff --git a/doc/new-release.md b/doc/new-release.md new file mode 100644 index 0000000..8debb68 --- /dev/null +++ b/doc/new-release.md @@ -0,0 +1,11 @@ +# Checklist for new release + +1. change version in `src/Application.php` +2. change version and date in `CHANGELOG.md` +3. add new Git tag +4. create [new release on GitHub](https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases) with summary of important changes with respect to last version +5. to Github release add diff link, e.g. + +``` +For the details you can have a look at the [diff](https://github.com/php-parallel-lint/PHP-Parallel-Lint/compare/v1.0.0...v1.1.0). +``` diff --git a/parallel-lint b/parallel-lint index ea93fff..0d77fdb 100755 --- a/parallel-lint +++ b/parallel-lint @@ -38,8 +38,10 @@ if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50400) { $autoloadLocations = [ getcwd() . '/vendor/autoload.php', getcwd() . '/../../autoload.php', + __DIR__ . '/vendor/autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php', + __DIR__ . '/../../autoload.php', ]; $loaded = false; diff --git a/src/Application.php b/src/Application.php index 4151579..4517083 100644 --- a/src/Application.php +++ b/src/Application.php @@ -4,7 +4,7 @@ class Application { - const VERSION = '1.0.0'; + const VERSION = '1.2.0'; // Return codes const SUCCESS = 0, @@ -18,7 +18,7 @@ class Application public function run() { if (in_array('proc_open', explode(',', ini_get('disable_functions')))) { - echo "Function 'proc_open' is required, but it is disabled by disable_functions setting.", PHP_EOL; + echo "Function 'proc_open' is required, but it is disabled by the 'disable_functions' ini setting.", PHP_EOL; return self::FAILED; } diff --git a/src/ParallelLint.php b/src/ParallelLint.php index fcb4cb9..8c12a73 100644 --- a/src/ParallelLint.php +++ b/src/ParallelLint.php @@ -119,7 +119,7 @@ public function lint(array $files) foreach ($waiting as $file => $process) { $skipStatus = $skipLintProcess->isSkipped($file); if ($skipStatus === null) { - throw new \Exception("File $file has empty skip status. Please contact PHP Parallel Lint author."); + throw new \Exception("File $file has empty skip status. Please contact the author of PHP Parallel Lint."); } else if ($skipStatus === true) { $skippedFiles[] = $file; diff --git a/src/Process/GitBlameProcess.php b/src/Process/GitBlameProcess.php index f5c0a45..2d675b8 100644 --- a/src/Process/GitBlameProcess.php +++ b/src/Process/GitBlameProcess.php @@ -33,7 +33,7 @@ public function isSuccess() public function getAuthor() { if (!$this->isSuccess()) { - throw new RunTimeException("Author can be taken only for success process output."); + throw new RunTimeException("Author can only be retrieved for successful process output."); } $output = $this->getOutput(); @@ -48,7 +48,7 @@ public function getAuthor() public function getAuthorEmail() { if (!$this->isSuccess()) { - throw new RunTimeException("Author e-mail can be taken only for success process output."); + throw new RunTimeException("Author e-mail can only be retrieved for successful process output."); } $output = $this->getOutput(); @@ -63,7 +63,7 @@ public function getAuthorEmail() public function getAuthorTime() { if (!$this->isSuccess()) { - throw new RunTimeException("Author time can be taken only for success process output."); + throw new RunTimeException("Author time can only be retrieved for successful process output."); } $output = $this->getOutput(); @@ -84,7 +84,7 @@ public function getAuthorTime() public function getCommitHash() { if (!$this->isSuccess()) { - throw new RunTimeException("Commit hash can be taken only for success process output."); + throw new RunTimeException("Commit hash can only be retrieved for successful process output."); } return substr($this->getOutput(), 0, strpos($this->getOutput(), ' ')); @@ -97,7 +97,7 @@ public function getCommitHash() public function getSummary() { if (!$this->isSuccess()) { - throw new RunTimeException("Commit summary can be taken only for success process output."); + throw new RunTimeException("Commit summary can only be retrieved for successful process output."); } $output = $this->getOutput(); diff --git a/src/Process/LintProcess.php b/src/Process/LintProcess.php index 55eec99..e2e6b2d 100644 --- a/src/Process/LintProcess.php +++ b/src/Process/LintProcess.php @@ -80,7 +80,7 @@ public function getSyntaxError() } } - throw new RunTimeException("The output '{$this->getOutput()}' does not contains Parse or Syntax error"); + throw new RunTimeException("The output '{$this->getOutput()}' does not contain Parse or Syntax errors"); } return false; diff --git a/tests/Settings.parseArguments.phpt b/tests/Settings.parseArguments.phpt index 3d72fc6..60aa7c6 100644 --- a/tests/Settings.parseArguments.phpt +++ b/tests/Settings.parseArguments.phpt @@ -90,7 +90,7 @@ class SettingsParseArgumentsTest extends Tester\TestCase $expectedSettings = new Settings(); $expectedSettings->showProgress = false; - Assert::equal($expectedSettings->colors, $settings->colors); + Assert::equal($expectedSettings->showProgress, $settings->showProgress); } public function testJsonOutput()