Skip to content

Commit 6b5be99

Browse files
committed
Small changes
1 parent 0bb8015 commit 6b5be99

File tree

17 files changed

+1342
-463
lines changed

17 files changed

+1342
-463
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,28 @@ Currently plug-in supports:
1515
- [TSQL](https://github.com/antlr/grammars-v4/tree/master/sql/tsql)
1616
- [MySQL](https://github.com/antlr/grammars-v4/tree/master/sql/mysql/Positive-Technologies)
1717
- [PostgreSQL](https://github.com/tshprecher/antlr_psql)
18+
- [PostgreSQL](https://github.com/antlr/grammars-v4/tree/master/sql/postgresql)
1819
- [VSQL](https://github.com/gretard/antlr4-grammar-vsql)
1920
- Reporting of issues found by:
2021
- [SQLCodeGuard](https://www.red-gate.com/products/sql-development/sql-code-guard/index)
2122
- [MSBuild](https://msdn.microsoft.com/en-us/library/dd172133(v=vs.100).aspx)
2223
- [SQLCheck](https://github.com/jarulraj/sqlcheck)
23-
- Custom rules reported by [plugin](https://github.com/gretard/sonar-sql-plugin/blob/master/docs/pluginRules.md)
24+
- SQL code violations reported by the [plugin](https://github.com/gretard/sonar-sql-plugin/blob/master/docs/pluginRules.md)
2425
- Reporting of code coverage calculated by [SQLCover](https://github.com/GoEddie/SQLCover)
2526
- Lines and comment lines measures reporting
2627
- Cognitive and cyclomatic complexity metrics reporting
27-
- Custom user rules. Configuration can be found at [here](https://github.com/gretard/sonar-sql-plugin/blob/master/docs/customRulesSetup.md)
28+
- Custom user rules. Users can define additional detection rules in the declarative format for the supported SQL dialects. These rules can report code violations specific to the code base and domain. For example, user wants to see code violdations where after each INSERT statement COMMIT statement is not found. Plugin does not report such code, however, if user defines custom rule in the declarative format, then SonarQube will report such violations. More details can be found at [here](https://github.com/gretard/sonar-sql-plugin/blob/master/docs/customRulesSetup.md)
2829

2930
## Tutorials ##
3031
Tutorials:
3132
- [Integrating Redgate SQL Code Guard with SonarQube](https://www.red-gate.com/hub/product-learning/sql-change-automation/integrating-redgate-sql-code-guard-with-sonarqube)
33+
- [Scanning a TSQL Project With SonarQube](https://dzone.com/articles/getting-tsql-project-scanned-with-sonarqube)
3234

3335
## Requirements ##
3436
Different plugin versions supports the following:
3537
- 1.0.0 - Sonarqube 7.4+versions
3638
- 1.2.0 - Sonarqube 9+versions
39+
- 1.3.0 - Sonarqube 9+versions
3740

3841
## Installation ##
3942
1. Download and install SonarQube
@@ -62,15 +65,16 @@ sonar.sql.dialect=tsql
6265
### PostgreSQL ###
6366
Sonar settings for pssql. You can check example at [here](https://github.com/gretard/sonar-sql-plugin/tree/master/examples/2-pssql)
6467
```
65-
sonar.projectKey=examples.sql.mysql.project
66-
sonar.projectName=examples.sql.mysql.project
68+
sonar.projectKey=examples.sql.psql.project
69+
sonar.projectName=examples.sql.psql.project
6770
sonar.projectVersion=1.1
6871
sonar.sources=src
6972
# optional
7073
sonar.language=sql
7174
sonar.sql.dialect=pssql
7275
```
7376

77+
7478
### MySQL ###
7579
Sonar settings for mysql. You can check example at [here](https://github.com/gretard/sonar-sql-plugin/tree/master/examples/3-mysql)
7680
```
@@ -126,6 +130,7 @@ Added container definitions for easy development with VSCode. Download the [remo
126130
1) Then you can lifecycle > package target to build the plugin. The .jar file will end up in the *sonar-sql-plugin/src/sonar-sql-plugin/target/* folder.
127131
2) Copy the jar to the plugins folder of your sonarqube instance
128132
```
133+
mkdir -p ~/workspace/sonarqube/extensions/plugins
129134
cp ~/workspace/sonar-sql-plugin/src/sonar-sql-plugin/target/sonar-sql-plugin-1.1.0.jar ~/workspace/sonarqube/extensions/plugins
130135
```
131136
3) Start sonarqube
@@ -137,7 +142,7 @@ docker run -i --name sonarqube \
137142
-v ~/workspace/sonarqube/extensions:/opt/sonarqube/extensions \
138143
-v ~/workspace/sonarqube/logs:/opt/sonarqube/logs \
139144
-v ~/workspace/sonarqube/data:/opt/sonarqube/data \
140-
sonarqube:8.9.0-community
145+
sonarqube
141146
```
142147
* next time only start the container
143148
```
@@ -149,6 +154,7 @@ docker run \
149154
--rm \
150155
-e SONAR_HOST_URL="http://127.0.0.1:9000" \
151156
-e SONAR_LOGIN="YOUR_ADMIN_TOKEN_HERE" \
157+
-e SONAR_PASSWORD="YOUR_ADMIN_PWD_HERE" \
152158
--network="host" \
153159
-v "FOLDER_WITH_THE_CODE:/usr/src" \
154160
sonarsource/sonar-scanner-cli -X

docs/mysqlClasses.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Supported classes:
66
- AlterByAddCheckTableConstraintContext
77
- AlterByAddColumnContext
88
- AlterByAddColumnsContext
9+
- AlterByAddDefinitionsContext
910
- AlterByAddForeignKeyContext
1011
- AlterByAddIndexContext
1112
- AlterByAddPartitionContext
@@ -56,6 +57,7 @@ Supported classes:
5657
- AlterInstanceContext
5758
- AlterLogfileGroupContext
5859
- AlterProcedureContext
60+
- AlterSequenceContext
5961
- AlterServerContext
6062
- AlterSimpleDatabaseContext
6163
- AlterSpecificationContext
@@ -93,6 +95,7 @@ Supported classes:
9395
- ChannelFlushOptionContext
9496
- ChannelOptionContext
9597
- CharFunctionCallContext
98+
- CharSetContext
9699
- CharsetNameBaseContext
97100
- CharsetNameContext
98101
- CheckColumnConstraintContext
@@ -112,6 +115,7 @@ Supported classes:
112115
- ColumnDefinitionContext
113116
- CommentColumnConstraintContext
114117
- CommitWorkContext
118+
- CommonTableExpressionsContext
115119
- ComparisonOperatorContext
116120
- CompoundStatementContext
117121
- ConnectionOptionContext
@@ -130,6 +134,8 @@ Supported classes:
130134
- CreateIndexContext
131135
- CreateLogfileGroupContext
132136
- CreateProcedureContext
137+
- CreateRoleContext
138+
- CreateSequenceContext
133139
- CreateServerContext
134140
- CreateTableContext
135141
- CreateTablespaceInnodbContext
@@ -140,6 +146,8 @@ Supported classes:
140146
- CreateUserMysqlV56Context
141147
- CreateUserMysqlV57Context
142148
- CreateViewContext
149+
- CteColumnNameContext
150+
- CteNameContext
143151
- CurrentSchemaPriviLevelContext
144152
- CurrentTimestampContext
145153
- CursorStatementContext
@@ -180,14 +188,16 @@ Supported classes:
180188
- DropIndexContext
181189
- DropLogfileGroupContext
182190
- DropProcedureContext
191+
- DropRoleContext
192+
- DropSequenceContext
183193
- DropServerContext
184194
- DropTableContext
185195
- DropTablespaceContext
186196
- DropTriggerContext
187197
- DropUserContext
188198
- DropViewContext
189199
- ElifAlternativeContext
190-
- EmptyStatementContext
200+
- EmptyStatement_Context
191201
- EnableTypeContext
192202
- EngineNameContext
193203
- ExecuteStatementContext
@@ -206,6 +216,11 @@ Supported classes:
206216
- FlushTableOptionContext
207217
- ForeignKeyTableConstraintContext
208218
- FormatColumnConstraintContext
219+
- FrameBetweenContext
220+
- FrameClauseContext
221+
- FrameExtentContext
222+
- FrameRangeContext
223+
- FrameUnitsContext
209224
- FromClauseContext
210225
- FullColumnNameContext
211226
- FullColumnNameExpressionAtomContext
@@ -292,6 +307,7 @@ Supported classes:
292307
- LoadedTableIndexesContext
293308
- LockActionContext
294309
- LockClauseContext
310+
- LockOptionContext
295311
- LockTableElementContext
296312
- LockTablesContext
297313
- LogicalExpressionContext
@@ -317,6 +333,8 @@ Supported classes:
317333
- NaturalJoinContext
318334
- NestedExpressionAtomContext
319335
- NestedRowExpressionAtomContext
336+
- NonAggregateFunctionCallContext
337+
- NonAggregateWindowedFunctionContext
320338
- NotExpressionContext
321339
- NullColumnConstraintContext
322340
- NullNotnullContext
@@ -325,8 +343,10 @@ Supported classes:
325343
- OrderByClauseContext
326344
- OrderByExpressionContext
327345
- OuterJoinContext
346+
- OverClauseContext
328347
- OwnerStatementContext
329348
- ParenthesisSelectContext
349+
- PartitionClauseContext
330350
- PartitionComparisonContext
331351
- PartitionDefinerAtomContext
332352
- PartitionDefinerVectorContext
@@ -398,6 +418,7 @@ Supported classes:
398418
- RevokeProxyContext
399419
- RevokeStatementContext
400420
- RewriteDbReplicationContext
421+
- RoleNameContext
401422
- RoleOptionContext
402423
- RoleRevokeContext
403424
- RollbackStatementContext
@@ -428,6 +449,7 @@ Supported classes:
428449
- SelectSpecContext
429450
- SelectStarElementContext
430451
- SelectStatementContext
452+
- SequenceSpecContext
431453
- SerialDefaultColumnConstraintContext
432454
- ServerOptionContext
433455
- SetAutocommitContext
@@ -437,6 +459,7 @@ Supported classes:
437459
- SetNewValueInsideTriggerContext
438460
- SetPasswordContext
439461
- SetPasswordStatementContext
462+
- SetRoleContext
440463
- SetStatementContext
441464
- SetTransactionContext
442465
- SetTransactionStatementContext
@@ -512,6 +535,7 @@ Supported classes:
512535
- TableIndexesContext
513536
- TableNameContext
514537
- TableOptionAutoIncrementContext
538+
- TableOptionAutoextendSizeContext
515539
- TableOptionAverageContext
516540
- TableOptionCharsetContext
517541
- TableOptionChecksumContext
@@ -523,6 +547,7 @@ Supported classes:
523547
- TableOptionDataDirectoryContext
524548
- TableOptionDelayContext
525549
- TableOptionEncryptionContext
550+
- TableOptionEngineAttributeContext
526551
- TableOptionEngineContext
527552
- TableOptionIndexDirectoryContext
528553
- TableOptionInsertMethodContext
@@ -535,6 +560,8 @@ Supported classes:
535560
- TableOptionRecalculationContext
536561
- TableOptionRowFormatContext
537562
- TableOptionSamplePageContext
563+
- TableOptionSecondaryEngineAttributeContext
564+
- TableOptionStartTransactionContext
538565
- TableOptionTableTypeContext
539566
- TableOptionTablespaceContext
540567
- TableOptionUnionContext
@@ -588,10 +615,15 @@ Supported classes:
588615
- ValuesFunctionCallContext
589616
- VariableClauseContext
590617
- VisibilityColumnConstraintContext
618+
- WaitNowaitClauseContext
591619
- WeightFunctionCallContext
592620
- WhileStatementContext
593621
- WildDoTableReplicationContext
594622
- WildIgnoreTableReplicationContext
623+
- WindowClauseContext
624+
- WindowNameContext
625+
- WindowSpecContext
626+
- WithClauseContext
595627
- XaCommitWorkContext
596628
- XaEndTransactionContext
597629
- XaPrepareStatementContext

0 commit comments

Comments
 (0)