go-ruleguard icon indicating copy to clipboard operation
go-ruleguard copied to clipboard

what to do if import doesn't exist in project dependencies?

Open peakle opened this issue 3 years ago • 4 comments

currently ruleguard fails if it doesn't find package from dsl.import method

peakle avatar Apr 12 '22 15:04 peakle

This might be related to #253 and #408

mem avatar Sep 12 '22 13:09 mem

@mem this issue about third party packages imported in rules such as this one for example: https://github.com/delivery-club/delivery-club-rules/blob/462a5e373a3d63ec51a8687cbb6dbc0379ac30b3/rules.go#L487

peakle avatar Sep 13 '22 20:09 peakle

solutions that i can imagine now:

  • add option (disabled by default) which will skip rule if imported package doesn't exist in project
  • always skip rule if it doensn't exist in project

what do you think @quasilyte?

peakle avatar Sep 13 '22 20:09 peakle

another one solution:

  • filter func in Importer which can be called (if exist) after/before Import method

peakle avatar Sep 14 '22 06:09 peakle