Closed jmgawecki closed 9 months ago
@jmgawecki thanks for reaching out - can you share the configuration you're using in .launchdarkly/coderefs.yml
file?
Hey there, thanks for getting back. Would you be able to guide me where do I find this directory? Is it in the project?
It's optional, but it you have it, it should be part of project repo. Here is more information about configuration https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/CONFIGURATION.md#yaml
If you don't see one that exists, my guess is that you may need some aliases configured to find your flag keys.
Can you share an example of what one of your flag's look like in the code? (variable name / format etc.)
Flags are kept in the enum as such (Swift):
public enum FeatureFlag: String, CaseIterable, Codable {
case FIRST_FEATURE_FLAG
case SECOND_FEATURE_FLAG
}
The only file I added is .../Project/.github/workflows/action.yaml
Thanks for sharing, as long as your FIRST_FEATURE_FLAG
matches the flag key in LD (for example, "first-feature-flag"
, it seems you'll need to configure aliases in ...Project/.launchdarkly/coderefs.yaml
like this:
aliases:
- type: uppersnakecase
Thanks,
I've checked the LD and flags there and what's defined here are a perfect match, for ex:
FIRST_FEATURE_FLAG
in LD is exactly the same on the client FIRST_FEATURE_FLAG
.
In that case, do I understand it correctly that aliases should not be needed?
The way that our flag key scanning works means that we look for matches of the KEY
surrounded by delimiters like so, "KEY"
Since your usage uses the KEY
without quotes, it needs the uppersnakecase
alias to find the match (aliases don't require delimiters`.
Another option is to disable delimiter matching in your configuration like
delimiters:
disableDefaults: true
Please let me know if either of those options work
I found the solution. When explicitly writing down the raw value, LD finds it. As en example:
public enum FeatureFlag: String, CaseIterable, Codable {
case FIRST_FEATURE_FLAG = "FIRST_FEATURE_FLAG" // finds it
case SECOND_FEATURE_FLAG // will not find it
}
Is this potentially a bug?
This is expected behavior - Here are some tests that demonstrate the behavior you're seeing https://github.com/launchdarkly/ld-find-code-refs/pull/395
This solved the issue! Thanks
Issue has been resolved by disabling delimiters
Glad we were able to come to resolution!
Scan succeeds but finds no references.
Our yaml file:
Result of the scan:
The very same configuration on our Android project works just fine, finds reference and sends them to LD UI. I've checked the gitignore file as I've seen that entry .* may cause some issues but it's not the case for us.
Thanks for help