forcedotcom / sfdx-code-analyzer-vscode

Salesforce Code Analyzer is a unified tool for source code analysis. Run Code Analyzer to scan multiple languages in your code and add diagnostic info to your code that describes the violations.
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

@W-15093436@ trigger scan on save when a file is saved #48

Closed jag-j closed 8 months ago

jag-j commented 8 months ago

@jfeingold35 - Unfortunately there isn't a way to add tests for activation events AFAIK. I looked at some examples on other extensions and they don't seem to have either.

jfeingold35 commented 8 months ago

@jag-j , can you add a test for the scan being triggered after a file is saved?

stephen-carter-at-sf commented 8 months ago

Food for thought regarding:

Unfortunately there isn't a way to add tests for activation events AFAIK. I looked at some examples on other extensions and they don't seem to have either.

There is always a way to test... but it may require a number of layers of indirection and dependency injection. The trade off is that the code may become unnecessarily complex if we add in a ton of interfaces to achieve indirection and testability. But in this case it seems that if we added in the interfaces for indirection, we would simply be testing that our interfaces were called and wouldn't provide much value other than code coverage purposes. So this mainly depends on how high we want our code coverage numbers. But in terms of functionality testing... doesn't help much if the test code is highly coupled to the source code due to the nature of the feature we are testing.