Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude component vendor folder from snippet coverage #1168

Merged
merged 2 commits into from
Jul 10, 2018
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
2 changes: 1 addition & 1 deletion Core/src/Testing/FileListFilterIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function accept()
if ($exclude instanceof RegexFileFilter) {
$pattern = $exclude->regex;

if (preg_match('/'. $pattern .'/', $path) === 1) {
if (preg_match($pattern, $path) === 1) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace Google\Cloud\Dev\DocGenerator;
namespace Google\Cloud\Core\Testing;

/**
* A regex exclude path
Expand Down
7 changes: 6 additions & 1 deletion Core/src/Testing/TestHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Google\Cloud\Core\Testing;

use Google\Cloud\Core\Testing\RegexFileFilter;
use Google\Cloud\Core\Testing\Snippet\Container;
use Google\Cloud\Core\Testing\Snippet\Coverage\Coverage;
use Google\Cloud\Core\Testing\Snippet\Coverage\ExcludeFilter;
Expand Down Expand Up @@ -109,7 +110,11 @@ public static function snippetBootstrap()
putenv('GOOGLE_APPLICATION_CREDENTIALS='. \Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE());

$parser = new Parser;
$scanner = new Scanner($parser, self::projectRoot(), ['/vendor/', '/dev/']);
$scanner = new Scanner($parser, self::projectRoot(), [
'/vendor/',
'/dev/',
new RegexFileFilter('/\w{0,}\/vendor\//')
]);
$coverage = new Coverage($scanner);
$coverage->buildListToCover();

Expand Down
1 change: 0 additions & 1 deletion dev/src/DocGenerator/Command/Docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Dev\Command\GoogleCloudCommand;
use Google\Cloud\Dev\DocGenerator\DocGenerator;
use Google\Cloud\Dev\DocGenerator\GuideGenerator;
use Google\Cloud\Dev\DocGenerator\RegexFileFilter;
use Google\Cloud\Dev\DocGenerator\TableOfContents;
use Google\Cloud\Dev\DocGenerator\TypeGenerator;
use Google\Cloud\Dev\GetComponentsTrait;
Expand Down