Skip to content

Commit

Permalink
Merge pull request #148 from szepeviktor/typos
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
DaveLiddament authored Jan 4, 2025
2 parents de2f1c1 + cc28ece commit b3c10d1
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,19 @@ That's no problem there are 3 methods to [integrate a static analysis tool](docs
## Output formats

The format for showing issues after the baseline is removed can be specified using `--output-format` option.
Possible values are: `table`, `text`, `json` or `github` (for Github actions).
Possible values are: `table`, `text`, `json` or `github` (for GitHub actions).

## Ignoring warnings

Some static analysis tools (e.g. PHP Code Sniffer) classify issues wth a severity or either `error` or `warning`.
Some static analysis tools (e.g. PHP Code Sniffer) classify issues with a severity or either `error` or `warning`.
By default, SARB will report all of these. If you wish to ignore warnings you can use the `--ignore-warnings` option.

E.g.
```shell
vendor/bin/phpcs src --report=json | vendor/bin/sarb remove phpcs.baseline --ignore-warnings
```

## SARB with Github Actions
## SARB with GitHub Actions

If you're using `actions/checkout@v2` to check out your code you'll need to add set `fetch-depth` to `0`.
By default `checkout` only gets that latest state of the code and none of the history.
Expand Down
2 changes: 1 addition & 1 deletion docs/HowSarbWorks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SARB does 2 main tasks.

- Create baseline.
- Remove baseline results from static analysis results run after tha baseline.
- Remove baseline results from static analysis results run after the baseline.

SARB with the help of an SCM (by default git) tracks the lines of code between the baseline and the current commit.

Expand Down
10 changes: 5 additions & 5 deletions docs/NewResultsParser.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The next thing to do is to create an implementation of a ResultsParser. The exam

#### Method: getIdentifier

The first method to implement is `getIdentifer` this just returns an instance of the relevant `Identifer`class.
The first method to implement is `getIdentifier` this just returns an instance of the relevant `Identifier`class.

```php
declare(strict_types=1);
Expand All @@ -99,7 +99,7 @@ class PsalmJsonResultsParser implements ResultsParser

public function getIdentifier(): Identifier
{
return new PsalmJsonIdetifier();
return new PsalmJsonIdentifier();
}

}
Expand Down Expand Up @@ -285,7 +285,7 @@ SARB needs to pull out:
**NOTES:**

1. `Type` must refer to the type of violation (e.g. `MissingConstructor`). See more about this at [How SARB works](HowSarbWorks.md)
1. Ideally the file path should be the absolute path. SARB stores the relative path in the baseline file, but the HistoryAnalyser needs the absolute path. If the static analysis tool does not provide an absoute path then a relative path can be used, see [using a relative path](#using-relative-paths).
1. Ideally the file path should be the absolute path. SARB stores the relative path in the baseline file, but the HistoryAnalyser needs the absolute path. If the static analysis tool does not provide an absolute path then a relative path can be used, see [using a relative path](#using-relative-paths).
2.
Here is the code to pull the information from the array:

Expand All @@ -302,14 +302,14 @@ This allows tool specific output formatters to be written to output additional i
E.g. PHP-CS gives additional fields e.g. is_fixable. If this data needs to be shown to end user then a custom output formatter could be written to give all this additional information.


SARB needs to capture all ths information and create an `AnalysisResult`.
SARB needs to capture all this information and create an `AnalysisResult`.
```php
$location = new Location(
new AbsoluteFileName($fileNameAsString),
$projectRoot,
new LineNumber($lineAsInt)
);

$severity = ($severityAsString === 'error') ? Severity::error() : Severity::warning();

