Skip to content

Commit 1beafb9

Browse files
committed
Cleanup
1 parent 00fbc3e commit 1beafb9

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

README.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Different plugin versions supports the following:
4343
3. Start SonarQube and enable rules
4444
4. [TSQL] (Optional) Install [SQLCodeGuard](https://www.red-gate.com/products/sql-development/sql-code-guard/index) into your build machine where you plan to run sonar scanner
4545
5. [TSQL, MySQL, PotsgreSQL] (Optional) - Install [SQLCheck](https://github.com/jarulraj/sqlcheck) into your build machine where you plan to run sonar scanner
46-
6. [TSQL] (Optional) Setup SQLCover reorting. You can check tsql example at here for full setup.
46+
6. [TSQL] (Optional) Setup SQLCover reorting. You can check tsql example at [here](https://github.com/gretard/sonar-sql-plugin/tree/master/examples/1-tsql) for full setup.
4747

4848
## Getting started ###
4949
Please see examples on how to use different dialects.
@@ -98,6 +98,22 @@ sonar.language=sql
9898
sonar.sql.dialect=vsql
9999
```
100100

101+
### Custom rules example ###
102+
This is an example for sonar settings for project which uses custom plugin rules from local directory (located at ./rules directory). You can check full example at [here](https://github.com/gretard/sonar-sql-plugin/tree/master/examples/6-pssql-with-custom-rules)
103+
```
104+
sonar.projectKey=pssql.custom.rules
105+
sonar.projectName=Test PSSQL custom rules project
106+
sonar.projectVersion=1.0
107+
sonar.sources=src
108+
109+
# optional
110+
sonar.language=sql
111+
sonar.sql.dialect=pssqlv2
112+
113+
# change these
114+
sonar.sql.rules.path=./rules
115+
```
116+
101117
## Plugin configuration ##
102118
The following options are available for configuration:
103119

@@ -124,35 +140,10 @@ Please configure additional properties:
124140
`sonar.lang.patterns.plsqlopen=na`
125141

126142
## Using command line tools
127-
With the plugin - there are additional 2 cli tools available (they are not required for sonar execution):
143+
With the plugin - there is additional cli tool available (they are not required for sonar execution):
128144

129-
- **sql-sca-cli.jar** - allows to execute sql code analysis from the command line
130145
- **rulesHelper.jar** - command line helper tool for writing custom sql rules
131-
132-
### sql-sca-cli
133-
Usage:
134146

135-
- ```java -jar sql-sca-cli.jar --help``` - will print help
136-
- ```java -jar sql-sca-cli.jar``` - will scan current directory
137-
- ```java -jar sql-sca-cli.jar -i /home/test``` - will scan test directory
138-
139-
Full help info:
140-
```usage: sql-sca-cli
141-
-c,--custom-rules-path <arg> path to custom rules directory,
142-
defaults to current directory
143-
-csuffix,--custom-rules-suffix <arg> custom rules suffix, defaults to:
144-
.customRules
145-
-d,--dialect <arg> SQL dialect, defaults to: tsql,
146-
possible values: [TSQL, PSSQL,
147-
MYSQL, VSQL, PSSQLV2]
148-
-h,--help show help
149-
-i,--input <arg> input directory for analysis,
150-
defaults to current directory
151-
-p,--prefixes <arg> file prefixes for analysis,
152-
defaults to: .sql
153-
-warnOnly,--warnOnly flag whether tool should report
154-
warnings only
155-
```
156147

157148
### rulesHelper
158149
Usage:
@@ -177,6 +168,7 @@ verify file "c:/tests/customRules.rules;" mysql
177168

178169

179170
## Contributing ##
171+
### Developing locally
180172
Added container definitions for easy development with VSCode. Download the [remote containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and let it figure out the maven targets.
181173
<img width="1917" alt="vscode_remote_containers_extension_maven" src="https://user-images.githubusercontent.com/3657015/125957363-653c9f6f-b5cc-4a3c-96ef-9dc18d0f8bfb.png">
182174
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.
@@ -220,6 +212,5 @@ docker run \
220212
1. Generate lexer and parser, example package: org.antlr.sql.dialects.vsql
221213
2. Implement SQLDialect extending BaseDialect.class, i.e. VSQLDialect
222214
3. Implement sql rules, example VSQLRules
223-
4. Register rules at SQLDialectRules
215+
4. Register rules at SQLDialectRules. This step is optional as plugin will support custom rules from user project provided in xml format.
224216
5. Update ./src/external/README.md with references to your added grammar
225-

0 commit comments

Comments
 (0)