Toolset for the developers contributing to http://github.com/SonarSource and http://github.com/SonarCommunity repositories.
Dogfooding is a core principle at SonarSource. Installing SonarLint in your favorite IDE is strongly recommended. Any feedback should be provided on:
sonarlint
.The "connected mode" feature should also be enabled and configured with https://next.sonarqube.com/ or https://sonarcloud.io, depending on projects.
Eclipse users should also rely on the dogfooding Eclipse Update Site in order to experiment latest milestones:
Intellij users should also rely on the development marketplace in order to experiment latest milestones:
If you have never used Git before, you need to do some setup first. Run the following commands so that Git knows your name and email.
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
Setup line endings preferences:
# For Unix/Mac users
git config --global core.autocrlf input
git config --global core.safecrlf true
# For Windows users
git config --global core.autocrlf true
git config --global core.safecrlf true
On Windows, you must explicitly tell Git to use long paths so you won't run into issues with files in deeply nested directories:
git config --global core.longpaths true
The merge is working pretty well on small repositories (with move and rename of files). But it's not working on large repositories as the detection of file renaming is O(n²), so we need to update some threshold (more explanations are available in this post : http://blogs.atlassian.com/2011/10/confluence_git_rename_merge_oh_my/) :
git config --global merge.renameLimit 10000
Commits must relate to a JIRA issue. Convention for messages inspired by http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html :
Example :
SONAR-2204,SONAR-2259 Fix URL encoding
* For correct URL encoding we must encode parameters on lower level -
in Query itself, but not in concrete implementation of Connector,
because in Query we can distinguish concrete parts of URL.
* Moreover in this case any additional encoding routines in Connector
are useless, so were removed.
If the change concerns a documentation-only change, then prefix it with "DOC ".
The following points must be respected in the GitHub account settings:
Eclipse settings are available in the directory /eclipse.
sonar-formatter.xml: positions new lines, comments, spaces, parentheses, etc. To be imported in Window > Preferences > Java > Code Style > Formatter.
sonar.importorder: organizes the "import" lines. To be imported in Window > Preferences > Java > Code Style > Organize Imports.
sonar-cleanup.xml: cleans up the code, by organizing imports, formating source code, correcting indentation, etc. To be imported in Window > Preferences > Java > Code Style > Clean Up.
In Windows > Preferences > Java > Editor > Save Actions, check the checkboxes to perform the clean up at every "save" action. The "additional actions" displayed should be configured as well.
In Window > Preferences > Maven > Errors/Warnings, set "Plugin execution not covered by lifecycle execution" to "Ignore". This will silence out error messages when importing your Maven projects
On Windows, in Window > Preferences > General > Workspace, set "Text file encoding" to "UTF-8" and "New text file line delimiter" to "Unix".
Code Style Configuration for IntellijIntellij IDEA users must install the plugin Adapter for Eclipse Code Formatter:
Use the Eclipse code formatter
Eclipse workspace/project folder or config file
to sonar-formatter.xmlOptimize Imports (IntelliJ's Import Optimizing must be turned ON)
Import Order from file
to sonar.importorder Go to Preferences/Settings > Editor > General
:
Ensure every saved file ends with a line break
(under the On Save
section).Go to Preferences/Settings > Editor > General > Auto import
:
Optimize imports on the fly
for Java:You can either import the code style settings to IntelliJ IDEA by simply importing this scheme in IDEA's code style settings (Editor > 'Code Style' > Java > 'Scheme' > ⚙️ > 'Import Scheme' > 'IntelliJ IDEA code style XML'
), or you can apply the settings manually (see below). The result should be the same.
Follow these steps to set code style settings if not using this scheme from above.
Go to Preferences/Settings > Editor > Code Style > Java > Tabs and Indents
:
Tab size
to 2Indent
to 2Continuation indent
to 2Go to Preferences/Settings > Editor > Code Style > Java > Wrapping and Braces > Method declaration parameter
:
Align when multiline
Go to Preferences/Settings > Editor > Code Style > Java > JavaDoc > Other
:
Generate "<p>" on empty lines
Go to Preferences/Settings > Editor > Code Style > Java > Imports
Class count to use import with '*'
to 999Names count to use static import with '*'
to 999Packages to Use Import with '*'
Import Layout
to:
import all other imports
<blank line>
import static all other imports
import module imports
Go to Preferences/Settings > Editor > Code Style > Kotlin > Tabs and Indents
:
Tab size
to 4Indent
to 4Continuation indent
to 4Go to Preferences/Settings > Editor > Code Style > Kotlin > Imports
:
Use single name import
in Top-Level Symbols
Use single name import
in Java Statics and Enum Members
Packages to Use Imports with '*'
Go to Preferences/Settings > Editor > Code Style > Kotlin > Other
:
Use trailing comma
For Kotlin, we use the default 140 character line length.
Go to Preferences/Settings > Editor > Code Style > XML > Tabs and Indents
:
Tab size
to 2Indent
to 2Continuation indent
to 2 Go to Preferences/Settings > Editor > Code Style > XML > Other
:
Hard wrap at
to 140Keep line breaks in text
Keep white spaces
In order to correctly format build.gradle files, code style for Groovy has to be set.
Go to Preferences/Settings > Editor > Code Style > Groovy
:
Tab size
to 2Indent
to 2Continuation indent
to 2For Javascript (Typescript) Go to Preferences/Settings > Editor > Code Style > TypeScript > Imports
:
Sort imported members
Sort imports by modules
We use a tool called Prettier. In order to ensure it functions correctly, install the Prettier plugin. Once installed set the files as such:
The Prettier plugin requires IntelliJ Ultimate, but it's possible to use it without the plugin, e.g. like this.
Then to make sure prettier is run correctly, modify the on save actions:
Install Scala plugin if not installed already
Go to Preferences/Settings > Editor > Code Style > Scala > Imports
:
Class count to use import with '_'
to 999Merge imports with the same prefix into one statement
Import Layout
(it should be the default):If the project uses maven, and you experience problems with the built-in build system (Build ➡️ Rebuild Project) like long build times or build failures, you should delegate the build to maven. Make sure to skip tests during the build:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4