launchdarkly / ld-find-code-refs

Build tool for automatically sending feature flag code references to LaunchDarkly
https://launchdarkly.com
Other
46 stars 34 forks source link

'Failed to generate aliases' error when no files could be found by glob filepattern #235

Closed marioleed closed 2 years ago

marioleed commented 2 years ago

We're getting an error when we don't have feature flags in a project, i.e. there is no matching files as entered in the --dir argument.

Error message:

ERROR: 2022/03/17 17:14:21 matcher.go:43: failed to generate aliases: filepattern '0': could not process path glob 'D:\a\1\s*\FeatureFlags\.cs' for project: dummy

.launchdarkly/coderefs.yaml:

projKey: dummy
repoName: dummy-project
aliases:
  - type: filepattern
    paths:
      - '/**/FeatureFlags/*.cs'
    patterns:
      - 'public class \b(?P<FLAG_ALIAS>\w+)\b[\s\n]*:[\s\n]*FeatureFlag<\w+>[\s\n]*{[\s\n]*public override string Keyname[\s\n]*{?[\s\n]*g?e?t?[\s\n]*;?[\s\n]*}?[\s\n]*=>?[\s\n]*"FLAG_KEY"'

Before there was no errors if there were no files matching, which is the desired outcome, but now it gives the above error which we don't really care about. We have also added files matching the filepattern and it works - though it feels odd to have dummy files just to match a filepattern when we don't have any flags in a particular project.

It would be nice if it didn't throw an error in this case or if it could be an opt-in or opt-out feature (maybe in the coderefs.yaml or as an cli argument).

jazanne commented 2 years ago

@marioleed Thank you for reporting this issue and sorry for the interruption to your flow. Can you tell me what version of the plugin you were using previously when you didn't get errors for no files matching and the version you're using now where you see the errors?

marioleed commented 2 years ago

@jazanne Sorry for late reply!

The last version we ran (without any flags being present in the project and no errors) is 2.2.3. Don't know if it helps that much. The version we're running now is 2.5.7.

jazanne commented 2 years ago

This is now available in v2.7.0