Skip to content

feat(gherkin-to-asciidoc)!: add forceRewrite to skip renumbering already-numbered lines - #103

Merged
Arc-E-Tect merged 1 commit into
mainfrom
gherkin-to-asciidoc-indexing-force-rewrite
Aug 5, 2026
Merged

feat(gherkin-to-asciidoc)!: add forceRewrite to skip renumbering already-numbered lines#103
Arc-E-Tect merged 1 commit into
mainfrom
gherkin-to-asciidoc-indexing-force-rewrite

Conversation

@Arc-E-Tect

@Arc-E-Tect Arc-E-Tect commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a forceRewrite DSL property (default false) and matching -PgherkinToAsciidoc.forceRewrite CLI override.
  • When false (new default): a Feature/Scenario line whose existing number already matches the format the currently configured indexing value would itself produce is left completely untouched - only lines not yet correctly numbered for that mode are numbered. A newly added feature file that sorts alphabetically before already-numbered files is given the next number not already in use, rather than bumping every file after it.
  • A number left over from a different indexing value still doesn't "reflect" the current one, so it's stripped and replaced as before - e.g. switching from SCENARIO to ALL renumbers old single-integer scenario numbers to the new <featureNumber>.<n> format. OFF still always strips every number regardless of forceRewrite, since OFF's canonical state for every line is unnumbered.
  • Rewrites FeatureIndexer around a two-phase parse-then-resolve model (collect every Feature/Scenario line first, then resolve numbers - pinned or freshly assigned - before rewriting any file). forceRewrite = true restores the previous single-pass strip-then-renumber-everything behaviour unchanged.
  • Documents both in the plugin README (new "Not Renumbering Already-Numbered Lines" and updated "Overriding indexing/forceRewrite from the Command Line" sections) and the indexing example (new walkthrough, verified for real).

Breaking change

indexing's default numbering behaviour changes. Previously every generateFeatureDocs run fully renumbered every Feature/Scenario from scratch; by default it now preserves numbers that already match the current indexing value's format instead. Set forceRewrite = true (or -PgherkinToAsciidoc.forceRewrite=true) to keep the old always-renumber-everything behaviour.

Notes

  • Pins the example to gherkin-to-asciidoc = 3.0.0 (major bump: another breaking default-behaviour change, following 2.0.0's indexing and 2.1.0's additive ci/CLI-override). Verified locally against the plugin's own source (via a temporary includeBuild, since removed) before pinning - ran the exact documented walkthrough for real, both the default (preserving) and forceRewrite=true (full reshuffle) behaviour matched the README exactly.

…ady-numbered lines

Adds a forceRewrite DSL property (default false) and matching
-PgherkinToAsciidoc.forceRewrite CLI override. When false, a
Feature/Scenario line whose existing number already matches the
format the currently configured indexing value would itself produce
is left completely untouched; only lines not yet correctly numbered
for that mode are numbered. A newly added feature file that sorts
alphabetically before already-numbered files is given the next
number not already in use, rather than bumping every file after it.
A number left over from a *different* indexing value still doesn't
"reflect" the current one, so it's stripped and replaced as before -
e.g. switching from SCENARIO to ALL renumbers old single-integer
scenario numbers to the new <featureNumber>.<n> format. OFF still
always strips every number regardless of forceRewrite, since OFF's
canonical state for every line is unnumbered.

Rewrites FeatureIndexer around a two-phase parse-then-resolve model
(collect every Feature/Scenario line first, then resolve numbers -
pinned or freshly assigned - before rewriting any file) to support
this; forceRewrite = true restores the previous single-pass
strip-then-renumber-everything behaviour unchanged.

