I am using Jenkins and SONARQUBE PL/SQL plugin for Oracle SQL code analysis, I need to create Custom rules using XPATH for Quality Analysis of the SQL Script files that are sent for deployment over Jenkins.
I am trying to create a custom rule that detects if a semicolon (" ; ") is missing at the end of any SQL commands. SQL termination ("semicolon") is of importance for deploying SQL scripts with SQLPLUS.
example of code
insert into table_name values('wait','for','completion'); -- compliant with script
insert into table_name values('somename','for','good'); -- compliant with script
**insert into table_name values('someplace','for','game')** -- non compliant as semicolon missing
insert into table_name values('something','for','change'); -- compliant with script
delete from table_name ; -- compliant with script
delete from table_name ; -- compliant with script
update table_name set name='james' where id='22';
there is a insert query that is missing the semicolon , and hence sonarqube should detect this and fail the jenkins build or fail the SONAR Quality test.
please help creating the PLSQL custom rule for detecting correct SQL termination by semicolon.
example of xpath would be: /COMPILATION_UNIT/ANY_DML_EXPRESSION/following-sibling::SEMICOLON -- something like this