Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/Support/PhpCodeSniffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ private function process(string $tool, array $params = []): int
define('PHP_CODESNIFFER_CBF', $tool === 'runPHPCBF');
}

$cwd = str_replace('\\', '/', getcwd());

$ignore = $this->dusterConfig->get('exclude')
? ['--ignore=' . implode(',', $this->dusterConfig->get('exclude'))]
? ['--ignore=' . implode(',',
Comment thread
indykoning marked this conversation as resolved.
array_map(fn ($path) => str_contains($path, $cwd) ? $path : $cwd . '/*' . $path, $this->dusterConfig->get('exclude')))]
: [];

$_SERVER['argv'] = [
Expand Down
26 changes: 26 additions & 0 deletions tests/Feature/BuildProjectDirectoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

it('lints reports issues when running inside a build project directory with issues', function () {
chdir(__DIR__ . '/../Fixtures/BuildProjectDirectoryIssues/build');

[$statusCode, $output] = run('lint', [
'path' => base_path('tests/Fixtures/BuildProjectDirectoryIssues/build'),
]);

expect($statusCode)->toBe(1)
->and($output)
->toContain('Linting using Pint')
->toContain('concat_space');
});

it('lints when running inside a build project directory', function () {
chdir(__DIR__ . '/../Fixtures/BuildProjectDirectoryNoIssues/build');

[$statusCode, $output] = run('lint', [
'path' => base_path('tests/Fixtures/BuildProjectDirectoryNoIssues/build'),
]);

expect($statusCode)->toBe(0)
->and($output)
->toContain('Linting using Pint');
});
3 changes: 3 additions & 0 deletions tests/Fixtures/BuildProjectDirectoryIssues/build/file.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$a = 'b'.'c';
3 changes: 3 additions & 0 deletions tests/Fixtures/BuildProjectDirectoryNoIssues/build/file.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$a = 'b' . 'c';