Skip to content

Comments

refactor(convert): dynamically detect languages and versions instead …#2359

Open
Arunodoy18 wants to merge 2 commits intoOWASP:masterfrom
Arunodoy18:refactor/2340-dynamic-convertvars-detection
Open

refactor(convert): dynamically detect languages and versions instead …#2359
Arunodoy18 wants to merge 2 commits intoOWASP:masterfrom
Arunodoy18:refactor/2340-dynamic-convertvars-detection

Conversation

@Arunodoy18
Copy link

Summary

Refactors ConvertVars to dynamically detect available languages and versions by scanning the source/ directory at runtime instead of relying on hardcoded lists.

Closes #2340.

Problem

ConvertVars previously used hardcoded LANGUAGE_CHOICES and VERSION_CHOICES.
This required manual updates whenever new YAML files were added and created a risk of inconsistencies between the script and the actual contents of source/.

Changes

  • Scan the source/ directory for .yaml files during initialization.
  • Extract version and language from filename patterns.
  • Dynamically populate:
    • LANGUAGE_CHOICES
    • VERSION_CHOICES
  • Preserve special values: "all" and "latest".
  • Maintain existing CLI behavior (no breaking changes).

Benefits

  • Eliminates manual maintenance when new files are added.
  • Prevents mismatch between script configuration and available source files.
  • Improves contributor discoverability.
  • Reduces technical debt.

Notes

  • Directory scanning occurs once during initialization.
  • Malformed filenames are handled safely.
  • No changes to conversion logic or output format.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic Choice Detection in convert.py

1 participant