From 1b9d42446f8c902377db532f64700c86cc4c6e42 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 21:27:41 +0200 Subject: [PATCH 1/7] [MonorepoBuilder] Rename ValidateVersionsCommand to ValidateCommand --- packages/MonorepoBuilder/README.md | 2 +- .../{ValidateVersionsCommand.php => ValidateCommand.php} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/MonorepoBuilder/src/Console/Command/{ValidateVersionsCommand.php => ValidateCommand.php} (97%) diff --git a/packages/MonorepoBuilder/README.md b/packages/MonorepoBuilder/README.md index 85f3f038abe..d49bf8c2a9f 100644 --- a/packages/MonorepoBuilder/README.md +++ b/packages/MonorepoBuilder/README.md @@ -67,7 +67,7 @@ vendor/bin/monorepo-builder bump-interdependency "^4.0" In synchronized monorepo, it's common to use same package version to prevent bugs and WTFs. So if one of your package uses `symfony/console` 3.4 and the other `symfony/console` 4.1, this will tell you: ```bash -vendor/bin/monorepo-builder validate-versions +vendor/bin/monorepo-builder validate ``` ### 4. Keep Package Alias Up-To-Date diff --git a/packages/MonorepoBuilder/src/Console/Command/ValidateVersionsCommand.php b/packages/MonorepoBuilder/src/Console/Command/ValidateCommand.php similarity index 97% rename from packages/MonorepoBuilder/src/Console/Command/ValidateVersionsCommand.php rename to packages/MonorepoBuilder/src/Console/Command/ValidateCommand.php index 83fecec2715..c7716084484 100644 --- a/packages/MonorepoBuilder/src/Console/Command/ValidateVersionsCommand.php +++ b/packages/MonorepoBuilder/src/Console/Command/ValidateCommand.php @@ -11,7 +11,7 @@ use Symplify\MonorepoBuilder\VersionValidator; use Symplify\PackageBuilder\Console\Command\CommandNaming; -final class ValidateVersionsCommand extends Command +final class ValidateCommand extends Command { /** * @var SymfonyStyle From 56c8813b18ada916cc97a7cb9b580a950a931272 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 22:37:18 +0200 Subject: [PATCH 2/7] [ChanlogLinker] Add cleanup command --- .../src/Analyzer/LinksAnalyzer.php | 31 +++++++++++- .../ChangelogLinker/src/ChangelogCleaner.php | 32 +++++++++++++ .../src/Console/Command/CleanupCommand.php | 48 +++++++++++++++++++ .../LinksAnalyzer/LinksAnalyzerTest.php | 9 ++++ .../Source/SomeFileWithDeadlinks.md | 7 +++ .../ChangelogCleaner/ChangelogCleanerTest.php | 36 ++++++++++++++ .../tests/ChangelogCleaner/Source/after/01.md | 6 +++ .../tests/ChangelogCleaner/Source/after/02.md | 8 ++++ .../ChangelogCleaner/Source/before/01.md | 7 +++ .../ChangelogCleaner/Source/before/02.md | 9 ++++ .../tests/ChangelogCleaner/Source/config.yml | 5 ++ 11 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 packages/ChangelogLinker/src/ChangelogCleaner.php create mode 100644 packages/ChangelogLinker/src/Console/Command/CleanupCommand.php create mode 100644 packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/Source/SomeFileWithDeadlinks.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/01.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/02.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/01.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/02.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/config.yml diff --git a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php index 161c6fd05db..9da4ecb2f9d 100644 --- a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php +++ b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php @@ -12,17 +12,46 @@ final class LinksAnalyzer */ private $linkedIds = []; + /** + * @var string[] + */ + private $references = []; + public function analyzeContent(string $content): void { + // [content]: url $this->linkedIds = []; - foreach (Strings::matchAll($content, RegexPattern::LINK_REFERENCE) as $match) { $this->linkedIds[] = $match['reference']; } + $this->linkedIds = array_unique($this->linkedIds); + + // [content] + $this->references = []; + foreach (Strings::matchAll($content, '#\[\#?(?[(\w\d]+)\](?!:)(?!\()#') as $match) { + $this->references[] = $match['reference']; + } + $this->references = array_unique($this->references); } public function hasLinkedId(string $id): bool { return in_array($id, $this->linkedIds, true); } + + /** + * @return string[] + */ + public function getDeadLinks(): array + { + $deadLinks = array_diff($this->linkedIds, $this->references); + + // special link, that needs to be kept + $commentPosition = array_search('comment', $deadLinks, true); + if ($commentPosition !== false) { + unset($deadLinks[$commentPosition]); + } + + return array_values($deadLinks); + } } diff --git a/packages/ChangelogLinker/src/ChangelogCleaner.php b/packages/ChangelogLinker/src/ChangelogCleaner.php new file mode 100644 index 00000000000..e6228920100 --- /dev/null +++ b/packages/ChangelogLinker/src/ChangelogCleaner.php @@ -0,0 +1,32 @@ +linksAnalyzer = $linksAnalyzer; + } + + public function processContent(string $changelogContent): string + { + $this->linksAnalyzer->analyzeContent($changelogContent); + + $deadLinks = $this->linksAnalyzer->getDeadLinks(); + + foreach ($deadLinks as $deadLink) { + $changelogContent = Strings::replace($changelogContent, sprintf('#\[\#?(%s)\]:(.*?)\n#', $deadLink)); + } + + return $changelogContent; + } +} diff --git a/packages/ChangelogLinker/src/Console/Command/CleanupCommand.php b/packages/ChangelogLinker/src/Console/Command/CleanupCommand.php new file mode 100644 index 00000000000..7b7bd231204 --- /dev/null +++ b/packages/ChangelogLinker/src/Console/Command/CleanupCommand.php @@ -0,0 +1,48 @@ +changelogFileSystem = $changelogFileSystem; + $this->changelogCleaner = $changelogCleaner; + } + + protected function configure(): void + { + $this->setName(CommandNaming::classToName(self::class)); + $this->setDescription('Removes dead links from CHANGELOG.md'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $changelogContent = $this->changelogFileSystem->readChangelog(); + + $processedChangelogContent = $this->changelogCleaner->processContent($changelogContent); + + $this->changelogFileSystem->storeChangelog($processedChangelogContent); + + // success + return 0; + } +} diff --git a/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/LinksAnalyzerTest.php b/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/LinksAnalyzerTest.php index 8ee165e1f2e..b9271161222 100644 --- a/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/LinksAnalyzerTest.php +++ b/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/LinksAnalyzerTest.php @@ -24,4 +24,13 @@ public function test(): void $this->assertTrue($this->linksAnalyzer->hasLinkedId('5')); $this->assertFalse($this->linksAnalyzer->hasLinkedId('10')); } + + public function testDeadLinks(): void + { + $this->linksAnalyzer->analyzeContent(file_get_contents(__DIR__ . '/Source/SomeFileWithDeadlinks.md')); + + $deadLinks = $this->linksAnalyzer->getDeadLinks(); + + $this->assertSame(['5', '15'], $deadLinks); + } } diff --git a/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/Source/SomeFileWithDeadlinks.md b/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/Source/SomeFileWithDeadlinks.md new file mode 100644 index 00000000000..e4ed1477a70 --- /dev/null +++ b/packages/ChangelogLinker/tests/Analyzer/LinksAnalyzer/Source/SomeFileWithDeadlinks.md @@ -0,0 +1,7 @@ +### Added + +- [#10] A link + +[#5]: Link +[#10]: Deadlink +[#15]: Deadlink diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php new file mode 100644 index 00000000000..416aa1e7272 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php @@ -0,0 +1,36 @@ +changelogCleaner = $this->container->get(ChangelogCleaner::class); + } + + /** + * @dataProvider dataProvider() + */ + public function test(string $originalFile, string $expectedFile): void + { + $processedFile = $this->changelogCleaner->processContent(file_get_contents($originalFile)); + + $this->assertStringEqualsFile($expectedFile, $processedFile); + } + + public function dataProvider(): Iterator + { + yield [__DIR__ . '/Source/before/01.md', __DIR__ . '/Source/after/01.md']; + yield [__DIR__ . '/Source/before/02.md', __DIR__ . '/Source/after/02.md']; + } +} diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/01.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/01.md new file mode 100644 index 00000000000..1bdbd2e2c2a --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/01.md @@ -0,0 +1,6 @@ +# Changelog + +## v2.0.0 + +### Added + diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/02.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/02.md new file mode 100644 index 00000000000..9b4c71a332e --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/02.md @@ -0,0 +1,8 @@ +# Changelog + +## v2.0.0 + +### Added + +[comment]: some comment + diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/01.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/01.md new file mode 100644 index 00000000000..918aff72f0e --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/01.md @@ -0,0 +1,7 @@ +# Changelog + +## v2.0.0 + +### Added + +[#10]: Deadlink diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/02.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/02.md new file mode 100644 index 00000000000..fe46dc0f93e --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/02.md @@ -0,0 +1,9 @@ +# Changelog + +## v2.0.0 + +### Added + +[comment]: some comment + +[#10]: Deadlink diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/config.yml b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/config.yml new file mode 100644 index 00000000000..543e0369175 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/config.yml @@ -0,0 +1,5 @@ +parameters: + repository_url: 'https://github.com/dummy/dummy' + + names_to_urls: + 'SomeThingToLink': 'https://someUrl.com' From 435c071e0002cace5ac8919040ed22ea076f38cd Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 22:40:46 +0200 Subject: [PATCH 3/7] cleanup static --- .../tests/ChangelogCleaner/ChangelogCleanerTest.php | 5 +++-- .../tests/ChangelogFormatter/ChangelogFormatterTest.php | 3 ++- .../tests/ChangelogLinker/ChangelogLinkerTest.php | 3 ++- phpstan.neon | 2 -- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php index 416aa1e7272..bdf7e5f79e6 100644 --- a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php @@ -1,8 +1,9 @@ changelogCleaner->processContent(file_get_contents($originalFile)); + $processedFile = $this->changelogCleaner->processContent(FileSystem::read($originalFile)); $this->assertStringEqualsFile($expectedFile, $processedFile); } diff --git a/packages/ChangelogLinker/tests/ChangelogFormatter/ChangelogFormatterTest.php b/packages/ChangelogLinker/tests/ChangelogFormatter/ChangelogFormatterTest.php index 2aa5a12eaa8..14b1f1ca368 100644 --- a/packages/ChangelogLinker/tests/ChangelogFormatter/ChangelogFormatterTest.php +++ b/packages/ChangelogLinker/tests/ChangelogFormatter/ChangelogFormatterTest.php @@ -3,6 +3,7 @@ namespace Symplify\ChangelogLinker\Tests\ChangelogFormatter; use Iterator; +use Nette\Utils\FileSystem; use PHPUnit\Framework\TestCase; use Symplify\ChangelogLinker\ChangelogFormatter; @@ -23,7 +24,7 @@ protected function setUp(): void */ public function test(string $fileToFormat, string $expectedFormattedFile): void { - $fileContentToFormat = file_get_contents($fileToFormat); + $fileContentToFormat = FileSystem::read($fileToFormat); $this->assertStringEqualsFile($expectedFormattedFile, $this->changelogFormatter->format($fileContentToFormat)); } diff --git a/packages/ChangelogLinker/tests/ChangelogLinker/ChangelogLinkerTest.php b/packages/ChangelogLinker/tests/ChangelogLinker/ChangelogLinkerTest.php index ecc54468e7f..4b26a21482d 100644 --- a/packages/ChangelogLinker/tests/ChangelogLinker/ChangelogLinkerTest.php +++ b/packages/ChangelogLinker/tests/ChangelogLinker/ChangelogLinkerTest.php @@ -3,6 +3,7 @@ namespace Symplify\ChangelogLinker\Tests\ChangelogLinker; use Iterator; +use Nette\Utils\FileSystem; use Symplify\ChangelogLinker\ChangelogLinker; use Symplify\ChangelogLinker\DependencyInjection\ContainerFactory; use Symplify\ChangelogLinker\Tests\AbstractContainerAwareTestCase; @@ -33,7 +34,7 @@ protected function setUp(): void */ public function test(string $originalFile, string $expectedFile): void { - $processedFile = $this->changelogLinker->processContentWithLinkAppends(file_get_contents($originalFile)); + $processedFile = $this->changelogLinker->processContentWithLinkAppends(FileSystem::read($originalFile)); $this->assertStringEqualsFile($expectedFile, $processedFile); } diff --git a/phpstan.neon b/phpstan.neon index e2783b0820e..2daea1a02bd 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -76,13 +76,11 @@ parameters: - '#Property Symplify\\BetterPhpDocParser\\Printer\\PhpDocInfoPrinter::\$nodeWithPositionsObjectStorage \(iterable\&Symplify\\BetterPhpDocParser\\PhpDocParser\\Storage\\NodeWithPositionsObjectStorage\) does not accept Symplify\\BetterPhpDocParser\\PhpDocParser\\Storage\\NodeWithPositionsObjectStorage#' - '#Parameter \#1 \$content of method Symplify\\BetterPhpDocParser\\PhpDocInfo\\PhpDocInfoFactory::createFrom\(\) expects string, string\|false given#' - '#Cannot access property \$name on PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode\|null#' - - '#Parameter \#1 \$content of method Symplify\\ChangelogLinker\\ChangelogLinker::processContentWithLinkAppends\(\) expects string, string\|false given#' - '#Parameter \#1 \$content of method Symplify\\ChangelogLinker\\Analyzer\\IdsAnalyzer::getHighestIdInChangelog\(\) expects string, string\|false given#' - '#Parameter \#1 \$content of method Symplify\\ChangelogLinker\\Analyzer\\LinksAnalyzer::analyzeContent\(\) expects string, string\|false given#' - '#Parameter \#1 \$content of method Symplify\\ChangelogLinker\\Analyzer\\VersionsAnalyzer::analyzeContent\(\) expects string, string\|false given#' - '#Cannot call method getCategory\(\) on Symplify\\ChangelogLinker\\ChangeTree\\Change\|null#' - '#Cannot call method getPackage\(\) on Symplify\\ChangelogLinker\\ChangeTree\\Change\|null#' - - '#Parameter \#1 \$content of method Symplify\\ChangelogLinker\\ChangelogFormatter::format\(\) expects string, string\|false given#' - '#Parameter \#3 \$length of function substr expects int, int\|false given#' - '#If condition is always false#' - '#If condition is always true#' From 512bd5e3ef2dd71a73dd18c4667952fa421fa6a4 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 22:43:19 +0200 Subject: [PATCH 4/7] add version support --- packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php | 2 +- .../tests/ChangelogCleaner/ChangelogCleanerTest.php | 1 + .../tests/ChangelogCleaner/Source/after/03.md | 7 +++++++ .../tests/ChangelogCleaner/Source/before/03.md | 8 ++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/03.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/03.md diff --git a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php index 9da4ecb2f9d..79fe851e538 100644 --- a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php +++ b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php @@ -28,7 +28,7 @@ public function analyzeContent(string $content): void // [content] $this->references = []; - foreach (Strings::matchAll($content, '#\[\#?(?[(\w\d]+)\](?!:)(?!\()#') as $match) { + foreach (Strings::matchAll($content, '#\[\#?(?[(\w\d\.]+)\](?!:)(?!\()#') as $match) { $this->references[] = $match['reference']; } $this->references = array_unique($this->references); diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php index bdf7e5f79e6..076c2f0b8c2 100644 --- a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php @@ -33,5 +33,6 @@ public function dataProvider(): Iterator { yield [__DIR__ . '/Source/before/01.md', __DIR__ . '/Source/after/01.md']; yield [__DIR__ . '/Source/before/02.md', __DIR__ . '/Source/after/02.md']; + yield [__DIR__ . '/Source/before/03.md', __DIR__ . '/Source/after/03.md']; } } diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/03.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/03.md new file mode 100644 index 00000000000..75d13627d47 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/03.md @@ -0,0 +1,7 @@ +# Changelog + +## [v2.0.0] DATE + +### Added + +[v2.0.0]: Some versions diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/03.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/03.md new file mode 100644 index 00000000000..6c6c88a0959 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/03.md @@ -0,0 +1,8 @@ +# Changelog + +## [v2.0.0] DATE + +### Added + +[#10]: Deadlink +[v2.0.0]: Some versions From 5107a271727d162c0154ba0296fab2fd3fec1a87 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 22:45:00 +0200 Subject: [PATCH 5/7] add user link support --- packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php | 2 +- .../tests/ChangelogCleaner/ChangelogCleanerTest.php | 1 + .../tests/ChangelogCleaner/Source/after/04.md | 7 +++++++ .../tests/ChangelogCleaner/Source/before/04.md | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/04.md create mode 100644 packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/04.md diff --git a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php index 79fe851e538..55e24855c00 100644 --- a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php +++ b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php @@ -28,7 +28,7 @@ public function analyzeContent(string $content): void // [content] $this->references = []; - foreach (Strings::matchAll($content, '#\[\#?(?[(\w\d\.]+)\](?!:)(?!\()#') as $match) { + foreach (Strings::matchAll($content, '#\[\#?(?[(@\w\d\.]+)\](?!:)(?!\()#') as $match) { $this->references[] = $match['reference']; } $this->references = array_unique($this->references); diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php index 076c2f0b8c2..236dffb5793 100644 --- a/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/ChangelogCleanerTest.php @@ -34,5 +34,6 @@ public function dataProvider(): Iterator yield [__DIR__ . '/Source/before/01.md', __DIR__ . '/Source/after/01.md']; yield [__DIR__ . '/Source/before/02.md', __DIR__ . '/Source/after/02.md']; yield [__DIR__ . '/Source/before/03.md', __DIR__ . '/Source/after/03.md']; + yield [__DIR__ . '/Source/before/04.md', __DIR__ . '/Source/after/04.md']; } } diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/04.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/04.md new file mode 100644 index 00000000000..0d093aa8595 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/after/04.md @@ -0,0 +1,7 @@ +# Changelog + +- [#406] Added support for ignoring particular codes and files, Thanks to [@ostrolucky] + +### Added + +[@ostrolucky]: URL diff --git a/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/04.md b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/04.md new file mode 100644 index 00000000000..0d093aa8595 --- /dev/null +++ b/packages/ChangelogLinker/tests/ChangelogCleaner/Source/before/04.md @@ -0,0 +1,7 @@ +# Changelog + +- [#406] Added support for ignoring particular codes and files, Thanks to [@ostrolucky] + +### Added + +[@ostrolucky]: URL From 32265bef8d69d9bb97a9b39c5c30cd5fee99208a Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 22:47:42 +0200 Subject: [PATCH 6/7] apply cleanup on CHANGELOG.md + add to composer.json --- CHANGELOG.md | 45 ------------------- composer.json | 3 +- .../src/Analyzer/LinksAnalyzer.php | 2 +- 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 888200918a3..23e9d60ff3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1142,13 +1142,11 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#474]: https://github.com/Symplify/Symplify/pull/474 [#473]: https://github.com/Symplify/Symplify/pull/473 [#472]: https://github.com/Symplify/Symplify/pull/472 -[#471]: https://github.com/Symplify/Symplify/pull/471 [#466]: https://github.com/Symplify/Symplify/pull/466 [#437]: https://github.com/Symplify/Symplify/pull/437 [#487]: https://github.com/Symplify/Symplify/issues/487 [#483]: https://github.com/Symplify/Symplify/issues/483 [#477]: https://github.com/Symplify/Symplify/issues/477 -[v3.0.1]: https://github.com/Symplify/Symplify/compare/v3.0.0...v3.0.1 [v3.0.0]: https://github.com/Symplify/Symplify/compare/v2.5.0...v3.0.0 [#452]: https://github.com/Symplify/Symplify/pull/452 [v2.5.0]: https://github.com/Symplify/Symplify/compare/v2.4.0...v2.5.0 @@ -1164,7 +1162,6 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#431]: https://github.com/Symplify/Symplify/pull/431 [#430]: https://github.com/Symplify/Symplify/pull/430 [#427]: https://github.com/Symplify/Symplify/pull/427 -[#422]: https://github.com/Symplify/Symplify/issues/422 [#421]: https://github.com/Symplify/Symplify/pull/421 [#419]: https://github.com/Symplify/Symplify/pull/419 [#417]: https://github.com/Symplify/Symplify/pull/417 @@ -1235,7 +1232,6 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#225]: https://github.com/Symplify/Symplify/pull/225 [#224]: https://github.com/Symplify/Symplify/pull/224 [#223]: https://github.com/Symplify/Symplify/pull/223 -[#222]: https://github.com/Symplify/Symplify/pull/222 [#221]: https://github.com/Symplify/Symplify/pull/221 [#217]: https://github.com/Symplify/Symplify/pull/217 [#215]: https://github.com/Symplify/Symplify/pull/215 @@ -1253,10 +1249,8 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#188]: https://github.com/Symplify/Symplify/pull/188 [#186]: https://github.com/Symplify/Symplify/pull/186 [#184]: https://github.com/Symplify/Symplify/pull/184 -[#183]: https://github.com/Symplify/Symplify/pull/183 [#182]: https://github.com/Symplify/Symplify/pull/182 [#179]: https://github.com/Symplify/Symplify/pull/179 -[#173]: https://github.com/Symplify/Symplify/pull/173 [#170]: https://github.com/Symplify/Symplify/pull/170 [#165]: https://github.com/Symplify/Symplify/pull/165 [#164]: https://github.com/Symplify/Symplify/pull/164 @@ -1314,18 +1308,14 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#577]: https://github.com/Symplify/Symplify/pull/577 [#576]: https://github.com/Symplify/Symplify/pull/576 [#574]: https://github.com/Symplify/Symplify/pull/574 -[#573]: https://github.com/Symplify/Symplify/pull/573 [#570]: https://github.com/Symplify/Symplify/pull/570 [#562]: https://github.com/Symplify/Symplify/pull/562 [#560]: https://github.com/Symplify/Symplify/pull/560 [#559]: https://github.com/Symplify/Symplify/pull/559 [@tomasfejfar]: https://github.com/tomasfejfar -[@muglug]: https://github.com/muglug [#583]: https://github.com/Symplify/Symplify/pull/583 -[#578]: https://github.com/Symplify/Symplify/pull/578 [caf08e]: https://github.com/Symplify/Symplify/commit/caf08e93b2627e1e981493349957f4e49d55cd6a [59bdfc]: https://github.com/Symplify/Symplify/commit/59bdfc3c0d4945f946d17f127e6a329384d5bab8 -[257e5b]: https://github.com/Symplify/Symplify/commit/257e5bc68b9341f8fbe1e306d08f736038d6d626 [1fcc92]: https://github.com/Symplify/Symplify/commit/1fcc927258710b0a03a806fa1661ed0179a5aaf7 [#640]: https://github.com/Symplify/Symplify/pull/640 [#638]: https://github.com/Symplify/Symplify/issues/638 @@ -1359,16 +1349,12 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#708]: https://github.com/Symplify/Symplify/pull/708 [#707]: https://github.com/Symplify/Symplify/pull/707 [#705]: https://github.com/Symplify/Symplify/pull/705 -[#704]: https://github.com/Symplify/Symplify/pull/704 -[#703]: https://github.com/Symplify/Symplify/pull/703 [#700]: https://github.com/Symplify/Symplify/pull/700 [#698]: https://github.com/Symplify/Symplify/pull/698 [#693]: https://github.com/Symplify/Symplify/pull/693 [#692]: https://github.com/Symplify/Symplify/pull/692 -[#691]: https://github.com/Symplify/Symplify/pull/691 [#680]: https://github.com/Symplify/Symplify/pull/680 [@OndraM]: https://github.com/OndraM -[v4.0.0alpha3]: https://github.com/Symplify/Symplify/compare/v3.2.0...v4.0.0alpha3 [#722]: https://github.com/Symplify/Symplify/pull/722 [#721]: https://github.com/Symplify/Symplify/pull/721 [#720]: https://github.com/Symplify/Symplify/pull/720 @@ -1391,14 +1377,12 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [v4.0.0]: https://github.com/Symplify/Symplify/compare/v3.2.0...v4.0.0 [#755]: https://github.com/Symplify/Symplify/pull/755 [#706]: https://github.com/Symplify/Symplify/pull/706 -[v4.0.1]: https://github.com/Symplify/Symplify/compare/v4.0.0...v4.0.1 [#759]: https://github.com/Symplify/Symplify/pull/759 [#758]: https://github.com/Symplify/Symplify/pull/758 [#757]: https://github.com/Symplify/Symplify/pull/757 [#750]: https://github.com/Symplify/Symplify/issues/750 [#764]: https://github.com/Symplify/Symplify/pull/764 [#763]: https://github.com/Symplify/Symplify/pull/763 -[v4.0.2]: https://github.com/Symplify/Symplify/compare/v4.0.1...v4.0.2 [#769]: https://github.com/Symplify/Symplify/pull/769 [#768]: https://github.com/Symplify/Symplify/pull/768 [#767]: https://github.com/Symplify/Symplify/pull/767 @@ -1415,9 +1399,7 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#776]: https://github.com/Symplify/Symplify/pull/776 [#771]: https://github.com/Symplify/Symplify/pull/771 [#770]: https://github.com/Symplify/Symplify/pull/770 -[v4.1.1]: https://github.com/Symplify/Symplify/compare/v4.1.0...v4.1.1 [#796]: https://github.com/Symplify/Symplify/pull/796 -[v4.2.0]: https://github.com/Symplify/Symplify/compare/v4.1.0...v4.2.0 [#811]: https://github.com/Symplify/Symplify/pull/811 [#810]: https://github.com/Symplify/Symplify/pull/810 [#809]: https://github.com/Symplify/Symplify/pull/809 @@ -1454,13 +1436,11 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#867]: https://github.com/Symplify/Symplify/pull/867 [#863]: https://github.com/Symplify/Symplify/pull/863 [#862]: https://github.com/Symplify/Symplify/pull/862 -[#861]: https://github.com/Symplify/Symplify/pull/861 [#858]: https://github.com/Symplify/Symplify/pull/858 [#857]: https://github.com/Symplify/Symplify/pull/857 [#855]: https://github.com/Symplify/Symplify/pull/855 [#854]: https://github.com/Symplify/Symplify/pull/854 [#837]: https://github.com/Symplify/Symplify/pull/837 -[#833]: https://github.com/Symplify/Symplify/pull/833 [#860]: https://github.com/Symplify/Symplify/pull/860 [#843]: https://github.com/Symplify/Symplify/pull/843 [#727]: https://github.com/Symplify/Symplify/pull/727 @@ -1479,13 +1459,7 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#884]: https://github.com/Symplify/Symplify/pull/884 [#883]: https://github.com/Symplify/Symplify/pull/883 [#881]: https://github.com/Symplify/Symplify/pull/881 -[#880]: https://github.com/Symplify/Symplify/pull/880 [#879]: https://github.com/Symplify/Symplify/pull/879 -[#878]: https://github.com/Symplify/Symplify/pull/878 -[#877]: https://github.com/Symplify/Symplify/pull/877 -[#876]: https://github.com/Symplify/Symplify/pull/876 -[#875]: https://github.com/Symplify/Symplify/pull/875 -[#872]: https://github.com/Symplify/Symplify/pull/872 [#871]: https://github.com/Symplify/Symplify/pull/871 [#870]: https://github.com/Symplify/Symplify/pull/870 [@jankonas]: https://github.com/jankonas @@ -1506,13 +1480,7 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#884]: https://github.com/Symplify/Symplify/pull/884 [#883]: https://github.com/Symplify/Symplify/pull/883 [#881]: https://github.com/Symplify/Symplify/pull/881 -[#880]: https://github.com/Symplify/Symplify/pull/880 [#879]: https://github.com/Symplify/Symplify/pull/879 -[#878]: https://github.com/Symplify/Symplify/pull/878 -[#877]: https://github.com/Symplify/Symplify/pull/877 -[#876]: https://github.com/Symplify/Symplify/pull/876 -[#875]: https://github.com/Symplify/Symplify/pull/875 -[#872]: https://github.com/Symplify/Symplify/pull/872 [#871]: https://github.com/Symplify/Symplify/pull/871 [#870]: https://github.com/Symplify/Symplify/pull/870 [@jankonas]: https://github.com/jankonas @@ -1548,13 +1516,10 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#963]: https://github.com/Symplify/Symplify/pull/963 [#962]: https://github.com/Symplify/Symplify/pull/962 [#961]: https://github.com/Symplify/Symplify/pull/961 -[#959]: https://github.com/Symplify/Symplify/pull/959 [#958]: https://github.com/Symplify/Symplify/pull/958 [#957]: https://github.com/Symplify/Symplify/pull/957 [#956]: https://github.com/Symplify/Symplify/pull/956 [#955]: https://github.com/Symplify/Symplify/pull/955 -[#954]: https://github.com/Symplify/Symplify/pull/954 -[#953]: https://github.com/Symplify/Symplify/pull/953 [#952]: https://github.com/Symplify/Symplify/pull/952 [#951]: https://github.com/Symplify/Symplify/pull/951 [#950]: https://github.com/Symplify/Symplify/pull/950 @@ -1578,9 +1543,7 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#1004]: https://github.com/Symplify/Symplify/pull/1004 [#1003]: https://github.com/Symplify/Symplify/pull/1003 [#1002]: https://github.com/Symplify/Symplify/pull/1002 -[#999]: https://github.com/Symplify/Symplify/pull/999 [#998]: https://github.com/Symplify/Symplify/pull/998 -[#996]: https://github.com/Symplify/Symplify/pull/996 [#995]: https://github.com/Symplify/Symplify/pull/995 [#994]: https://github.com/Symplify/Symplify/pull/994 [#993]: https://github.com/Symplify/Symplify/pull/993 @@ -1592,14 +1555,10 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#984]: https://github.com/Symplify/Symplify/pull/984 [#975]: https://github.com/Symplify/Symplify/pull/975 [v4.6.0]: https://github.com/Symplify/Symplify/compare/v4.5.1...v4.6.0 -[#1023]: https://github.com/Symplify/Symplify/pull/1023 [#1020]: https://github.com/Symplify/Symplify/pull/1020 [#1014]: https://github.com/Symplify/Symplify/pull/1014 [#1013]: https://github.com/Symplify/Symplify/pull/1013 -[#1010]: https://github.com/Symplify/Symplify/pull/1010 [#1009]: https://github.com/Symplify/Symplify/pull/1009 -[#1001]: https://github.com/Symplify/Symplify/pull/1001 -[#1000]: https://github.com/Symplify/Symplify/pull/1000 [v4.6.1]: https://github.com/Symplify/Symplify/compare/v4.6.0...v4.6.1 [#1044]: https://github.com/Symplify/Symplify/pull/1044 [#1043]: https://github.com/Symplify/Symplify/pull/1043 @@ -1612,11 +1571,8 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#1036]: https://github.com/Symplify/Symplify/pull/1036 [#1035]: https://github.com/Symplify/Symplify/pull/1035 [#1034]: https://github.com/Symplify/Symplify/pull/1034 -[#1033]: https://github.com/Symplify/Symplify/pull/1033 [#1032]: https://github.com/Symplify/Symplify/pull/1032 [#1030]: https://github.com/Symplify/Symplify/pull/1030 -[#1027]: https://github.com/Symplify/Symplify/pull/1027 -[#1026]: https://github.com/Symplify/Symplify/pull/1026 [#1021]: https://github.com/Symplify/Symplify/pull/1021 [#1016]: https://github.com/Symplify/Symplify/pull/1016 [#1015]: https://github.com/Symplify/Symplify/pull/1015 @@ -1625,4 +1581,3 @@ This change was finished in [Statie](https://github.com/Symplify/Statie) and [Ea [#997]: https://github.com/Symplify/Symplify/pull/997 [#973]: https://github.com/Symplify/Symplify/pull/973 [#972]: https://github.com/Symplify/Symplify/pull/972 -[@TomasLudvik]: https://github.com/TomasLudvik diff --git a/composer.json b/composer.json index 4fd91142b1b..6050d695078 100644 --- a/composer.json +++ b/composer.json @@ -100,7 +100,8 @@ "phpstan": "vendor/bin/phpstan analyse packages --level max --configuration phpstan.neon", "changelog": [ "packages/ChangelogLinker/bin/changelog-linker dump-merges --in-categories --in-packages", - "packages/ChangelogLinker/bin/changelog-linker linkify" + "packages/ChangelogLinker/bin/changelog-linker linkify", + "packages/ChangelogLinker/bin/changelog-linker cleanup" ] }, "config": { diff --git a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php index 55e24855c00..65af6632667 100644 --- a/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php +++ b/packages/ChangelogLinker/src/Analyzer/LinksAnalyzer.php @@ -28,7 +28,7 @@ public function analyzeContent(string $content): void // [content] $this->references = []; - foreach (Strings::matchAll($content, '#\[\#?(?[(@\w\d\.]+)\](?!:)(?!\()#') as $match) { + foreach (Strings::matchAll($content, '#\[\#?(?[(-\/@\w\d\.]+)\](?!:)(?!\()#') as $match) { $this->references[] = $match['reference']; } $this->references = array_unique($this->references); From d1c21c0b4de93483850763cdcc8e5275ff9bbe35 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 1 Sep 2018 23:07:40 +0200 Subject: [PATCH 7/7] travis: fix command name --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7735d07af35..47e05135157 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,7 @@ script: fi # validate monorepo <=> packages composer dependencies - - packages/MonorepoBuilder/bin/monorepo-builder validate-versions + - packages/MonorepoBuilder/bin/monorepo-builder validate after_script: # upload coverage.xml to Coveralls