Sonar Grammar Plugin to provide spell checking of source code.
As a spell checking library Jazzy is used http://jazzy.sourceforge.net/
- Java 1.7
- Maven
- SonarQube(current version 5.1)
- Download SonarQube (current version 5.1) from Sonarqube homepage
- Unpack and go to \sonarqube-5.1\bin\ folder
- Select you current OS and run sonar(can be ".bat" or ".sh" file)
- In browser go to - http://localhost:9000/
- Login in Sonar as Administrator (login - admin, password - admin)
- On Sonar page top menu go to the "Quality Profiles". You need to make sure that "Sonar way " stands as the default
- Open terminal(comand line), go to the project that you want to test and write "mvn sonar:sonar" command. For debug use "mvnDebug sonar:sonar" command(port 8000)
- After that you can see results on http://localhost:9000/dashboard/ or follow the link that will be found in bottom command line
- Use maven for build project
- In "sonar-grammar\target" folder will be "sonar-grammar-plugin-XXX.jar" file. Copy this file to local SonarQubefolder - "sonarqube-5.1\extensions\plugins"
- Restart local SonarQube
- Open SonarQube console - http://localhost:9000/ and login as Administrator(login - admin, password - admin)
- Go to the tab "Quality Profiles" and set Sonar Grammar Profile as Default
- (Optional) for check not only grammar plugin but "Sonnar way" and "Grammar" together. Set inheritance for Grammar profile: "Quality Profiles" - select "Sonar Grammar Profile" - click "Profile Inheritance" and select inheritance from "Sonnar way" in drop-down list
- Plugin ready for work. You can use step 7-8 from "SonarQube install steps"
Also you can use maven plugin - https://github.com/SonarSource/sonar-dev-maven-plugin for uploads the plugin artifact to server:
- Requires SonarQube 4.3 or greater.
- Enable the development mode on server : add sonar.dev=true to conf/sonar.properties
- Restart server
- Build and upload the plugin : mvn package org.codehaus.sonar:sonar-dev-maven-plugin::upload
- It requires the properties sonarHome (path to local server installation) and sonarUrl (default value is http://localhost:9000)
- To start Sonar
mvn install org.codehaus.sonar:sonar-dev-maven-plugin:start-war -Dsonar.runtimeVersion=3.7.3 -Djava.io.tmpdir=/tmp
- To debug in another console
export SONAR_RUNNER_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
mvnDebug sonar:sonar
There is built in dictionary, however to add additional words here is a bash script to rearrange dictionary. To do this - append new word to dict/english.0, run reprocess_dict.sh after that copy dict/english.1 with new word and in correct format to src/main/resources/dict/english.0.