Skip to content

Commit b61073b

Browse files
committed
feat(Release) Created builds for 2.1.0 release
1 parent b3bea00 commit b61073b

File tree

11 files changed

+25
-63
lines changed

11 files changed

+25
-63
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches-ignore: [ master ]
1010

1111
env:
12-
version: '2.0.1'
12+
version: '2.1.0'
1313
extensions: :opcache #intl, pcov #fileinfo is needed for Windows
1414

1515
jobs:

README.md

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ At this moment, the supported tools are:
7474
* [Php Stan](https://github.com/phpstan/phpstan)
7575
* [Local PHP Security Checker](https://github.com/fabpot/local-php-security-checker)
7676

77-
But you can set your [own script](https://github.com/Wtyd/githooks/wiki/Console%20Commands#Hook) on any git hook.
77+
But you can set your [own script](https://github.com/Wtyd/githooks/wiki/Console%20Commands#set-your-own-script) on any git hook.
7878

7979
# Set the Configuration File
8080
The `githooks.yml` file is splitted on three parts:
@@ -112,61 +112,7 @@ phpcs:
112112
standard: 'PSR12'
113113
```
114114

115-
All the available options are:
116-
117-
| Option | Description | Examples |
118-
| --------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------ |
119-
| **phpstan** | | |
120-
| executablePath | String. Path to executable. Default 'phpstan' | phpstan, 'vendor/bin/phpstan', 'path/to/phpstan' |
121-
| paths | Array. Paths or files against the tool will be executed | ['./src'], ['./src', './app/MiFile.php'] |
122-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--no-progress', '--no-progress --ansi' |
123-
| config | String. Path to configuration file | 'phpstan.neon', 'path/to/phpstan.neon' |
124-
| memory-limit | String. Set the php memory limit while phpstan is running | '1M', '2000M', '1G' |
125-
| level | Integer. Default 0, max 8. | 0, 1, 5, 8 |
126-
| **parallel-lint** | | |
127-
| executablePath | String. Path to executable. Default 'parallel-lint' | parallel-lint, 'vendor/bin/parallel-lint', 'path/to/parallel-lint' |
128-
| paths | Array. Paths or files against the tool will be executed | [src], [src, './app/MiFile.php'] |
129-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--colors' |
130-
| exclude | Array. Paths or files to exclude. | [vendor], [vendor, './app/MiFile.php'] |
131-
| **phpcs** | | |
132-
| executablePath | String. Path to executable. Default 'phpcs' | phpcs, 'vendor/bin/phpcs', 'path/to/phpcs' |
133-
| paths | Array. Paths or files against the tool will be executed | [src], [src, './app/MiFile.php'] |
134-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--report=summary', '--report=summary --parallel=2' |
135-
| standard | String. Rules or configuration file with the rules. | 'PSR12', 'Squizs', 'Generic', 'PEAR', 'myrules.xml' |
136-
| ignore | Array. Paths or files to exclude. | [vendor], [vendor, './app/MiFile.php'] |
137-
| error-severity | Integer. Level of error to detect. | 1, 5 |
138-
| warning-severity | Integer. Level of warning to detect. | 5, 7, 9 |
139-
| **phpcbf** | | |
140-
| executablePath | String. Path to executable. Default 'phpcs' | phpcbf, 'vendor/bin/phpcbf', 'path/to/phpcbf' |
141-
| paths | Array. Paths or files against the tool will be executed | [src], [src, './app/MiFile.php'] |
142-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--report=summary', '--report=summary --parallel=2' |
143-
| usePhpcsConfiguration | Boolean. Grab the *phpcs* setting. Default `false` | true, false |
144-
| standard | String. Rules or configuration file with the rules. | 'PSR12', 'Squizs', 'Generic', 'PEAR', 'myrules.xml' |
145-
| ignore | Array. Paths or files to exclude. | [vendor], [vendor, './app/MiFile.php'] |
146-
| error-severity | Integer. Level of error to detect. | 1, 5 |
147-
| warning-severity | Integer. Level of warning to detect. | 5, 7, 9 |
148-
| **phpmd** | | |
149-
| executablePath | String. Path to executable. Default 'phpmd' | phpmd, 'vendor/bin/phpmd', 'path/to/phpmd' |
150-
| paths | Array. Paths or files against the tool will be executed | ['./src'], ['./src', './app/MiFile.php'] |
151-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--strict' |
152-
| rules | String. Rules or configuration file with the rules. | 'controversial,codesize', 'naming', 'myrules.xml' |
153-
| exclude | Array. Paths or files to exclude. | ['./vendor'], ['./vendor', './app/MiFile.php'] |
154-
| **phpcpd** | | |
155-
| executablePath | String. Path to executable. Default 'phpcpd' | phpcpd, 'vendor/bin/phpcpd', 'path/to/phpcpd' |
156-
| paths | Array. Paths or files against the tool will be executed | [src], [src, './app/MiFile.php'] |
157-
| exclude | Array. Paths or files to exclude. | [vendor], [vendor, './app/MiFile.php'] |
158-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '--min-lines=5' |
159-
| **security-checker** | | |
160-
| executablePath | String. Path to executable. Default 'local-php-security-checker' | local-php-security-checker, 'path/to/local-php-security-checker' |
161-
| otherArguments | String. Flags or arguments that are not covered in GitHooks | '-format json' |
162-
163-
164-
These are the options supported by GitHooks. Obviously, each tool has many other options. More precise configuration is possible with each tool configuration file.
165-
166-
Many of the options are *optional* as long as the tool has a properly established configuration file. The `conf:init` command copies a githooks.yml file template to the root of the project with all the options commented of each the tool. To make sure that when you finish configuring it, all the options are valid, you can launch the command `conf:check`:
167-
<p>
168-
<img src="https://i.ibb.co/Qfjf0vv/Git-Hooks-Conf.png" alt="conf:check">
169-
</p>
115+
All the available options are in the [wiki](https://github.com/Wtyd/githooks/wiki/ConfigurationFile).
170116

171117
# Contributing
172118
Contributions from others would be very much appreciated! Send pull [request](https://github.com/Wtyd/githooks/pulls)/[issue](https://github.com/Wtyd/githooks/issues). Check all steps for do that at Wiki section for [Contributing](https://github.com/Wtyd/githooks/wiki/Contributing). Thanks!

app/Commands/CreateHookCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public function handle()
6868
try {
6969
$destiny = "{$this->root}/.git/hooks/{$this->hook}";
7070

71+
if (file_exists($destiny)) {
72+
unlink($destiny);
73+
}
7174
copy($origin, $destiny);
7275
chmod($destiny, 0755);
7376
$this->printer->success("Hook {$this->hook} created");

builds/githooks

75 KB
Binary file not shown.

builds/php7.1/githooks

31.9 KB
Binary file not shown.

qa/phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
ignoreErrors: [
1111
'#Call to an undefined static method Illuminate\\Support\\Facades\\Storage::[a-zA-Z\\_]+\(\)#',
1212
'#Method Wtyd\\GitHooks\\ConfigurationFile\\Exception\\WrongExecutionValueException::[a-zA-Z0-9\\_]+\(\) has parameter \$executionValue with no typehint specified.#',
13+
'#Parameter \#1 \$version1 of function version_compare expects string, string\|false given.#' # phpversion returns string|false
1314
# '#Method [a-zA-Z0-9\\_]+ToolConfigurationFactory::create\(\) has parameter \$toolData with no typehint specified.#'
1415
# '#Method [a-zA-Z0-9\\_]+Command::handle\(\)#',
1516
# '#Property [a-zA-Z0-9\\_]+Command::\$root \(string\) does not accept string\|false.#'

src/Utils/ComposerUpdater.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ class ComposerUpdater
1515
*/
1616
public static function php72orMinorUpdate()
1717
{
18+
$printer = new Printer();
19+
if (version_compare(phpversion(), '7.3.0', '>=')) {
20+
$printer->info('For php 7.3 or higher is not needed');
21+
return;
22+
}
23+
1824
$rootPaht = getcwd();
1925
$origin = "$rootPaht/vendor/wtyd/githooks/builds/php7.1/githooks";
2026
$destiny = "$rootPaht/vendor/bin/githooks";
2127
if (file_exists($destiny)) {
2228
unlink($destiny);
2329
}
2430

25-
$printer = new Printer();
2631
try {
2732
copy($origin, $destiny);
33+
chmod($destiny, 0755);
2834
$printer->info('GitHooks was correctly installed');
2935
} catch (\Throwable $th) {
3036
$printer->error('Something went wrong');

tests/System/Release/CreateConfigurationFileTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class CreateConfigurationFileTest extends ReleaseTestCase
1212
/** @test */
1313
function it_creates_the_configuration_file_and_returns_exit_code_0()
1414
{
15+
$this->deleteDirStructure('vendor/wtyd');
16+
1517
mkdir('vendor/wtyd/githooks/qa/', 0777, true);
1618
file_put_contents(
1719
'vendor/wtyd/githooks/qa/githooks.dist.yml',

tests/System/Release/ExecuteToolTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ function it_returns_exit_0_when_executes_all_tools_and_all_pass($executionModeAr
4242
{
4343
file_put_contents(
4444
'githooks.yml',
45-
$this->configurationFileBuilder->setTools(['phpcs', 'parallel-lint', 'phpmd', 'phpcpd', 'phpstan'])
45+
$this->configurationFileBuilder->setTools(['phpcs', 'phpcbf', 'parallel-lint', 'phpmd', 'phpcpd', 'phpstan'])
4646
->setOptions($executionModeFile)
4747
->buildYalm()
4848
);
4949
passthru("$this->githooks tool all $executionModeArgument", $exitCode);
5050

5151
$this->assertEquals(0, $exitCode);
52+
$this->assertToolHasBeenExecutedSuccessfully('phpcs');
5253
$this->assertToolHasBeenExecutedSuccessfully('phpcbf');
5354
$this->assertToolHasBeenExecutedSuccessfully('parallel-lint');
5455
$this->assertToolHasBeenExecutedSuccessfully('phpmd');
@@ -78,7 +79,7 @@ function it_executes_all_tools_with_fast_execution_mode($executionModeArgument,
7879
{
7980
file_put_contents(
8081
'githooks.yml',
81-
$this->configurationFileBuilder->setTools(['phpcs', 'parallel-lint', 'phpmd', 'phpcpd', 'phpstan'])
82+
$this->configurationFileBuilder->setTools(['phpcs', 'phpcbf', 'parallel-lint', 'phpmd', 'phpcpd', 'phpstan'])
8283
->setOptions($executionModeFile)
8384
->buildYalm()
8485
);
@@ -97,6 +98,7 @@ function it_executes_all_tools_with_fast_execution_mode($executionModeArgument,
9798
shell_exec("git reset -- $fileWithoutErrorsPath");
9899

99100
$this->assertEquals(1, $exitCode);
101+
$this->assertToolHasBeenExecutedSuccessfully('phpcs');
100102
$this->assertToolHasBeenExecutedSuccessfully('phpcbf');
101103
$this->assertToolHasBeenExecutedSuccessfully('parallel-lint');
102104
$this->assertToolHasBeenExecutedSuccessfully('phpmd');
@@ -109,7 +111,7 @@ function it_returns_1_when_phpcs_finds_bugs_and_fixes_them_automatically()
109111
{
110112
file_put_contents(
111113
'githooks.yml',
112-
$this->configurationFileBuilder->setTools(['phpcs'])
114+
$this->configurationFileBuilder->setTools(['phpcbf'])
113115
->buildYalm()
114116
);
115117

tests/System/Release/NewVersionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function it_prints_the_new_version()
2323
{
2424
passthru("$this->githooks --version", $exitCode);
2525

26-
$newVersion = '2.0.1';
26+
$newVersion = '2.1.0';
2727
$this->assertStringContainsString("GitHooks $newVersion", $this->getActualOutput());
2828
$this->assertEquals(0, $exitCode);
2929
}

0 commit comments

Comments
 (0)