$analysisResult = new AnalysisResult(
Expand Down
2 changes: 1 addition & 1 deletion docs/SarbVsOtherBaseliningTechniques.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Rerunning PHPStan with its baseline gives only the newly introduced issues:

SARB highlights the same issues:

**SARB ouput**
**SARB output**
```
Latest analysis issue count: 4
Baseline issue count: 2
Expand Down
2 changes: 1 addition & 1 deletion docs/ViolationTypeClassificationGuessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ E.g.
- Message: `Demo\Employee has an uninitialized variable $this->age, but no constructor`

Sometimes static analysis tools only provide a message and no classification.
The problem with using the message is that between builds the mesage might change
The problem with using the message is that between builds the message might change
but the fundamental violation remains the same.

E.g. Assume `Demo\Employee` was renamed to `Demo\Person` between builds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function processLine(string $line): State

private function processAsRename(string $line): State
{
$orginalFileName = StringUtils::removeFromStart(self::RENAME_FROM, $line);
$this->fileMutationBuilder->setOriginalFileName(new OriginalFileName($orginalFileName));
$originalFileName = StringUtils::removeFromStart(self::RENAME_FROM, $line);
$this->fileMutationBuilder->setOriginalFileName(new OriginalFileName($originalFileName));

return new FindRenameToState($this->fileMutationBuilder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function processViolationsInFile(
* @throws InvalidPathException
*/
private function processViolation(
AbsoluteFileName $aboluteFileName,
AbsoluteFileName $absoluteFileName,
ProjectRoot $projectRoot,
array $violation,
): AnalysisResult {
Expand All @@ -109,7 +109,7 @@ private function processViolation(
$lineAsInt = ArrayUtils::getIntValue($violation, 'beginLine');

$location = Location::fromAbsoluteFileName(
$aboluteFileName,
$absoluteFileName,
$projectRoot,
new LineNumber($lineAsInt),
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function testHappyPath(): void
$this->removeTestDirectory();
}

public function testRelativePathFlagHasNoAffectWhenUsingAbsolutPaths(): void
public function testRelativePathFlagHasNoAffectWhenUsingAbsolutePaths(): void
{
$this->createTestDirectory();
$this->gitWrapper->init($this->projectRoot);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Core/Analyser/BaseLineResultsRemoveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testRemoveBaseLineResults(): void
$this->assertTrue($expectedType->isEqual($actualAnalysisResult->getType()));
}

public function testRemoveBaseLineResultsIngnoringWarnings(): void
public function testRemoveBaseLineResultsIgnoringWarnings(): void
{
$prunedAnalysisResults = $this->baseLineResultsRemover->pruneBaseLine(
$this->latestAnalysisResults,
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Core/File/FileReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testReadInvalidJsonFile(): void

public function testReadInvalidFile(): void
{
$fileName = $this->getFileName('none-existant-file.json');
$fileName = $this->getFileName('non-existent-file.json');
$this->expectException(FileAccessException::class);
$this->fileReader->readJsonFile($fileName);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Framework/Command/MockBaseLineCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
private ResultsParser $expectedResultsParser,
private BaseLineFileName $expectedBaseLineFileName,
private ?ProjectRoot $expectedProjectRoot,
private string $expectedAnaylsisResultsAsString,
private string $expectedAnalysisResultsAsString,
private ?\Throwable $throwable,
) {
}
Expand All @@ -47,7 +47,7 @@ public function createBaseLine(
);
}

$this->assertSameAllowingExtraNewLine($this->expectedAnaylsisResultsAsString, $analysisResultsAsString);
$this->assertSameAllowingExtraNewLine($this->expectedAnalysisResultsAsString, $analysisResultsAsString);

if (null !== $this->throwable) {
throw $this->throwable;
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Framework/Command/RemoveBaseLineCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ final class RemoveBaseLineCommandTest extends TestCase
/**
* @var OutputFormatter
*/
private $defaultOutputFormater;
private $defaultOutputFormatter;
/**
* @var OutputFormatter
*/
private $stubOutputFormatter;

protected function setUp(): void
{
$this->defaultOutputFormater = new TableOutputFormatter();
$this->defaultOutputFormatter = new TableOutputFormatter();
$this->stubOutputFormatter = new OutputFormatterStub();

$this->outputFormatterRegistry = new OutputFormatterRegistry([
$this->defaultOutputFormater,
$this->defaultOutputFormatter,
$this->stubOutputFormatter,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testNewHistoryAnalyser(): void
$this->assertInstanceOf(DiffHistoryAnalyser::class, $diffHistoryAnalyser);
}

public function testGetIdentifer(): void
public function testGetIdentifier(): void
{
$this->assertSame('git', $this->gitDiffHistoryFactory->getIdentifier());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function testGitDiffCommandFails(): void
{
$projectRoot = ProjectRoot::fromCurrentWorkingDirectory(__DIR__);
$gitCliWrapper = new GitCliWrapper();
$nonExistantGitSha = new GitCommit('0000000000000000000000000000000000000000');
$nonExistentGitSha = new GitCommit('0000000000000000000000000000000000000000');
$this->expectException(GitException::class);
$gitCliWrapper->getGitDiff($projectRoot, $nonExistantGitSha);
$gitCliWrapper->getGitDiff($projectRoot, $nonExistentGitSha);
}

public function testGetGitShaCommandFails(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testNoIssues(): void

public function testWithIssues(): void
{
$expectedOuput = <<<EOF
$expectedOutput = <<<EOF
[
{
"file": "\/FILE_1",
Expand All @@ -51,7 +51,7 @@ public function testWithIssues(): void
]
EOF;

$this->assertIssuesOutput($expectedOuput);
$this->assertIssuesOutput($expectedOutput);
}

protected function getOutputFormatter(): OutputFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testNoIssues(): void

public function testWithIssues(): void
{
$expectedOuput = <<<XML
$expectedOutput = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="SARB" tests="3" failures="3">
<testsuite name="FILE_1" errors="0" tests="2" failures="2">
Expand All @@ -51,7 +51,7 @@ public function testWithIssues(): void
</testsuites>
XML;
$this->assertIssuesOutput($expectedOuput);
$this->assertIssuesOutput($expectedOutput);
}

protected function getOutputFormatter(): OutputFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testNoIssues(): void

public function testWithIssues(): void
{
$expectedOuput = <<<EOF
$expectedOutput = <<<EOF
FILE: /FILE_1
+------+-------------+
Expand All @@ -46,12 +46,12 @@ public function testWithIssues(): void
EOF;

$this->assertIssuesOutput($expectedOuput);
$this->assertIssuesOutput($expectedOutput);
}

public function testWithIssuesAndWarningsIgnored(): void
{
$expectedOuput = <<<EOF
$expectedOutput = <<<EOF
FILE: /FILE_1
+------+-------------+
Expand All @@ -63,7 +63,7 @@ public function testWithIssuesAndWarningsIgnored(): void
EOF;

$this->assertIssuesOutputWithWarningsIgnored($expectedOuput);
$this->assertIssuesOutputWithWarningsIgnored($expectedOutput);
}

protected function getOutputFormatter(): OutputFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testNoIssues(): void

public function testWithIssues(): void
{
$expectedOuput = <<<EOF
$expectedOutput = <<<EOF
/FILE_1:10 - TYPE_1
MESSAGE_1
Expand All @@ -38,7 +38,7 @@ public function testWithIssues(): void
EOF;

$this->assertIssuesOutput($expectedOuput);
$this->assertIssuesOutput($expectedOutput);
}

protected function getOutputFormatter(): OutputFormatter
Expand Down

0 comments on commit b3c10d1

Please sign in to comment.