Skip to content

Instantly share code, notes, and snippets.

@simonbrandhof
simonbrandhof / default-org.sql
Last active February 14, 2019 13:22
Issues Faceting
select g, severity, assignee, issueType, resolution, val, debt -- restrict limits to hotspots
from (
select g, severity, assignee, issueType, resolution, val, debt, row_number() over(
partition by g
order by val desc
) as rn
from (
select g,
severity,
assignee,
@simonbrandhof
simonbrandhof / keybase.md
Created January 14, 2019 19:35
keybase.md

Keybase proof

I hereby claim:

  • I am simonbrandhof on github.
  • I am simonbrandhof (https://keybase.io/simonbrandhof) on keybase.
  • I have a public key ASDw1AtgACjmF1fwil44Zi3BCLFEa_pyE0lQCLN9cgM6kgo

To claim this, I am signing this object:

@simonbrandhof
simonbrandhof / gist:9a2125c2810f675efb40
Created November 6, 2015 12:31
Summary of plugin build
[INFO] -------------------------------------------------------
[INFO] Plugin definition in update center
[INFO] Key: xoo
[INFO] Name: Xoo
[INFO] Description: Sample of plugin to document and test available APIs
[INFO] Version: 5.3-SNAPSHOT
[INFO] Entry-point Class: org.sonar.xoo.XooPlugin
[INFO] Required Plugins:
[INFO] Use Child-first ClassLoader: false
[INFO] Base Plugin:
@simonbrandhof
simonbrandhof / option1.java
Last active August 31, 2015 08:01
CE API
// Option 1: a single extension point to define metadata and compute measures
// advantage : single interface
// drawback : interface has 2 methods
@ExtensionPoint
public interface MeasureComputer {
// advantage : pattern is not based on method "done()". It enforces the test
// to validate MeasureComputerDefinition.
MeasureComputeDefinition define(MeasureComputerDefinitionContext defContext);
@simonbrandhof
simonbrandhof / gist:59c4103ef98c00cc7103
Created April 2, 2015 14:10
gmaven-plugin not threadsafe
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.353 s (Wall Clock)
[INFO] Finished at: 2015-04-02T16:06:40+02:00
[INFO] Final Memory: 30M/367M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (randomize-environment) on project sonar-xoo-plugin: No providers found matching selection: 1.6 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (randomize-environment) on project sonar-xoo-plugin: No providers found matching selection: 1.6
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
@simonbrandhof
simonbrandhof / gist:5f73d97ffe2aa6283e6f
Last active August 29, 2015 14:15
Proposal for log testing
public class MyClass {
// no coupling with SLF4J
private final org.sonar.api.utils.log.Logger logger = org.sonar.api.utils.log.Loggers.get(getClass());
void foo() {
if (logger.isDebugEnabled()) {
logger.debug("foo");
}
}
}
Simons-MacBook-Pro:bischeck sbrandhof$ ant
Buildfile: /Users/sbrandhof/dev/projects/bischeck/build.xml
prepare:
compile:
[javac] Compiling 128 source files to /Users/sbrandhof/dev/projects/bischeck/target/classes
[javac] /Users/sbrandhof/dev/projects/bischeck/src/main/java/com/ingby/socbox/bischeck/cache/LastStatus.java:35: error: package com.ingby.socbox.bischeck.xsd.laststatuscache does not exist
[javac] import com.ingby.socbox.bischeck.xsd.laststatuscache.XMLEntry;
[javac] ^
@simonbrandhof
simonbrandhof / gist:cb1006435ae086d4e264
Created July 2, 2014 21:58
Issuable on directories
import org.sonar.api.component.ResourcePerspectives;
public class MySensor implements Sensor {
private final ResourcePerspectives perspectives;
public MySensor(ResourcePerspectives perspectives) {
this.perspectives = perspectives;
}
@simonbrandhof
simonbrandhof / FooPage.java
Last active August 29, 2015 13:57
Sample of tab
@NavigationSection(NavigationSection.RESOURCE_TAB)
@ResourceQualifier({Qualifiers.FILE})
@RequiredMeasures(anyOf = {"a_metric"})
@UserRole(UserRole.USER)
public class FooPage extends AbstractRubyTemplate implements RubyRailsWidget {
protected String getTemplatePath() {
return "/myplugin/my_template.erb";
}
@Override
simons-imac:metawidget sbrandhof$ mvn clean install -DskipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Metawidget
[INFO] reference-guide
[INFO] modules-parent
[INFO] modules-java-parent
[INFO] metawidget-core