From 218ece2e79fbba981a5c88000df7b62285db2383 Mon Sep 17 00:00:00 2001 From: Daniel Metzler Date: Fri, 21 May 2021 22:18:45 +0200 Subject: [PATCH 01/13] Fixed typo in DuplicatedArrayKey title incl. link. --- src/site/rst/rules/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/rst/rules/index.rst b/src/site/rst/rules/index.rst index 2af522c53..6d25f2f60 100644 --- a/src/site/rst/rules/index.rst +++ b/src/site/rst/rules/index.rst @@ -18,7 +18,7 @@ Clean Code Rules - `ElseExpression `_: An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code in several smaller methods. For very simple assignments you could also use the ternary operations. - `StaticAccess `_: Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods. - `IfStatementAssignment `_: Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string. -- `DuplicateArrayKey `_: Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one. +- `DuplicatedArrayKey `_: Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one. - `MissingImport `_: Importing all external classes in a file through use statements makes them clearly visible. - `UndefinedVariable `_: Detects when a variable is used that has not been defined before. - `ErrorControlOperator `_: Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Moreover it can slow down the execution of your code. Consider changing error_reporting() level and/or setting up your own error handler. From 8b86a034ea0550f9c1122444189892f7ac24ea0d Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 21 Jun 2021 13:23:56 +0530 Subject: [PATCH 02/13] added newline resolves #898 --- src/main/php/PHPMD/Renderer/AnsiRenderer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/php/PHPMD/Renderer/AnsiRenderer.php b/src/main/php/PHPMD/Renderer/AnsiRenderer.php index cad14932c..fb95e0d78 100644 --- a/src/main/php/PHPMD/Renderer/AnsiRenderer.php +++ b/src/main/php/PHPMD/Renderer/AnsiRenderer.php @@ -38,6 +38,7 @@ private function writeViolationsReport(Report $report) $previousFile = null; foreach ($report->getRuleViolations() as $violation) { if ($violation->getFileName() !== $previousFile) { + echo nl2br("\n"); $this->writeViolationFileHeader($violation); } From 774f2b92376a1dc7e8b2c7438b59037697fd14bb Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 21 Jun 2021 14:02:01 +0530 Subject: [PATCH 03/13] Update AnsiRenderer.php --- src/main/php/PHPMD/Renderer/AnsiRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/php/PHPMD/Renderer/AnsiRenderer.php b/src/main/php/PHPMD/Renderer/AnsiRenderer.php index fb95e0d78..637228cfe 100644 --- a/src/main/php/PHPMD/Renderer/AnsiRenderer.php +++ b/src/main/php/PHPMD/Renderer/AnsiRenderer.php @@ -38,7 +38,7 @@ private function writeViolationsReport(Report $report) $previousFile = null; foreach ($report->getRuleViolations() as $violation) { if ($violation->getFileName() !== $previousFile) { - echo nl2br("\n"); + $this->writer->write('\n'); $this->writeViolationFileHeader($violation); } From ed40717cea75c21ee8e569793e14b23181b679ec Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 21 Jun 2021 14:25:36 +0530 Subject: [PATCH 04/13] Update src/main/php/PHPMD/Renderer/AnsiRenderer.php Co-authored-by: Kyle --- src/main/php/PHPMD/Renderer/AnsiRenderer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/php/PHPMD/Renderer/AnsiRenderer.php b/src/main/php/PHPMD/Renderer/AnsiRenderer.php index 637228cfe..b980784ef 100644 --- a/src/main/php/PHPMD/Renderer/AnsiRenderer.php +++ b/src/main/php/PHPMD/Renderer/AnsiRenderer.php @@ -38,7 +38,9 @@ private function writeViolationsReport(Report $report) $previousFile = null; foreach ($report->getRuleViolations() as $violation) { if ($violation->getFileName() !== $previousFile) { - $this->writer->write('\n'); + if ($previousFile !== null) { + $this->writer->write('\n'); + } $this->writeViolationFileHeader($violation); } From 55542421f94941e061de0916ca58f10f29fbb6a2 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 21 Jun 2021 10:57:24 +0200 Subject: [PATCH 05/13] Use PHP_EOL --- src/main/php/PHPMD/Renderer/AnsiRenderer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/php/PHPMD/Renderer/AnsiRenderer.php b/src/main/php/PHPMD/Renderer/AnsiRenderer.php index b980784ef..7f16e42a4 100644 --- a/src/main/php/PHPMD/Renderer/AnsiRenderer.php +++ b/src/main/php/PHPMD/Renderer/AnsiRenderer.php @@ -39,8 +39,9 @@ private function writeViolationsReport(Report $report) foreach ($report->getRuleViolations() as $violation) { if ($violation->getFileName() !== $previousFile) { if ($previousFile !== null) { - $this->writer->write('\n'); + $this->writer->write(PHP_EOL); } + $this->writeViolationFileHeader($violation); } From 53c90416e2403753becf60c5f4e09d5f7133da99 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Tue, 22 Jun 2021 12:21:03 +0200 Subject: [PATCH 06/13] Use writer getter --- src/main/php/PHPMD/Renderer/AnsiRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/php/PHPMD/Renderer/AnsiRenderer.php b/src/main/php/PHPMD/Renderer/AnsiRenderer.php index 7f16e42a4..3486e4ccf 100644 --- a/src/main/php/PHPMD/Renderer/AnsiRenderer.php +++ b/src/main/php/PHPMD/Renderer/AnsiRenderer.php @@ -39,7 +39,7 @@ private function writeViolationsReport(Report $report) foreach ($report->getRuleViolations() as $violation) { if ($violation->getFileName() !== $previousFile) { if ($previousFile !== null) { - $this->writer->write(PHP_EOL); + $this->getWriter()->write(PHP_EOL); } $this->writeViolationFileHeader($violation); From 5e5cbe7097dd6772bd550fb54c88623734e01c15 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Tue, 22 Jun 2021 12:25:20 +0200 Subject: [PATCH 07/13] Update tests according to new vertical spacing --- src/test/php/PHPMD/Renderer/AnsiRendererTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/php/PHPMD/Renderer/AnsiRendererTest.php b/src/test/php/PHPMD/Renderer/AnsiRendererTest.php index 95ac53f5d..61ec09c5f 100644 --- a/src/test/php/PHPMD/Renderer/AnsiRendererTest.php +++ b/src/test/php/PHPMD/Renderer/AnsiRendererTest.php @@ -73,6 +73,7 @@ public function testRendererOutputsForReportWithContents() $expectedChunks = array( PHP_EOL . "FILE: /bar.php" . PHP_EOL . "--------------" . PHP_EOL, " 1 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL, + PHP_EOL, PHP_EOL . "FILE: /foo.php" . PHP_EOL . "--------------" . PHP_EOL, " 2 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL, " 3 | \e[31mVIOLATION\e[0m | Test description" . PHP_EOL, From c8d6ba34f4f138b765b7e21c9991e4c2c28d37b3 Mon Sep 17 00:00:00 2001 From: Frank Dekker Date: Sat, 17 Jul 2021 16:50:07 +0200 Subject: [PATCH 08/13] Remove absolute path from BaselineSet and adjust baseline matching --- src/main/php/PHPMD/Baseline/BaselineSet.php | 2 +- .../php/PHPMD/Baseline/BaselineSetFactory.php | 6 +--- .../php/PHPMD/Baseline/ViolationBaseline.php | 29 ++++++++++--------- .../php/PHPMD/Renderer/RendererFactory.php | 6 ++-- src/main/php/PHPMD/Utility/Paths.php | 26 ----------------- 5 files changed, 19 insertions(+), 50 deletions(-) diff --git a/src/main/php/PHPMD/Baseline/BaselineSet.php b/src/main/php/PHPMD/Baseline/BaselineSet.php index 8687f6aac..dce9db472 100644 --- a/src/main/php/PHPMD/Baseline/BaselineSet.php +++ b/src/main/php/PHPMD/Baseline/BaselineSet.php @@ -28,7 +28,7 @@ public function contains($ruleName, $fileName, $methodName) $fileName = str_replace('\\', '/', $fileName); foreach ($this->violations[$ruleName] as $baseline) { - if ($baseline->getFileName() === $fileName && $baseline->getMethodName() === $methodName) { + if ($baseline->matches($fileName, $methodName)) { return true; } } diff --git a/src/main/php/PHPMD/Baseline/BaselineSetFactory.php b/src/main/php/PHPMD/Baseline/BaselineSetFactory.php index 68bfa5ffd..661b04dcb 100644 --- a/src/main/php/PHPMD/Baseline/BaselineSetFactory.php +++ b/src/main/php/PHPMD/Baseline/BaselineSetFactory.php @@ -26,9 +26,7 @@ public static function fromFile($fileName) throw new RuntimeException('Unable to read xml from: ' . $fileName); } - $basePath = dirname($fileName); $baselineSet = new BaselineSet(); - foreach ($xml->children() as $node) { if ($node->getName() !== 'violation') { continue; @@ -42,14 +40,12 @@ public static function fromFile($fileName) throw new RuntimeException('Missing `file` attribute in `violation` in ' . $fileName); } - $ruleName = (string)$node['rule']; - $filePath = Paths::concat($basePath, (string)$node['file']); $methodName = null; if (isset($node['method']) === true && ((string)$node['method']) !== '') { $methodName = (string)($node['method']); } - $baselineSet->addEntry(new ViolationBaseline($ruleName, $filePath, $methodName)); + $baselineSet->addEntry(new ViolationBaseline((string)$node['rule'], (string)$node['file'], $methodName)); } return $baselineSet; diff --git a/src/main/php/PHPMD/Baseline/ViolationBaseline.php b/src/main/php/PHPMD/Baseline/ViolationBaseline.php index de40a8788..5588ff72c 100644 --- a/src/main/php/PHPMD/Baseline/ViolationBaseline.php +++ b/src/main/php/PHPMD/Baseline/ViolationBaseline.php @@ -10,6 +10,9 @@ class ViolationBaseline /** @var string */ private $fileName; + /** @var int */ + private $fileNameLength; + /** @var string|null */ private $methodName; @@ -20,9 +23,10 @@ class ViolationBaseline */ public function __construct($ruleName, $fileName, $methodName) { - $this->ruleName = $ruleName; - $this->fileName = $fileName; - $this->methodName = $methodName; + $this->ruleName = $ruleName; + $this->fileName = $fileName; + $this->methodName = $methodName; + $this->fileNameLength = strlen($fileName); } /** @@ -34,18 +38,15 @@ public function getRuleName() } /** - * @return string - */ - public function getFileName() - { - return $this->fileName; - } - - /** - * @return string|null + * Test if the given filepath and method matches the baseline + * + * @param string $filepath the full filepath to match against + * @param string|null $methodName the name of the method of the method, if any + * + * @return bool */ - public function getMethodName() + public function matches($filepath, $methodName) { - return $this->methodName; + return $this->methodName === $methodName && substr($filepath, -$this->fileNameLength) === $this->fileName; } } diff --git a/src/main/php/PHPMD/Renderer/RendererFactory.php b/src/main/php/PHPMD/Renderer/RendererFactory.php index 7796fc780..bc499a086 100644 --- a/src/main/php/PHPMD/Renderer/RendererFactory.php +++ b/src/main/php/PHPMD/Renderer/RendererFactory.php @@ -2,7 +2,6 @@ namespace PHPMD\Renderer; -use PHPMD\Utility\Paths; use PHPMD\Writer\StreamWriter; use RuntimeException; @@ -14,9 +13,8 @@ class RendererFactory */ public static function createBaselineRenderer(StreamWriter $writer) { - // determine basedir based on stream output filepath - $absolutePath = Paths::getAbsolutePath($writer->getStream()); - $renderer = new BaselineRenderer(dirname($absolutePath)); + // set base path to current working directory + $renderer = new BaselineRenderer(getcwd()); $renderer->setWriter($writer); return $renderer; diff --git a/src/main/php/PHPMD/Utility/Paths.php b/src/main/php/PHPMD/Utility/Paths.php index fd7555d53..7806230a3 100644 --- a/src/main/php/PHPMD/Utility/Paths.php +++ b/src/main/php/PHPMD/Utility/Paths.php @@ -6,20 +6,6 @@ class Paths { - /** - * Append $pathB to $pathA and apply the correct amount of slashes between them - * - * @param string $pathA - * @param string $pathB - * @return string - */ - public static function concat($pathA, $pathB) - { - $pathA = rtrim(str_replace('\\', '/', $pathA), '/'); - $pathB = ltrim(str_replace('\\', '/', $pathB), '/'); - return $pathA . '/' . $pathB; - } - /** * Transform the given absolute path to the relative path based on the given base path. * @@ -41,18 +27,6 @@ public static function getRelativePath($basePath, $filePath) return $filePath; } - /** - * Derive the absolute path from the given resource - * @param resource $resource - * @return string - * @throws RuntimeException - */ - public static function getAbsolutePath($resource) - { - $metaData = stream_get_meta_data($resource); - return self::getRealPath($metaData['uri']); - } - /** * Get the realpath of the given path or exception on failure * @param string $path From aa723b7ac75a4cb740eda4f0f62e2741b26b3ef7 Mon Sep 17 00:00:00 2001 From: Frank Dekker Date: Sat, 17 Jul 2021 16:50:48 +0200 Subject: [PATCH 09/13] Add coverage for changed files --- .../PHPMD/Baseline/ViolationBaselineTest.php | 35 ++++++++++++---- .../PHPMD/Renderer/RendererFactoryTest.php | 12 ------ src/test/php/PHPMD/TextUI/CommandTest.php | 6 ++- src/test/php/PHPMD/Utility/PathsTest.php | 42 ------------------- 4 files changed, 32 insertions(+), 63 deletions(-) diff --git a/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php b/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php index ae8b4bf04..15d6bf1af 100644 --- a/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php +++ b/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php @@ -13,23 +13,42 @@ class ViolationBaselineTest extends TestCase * @covers ::__construct * @covers ::getRuleName * @covers ::getFileName - * @covers ::getMethodName */ - public function testAccessorsWithoutMethod() + public function testGetRuleName() { $violation = new ViolationBaseline('rule', 'foobar', null); static::assertSame('rule', $violation->getRuleName()); - static::assertSame('foobar', $violation->getFileName()); - static::assertNull($violation->getMethodName()); } /** + * Test the give file matches the baseline correctly + * * @covers ::__construct - * @covers ::getMethodName + * @covers ::matches + * @return void */ - public function testAccessorsWithMethod() + public function testMatchesWithMethod() { - $violation = new ViolationBaseline('rule', 'foobar', 'method'); - static::assertSame('method', $violation->getMethodName()); + $violation = new ViolationBaseline('sniff', 'foobar.txt', 'method'); + static::assertTrue($violation->matches('foobar.txt', 'method')); + static::assertTrue($violation->matches('/test/foobar.txt', 'method')); + static::assertFalse($violation->matches('foo.txt', 'method')); + static::assertFalse($violation->matches('foobar.txt', 'unknown')); + } + + /** + * Test the give file matches the baseline correctly + * + * @covers ::__construct + * @covers ::matches + * @return void + */ + public function testMatchesWithoutMethod() + { + $violation = new ViolationBaseline('sniff', 'foobar.txt', null); + static::assertTrue($violation->matches('foobar.txt', null)); + static::assertTrue($violation->matches('/test/foobar.txt', null)); + static::assertFalse($violation->matches('foobar.txt', 'method')); + static::assertFalse($violation->matches('/test/unknown.txt', null)); } } diff --git a/src/test/php/PHPMD/Renderer/RendererFactoryTest.php b/src/test/php/PHPMD/Renderer/RendererFactoryTest.php index e2707db8f..6a7bd553d 100644 --- a/src/test/php/PHPMD/Renderer/RendererFactoryTest.php +++ b/src/test/php/PHPMD/Renderer/RendererFactoryTest.php @@ -4,7 +4,6 @@ use PHPMD\AbstractTest; use PHPMD\Writer\StreamWriter; -use RuntimeException; /** * @coversDefaultClass \PHPMD\Renderer\RendererFactory @@ -21,15 +20,4 @@ public function testCreateBaselineRendererSuccessfully() static::assertSame($writer, $renderer->getWriter()); } - - /** - * @covers ::createBaselineRenderer - * @expectedException RuntimeException - * @expectedExceptionMessage Unable to determine the realpath for - */ - public function testCreateBaselineRendererThrowsExceptionForInvalidStream() - { - $writer = new StreamWriter(STDOUT); - RendererFactory::createBaselineRenderer($writer); - } } diff --git a/src/test/php/PHPMD/TextUI/CommandTest.php b/src/test/php/PHPMD/TextUI/CommandTest.php index dfa789872..54e6ea19d 100644 --- a/src/test/php/PHPMD/TextUI/CommandTest.php +++ b/src/test/php/PHPMD/TextUI/CommandTest.php @@ -18,6 +18,7 @@ namespace PHPMD\TextUI; use PHPMD\AbstractTest; +use PHPMD\Utility\Paths; /** * Test case for the {@link \PHPMD\TextUI\Command} class. @@ -246,7 +247,7 @@ public function testMainGenerateBaseline() static::assertSame(Command::EXIT_SUCCESS, $exitCode); static::assertFileExists($temp); - static::assertContains($uri, file_get_contents($temp)); + static::assertContains(Paths::getRelativePath(getcwd(), $uri), file_get_contents($temp)); } /** @@ -262,6 +263,9 @@ public function testMainUpdateBaseline() { $sourceTemp = self::createTempFileUri('ClassWithMultipleViolations.php'); $baselineTemp = self::createTempFileUri(); + // set work directory to the temp dir + self::changeWorkingDirectory(dirname($baselineTemp)); + copy(static::createResourceUriForTest('UpdateBaseline/ClassWithMultipleViolations.php'), $sourceTemp); copy(static::createResourceUriForTest('UpdateBaseline/phpmd.baseline.xml'), $baselineTemp); diff --git a/src/test/php/PHPMD/Utility/PathsTest.php b/src/test/php/PHPMD/Utility/PathsTest.php index b7a634c40..aa49870e5 100644 --- a/src/test/php/PHPMD/Utility/PathsTest.php +++ b/src/test/php/PHPMD/Utility/PathsTest.php @@ -10,30 +10,6 @@ */ class PathsTest extends AbstractTest { - /** - * @covers ::concat - */ - public function testConcatShouldConcatTwoPaths() - { - static::assertSame('/foo/bar', Paths::concat('/foo', '/bar')); - } - - /** - * @covers ::concat - */ - public function testConcatShouldDeduplicateSlashes() - { - static::assertSame('/foo/bar', Paths::concat('/foo/', '/bar')); - } - - /** - * @covers ::concat - */ - public function testConcatShouldForwardAllSlashes() - { - static::assertSame('/foo/bar/text.txt', Paths::concat('/foo\\', '/bar\\text.txt')); - } - /** * @covers ::getRelativePath */ @@ -58,24 +34,6 @@ public function testGetRelativePathShouldNotSubtractOnInfixPath() static::assertSame('/foo/bar/text.txt', Paths::getRelativePath('/bar', '/foo/bar/text.txt')); } - /** - * @covers ::getAbsolutePath - * @expectedException RuntimeException - */ - public function testGetAbsolutePathShouldReturnNullForIrregularStream() - { - Paths::getAbsolutePath(fopen('php://stdout', 'wb')); - } - - /** - * @covers ::getAbsolutePath - */ - public function testGetAbsolutePathShouldReturnPath() - { - $path = static::createResourceUriForTest('resource.txt'); - static::assertSame(realpath($path), Paths::getAbsolutePath(fopen($path, 'rb'))); - } - /** * @covers ::getRealPath */ From 6ac6b82600f6d6996dd0e684c0ac199269f46cf5 Mon Sep 17 00:00:00 2001 From: Frank Dekker Date: Sat, 17 Jul 2021 17:10:54 +0200 Subject: [PATCH 10/13] Updated documentation --- README.rst | 9 +++++---- src/site/rst/documentation/index.rst | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index cec20e3b0..b50bf1dda 100644 --- a/README.rst +++ b/README.rst @@ -133,13 +133,14 @@ Command line options violations are found. - ``--generate-baseline`` - will generate a ``phpmd.baseline.xml`` for existing violations - next to the ruleset definition file. + next to the ruleset definition file. The file paths of the violations will be relative to the current + working directory. - ``--update-baseline`` - will remove all violations from an existing ``phpmd.baseline.xml`` - that no longer exist. New violations will _not_ be added. + that no longer exist. New violations will _not_ be added. The file path of the violations will be relative + to the current working directory. - - ``--baseline-file`` - the filepath to a custom baseline xml file. The filepath - of all baselined files must be relative to this file location. + - ``--baseline-file`` - the filepath to a custom baseline xml file. An example command line: :: diff --git a/src/site/rst/documentation/index.rst b/src/site/rst/documentation/index.rst index ccd9568e5..6284a4412 100644 --- a/src/site/rst/documentation/index.rst +++ b/src/site/rst/documentation/index.rst @@ -65,13 +65,14 @@ Command line options violations are found. - ``--generate-baseline`` - will generate a ``phpmd.baseline.xml`` for existing violations - next to the ruleset definition file. + next to the ruleset definition file. The file paths of the violations will be relative to the current + working directory. - ``--update-baseline`` - will remove all violations from an existing ``phpmd.baseline.xml`` - that no longer exist. New violations will _not_ be added. + that no longer exist. New violations will _not_ be added. The file path of the violations will be relative + to the current working directory. - - ``--baseline-file`` - the filepath to a custom baseline xml file. The filepath - of all baselined files must be relative to this file location. + - ``--baseline-file`` - the filepath to a custom baseline xml file. An example command line: :: From 804b5445f8c0071b02777d8a1a1bb5953d7b3f7c Mon Sep 17 00:00:00 2001 From: Frank Dekker Date: Sat, 17 Jul 2021 17:23:32 +0200 Subject: [PATCH 11/13] Fixed coverage notation --- src/test/php/PHPMD/Baseline/ViolationBaselineTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php b/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php index 15d6bf1af..8635b3e18 100644 --- a/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php +++ b/src/test/php/PHPMD/Baseline/ViolationBaselineTest.php @@ -12,7 +12,6 @@ class ViolationBaselineTest extends TestCase /** * @covers ::__construct * @covers ::getRuleName - * @covers ::getFileName */ public function testGetRuleName() { From 18d2246f07ffd78dfa2f966a89f88acd1ba677df Mon Sep 17 00:00:00 2001 From: Frank Dekker Date: Sat, 17 Jul 2021 17:27:06 +0200 Subject: [PATCH 12/13] Removed unused import --- src/main/php/PHPMD/Baseline/BaselineSetFactory.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/php/PHPMD/Baseline/BaselineSetFactory.php b/src/main/php/PHPMD/Baseline/BaselineSetFactory.php index 661b04dcb..f51638c80 100644 --- a/src/main/php/PHPMD/Baseline/BaselineSetFactory.php +++ b/src/main/php/PHPMD/Baseline/BaselineSetFactory.php @@ -2,7 +2,6 @@ namespace PHPMD\Baseline; -use PHPMD\Utility\Paths; use RuntimeException; class BaselineSetFactory From 6d3e59fc2ca731c4a86e00d4ad33210d2873e321 Mon Sep 17 00:00:00 2001 From: Tobias van Beek Date: Wed, 21 Jul 2021 21:57:01 +0200 Subject: [PATCH 13/13] Prepare the release for version 2.10.2 --- CHANGELOG | 8 ++++++++ build.properties | 2 +- composer.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 99748d0eb..0246c88b3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +phpmd-2.10.1 (2021/07/22) +======================== + +- Added #898 in #902: Added newline for better ANSI output +- Changed #901 in #903: Improve baseline basepath calculation +- Fixed #894: Fixed typo in DuplicatedArrayKey title incl. link +- Fixed Update PHP Depend to the latest version, this fixed different PHP 8 options: #889 #893 #896 + phpmd-2.10.1 (2021/05/11) ======================== diff --git a/build.properties b/build.properties index 9918062fd..971e5ae53 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ project.dir = project.uri = phpmd.org project.name = phpmd -project.version = 2.10.1 +project.version = 2.10.2 project.stability = stable # Disable pear support. This cannot be removed as long as setup tool is used diff --git a/composer.json b/composer.json index 96b9548b6..c0345c1ac 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "minimum-stability": "stable", "require": { "php": ">=5.3.9", - "pdepend/pdepend": "^2.9.1", + "pdepend/pdepend": "^2.10.0", "ext-xml": "*", "composer/xdebug-handler": "^1.0 || ^2.0" },