SEM008 : List all tokens in the batch
Introduction
Section titled “Introduction”Description
Section titled “Description”Metrics rule - reports all tokens. For use with SonarQube CPD.
How to fix
Section titled “How to fix”The rule is only informational.
The rule has a Batch scope and is applied only on the SQL script.
Parameters
Section titled “Parameters”| Name | Description | Default Value |
|---|---|---|
| SkipComments | The parameter controls whether to ignore comments. | yes |
Remarks
Section titled “Remarks”The rule does not need Analysis Context or SQL Connection.
Effort To Fix
Section titled “Effort To Fix”Not configured.
Categories
Section titled “Categories”Metrics
Additional Information
Section titled “Additional Information”There is no additional info for this rule.
Example Test SQL
Section titled “Example Test SQL”begindeclare @like varchar(20)set @like = '1,2,3';
-- non-ANSI inner join syntax:SELECT a.au_id , t.titlr eFROM titles AS t , authors AS a , titleauthor AS taWHERE a.au_id = ta.au_id AND ta.title_id = t.title_id AND t.title LIKE 'Example%'
-- ANSI inner join syntax:
/* some comment */
endAnalysis Results
Section titled “Analysis Results”| Message | Line | Column | |
|---|---|---|---|
| 1 | SEM008 : Range=1;0;1;5,Type=keyword,Token=begin | 1 | 0 |
| 2 | SEM008 : Range=2;0;2;7,Type=keyword,Token=declare | 2 | 0 |
| 3 | SEM008 : Range=2;8;2;13,Type=variable-local,Token=@like | 2 | 8 |
| 4 | SEM008 : Range=2;14;2;21,Type=predefined,Token=varchar | 2 | 14 |
| 5 | SEM008 : Range=2;22;2;24,Type=constant-exact-number,Token=20 | 2 | 22 |
| 6 | SEM008 : Range=3;0;3;3,Type=keyword,Token=set | 3 | 0 |
| 7 | SEM008 : Range=3;4;3;9,Type=variable-local,Token=@like | 3 | 4 |
| 8 | SEM008 : Range=3;10;3;11,Type=opearator-assignment,Token== | 3 | 10 |
| 9 | SEM008 : Range=3;12;3;19,Type=constant-string,Token=‘1,2,3’ | 3 | 12 |
| 10 | SEM008 : Range=6;0;6;6,Type=keyword,Token=select | 6 | 0 |
| … | |||
| 46 | SEM008 : Range=13;24;13;34,Type=constant-string,Token=‘Example%’ | 13 | 24 |
| 47 | SEM008 : Range=20;0;20;3,Type=keyword,Token=end | 20 | 0 |