Embezzler is a simple script to automatically assign SonarQube issues to authors according to SCM.
Embezzler is a self-contained script that could be easily distributed, it is written in Groovy, uses Grape for SonarQube API dependency.
# get last unassigned issue and assign it to appropriate user
groovy Embezzler.groovy -s http://localhost:9000 -u login -p password -c 'project1,project2' -n 1 --dry-run false
# get last 5 unassigned issues started from yesterday and assign it to appropriate users
groovy Embezzler.groovy -s http://localhost:9000 -u login -p password -c 'project1,project2' -n 5 -db 1 --dry-run false
# get all unassigned issues started from yesterday and assign it to appropriate users
groovy Embezzler.groovy -s http://localhost:9000 -u login -p password -c 'project1,project2' -db 1 --dry-run false
groovy main/groovy/Embezzler.groovy --help
usage: groovy Embezzler.groovy -s http://localhost:9000 -u user -p
password
-c,--components <arg> specify list of components (separated by comma)
-d,--dry-run <arg> specify to not to perform any action, by default
is dry-run
-h,--help print this message
-n,--number <arg> specify number of issues to retreive, if not
specified will be queried all issues for whole day
-db,--days-before <arg> specify day for which will be queried issues
(1 - yesterday, 2 - two days ago and so on), if not
specified issues will be queried without date
relation
-da,--default-assignee <arg> specify default user to assign issues on
-p,--password <arg> specify user password
-s,--host <arg> specify SonarQube URL
-u,--user <arg> specify user login
In order to hide password from console history or script is used with CI server, for example Jenkins, you can specify environment variable SNR_PASSWORD instead of passing password with -p.
export SNR_PASSWORD=mypassword