Code Monkey home page Code Monkey logo

sonar-developer-toolset's Introduction

Developer Toolset for Sonar-* Projects

Toolset for the developers contributing to http://github.com/SonarSource and http://github.com/SonarCommunity repositories.

Git

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 "[email protected]"

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

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

Commit messages

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 :

  • The first line must be short (50 chars or less) and auto-descriptive in a format " ", for example "SONAR-1937 Code review"
  • Write your commit message in the present tense: "Fix bug" and not "Fixed bug".
  • The second line is blank.
  • Next lines optionally define a short summary of changes (wrap them to about 72 chars or so).

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.

The (Almost) Unbreakable Build

To be sure that code changes do not break the build in master branch, the spush command must be executed to push commits. It's especially useful when many people work on the same codebase.

# To be executed in the root directory of the Git repository
spush

Codebase is forked, built then committed changes are pushed to the remote branch if the build passes. Forking in another directory allows developer to continue working and editing code in his workspace.

Build automatically executes the script build.sh if it exists, else it executes mvn clean install

Code Style

Eclipse settings are available in the directory /eclipse. Intellij IDEA users must install the plugin Eclipse Code Formatter and import Eclipse settings files:

  • check the "Use the Eclipse code formatter" option and use sonar-formatter.xml as the Eclipse Java Formatter config file
  • check the "From file" option in the "Import order" section and use sonar.importorder

Intellij code style

IDEA must also be manually configured for imports : Preferences > Editor > Code Style > Java > Imports

  • Class count to use import with '*'" -> 999
  • Names count to use static import with '*' -> 999
  • Import Layout
    • import all other imports
    • <blank line>
    • import static all other imports

Intellij imports

Eclipse 4.4 formatter support must be enable in recent versions of the Eclipse Code Formatter plugin:

enable Eclipse 4.4 formatter

Plugin (Almost) Hot Deploy

SonarQube 4.3 allows to quickly restart server when the development mode is enabled (sonar.dev=true in conf/sonar.properties). It's used to deploy a new version of the plugin under development. It's a bit faster than restarting the server in a standard way (JRuby environment is not reloaded). Execute the following command from plugin sources :

mvn package org.codehaus.sonar:sonar-dev-maven-plugin::upload -DsonarHome=/path/to/server/home -DsonarUrl=http://localhost:9000

Note that the default value of sonarUrl is http://localhost:9000.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.