-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add fake code scanning function [IDE-158] #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
51f574c to
f422152
Compare
cmars
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really excited to see this starting! Some comments below to consider but nothing blocking.
Some ideas for followups:
- Could we generate the client (or just these wireformat types) from an OpenAPI spec? I've had good results with https://github.com/deepmap/oapi-codegen. This will help later when we need to iterate on new APIs, or support multiple versions.
- Could we introduce a linter (https://golangci-lint.run/) and add it to CI? I think it'll really help us maintain code quality in the long term.
Thanks again for this!
pkg/fake/fake.go
Outdated
| * limitations under the License. | ||
| */ | ||
|
|
||
| package fake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this fake go into an internal package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan is to be able to use everything in this package from snyk-ls until Analysis have APIs for us to use. So the reason both this and the SARIF are exposed externally is because of that
| "encoding/json" | ||
| ) | ||
|
|
||
| var fakeResponse = `{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider loading this from a testdata fixture file (thinking of https://dave.cheney.net/2016/05/10/test-fixtures-in-go). It may be easier to work with (read, query, format, add more examples) as separate file(s).
5ffe93b to
e61a3ce
Compare
Adding a fake function that we can call from
snyk-lsand gradually add more functionality into. The reason I decided to return SARIF is because both the CLI andsnyk-lsread SARIF at the moment and format it into whatever they need to process. SARIF is what we will continue using for Snyk Code scanning as well, so it seemed like a safe first piece of "functionality" to add.Gradually, we will be moving the bundle creation and analysis code into here.