Merge pull request #31206 from woocommerce/fix/changelogger-validate

Jetpack Changelogger: Validate entries
This commit is contained in:
Claudio Sanches 2021-11-26 13:21:01 -03:00 committed by GitHub
commit bc910e2364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 57 deletions

View File

@ -12,15 +12,15 @@
"formatter": { "formatter": {
"filename": "../../../tools/changelogger/PackageFormatter.php" "filename": "../../../tools/changelogger/PackageFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }
} }

View File

@ -12,15 +12,15 @@
"formatter": { "formatter": {
"filename": "../../../tools/changelogger/PackageFormatter.php" "filename": "../../../tools/changelogger/PackageFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }
} }

View File

@ -12,15 +12,15 @@
"formatter": { "formatter": {
"filename": "../../../tools/changelogger/PackageFormatter.php" "filename": "../../../tools/changelogger/PackageFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }
} }

View File

@ -12,15 +12,15 @@
"formatter": { "formatter": {
"filename": "../../../tools/changelogger/PackageFormatter.php" "filename": "../../../tools/changelogger/PackageFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }
} }

View File

@ -12,15 +12,15 @@
"formatter": { "formatter": {
"filename": "../../../tools/changelogger/PackageFormatter.php" "filename": "../../../tools/changelogger/PackageFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }
} }

View File

@ -39,7 +39,7 @@
"sort-packages": true, "sort-packages": true,
"platform": { "platform": {
"php": "7.0.33" "php": "7.0.33"
} }
}, },
"autoload": { "autoload": {
"exclude-from-classmap": [ "exclude-from-classmap": [
@ -122,15 +122,15 @@
"formatter": { "formatter": {
"filename": "../../tools/changelogger/PluginFormatter.php" "filename": "../../tools/changelogger/PluginFormatter.php"
}, },
"types": [ "types": {
"Fix", "fix": "Fixes an existing bug",
"Add", "add": "Adds functionality",
"Update", "update": "Update existing functionality",
"Dev", "dev": "Development related task",
"Tweak", "tweak": "A minor adjustment to the codebase",
"Performance", "performance": "Address performance issues",
"Enhancement" "enhancement": "Improve existing functionality"
], },
"versioning": "wordpress", "versioning": "wordpress",
"changelog": "NEXT_CHANGELOG.md" "changelog": "NEXT_CHANGELOG.md"
} }

View File

@ -256,10 +256,11 @@ class Formatter extends KeepAChangelogParser {
foreach ( $entry->getChangesBySubheading() as $heading => $changes ) { foreach ( $entry->getChangesBySubheading() as $heading => $changes ) {
foreach ( $changes as $change ) { foreach ( $changes as $change ) {
$breaking_change = 'major' === $change->getSignificance() ? ' [ **BREAKING CHANGE** ]' : ''; $significance = $change->getSignificance();
$breaking_change = 'major' === $significance ? ' [ **BREAKING CHANGE** ]' : '';
$text = trim( $change->getContent() ); $text = trim( $change->getContent() );
if ( '' !== $text ) { if ( '' !== $text ) {
$preamble = $is_subentry ? '' : $bullet . $heading . $breaking_change . ' - '; $preamble = $is_subentry ? '' : $bullet . ucfirst( $significance ) . $breaking_change . ' - ';
$ret .= $preamble . str_replace( "\n", "\n$indent", $text ) . "\n"; $ret .= $preamble . str_replace( "\n", "\n$indent", $text ) . "\n";
} }
} }