This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import "testing" | |
func TestXYZ(t *testing.T) { | |
tests := []struct { | |
name string | |
want int | |
}{ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules: | |
- id: java.lang.string.replaceall-is-slow | |
message: | | |
Look out for invocations of regexp mehods like String#replaceAll("...", "...") on hot code paths. | |
Compiling into a reusable Pattern instance is almost always the preferable option. | |
severity: WARNING | |
patterns: | |
- pattern-either: | |
- pattern: |- | |
$STRING.replaceAll("...", "...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ruleguard.rules.go b/ruleguard.rules.go | |
index 5d4c4fe..8d2f8c1 100644 | |
--- a/ruleguard.rules.go | |
+++ b/ruleguard.rules.go | |
@@ -130,6 +130,34 @@ func errnoterror(m fluent.Matcher) { | |
Report("err variable not error type") | |
} | |
+// err found but return nil | |
+func errfoundreturnnil(m fluent.Matcher) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net/http" | |
"net/url" | |
"os" | |
"reflect" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"os" | |
"sync" | |
"github.com/Shopify/sarama" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.cloudbees.plugins.flow.*; | |
import com.nirima.jenkins.plugins.docker.DockerJobProperty; | |
projects = Jenkins.instance.getAllItems(); | |
projects.each { project -> | |
removed = false | |
project.properties.find{ it.key instanceof com.nirima.jenkins.plugins.docker.DockerJobProperty.DescriptorImpl }.each { property -> | |
project.removeProperty(property.value) | |
removed = true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import os | |
import sys | |
import re | |
import fnmatch | |
import logging | |
logging.basicConfig( | |
stream=sys.stdout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import fnmatch | |
import logging | |
import zipfile | |
logging.basicConfig( | |
stream=sys.stdout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" | |
Simple proof of concept for using kafka-python to talk to IBM Message Hub | |
https://gist.github.com/dnwe | |
http://kafka-python.readthedocs.io/ | |
""" | |
import os | |
import ssl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A template build.gradle to invoke the jobdsl plugin on the .groovy files | |
// which will syntactically validate them and output the generated Jenkins XML | |
// into the build directory. | |
repositories { | |
mavenCentral() | |
maven { url 'http://repo.jenkins-ci.org/releases/' } | |
} | |
dependencies { | |
compile 'org.jenkins-ci.plugins:job-dsl-core:1.46' |
NewerOlder