we need SonarCube to check SQL files for certain constraints like “If you ALTER TABLE to create a new Foreign-Key REFERENCES Column, then you MUST also provide a proper CREATE INDEX statement for that as well”.
Those SQL files are checked in to the source-tree as schema-migrations and applied by Java-Flyway on deployments.
If my understanding is correct, SonarCube only supports PL/SQL and T/SQL? Is that correct or can we come up with rules for above SQL DDL Checks?
Welcome to the community!
Natively we support T-SQL and PL/SQL starting in Developer Edition($). We also support the ability to write custom Java rules, and there’s also the possibility of writing a custom language plugin.
what does this imply exactly?
I guess I cant use T-SQL/PL-SQL for those means?
What’s the recommended way to tackle this then, a custom language plugin?
Yes, you may need to write a custom plugin.
Would we be able to use/integrate such a custom plugin in SonarCloud.io?
Oops. I overlooked the fact that you’re on SonarCloud. Sorry about that.
So you would write the same analysis engine, but not in the form of a plugin. You’d run it before analysis to generate a Generic Issues report and pull that in as part of analysis.