BREAKING CHANGE: indexing's default numbering behaviour changes.
Previously every generateFeatureDocs run fully renumbered every
Feature/Scenario from scratch; by default it now preserves numbers
that already match the current indexing value's format instead. Set
forceRewrite = true (or -PgherkinToAsciidoc.forceRewrite=true) to
keep the old always-renumber-everything behaviour.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Arc-E-Tect
Arc-E-Tect merged commit 48a74de into main Aug 5, 2026
4 of 5 checks passed
@Arc-E-Tect
Arc-E-Tect deleted the gherkin-to-asciidoc-indexing-force-rewrite branch August 5, 2026 15:02
Arc-E-Tect added a commit that referenced this pull request Aug 5, 2026
# [3.0.0](v2.1.0...v3.0.0) (2026-08-05)

### ✨ New and updated features

* **gherkin-to-asciidoc:** add forceRewrite to skip renumbering already-numbered lines ([#103](#103)) ([48a74de](48a74de)), closes [#103](#103)

### BREAKING CHANGE

* **gherkin-to-asciidoc:** indexing's default numbering behaviour changes.
Previously every generateFeatureDocs run fully renumbered every
Feature/Scenario from scratch; by default it now preserves numbers
that already match the current indexing value's format instead. Set
forceRewrite = true (or -PgherkinToAsciidoc.forceRewrite=true) to
keep the old always-renumber-everything behaviour.
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Arc-E-Tect added a commit that referenced this pull request Aug 10, 2026
# [1.0.0](shadow-api-detector-v0.4.0...shadow-api-detector-v1.0.0) (2026-08-10)

### ✨ New and updated features

* **gherkin-to-asciidoc:** add ci indexing value and a CLI override for the whole build ([#102](#102)) ([063c069](063c069)), closes [#102](#102) [#99](#99)
* **example-shadow-api-detector:** add composed RequestMapping example ([#98](#98)) ([6ea5163](6ea5163)), closes [#98](#98)
* **gherkin-to-asciidoc:** add forceRewrite to skip renumbering already-numbered lines ([#103](#103)) ([48a74de](48a74de)), closes [#103](#103)
* **gherkin-to-asciidoc:** add indexing DSL property to number features and scenarios ([#99](#99)) ([5c207c4](5c207c4)), closes [#99](#99)
* **shadow-api-detector:** stop auto-wiring detectShadowApis into check ([#105](#105)) ([03a3da7](03a3da7)), closes [#105](#105)

### 🐛 Bug Fixes

* **example-shadow-api-detector:** use official published plugin in examples ([#96](#96)) ([bca72d8](bca72d8)), closes [#96](#96)

### 📝 Documentation

* **gherkin-to-asciidoc:** add multi-project example demonstrating the indexing modes ([#100](#100)) ([a0cd7a7](a0cd7a7)), closes [#100](#100)
* **gherkin-to-asciidoc:** document the indexing property and the includeSubDirs/groupByFeature default changes ([#101](#101)) ([9fe4afd](9fe4afd)), closes [#101](#101) [#99](#99)

### BREAKING CHANGE

* **shadow-api-detector:** detectShadowApis no longer runs automatically as part
of check/build. Projects relying on the previous automatic wiring must
add the dependsOn shown above to keep the check in their build.
* **gherkin-to-asciidoc:** indexing's default numbering behaviour changes.
Previously every generateFeatureDocs run fully renumbered every
Feature/Scenario from scratch; by default it now preserves numbers
that already match the current indexing value's format instead. Set
forceRewrite = true (or -PgherkinToAsciidoc.forceRewrite=true) to
keep the old always-renumber-everything behaviour.
* **gherkin-to-asciidoc:** includeSubDirs and groupByFeature now default to
true (previously false). A project relying on the old defaults -
particularly one using sourceFile without explicitly setting
includeSubDirs = false, which will now fail validation - must set
includeSubDirs = false and/or groupByFeature = false explicitly to
keep its previous behaviour. Feature file processing order is also
now deterministic (alphabetical by path, directory files before
sub-directory files) instead of filesystem-dependent, which may
reorder scenarios in existing generated reports.
@Arc-E-Tect

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant