Improve code reference scan with indirect flag references
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
While some regex'ing was all it took for a successful PoC, there are valid ways of referencing feature flags we still don't cover.
For example (thanks @khvn26 for [pointing out](https://github.com/Flagsmith/flagsmith/pull/6970#discussion_r2960412159)), https://github.com/Flagsmith/flagsmith/pull/6970 introduces a function that will make flag references indirect:
```python
def is__premium_support__enabled(organisation):
return client.is_flag_enabled("premium_support") # This is found in the scan.
def the_actual_business_function():
if is__premium_support__enabled(org): # This is a more important reference, but isn't found.
...
def another_function():
if is__premium_support__enabled(org): # Multiple uses of the flag stay hidden!
...
```
## Acceptance criteria
- [ ] The code references scan covers for indirection such as the above.
Might be a good idea to look into [ast](https://docs.python.org/3/library/ast.html).
Contributor guide
Research direction
Locate the Python code-reference scan and read its current regex-based implementation; no file or test path is named in the issue. Review Python's ast documentation and trace how direct flag references are reported. Done means indirect calls such as is__premium_support__enabled are found at every use while direct references remain covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100