updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -33,7 +33,7 @@ abstract class AbstractNode implements Countable
private readonly ?AbstractNode $parent;
private string $id;
public function __construct(string $name, self $parent = null)
public function __construct(string $name, ?self $parent = null)
{
if (str_ends_with($name, DIRECTORY_SEPARATOR)) {
$name = substr($name, 0, -1);
@@ -131,7 +131,7 @@ abstract class AbstractNode implements Countable
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedBranches(),
$this->numberOfExecutableBranches()
$this->numberOfExecutableBranches(),
);
}
@@ -139,7 +139,7 @@ abstract class AbstractNode implements Countable
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedPaths(),
$this->numberOfExecutablePaths()
$this->numberOfExecutablePaths(),
);
}
@@ -45,13 +45,13 @@ final class Builder
$commonPath = $this->reducePaths($data);
$root = new Directory(
$commonPath,
null
null,
);
$this->addItems(
$root,
$this->buildDirectoryStructure($data),
$coverage->getTests()
$coverage->getTests(),
);
return $root;
@@ -80,8 +80,8 @@ final class Builder
$this->analyser->classesIn($filename),
$this->analyser->traitsIn($filename),
$this->analyser->functionsIn($filename),
$this->analyser->linesOfCodeFor($filename)
)
$this->analyser->linesOfCodeFor($filename),
),
);
}
} else {
@@ -37,7 +37,7 @@ final class CrapIndex
return sprintf(
'%01.2F',
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity,
);
}
}
@@ -76,7 +76,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
{
return new RecursiveIteratorIterator(
new Iterator($this),
RecursiveIteratorIterator::SELF_FIRST
RecursiveIteratorIterator::SELF_FIRST,
);
}
@@ -122,7 +122,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->classes = array_merge(
$this->classes,
$child->classes()
$child->classes(),
);
}
}
@@ -138,7 +138,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->traits = array_merge(
$this->traits,
$child->traits()
$child->traits(),
);
}
}
@@ -154,7 +154,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->functions = array_merge(
$this->functions,
$child->functions()
$child->functions(),
);
}
}
@@ -177,8 +177,8 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$childLinesOfCode = $child->linesOfCode();
$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['nonCommentLinesOfCode'] += $childLinesOfCode['nonCommentLinesOfCode'];
}
}
@@ -487,14 +487,14 @@ final class File extends AbstractNode
$this->classes[$className]['methods'][$methodName] = $methodData;
$this->classes[$className]['executableBranches'] += $methodData['executableBranches'];
$this->classes[$className]['executedBranches'] += $methodData['executedBranches'];
$this->classes[$className]['executablePaths'] += $methodData['executablePaths'];
$this->classes[$className]['executedPaths'] += $methodData['executedPaths'];
$this->classes[$className]['executedBranches'] += $methodData['executedBranches'];
$this->classes[$className]['executablePaths'] += $methodData['executablePaths'];
$this->classes[$className]['executedPaths'] += $methodData['executedPaths'];
$this->numExecutableBranches += $methodData['executableBranches'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
foreach (range($method['startLine'], $method['endLine']) as $lineNumber) {
$this->codeUnitsByLine[$lineNumber] = [
@@ -536,14 +536,14 @@ final class File extends AbstractNode
$this->traits[$traitName]['methods'][$methodName] = $methodData;
$this->traits[$traitName]['executableBranches'] += $methodData['executableBranches'];
$this->traits[$traitName]['executedBranches'] += $methodData['executedBranches'];
$this->traits[$traitName]['executablePaths'] += $methodData['executablePaths'];
$this->traits[$traitName]['executedPaths'] += $methodData['executedPaths'];
$this->traits[$traitName]['executedBranches'] += $methodData['executedBranches'];
$this->traits[$traitName]['executablePaths'] += $methodData['executablePaths'];
$this->traits[$traitName]['executedPaths'] += $methodData['executedPaths'];
$this->numExecutableBranches += $methodData['executableBranches'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
foreach (range($method['startLine'], $method['endLine']) as $lineNumber) {
$this->codeUnitsByLine[$lineNumber] = [
@@ -587,7 +587,7 @@ final class File extends AbstractNode
if (isset($this->functionCoverageData[$functionName]['branches'])) {
$this->functions[$functionName]['executableBranches'] = count(
$this->functionCoverageData[$functionName]['branches']
$this->functionCoverageData[$functionName]['branches'],
);
$this->functions[$functionName]['executedBranches'] = count(
@@ -596,14 +596,14 @@ final class File extends AbstractNode
static function (array $branch)
{
return (bool) $branch['hit'];
}
)
},
),
);
}
if (isset($this->functionCoverageData[$functionName]['paths'])) {
$this->functions[$functionName]['executablePaths'] = count(
$this->functionCoverageData[$functionName]['paths']
$this->functionCoverageData[$functionName]['paths'],
);
$this->functions[$functionName]['executedPaths'] = count(
@@ -612,15 +612,15 @@ final class File extends AbstractNode
static function (array $path)
{
return (bool) $path['hit'];
}
)
},
),
);
}
$this->numExecutableBranches += $this->functions[$functionName]['executableBranches'];
$this->numExecutedBranches += $this->functions[$functionName]['executedBranches'];
$this->numExecutablePaths += $this->functions[$functionName]['executablePaths'];
$this->numExecutedPaths += $this->functions[$functionName]['executedPaths'];
$this->numExecutedBranches += $this->functions[$functionName]['executedBranches'];
$this->numExecutablePaths += $this->functions[$functionName]['executablePaths'];
$this->numExecutedPaths += $this->functions[$functionName]['executedPaths'];
}
}
@@ -653,7 +653,7 @@ final class File extends AbstractNode
if (isset($this->functionCoverageData[$key]['branches'])) {
$methodData['executableBranches'] = count(
$this->functionCoverageData[$key]['branches']
$this->functionCoverageData[$key]['branches'],
);
$methodData['executedBranches'] = count(
@@ -662,14 +662,14 @@ final class File extends AbstractNode
static function (array $branch)
{
return (bool) $branch['hit'];
}
)
},
),
);
}
if (isset($this->functionCoverageData[$key]['paths'])) {
$methodData['executablePaths'] = count(
$this->functionCoverageData[$key]['paths']
$this->functionCoverageData[$key]['paths'],
);
$methodData['executedPaths'] = count(
@@ -678,8 +678,8 @@ final class File extends AbstractNode
static function (array $path)
{
return (bool) $path['hit'];
}
)
},
),
);
}