Skip to content
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

Add code analyzers support as nuget-packages to new SDK #332

Open
IVNSTN opened this issue Aug 31, 2023 · 1 comment
Open

Add code analyzers support as nuget-packages to new SDK #332

IVNSTN opened this issue Aug 31, 2023 · 1 comment
Labels
area: build sdk Related to Microsoft.Build.Sql SDK enhancement New feature or request

Comments

@IVNSTN
Copy link

IVNSTN commented Aug 31, 2023

Is your feature request related to a problem? Please describe.
We aim to control code quality in SQL projects with common (among other programming languages) set of rules related to: formatting, naming, bad practices detection. We produce our own linter which has a CLI app and is implemented as extension to VS 2019. But both of ways are divided from the build/compile/code analysis processes occurred during development process.

However there is a possibility to develop a Custom Static Code Analysis Rule Assembly which is supported by SSDT described in this msdn article. But the only way to install this custom code analyzer is to copy it manually somewhere in the deep of Program Files folder. This is very uncomfortable anyways and is a no go in corporate world where one does not have administrative privileges on his computer and just cannot modify anything inside Program Files. Even if one managed to install this analyzer once - how would all the users of this analyzer get updates, new releases?

Also currently you still need to enable custom analyzer manually in VS and this checkbox is not a part of project sources or sqlproj PropertyGroups thus you have no idea whether all the developer use this analyzer or not, it did not give you any warnings because there are no warnings or just because you forgot to enable this analyzer. This makes mentioned solution also unreliable.

Describe the solution you'd like
New SDK could just import all the nuget-packages which are marked somehow as code analyzers on the fly and apply them. Just as Roselyn does.

Scenario of using StyleCop code analyzer in C# development process:

  • add nuget dependency from StyleCop to your C# project
  • commit
  • clone repo
  • build your project
  • there you go - nuget package was restored, SDK detected code analyzer and applied it during build process
  • you see Warnings, Errors and Info messages in the dedicated VS tab

It'd be great if you make SDK:

  • import all analyzers from nuget packages - a project might require more than one analyzer
  • implement these analyzers support in VS 2019, VS 2022 and VS Code

Describe alternatives you've considered
If this will not be implemented then perhaps we will try this scenario:

  • deliver our linter as a nuget
  • add custom target to all sqlproj of ours which will call this linter during build process
    but error messages will not be integrated into VS IDE if I'm not mistaken.

Additional context

@chlafreniere chlafreniere added enhancement New feature or request area: build sdk Related to Microsoft.Build.Sql SDK labels Sep 13, 2023
@dzsquared
Copy link
Contributor

Expanding on this feature request, it would be an ideal way to unblock the use of custom code analysis rules with dotnet core build. At present, there's no way to execute custom rules on dotnet build in Linux/macOS. (that I've been able to work out at least)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build sdk Related to Microsoft.Build.Sql SDK enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants