Skip to content

fix: support feat! breaking change notation in semantic-release#46

Merged
dev-davexoyinbo merged 1 commit into
mainfrom
v2
May 25, 2026
Merged

fix: support feat! breaking change notation in semantic-release#46
dev-davexoyinbo merged 1 commit into
mainfrom
v2

Conversation

@dev-davexoyinbo
Copy link
Copy Markdown
Contributor

Add parserOpts to commit-analyzer so feat!: and feat(scope)!: are recognized as breaking changes and trigger a major bump. Angular preset v8 headerPattern lacks ! support by default.

Add parserOpts to commit-analyzer so feat!: and feat(scope)!:
are recognized as breaking changes and trigger a major bump.
Angular preset v8 headerPattern lacks ! support by default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Support feat! breaking change notation in semantic-release

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Add parserOpts to commit-analyzer for breaking change support
• Configure headerPattern to recognize feat! notation
• Enable breakingHeaderPattern for major version bumps
• Remove unnecessary preset configurations
Diagram
flowchart LR
  A["commit-analyzer config"] -- "add parserOpts" --> B["headerPattern with !"]
  B -- "recognize breaking changes" --> C["breakingHeaderPattern"]
  C -- "trigger major bump" --> D["semantic versioning"]

Loading

File Changes

1. release.config.js 🐞 Bug fix +6/-11

Configure parserOpts for breaking change notation support

• Added parserOpts configuration to commit-analyzer plugin
• Configured headerPattern regex to match feat! and feat(scope)! patterns
• Added breakingHeaderPattern to identify breaking changes with ! notation
• Removed preset configurations from commit-analyzer and release-notes-generator
• Simplified plugin configuration structure

release.config.js


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented May 25, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0)

Grey Divider


Action required

1. Greedy scope regex 🐞 Bug ≡ Correctness
Description
The new headerPattern/breakingHeaderPattern use (.*) for the scope capture, which can consume
) characters from the subject and cause the header regex not to match at all. When that happens,
semantic-release parsing can misclassify or skip commits, producing incorrect version bumps and
changelog entries.
Code

release.config.js[R6-7]

Evidence
The PR introduces greedy (.*) scope capture in both header regexes, which is prone to
over-matching and breaking the required :  delimiter alignment for valid commit headers.

release.config.js[4-9]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`parserOpts.headerPattern` and `parserOpts.breakingHeaderPattern` use a greedy `.*` inside the optional scope group (`\((.*)\)`), which can over-match when the subject contains `)` and prevent the header from matching.

## Issue Context
This config is used by semantic-release’s commit parsing; if the header regex fails, the commit may be uncategorized/ignored for bumping and/or changelog generation.

## Fix Focus Areas
- release.config.js[6-8]

## Suggested change
Replace `(.*)` with a scope-safe pattern such as `([^)]*)` (or `(.+?)`) in both regexes, e.g.:
- `headerPattern: /^(\w*)(?:\(([^)]*)\))?!?: (.*)$/`
- `breakingHeaderPattern: /^(\w*)(?:\(([^)]*)\))?!: (.*)$/`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Notes parser mismatch 🐞 Bug ≡ Correctness
Description
Only @semantic-release/commit-analyzer is configured with the custom parserOpts, while
@semantic-release/release-notes-generator remains unconfigured and will use its default parsing
rules. This can produce major version bumps for feat!: commits without corresponding
breaking-change content (or correct classification) in the generated release notes and
CHANGELOG.md.
Code

release.config.js[R4-13]

Evidence
The config applies custom parsing only to commit-analyzer, while release-notes-generator is left at
defaults; changelog generation is enabled, so any parsing mismatch affects published notes and
CHANGELOG.

release.config.js[4-13]
release.config.js[11-17]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`@semantic-release/commit-analyzer` has custom `parserOpts` for `!` breaking headers, but `@semantic-release/release-notes-generator` is configured as a bare string. This makes version calculation and notes/changelog generation parse commits differently.

