Class FeatureIndexer

java.lang.Object
com.arc_e_tect.gradle.gherkin.indexing.FeatureIndexer

public class FeatureIndexer extends Object
Numbers Feature/Scenario titles directly in the source .feature files according to a configured IndexingMode.

Every run first strips any numbering left over from a previous run (recognised by the <number> - prefix this class itself adds), then - unless the mode is IndexingMode.OFF - applies fresh numbering. This makes the operation idempotent and makes switching between modes (including back to OFF) simply undo the previous numbering rather than requiring any state to be tracked between runs.

Never called with IndexingMode.CI: the caller skips invoking this class entirely for that mode, since CI means the feature files must be left completely untouched, not even to strip prior numbering the way IndexingMode.OFF does.

  • Constructor Details

    • FeatureIndexer

      public FeatureIndexer()
      Creates a new FeatureIndexer.
  • Method Details

    • reindex

      public void reindex(List<File> featureFiles, IndexingMode mode)
      Rewrites every file in featureFiles in place: strips any Feature/ Scenario numbering added by a previous run, then applies numbering per mode. Files are numbered in the order they appear in featureFiles - the caller is responsible for ordering that list the way numbers should be assigned. A file is only rewritten on disk when its content actually changes.
      Parameters:
      featureFiles - the feature files collected for this run, in the order to number them in
      mode - the indexing mode to apply