feat: use CI variables to detect project path #1092
mt-annotations.yaml
on: pull_request
Matrix: tests
Annotations Status
0s
Annotations
3 warnings
Mutation Testing Code Review Annotations 8.1
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/cache@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Mutation Testing Code Review Annotations 8.1:
src/Logger/GitHubAnnotationsLogger.php#L60
Escaped Mutant for Mutator "FalseValue":
--- Original
+++ New
@@ @@
public function getLogLines(): array
{
$lines = [];
- if (($projectRootDirectory = getenv('GITHUB_WORKSPACE')) === false) {
+ if (($projectRootDirectory = getenv('GITHUB_WORKSPACE')) === true) {
$projectRootDirectory = trim(shell_exec('git rev-parse --show-toplevel'));
}
foreach ($this->resultsCollector->getEscapedExecutionResults() as $escapedExecutionResult) {
|
Mutation Testing Code Review Annotations 8.1:
src/Logger/GitLabCodeQualityLogger.php#L61
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
{
$lines = [];
if (($projectRootDirectory = getenv('CI_PROJECT_DIR')) === false) {
- $projectRootDirectory = trim(shell_exec('git rev-parse --show-toplevel'));
+ $projectRootDirectory = shell_exec('git rev-parse --show-toplevel');
}
foreach ($this->resultsCollector->getEscapedExecutionResults() as $escapedExecutionResult) {
$lines[] = ['type' => 'issue', 'fingerprint' => $escapedExecutionResult->getMutantHash(), 'check_name' => $escapedExecutionResult->getMutatorName(), 'description' => 'Escaped Mutant for Mutator ' . $escapedExecutionResult->getMutatorName(), 'content' => Str::convertToUtf8(Str::trimLineReturns($escapedExecutionResult->getMutantDiff())), 'categories' => ['Escaped Mutant'], 'location' => ['path' => Path::makeRelative($escapedExecutionResult->getOriginalFilePath(), $projectRootDirectory), 'lines' => ['begin' => $escapedExecutionResult->getOriginalStartingLine()]], 'severity' => 'major'];
|