## Issue Context
The changelog plugin consumes the release notes output; if the notes generator doesn’t recognize `feat!:` / `feat(scope)!:` consistently, releases can show a major bump while the notes/CHANGELOG don’t reflect the breaking change correctly.

## Fix Focus Areas
- release.config.js[4-17]

## Suggested change
Configure `@semantic-release/release-notes-generator` with the same `parserOpts` (and, if you intentionally rely on a specific preset, explicitly set it on both plugins as well), e.g.:

```js
["@semantic-release/release-notes-generator", {
 parserOpts: {
   headerPattern: /^(\w*)(?:\(([^)]*)\))?!?: (.*)$/,
   breakingHeaderPattern: /^(\w*)(?:\(([^)]*)\))?!: (.*)$/,
   headerCorrespondence: ["type", "scope", "subject"],
 },
}],
```

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@dev-davexoyinbo dev-davexoyinbo merged commit 16ce85d into main May 25, 2026
6 checks passed
Comment thread release.config.js
Comment on lines +6 to +7
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Greedy scope regex 🐞 Bug ≡ Correctness

The new headerPattern/breakingHeaderPattern use (.*) for the scope capture, which can consume
) characters from the subject and cause the header regex not to match at all. When that happens,
semantic-release parsing can misclassify or skip commits, producing incorrect version bumps and
changelog entries.
Agent Prompt
## Issue description
`parserOpts.headerPattern` and `parserOpts.breakingHeaderPattern` use a greedy `.*` inside the optional scope group (`\((.*)\)`), which can over-match when the subject contains `)` and prevent the header from matching.

## Issue Context
This config is used by semantic-release’s commit parsing; if the header regex fails, the commit may be uncategorized/ignored for bumping and/or changelog generation.

## Fix Focus Areas
- release.config.js[6-8]

## Suggested change
Replace `(.*)` with a scope-safe pattern such as `([^)]*)` (or `(.+?)`) in both regexes, e.g.:
- `headerPattern: /^(\w*)(?:\(([^)]*)\))?!?: (.*)$/`
- `breakingHeaderPattern: /^(\w*)(?:\(([^)]*)\))?!: (.*)$/`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread release.config.js
Comment on lines +4 to 13
["@semantic-release/commit-analyzer", {
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
headerCorrespondence: ["type", "scope", "subject"],
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits", // 👈 Add this for consistent notes
},
],
}],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Notes parser mismatch 🐞 Bug ≡ Correctness

Only @semantic-release/commit-analyzer is configured with the custom parserOpts, while
@semantic-release/release-notes-generator remains unconfigured and will use its default parsing
rules. This can produce major version bumps for feat!: commits without corresponding
breaking-change content (or correct classification) in the generated release notes and
CHANGELOG.md.
Agent Prompt
## Issue description
`@semantic-release/commit-analyzer` has custom `parserOpts` for `!` breaking headers, but `@semantic-release/release-notes-generator` is configured as a bare string. This makes version calculation and notes/changelog generation parse commits differently.

## Issue Context
The changelog plugin consumes the release notes output; if the notes generator doesn’t recognize `feat!:` / `feat(scope)!:` consistently, releases can show a major bump while the notes/CHANGELOG don’t reflect the breaking change correctly.

## Fix Focus Areas
- release.config.js[4-17]

## Suggested change
Configure `@semantic-release/release-notes-generator` with the same `parserOpts` (and, if you intentionally rely on a specific preset, explicitly set it on both plugins as well), e.g.:

```js
["@semantic-release/release-notes-generator", {
  parserOpts: {
    headerPattern: /^(\w*)(?:\(([^)]*)\))?!?: (.*)$/,
    breakingHeaderPattern: /^(\w*)(?:\(([^)]*)\))?!: (.*)$/,
    headerCorrespondence: ["type", "scope", "subject"],
  },
}],
```

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant