You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a gradle multiproject written in Java and am introducing Groovy just for unit testing. (with Spock)
Spotbugs however goes wild on my Spock test files, so I've had to exclude them for now - see below
( excludeFilter.set(rootProject.file("config/spotbugs/ignore.xml")) //exclude groovy code for now )
HelloSpockSpec.setMetaClass(MetaClass) may expose internal representation by storing an externally mutable object into HelloSpockSpec.metaClass
This code stores a reference to an externally mutable object into the internal representation of the object. If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Storing a copy of the object is better approach in many situations.
import spock.lang.Narrative
import spock.lang.Specification
@Narrative("Using a Spock table for parameterized test")
class HelloSpockSpec extends Specification {
def "length of Spock's and his friends' names"() {
expect:
name.size() == length
where:
name | length
"Spock" | 5
"Kirk" | 4
"Scotty" | 6
}
}
Does anyone have some sort of sensible default spotbugs config for Groovy I could use ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a gradle multiproject written in Java and am introducing Groovy just for unit testing. (with Spock)
Spotbugs however goes wild on my Spock test files, so I've had to exclude them for now - see below
( excludeFilter.set(rootProject.file("config/spotbugs/ignore.xml")) //exclude groovy code for now )
Does anyone have some sort of sensible default spotbugs config for Groovy I could use ?
Beta Was this translation helpful? Give feedback.
All reactions