CodeNarc Report

Report title:
Date:15 janv. 2018 21:19:13
Generated with:CodeNarc v1.1

Summary

PackageTotal FilesFiles with ViolationsPriority 1Priority 2Priority 3
All Packages4242--684
org/bson1414--220
org/bson/codecs1616--153
org/bson/codecs/configuration33--48
org/bson/io22--129
org/bson/json55--95
org/bson/types22--39

Package: org.bson

➥ BsonArraySpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired324

[SRC]def 'should be array type'() {

[MSG]Method "should be array type" has a dynamic return type

MethodReturnTypeRequired329

[SRC]def 'should construct empty array'() {

[MSG]Method "should construct empty array" has a dynamic return type

VariableTypeRequired331

[SRC]def array = new BsonArray()

[MSG]The type is not specified for variable "array"

MethodReturnTypeRequired339

[SRC]def 'should construct from a list'() {

[MSG]Method "should construct from a list" has a dynamic return type

VariableTypeRequired341

[SRC]def list = [BsonBoolean.TRUE, BsonBoolean.FALSE]

[MSG]The type is not specified for variable "list"

VariableTypeRequired344

[SRC]def array = new BsonArray(list)

[MSG]The type is not specified for variable "array"

MethodReturnTypeRequired352

[SRC]def 'should parse json'() {

[MSG]Method "should parse json" has a dynamic return type

➥ BsonBinaryReaderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired330

[SRC]def 'should skip value #value'() {

[MSG]Method "should skip value #value" has a dynamic return type

VariableTypeRequired332

[SRC]def document = new BsonDocument('name', value)

[MSG]The type is not specified for variable "document"

VariableTypeRequired333

[SRC]def reader = new BsonBinaryReader(toBson(document))

[MSG]The type is not specified for variable "reader"

➥ BsonBinarySubTypeSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired324

[SRC]def 'should be uuid only for legacy and uuid types'() {

[MSG]Method "should be uuid only for legacy and uuid types" has a dynamic return type

➥ BsonDocumentReaderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired330

[SRC]def setup() {

[MSG]Method "setup" has a dynamic return type

MethodReturnTypeRequired337

[SRC]def 'should read all types'() {

[MSG]Method "should read all types" has a dynamic return type

VariableTypeRequired339

[SRC]def doc = new BsonDocument(

[MSG]The type is not specified for variable "doc"

VariableTypeRequired367

[SRC]def decodedDoc = new BsonDocumentCodec().decode(new Bson..r().build())

[MSG]The type is not specified for variable "decodedDoc"

MethodReturnTypeRequired373

[SRC]def 'should fail, ReadBSONType can only be called when S..t VALUE'() {

[MSG]Method "should fail, ReadBSONType can only be called when State is TYPE, not VALUE" has a dynamic return type

VariableTypeRequired375

[SRC]def reader = new BsonDocumentReader(nullDoc)

[MSG]The type is not specified for variable "reader"

MethodReturnTypeRequired387

[SRC]def 'should fail, ReadBSONType can only be called when S..ot NAME'() {

[MSG]Method "should fail, ReadBSONType can only be called when State is TYPE, not NAME" has a dynamic return type

VariableTypeRequired389

[SRC]def reader = new BsonDocumentReader(nullDoc)

[MSG]The type is not specified for variable "reader"

➥ BsonDocumentSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired329

[SRC]def 'conversion methods should behave correctly for the ..py path'() {

[MSG]Method "conversion methods should behave correctly for the happy path" has a dynamic return type

VariableTypeRequired332

[SRC]def bsonNull = new BsonNull()

[MSG]The type is not specified for variable "bsonNull"

VariableTypeRequired333

[SRC]def bsonInt32 = new BsonInt32(42)

[MSG]The type is not specified for variable "bsonInt32"

VariableTypeRequired334

[SRC]def bsonInt64 = new BsonInt64(52L)

[MSG]The type is not specified for variable "bsonInt64"

VariableTypeRequired335

[SRC]def bsonDecimal128 = new BsonDecimal128(Decimal128.parse('1.0'))

[MSG]The type is not specified for variable "bsonDecimal128"

VariableTypeRequired336

[SRC]def bsonBoolean = new BsonBoolean(true)

[MSG]The type is not specified for variable "bsonBoolean"

VariableTypeRequired337

[SRC]def bsonDateTime = new BsonDateTime(new Date().getTime())

[MSG]The type is not specified for variable "bsonDateTime"

VariableTypeRequired338

[SRC]def bsonDouble = new BsonDouble(62.0)

[MSG]The type is not specified for variable "bsonDouble"

VariableTypeRequired339

[SRC]def bsonString = new BsonString('the fox ...')

[MSG]The type is not specified for variable "bsonString"

VariableTypeRequired340

[SRC]def minKey = new BsonMinKey()

[MSG]The type is not specified for variable "minKey"

VariableTypeRequired341

[SRC]def maxKey = new BsonMaxKey()

[MSG]The type is not specified for variable "maxKey"

VariableTypeRequired342

[SRC]def javaScript = new BsonJavaScript('int i = 0;')

[MSG]The type is not specified for variable "javaScript"

VariableTypeRequired343

[SRC]def objectId = new BsonObjectId(new ObjectId())

[MSG]The type is not specified for variable "objectId"

VariableTypeRequired344

[SRC]def scope = new BsonJavaScriptWithScope('int x = y', new..onInt32(1)))

[MSG]The type is not specified for variable "scope"

VariableTypeRequired345

[SRC]def regularExpression = new BsonRegularExpression('^test..*xyz$', 'i')

[MSG]The type is not specified for variable "regularExpression"

VariableTypeRequired346

[SRC]def symbol = new BsonSymbol('ruby stuff')

[MSG]The type is not specified for variable "symbol"

VariableTypeRequired347

[SRC]def timestamp = new BsonTimestamp(0x12345678, 5)

[MSG]The type is not specified for variable "timestamp"

VariableTypeRequired348

[SRC]def undefined = new BsonUndefined()

[MSG]The type is not specified for variable "undefined"

VariableTypeRequired349

[SRC]def binary = new BsonBinary((byte) 80, [5, 4, 3, 2, 1] as byte[])

[MSG]The type is not specified for variable "binary"

VariableTypeRequired350

[SRC]def bsonArray = new BsonArray([new BsonInt32(1), new Bso..olean(true),

[MSG]The type is not specified for variable "bsonArray"

VariableTypeRequired353

[SRC]def bsonDocument = new BsonDocument('a', new BsonInt32(1))

[MSG]The type is not specified for variable "bsonDocument"

VariableTypeRequired355

[SRC]def root = new BsonDocument(

[MSG]The type is not specified for variable "root"

MethodReturnTypeRequired3145

[SRC]def 'is<type> methods should return false for missing keys'() {

[MSG]Method "is<type> methods should return false for missing keys" has a dynamic return type

VariableTypeRequired3147

[SRC]def root = new BsonDocument()

[MSG]The type is not specified for variable "root"

Indentation3150

[SRC]!root.isNull('null')

[MSG]The statement on line 150 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3151

[SRC]!root.isNumber('number')

[MSG]The statement on line 151 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3152

[SRC]!root.isInt32('int32')

[MSG]The statement on line 152 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3153

[SRC]!root.isInt64('int64')

[MSG]The statement on line 153 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3154

[SRC]!root.isDecimal128('decimal128')

[MSG]The statement on line 154 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3155

[SRC]!root.isBoolean('boolean')

[MSG]The statement on line 155 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3156

[SRC]!root.isDateTime('date')

[MSG]The statement on line 156 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3157

[SRC]!root.isDouble('double')

[MSG]The statement on line 157 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3158

[SRC]!root.isString('string')

[MSG]The statement on line 158 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3159

[SRC]!root.isObjectId('objectId')

[MSG]The statement on line 159 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3160

[SRC]!root.isTimestamp('timestamp')

[MSG]The statement on line 160 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3161

[SRC]!root.isBinary('binary')

[MSG]The statement on line 161 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3162

[SRC]!root.isArray('array')

[MSG]The statement on line 162 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

Indentation3163

[SRC]!root.isDocument('document')

[MSG]The statement on line 163 in class org.bson.BsonDocumentSpecification is at the incorrect indent level: Expected column 9 but was 13

MethodReturnTypeRequired3166

[SRC]def 'get methods should return default values for missing keys'() {

[MSG]Method "get methods should return default values for missing keys" has a dynamic return type

VariableTypeRequired3168

[SRC]def bsonNull = new BsonNull()

[MSG]The type is not specified for variable "bsonNull"

VariableTypeRequired3169

[SRC]def bsonInt32 = new BsonInt32(42)

[MSG]The type is not specified for variable "bsonInt32"

VariableTypeRequired3170

[SRC]def bsonInt64 = new BsonInt64(52L)

[MSG]The type is not specified for variable "bsonInt64"

VariableTypeRequired3171

[SRC]def bsonDecimal128 = new BsonDecimal128(Decimal128.parse('1.0'))

[MSG]The type is not specified for variable "bsonDecimal128"

VariableTypeRequired3172

[SRC]def bsonBoolean = new BsonBoolean(true)

[MSG]The type is not specified for variable "bsonBoolean"

VariableTypeRequired3173

[SRC]def bsonDateTime = new BsonDateTime(new Date().getTime())

[MSG]The type is not specified for variable "bsonDateTime"

VariableTypeRequired3174

[SRC]def bsonDouble = new BsonDouble(62.0)

[MSG]The type is not specified for variable "bsonDouble"

VariableTypeRequired3175

[SRC]def bsonString = new BsonString('the fox ...')

[MSG]The type is not specified for variable "bsonString"

VariableTypeRequired3176

[SRC]def objectId = new BsonObjectId(new ObjectId())

[MSG]The type is not specified for variable "objectId"

VariableTypeRequired3177

[SRC]def regularExpression = new BsonRegularExpression('^test..*xyz$', 'i')

[MSG]The type is not specified for variable "regularExpression"

VariableTypeRequired3178

[SRC]def timestamp = new BsonTimestamp(0x12345678, 5)

[MSG]The type is not specified for variable "timestamp"

VariableTypeRequired3179

[SRC]def binary = new BsonBinary((byte) 80, [5, 4, 3, 2, 1] as byte[])

[MSG]The type is not specified for variable "binary"

VariableTypeRequired3180

[SRC]def bsonArray = new BsonArray([new BsonInt32(1), new Bso..olean(true),

[MSG]The type is not specified for variable "bsonArray"

VariableTypeRequired3184

[SRC]def bsonDocument = new BsonDocument('a', new BsonInt32(1))

[MSG]The type is not specified for variable "bsonDocument"

VariableTypeRequired3185

[SRC]def root = new BsonDocument()

[MSG]The type is not specified for variable "root"

MethodReturnTypeRequired3206

[SRC]def 'clone should make a deep copy of all mutable BsonValue types'() {

[MSG]Method "clone should make a deep copy of all mutable BsonValue types" has a dynamic return type

VariableTypeRequired3208

[SRC]def document = new BsonDocument('d', new BsonDocument()...onInt32(1)))

[MSG]The type is not specified for variable "document"

VariableTypeRequired3219

[SRC]def clone = document.clone()

[MSG]The type is not specified for variable "clone"

MethodReturnTypeRequired3242

[SRC]def 'get methods should throw if key is absent'() {

[MSG]Method "get methods should throw if key is absent" has a dynamic return type

VariableTypeRequired3244

[SRC]def root = new BsonDocument()

[MSG]The type is not specified for variable "root"

MethodReturnTypeRequired3331

[SRC]def 'should get first key'() {

[MSG]Method "should get first key" has a dynamic return type

VariableTypeRequired3333

[SRC]def document = new BsonDocument('i', new BsonInt32(2))

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3339

[SRC]def 'getFirstKey should throw NoSuchElementException if ..s empty'() {

[MSG]Method "getFirstKey should throw NoSuchElementException if the document is empty" has a dynamic return type

VariableTypeRequired3341

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3350

[SRC]def 'should create BsonReader'() {

[MSG]Method "should create BsonReader" has a dynamic return type

VariableTypeRequired3352

[SRC]def document = documentWithValuesOfEveryType()

[MSG]The type is not specified for variable "document"

VariableTypeRequired3355

[SRC]def reader = document.asBsonReader()

[MSG]The type is not specified for variable "reader"

MethodReturnTypeRequired3364

[SRC]def 'should serialize and deserialize'() {

[MSG]Method "should serialize and deserialize" has a dynamic return type

VariableTypeRequired3366

[SRC]def document = new BsonDocument('d', new BsonDocument()...onInt32(1)))

[MSG]The type is not specified for variable "document"

VariableTypeRequired3377

[SRC]def baos = new ByteArrayOutputStream()

[MSG]The type is not specified for variable "baos"

VariableTypeRequired3378

[SRC]def oos = new ObjectOutputStream(baos)

[MSG]The type is not specified for variable "oos"

VariableTypeRequired3382

[SRC]def bais = new ByteArrayInputStream(baos.toByteArray())

[MSG]The type is not specified for variable "bais"

VariableTypeRequired3383

[SRC]def ois = new ObjectInputStream(bais)

[MSG]The type is not specified for variable "ois"

VariableTypeRequired3384

[SRC]def deserializedDocument = ois.readObject()

[MSG]The type is not specified for variable "deserializedDocument"

➥ BsonDocumentWrapperSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired325

[SRC]def document = new Document()

[MSG]The type is not specified for field "document"

FieldTypeRequired331

[SRC]def wrapper = new BsonDocumentWrapper(document, new DocumentCodec())

[MSG]The type is not specified for field "wrapper"

MethodReturnTypeRequired333

[SRC]def 'should serialize and deserialize'() {

[MSG]Method "should serialize and deserialize" has a dynamic return type

VariableTypeRequired335

[SRC]def baos = new ByteArrayOutputStream()

[MSG]The type is not specified for variable "baos"

VariableTypeRequired336

[SRC]def oos = new ObjectOutputStream(baos)

[MSG]The type is not specified for variable "oos"

VariableTypeRequired340

[SRC]def bais = new ByteArrayInputStream(baos.toByteArray())

[MSG]The type is not specified for variable "bais"

VariableTypeRequired341

[SRC]def ois = new ObjectInputStream(bais)

[MSG]The type is not specified for variable "ois"

VariableTypeRequired342

[SRC]def deserializedDocument = ois.readObject()

[MSG]The type is not specified for variable "deserializedDocument"

➥ BsonDocumentWriterSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired327

[SRC]def 'should write all types'() {

[MSG]Method "should write all types" has a dynamic return type

VariableTypeRequired329

[SRC]def encodedDoc = new BsonDocument();

[MSG]The type is not specified for variable "encodedDoc"

MethodReturnTypeRequired337

[SRC]def 'should pipe all types'() {

[MSG]Method "should pipe all types" has a dynamic return type

VariableTypeRequired339

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired340

[SRC]def reader = new BsonDocumentReader(documentWithValuesOfEveryType())

[MSG]The type is not specified for variable "reader"

VariableTypeRequired341

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired350

[SRC]def 'should pipe all types with extra elements'() {

[MSG]Method "should pipe all types with extra elements" has a dynamic return type

VariableTypeRequired352

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired353

[SRC]def reader = new BsonDocumentReader(new BsonDocument())

[MSG]The type is not specified for variable "reader"

VariableTypeRequired354

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

VariableTypeRequired356

[SRC]def extraElements = []

[MSG]The type is not specified for variable "extraElements"

➥ BsonNumberSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired325

[SRC]def 'should convert to int value'() {

[MSG]Method "should convert to int value" has a dynamic return type

MethodReturnTypeRequired338

[SRC]def 'should convert to long value'() {

[MSG]Method "should convert to long value" has a dynamic return type

MethodReturnTypeRequired349

[SRC]def 'should convert to double value'() {

[MSG]Method "should convert to double value" has a dynamic return type

MethodReturnTypeRequired362

[SRC]def 'should convert to decimal128 value'() {

[MSG]Method "should convert to decimal128 value" has a dynamic return type

➥ BsonRegularExpressionSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired323

[SRC]def 'should get type'() {

[MSG]Method "should get type" has a dynamic return type

MethodReturnTypeRequired328

[SRC]def 'should sort options'() {

[MSG]Method "should sort options" has a dynamic return type

MethodReturnTypeRequired333

[SRC]def 'should accept invalid options'() {

[MSG]Method "should accept invalid options" has a dynamic return type

MethodReturnTypeRequired338

[SRC]def 'should allow null options'() {

[MSG]Method "should allow null options" has a dynamic return type

MethodReturnTypeRequired344

[SRC]def 'should get regular expression'() {

[MSG]Method "should get regular expression" has a dynamic return type

MethodReturnTypeRequired349

[SRC]def 'equivalent values should be equal and have same hashcode'() {

[MSG]Method "equivalent values should be equal and have same hashcode" has a dynamic return type

VariableTypeRequired351

[SRC]def first = new BsonRegularExpression('abc', 'uxsmi')

[MSG]The type is not specified for variable "first"

VariableTypeRequired352

[SRC]def second = new BsonRegularExpression('abc', 'imsxu')

[MSG]The type is not specified for variable "second"

MethodReturnTypeRequired359

[SRC]def 'should convert to string'() {

[MSG]Method "should convert to string" has a dynamic return type

➥ BsonTimestampSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired328

[SRC]def 'bsonType should get expected value'() {

[MSG]Method "bsonType should get expected value" has a dynamic return type

MethodReturnTypeRequired334

[SRC]def 'compareTo should sort the timestamps as unsigned values'() {

[MSG]Method "compareTo should sort the timestamps as unsigned values" has a dynamic return type

VariableTypeRequired335

[SRC]def timestamps = [new BsonTimestamp(Long.MIN_VALUE),

[MSG]The type is not specified for variable "timestamps"

MethodReturnTypeRequired354

[SRC]def 'constructors should initialize instance'() {

[MSG]Method "constructors should initialize instance" has a dynamic return type

VariableTypeRequired356

[SRC]def tsFromValue = new BsonTimestamp(value)

[MSG]The type is not specified for variable "tsFromValue"

VariableTypeRequired357

[SRC]def tsFromSecondsAndIncrement = new BsonTimestamp(seconds, increment)

[MSG]The type is not specified for variable "tsFromSecondsAndIncrement"

MethodReturnTypeRequired380

[SRC]def 'no args constructor should initialize instance'() {

[MSG]Method "no args constructor should initialize instance" has a dynamic return type

VariableTypeRequired382

[SRC]def tsFromValue = new BsonTimestamp()

[MSG]The type is not specified for variable "tsFromValue"

➥ BsonValueSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired324

[SRC]def 'is methods should return true for the correct type'() {

[MSG]Method "is methods should return true for the correct type" has a dynamic return type

MethodReturnTypeRequired349

[SRC]def 'is methods should return false for the incorrect type'() {

[MSG]Method "is methods should return false for the incorrect type" has a dynamic return type

MethodReturnTypeRequired374

[SRC]def 'as methods should return false for the incorrect type'() {

[MSG]Method "as methods should return false for the incorrect type" has a dynamic return type

➥ BsonWriterSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired325

[SRC]def shouldThrowExceptionForBooleanWhenWritingBeforeStart..Document() {

[MSG]Method "shouldThrowExceptionForBooleanWhenWritingBeforeStartingDocument" has a dynamic return type

MethodReturnTypeRequired336

[SRC]def shouldThrowExceptionForArrayWhenWritingBeforeStartingDocument() {

[MSG]Method "shouldThrowExceptionForArrayWhenWritingBeforeStartingDocument" has a dynamic return type

MethodReturnTypeRequired347

[SRC]def shouldThrowExceptionForNullWhenWritingBeforeStartingDocument() {

[MSG]Method "shouldThrowExceptionForNullWhenWritingBeforeStartingDocument" has a dynamic return type

MethodReturnTypeRequired358

[SRC]def shouldThrowExceptionForStringWhenStateIsValue() {

[MSG]Method "shouldThrowExceptionForStringWhenStateIsValue" has a dynamic return type

MethodReturnTypeRequired370

[SRC]def shouldThrowExceptionWhenEndingAnArrayWhenStateIsValue() {

[MSG]Method "shouldThrowExceptionWhenEndingAnArrayWhenStateIsValue" has a dynamic return type

MethodReturnTypeRequired382

[SRC]def shouldThrowExceptionWhenWritingASecondName() {

[MSG]Method "shouldThrowExceptionWhenWritingASecondName" has a dynamic return type

MethodReturnTypeRequired395

[SRC]def shouldThrowExceptionWhenEndingADocumentBeforeValueIsWritten() {

[MSG]Method "shouldThrowExceptionWhenEndingADocumentBeforeValueIsWritten" has a dynamic return type

MethodReturnTypeRequired3108

[SRC]def shouldThrowAnExceptionWhenTryingToWriteASecondValue() {

[MSG]Method "shouldThrowAnExceptionWhenTryingToWriteASecondValue" has a dynamic return type

MethodReturnTypeRequired3122

[SRC]def shouldThrowAnExceptionWhenTryingToWriteJavaScript() {

[MSG]Method "shouldThrowAnExceptionWhenTryingToWriteJavaScript" has a dynamic return type

MethodReturnTypeRequired3136

[SRC]def shouldThrowAnExceptionWhenWritingANameInAnArray() {

[MSG]Method "shouldThrowAnExceptionWhenWritingANameInAnArray" has a dynamic return type

MethodReturnTypeRequired3151

[SRC]def shouldThrowAnExceptionWhenEndingDocumentInTheMiddleO..gAnArray() {

[MSG]Method "shouldThrowAnExceptionWhenEndingDocumentInTheMiddleOfWritingAnArray" has a dynamic return type

MethodReturnTypeRequired3166

[SRC]def shouldThrowAnExceptionWhenEndingAnArrayInASubDocument() {

[MSG]Method "shouldThrowAnExceptionWhenEndingAnArrayInASubDocument" has a dynamic return type

MethodReturnTypeRequired3184

[SRC]def shouldThrowAnExceptionWhenWritingANameInAnArrayEvenW..sInArray() {

[MSG]Method "shouldThrowAnExceptionWhenWritingANameInAnArrayEvenWhenSubDocumentExistsInArray" has a dynamic return type

MethodReturnTypeRequired3204

[SRC]def shouldThrowExceptionWhenWritingObjectsIntoNestedArrays() {

[MSG]Method "shouldThrowExceptionWhenWritingObjectsIntoNestedArrays" has a dynamic return type

MethodReturnTypeRequired3224

[SRC]def shouldThrowAnExceptionWhenAttemptingToEndAnArrayThat..tStarted() {

[MSG]Method "shouldThrowAnExceptionWhenAttemptingToEndAnArrayThatWasNotStarted" has a dynamic return type

MethodReturnTypeRequired3239

[SRC]def shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope1() {

[MSG]Method "shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope1" has a dynamic return type

MethodReturnTypeRequired3254

[SRC]def shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope2() {

[MSG]Method "shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope2" has a dynamic return type

MethodReturnTypeRequired3269

[SRC]def shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope3() {

[MSG]Method "shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope3" has a dynamic return type

MethodReturnTypeRequired3284

[SRC]def shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope4() {

[MSG]Method "shouldThrowAnErrorIfTryingToWriteNamesIntoAJavascriptScope4" has a dynamic return type

MethodReturnTypeRequired3299

[SRC]def shouldThrowAnErrorIfKeyContainsNullCharacter() {

[MSG]Method "shouldThrowAnErrorIfKeyContainsNullCharacter" has a dynamic return type

MethodReturnTypeRequired3312

[SRC]def shouldNotThrowAnErrorIfValueContainsNullCharacter() {

[MSG]Method "shouldNotThrowAnErrorIfValueContainsNullCharacter" has a dynamic return type

MethodReturnTypeRequired3324

[SRC]def shouldNotThrowAnExceptionIfCorrectlyStartingAndEndin..ocuments() {

[MSG]Method "shouldNotThrowAnExceptionIfCorrectlyStartingAndEndingDocumentsAndSubDocuments" has a dynamic return type

MethodReturnTypeRequired3341

[SRC]def shouldThrowOnInvalidFieldName() {

[MSG]Method "shouldThrowOnInvalidFieldName" has a dynamic return type

MethodReturnTypeRequired3356

[SRC]def shouldThrowOnInvalidFieldNameNestedInDocument() {

[MSG]Method "shouldThrowOnInvalidFieldNameNestedInDocument" has a dynamic return type

MethodReturnTypeRequired3375

[SRC]def shouldThrowOnInvalidFieldNameNestedInDocumentInArray() {

[MSG]Method "shouldThrowOnInvalidFieldNameNestedInDocumentInArray" has a dynamic return type

➥ LimitedLookaheadMarkSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired331

[SRC]def 'should throw if mark without resetting previous mar..er writer) {

[MSG]Method "should throw if mark without resetting previous mark" has a dynamic return type

MethodReturnTypeRequired366

[SRC]def 'should throw if reset without mark'(BsonWriter writer) {

[MSG]Method "should throw if reset without mark" has a dynamic return type

MethodReturnTypeRequired3100

[SRC]def 'Lookahead should work at various states'(BsonWriter writer) {

[MSG]Method "Lookahead should work at various states" has a dynamic return type

MethodReturnTypeRequired3246

[SRC]def 'Lookahead should work at various states with Mark'(..er writer) {

[MSG]Method "Lookahead should work at various states with Mark" has a dynamic return type

MethodReturnTypeRequired3430

[SRC]def 'should peek binary subtype and size'(BsonWriter writer) {

[MSG]Method "should peek binary subtype and size" has a dynamic return type

VariableTypeRequired3452

[SRC]def subType = reader.peekBinarySubType()

[MSG]The type is not specified for variable "subType"

VariableTypeRequired3453

[SRC]def size = reader.peekBinarySize()

[MSG]The type is not specified for variable "size"

VariableTypeRequired3454

[SRC]def binary = reader.readBinaryData()

[MSG]The type is not specified for variable "binary"

VariableTypeRequired3455

[SRC]def longValue = reader.readInt64('int64')

[MSG]The type is not specified for variable "longValue"

➥ RawBsonDocumentSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired338

[SRC]static emptyDocument = new BsonDocument()

[MSG]The type is not specified for field "emptyDocument"

FieldTypeRequired339

[SRC]static emptyRawDocument = new RawBsonDocument(emptyDocum..entCodec());

[MSG]The type is not specified for field "emptyRawDocument"

FieldTypeRequired340

[SRC]static document = new BsonDocument()

[MSG]The type is not specified for field "document"

MethodReturnTypeRequired346

[SRC]def 'constructors should throw if parameters are invalid'() {

[MSG]Method "constructors should throw if parameters are invalid" has a dynamic return type

MethodReturnTypeRequired396

[SRC]def 'byteBuffer should contain the correct bytes'() {

[MSG]Method "byteBuffer should contain the correct bytes" has a dynamic return type

VariableTypeRequired398

[SRC]def byteBuf = rawDocument.getByteBuffer()

[MSG]The type is not specified for variable "byteBuf"

VariableTypeRequired3106

[SRC]def actualBytes = new byte[58]

[MSG]The type is not specified for variable "actualBytes"

MethodReturnTypeRequired3116

[SRC]def 'parse should through if parameter is invalid'() {

[MSG]Method "parse should through if parameter is invalid" has a dynamic return type

MethodReturnTypeRequired3124

[SRC]def 'should parse json'() {

[MSG]Method "should parse json" has a dynamic return type

MethodReturnTypeRequired3129

[SRC]def 'containKey should throw if the key name is null'() {

[MSG]Method "containKey should throw if the key name is null" has a dynamic return type

MethodReturnTypeRequired3140

[SRC]def 'containsKey should find an existing key'() {

[MSG]Method "containsKey should find an existing key" has a dynamic return type

MethodReturnTypeRequired3151

[SRC]def 'containsKey should not find a non-existing key'() {

[MSG]Method "containsKey should not find a non-existing key" has a dynamic return type

MethodReturnTypeRequired3164

[SRC]def 'containValue should find an existing value'() {

[MSG]Method "containValue should find an existing value" has a dynamic return type

MethodReturnTypeRequired3175

[SRC]def 'containValue should not find a non-existing value'() {

[MSG]Method "containValue should not find a non-existing value" has a dynamic return type

MethodReturnTypeRequired3185

[SRC]def 'isEmpty should return false when the document is not empty'() {

[MSG]Method "isEmpty should return false when the document is not empty" has a dynamic return type

MethodReturnTypeRequired3193

[SRC]def 'isEmpty should return true when the document is empty'() {

[MSG]Method "isEmpty should return true when the document is empty" has a dynamic return type

MethodReturnTypeRequired3198

[SRC]def 'should get correct size when the document is empty'() {

[MSG]Method "should get correct size when the document is empty" has a dynamic return type

MethodReturnTypeRequired3203

[SRC]def 'should get correct key set when the document is empty'() {

[MSG]Method "should get correct key set when the document is empty" has a dynamic return type

MethodReturnTypeRequired3208

[SRC]def 'should get correct values set when the document is empty'() {

[MSG]Method "should get correct values set when the document is empty" has a dynamic return type

MethodReturnTypeRequired3213

[SRC]def 'should get correct entry set when the document is empty'() {

[MSG]Method "should get correct entry set when the document is empty" has a dynamic return type

MethodReturnTypeRequired3218

[SRC]def 'should get correct size'() {

[MSG]Method "should get correct size" has a dynamic return type

MethodReturnTypeRequired3226

[SRC]def 'should get correct key set'() {

[MSG]Method "should get correct key set" has a dynamic return type

MethodReturnTypeRequired3234

[SRC]def 'should get correct values set'() {

[MSG]Method "should get correct values set" has a dynamic return type

MethodReturnTypeRequired3242

[SRC]def 'should get correct entry set'() {

[MSG]Method "should get correct entry set" has a dynamic return type

MethodReturnTypeRequired3253

[SRC]def 'should get first key'() {

[MSG]Method "should get first key" has a dynamic return type

MethodReturnTypeRequired3261

[SRC]def 'getFirstKey should throw NoSuchElementException if ..s empty'() {

[MSG]Method "getFirstKey should throw NoSuchElementException if the document is empty" has a dynamic return type

MethodReturnTypeRequired3269

[SRC]def 'should create BsonReader'() {

[MSG]Method "should create BsonReader" has a dynamic return type

VariableTypeRequired3271

[SRC]def reader = document.asBsonReader()

[MSG]The type is not specified for variable "reader"

MethodReturnTypeRequired3280

[SRC]def 'toJson should return equivalent JSON'() {

[MSG]Method "toJson should return equivalent JSON" has a dynamic return type

MethodReturnTypeRequired3288

[SRC]def 'toJson should respect default JsonWriterSettings'() {

[MSG]Method "toJson should respect default JsonWriterSettings" has a dynamic return type

VariableTypeRequired3290

[SRC]def writer = new StringWriter();

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired3302

[SRC]def 'toJson should respect JsonWriterSettings'() {

[MSG]Method "toJson should respect JsonWriterSettings" has a dynamic return type

VariableTypeRequired3304

[SRC]def jsonWriterSettings = new JsonWriterSettings(JsonMode.SHELL)

[MSG]The type is not specified for variable "jsonWriterSettings"

VariableTypeRequired3305

[SRC]def writer = new StringWriter();

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired3317

[SRC]def 'all write methods should throw UnsupportedOperationException'() {

[MSG]Method "all write methods should throw UnsupportedOperationException" has a dynamic return type

VariableTypeRequired3319

[SRC]def rawDocument = createRawDocumenFromDocument()

[MSG]The type is not specified for variable "rawDocument"

MethodReturnTypeRequired3352

[SRC]def 'should decode'() {

[MSG]Method "should decode" has a dynamic return type

MethodReturnTypeRequired3359

[SRC]def 'hashCode should equal hash code of identical BsonDocument'() {

[MSG]Method "hashCode should equal hash code of identical BsonDocument" has a dynamic return type

MethodReturnTypeRequired3367

[SRC]def 'equals should equal identical BsonDocument'() {

[MSG]Method "equals should equal identical BsonDocument" has a dynamic return type

MethodReturnTypeRequired3378

[SRC]def 'clone should make a deep copy'() {

[MSG]Method "clone should make a deep copy" has a dynamic return type

MethodReturnTypeRequired3395

[SRC]def 'should serialize and deserialize'() {

[MSG]Method "should serialize and deserialize" has a dynamic return type

VariableTypeRequired3397

[SRC]def baos = new ByteArrayOutputStream()

[MSG]The type is not specified for variable "baos"

VariableTypeRequired3398

[SRC]def oos = new ObjectOutputStream(baos)

[MSG]The type is not specified for variable "oos"

VariableTypeRequired3402

[SRC]def bais = new ByteArrayInputStream(baos.toByteArray())

[MSG]The type is not specified for variable "bais"

VariableTypeRequired3403

[SRC]def ois = new ObjectInputStream(bais)

[MSG]The type is not specified for variable "ois"

VariableTypeRequired3404

[SRC]def deserializedDocument = ois.readObject()

[MSG]The type is not specified for variable "deserializedDocument"

BlockEndsWithBlankLine3411

[MSG]Code block ends with a blank line.

VariableTypeRequired3433

[SRC]def strippedBytes = new byte[size]

[MSG]The type is not specified for variable "strippedBytes"

VariableTypeRequired3439

[SRC]def outputBuffer = new BasicOutputBuffer(1024)

[MSG]The type is not specified for variable "outputBuffer"

VariableTypeRequired3441

[SRC]def bytes = outputBuffer.getInternalBuffer()

[MSG]The type is not specified for variable "bytes"

VariableTypeRequired3447

[SRC]def unstrippedBytes = new byte[size + 2]

[MSG]The type is not specified for variable "unstrippedBytes"

Package: org.bson.codecs

➥ AtomicCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired332

[SRC]def 'should encode and decode atomic boolean'() {

[MSG]Method "should encode and decode atomic boolean" has a dynamic return type

VariableTypeRequired334

[SRC]def codec = new AtomicBooleanCodec()

[MSG]The type is not specified for variable "codec"

VariableTypeRequired335

[SRC]def atomicBoolean = new AtomicBoolean(true)

[MSG]The type is not specified for variable "atomicBoolean"

VariableTypeRequired336

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired339

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

VariableTypeRequired349

[SRC]def reader = new BsonDocumentReader(document)

[MSG]The type is not specified for variable "reader"

VariableTypeRequired352

[SRC]def value = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "value"

MethodReturnTypeRequired358

[SRC]def 'should encode and decode atomic integer'() {

[MSG]Method "should encode and decode atomic integer" has a dynamic return type

VariableTypeRequired360

[SRC]def codec = new AtomicIntegerCodec()

[MSG]The type is not specified for variable "codec"

VariableTypeRequired361

[SRC]def atomicInteger = new AtomicInteger(1)

[MSG]The type is not specified for variable "atomicInteger"

VariableTypeRequired362

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired365

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

VariableTypeRequired375

[SRC]def reader = new BsonDocumentReader(document)

[MSG]The type is not specified for variable "reader"

VariableTypeRequired378

[SRC]def value = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "value"

MethodReturnTypeRequired384

[SRC]def 'should encode and decode atomic long'() {

[MSG]Method "should encode and decode atomic long" has a dynamic return type

VariableTypeRequired386

[SRC]def codec = new AtomicLongCodec()

[MSG]The type is not specified for variable "codec"

VariableTypeRequired387

[SRC]def atomicLong = new AtomicLong(1L)

[MSG]The type is not specified for variable "atomicLong"

VariableTypeRequired388

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired391

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

VariableTypeRequired3101

[SRC]def reader = new BsonDocumentReader(document)

[MSG]The type is not specified for variable "reader"

VariableTypeRequired3104

[SRC]def value = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "value"

➥ BigDecimalCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired329

[SRC]def 'should round trip BigDecimal successfully'() {

[MSG]Method "should round trip BigDecimal successfully" has a dynamic return type

VariableTypeRequired331

[SRC]def codec = new BigDecimalCodec()

[MSG]The type is not specified for variable "codec"

VariableTypeRequired332

[SRC]def bsonDecimal128 = new BsonDecimal128(new Decimal128(bigDecimal))

[MSG]The type is not specified for variable "bsonDecimal128"

VariableTypeRequired335

[SRC]def writer = new BsonDocumentWriter(new BsonDocument())

[MSG]The type is not specified for variable "writer"

BlockEndsWithBlankLine366

[MSG]Code block ends with a blank line.

➥ BsonDocumentCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired356

[SRC]def 'should encode and decode all default types'() {

[MSG]Method "should encode and decode all default types" has a dynamic return type

VariableTypeRequired358

[SRC]def doc = new BsonDocument(

[MSG]The type is not specified for variable "doc"

VariableTypeRequired393

[SRC]def decodedDoc = new BsonDocumentCodec().decode(reader, ..r().build())

[MSG]The type is not specified for variable "decodedDoc"

MethodReturnTypeRequired3119

[SRC]def 'should respect encodeIdFirst property in encoder context'() {

[MSG]Method "should respect encodeIdFirst property in encoder context" has a dynamic return type

VariableTypeRequired3121

[SRC]def doc = new BsonDocument(

[MSG]The type is not specified for variable "doc"

VariableTypeRequired3139

[SRC]def encodedDocument = new BsonDocument()

[MSG]The type is not specified for variable "encodedDocument"

MethodReturnTypeRequired3159

[SRC]def 'should encode nested raw documents'() {

[MSG]Method "should encode nested raw documents" has a dynamic return type

VariableTypeRequired3161

[SRC]def doc = new BsonDocument('a', BsonBoolean.TRUE)

[MSG]The type is not specified for variable "doc"

VariableTypeRequired3162

[SRC]def rawDoc = new RawBsonDocument(doc, new BsonDocumentCodec());

[MSG]The type is not specified for variable "rawDoc"

VariableTypeRequired3163

[SRC]def docWithNestedRawDoc = new BsonDocument('a', rawDoc)...st(rawDoc)))

[MSG]The type is not specified for variable "docWithNestedRawDoc"

VariableTypeRequired3166

[SRC]def encodedDocument = new BsonDocument()

[MSG]The type is not specified for variable "encodedDocument"

MethodReturnTypeRequired3174

[SRC]def 'should determine if document has an id'() {

[MSG]Method "should determine if document has an id" has a dynamic return type

MethodReturnTypeRequired3180

[SRC]def 'should get document id'() {

[MSG]Method "should get document id" has a dynamic return type

MethodReturnTypeRequired3186

[SRC]def 'should generate document id if absent'() {

[MSG]Method "should generate document id if absent" has a dynamic return type

VariableTypeRequired3188

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3197

[SRC]def 'should not generate document id if present'() {

[MSG]Method "should not generate document id if present" has a dynamic return type

VariableTypeRequired3199

[SRC]def document = new BsonDocument('_id', new BsonInt32(1))

[MSG]The type is not specified for variable "document"

➥ BsonTypeClassMapSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired337

[SRC]def 'should have defaults for all BSON types'() {

[MSG]Method "should have defaults for all BSON types" has a dynamic return type

VariableTypeRequired339

[SRC]def map = new BsonTypeClassMap()

[MSG]The type is not specified for variable "map"

MethodReturnTypeRequired364

[SRC]def 'should obey replacements'() {

[MSG]Method "should obey replacements" has a dynamic return type

VariableTypeRequired366

[SRC]def map = new BsonTypeClassMap([(BsonType.DATE_TIME): java.sql.Date])

[MSG]The type is not specified for variable "map"

➥ BsonTypeCodecMapSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired328

[SRC]def bsonTypeClassMap = new BsonTypeClassMap()

[MSG]The type is not specified for field "bsonTypeClassMap"

FieldTypeRequired329

[SRC]def registry = fromRegistries(fromProviders(new Document..Provider()))

[MSG]The type is not specified for field "registry"

FieldTypeRequired330

[SRC]def bsonTypeCodecMap = new BsonTypeCodecMap(bsonTypeClas..p, registry)

[MSG]The type is not specified for field "bsonTypeCodecMap"

MethodReturnTypeRequired332

[SRC]def 'should map types to codecs'() {

[MSG]Method "should map types to codecs" has a dynamic return type

MethodReturnTypeRequired355

[SRC]def 'should throw exception for unmapped type'() {

[MSG]Method "should throw exception for unmapped type" has a dynamic return type

MethodReturnTypeRequired363

[SRC]def 'should throw exception for unregistered codec'() {

[MSG]Method "should throw exception for unregistered codec" has a dynamic return type

➥ BsonValueCodecProviderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired347

[SRC]def provider = new BsonValueCodecProvider()

[MSG]The type is not specified for field "provider"

FieldTypeRequired348

[SRC]def codecRegistry = fromProviders(provider)

[MSG]The type is not specified for field "codecRegistry"

MethodReturnTypeRequired350

[SRC]def 'should get correct codec'() {

[MSG]Method "should get correct codec" has a dynamic return type

➥ CharacterCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired329

[SRC]def 'should get encoder class'() {

[MSG]Method "should get encoder class" has a dynamic return type

MethodReturnTypeRequired333

[SRC]def 'when encoding a character, should throw if it is null'() {

[MSG]Method "when encoding a character, should throw if it is null" has a dynamic return type

VariableTypeRequired335

[SRC]def writer = new BsonDocumentWriter(new BsonDocument())

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired344

[SRC]def 'should encode a character'() {

[MSG]Method "should encode a character" has a dynamic return type

VariableTypeRequired346

[SRC]def writer = new BsonDocumentWriter(new BsonDocument())

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired358

[SRC]def 'should decode a character'() {

[MSG]Method "should decode a character" has a dynamic return type

VariableTypeRequired360

[SRC]def reader = new BsonDocumentReader(new BsonDocument('st..tring('c')))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired365

[SRC]def character = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "character"

MethodReturnTypeRequired371

[SRC]def 'when decoding a string whose length is not 1, shoul..ception'() {

[MSG]Method "when decoding a string whose length is not 1, should throw a BsonInvalidOperationException" has a dynamic return type

VariableTypeRequired373

[SRC]def reader = new BsonDocumentReader(new BsonDocument('st..ring('cc')))

[MSG]The type is not specified for variable "reader"

➥ CodeWithScopeSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired334

[SRC]def 'should encode code with scope as java script follow..f scope'() {

[MSG]Method "should encode code with scope as java script followed by document of scope" has a dynamic return type

MethodReturnTypeRequired354

[SRC]def 'should decode code with scope'() {

[MSG]Method "should decode code with scope" has a dynamic return type

➥ DocumentCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired360

[SRC]def 'should encode and decode all default types with all..er writer) {

[MSG]Method "should encode and decode all default types with all readers and writers" has a dynamic return type

VariableTypeRequired362

[SRC]def originalDocument = new Document()

[MSG]The type is not specified for variable "originalDocument"

VariableTypeRequired3104

[SRC]def decodedDoc = new DocumentCodec().decode(reader, Deco..r().build())

[MSG]The type is not specified for variable "decodedDoc"

MethodReturnTypeRequired3143

[SRC]def 'should decode binary subtypes for UUID'() {

[MSG]Method "should decode binary subtypes for UUID" has a dynamic return type

VariableTypeRequired3145

[SRC]def reader = new BsonBinaryReader(ByteBuffer.wrap(bytes as byte[]))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired3148

[SRC]def document = new DocumentCodec().decode(reader, Decode..r().build())

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3161

[SRC]def 'should respect encodeIdFirst property in encoder context'() {

[MSG]Method "should respect encodeIdFirst property in encoder context" has a dynamic return type

VariableTypeRequired3163

[SRC]def originalDocument = new Document('x', 2)

[MSG]The type is not specified for variable "originalDocument"

VariableTypeRequired3169

[SRC]def encodedDocument = new BsonDocument()

[MSG]The type is not specified for variable "encodedDocument"

MethodReturnTypeRequired3189

[SRC]def 'should apply transformer to decoded values'() {

[MSG]Method "should apply transformer to decoded values" has a dynamic return type

VariableTypeRequired3191

[SRC]def codec = new DocumentCodec(fromProviders([new ValueCo..rovider()]),

[MSG]The type is not specified for variable "codec"

VariableTypeRequired3195

[SRC]def doc = codec.decode(new BsonDocumentReader(new BsonDo..r().build())

[MSG]The type is not specified for variable "doc"

MethodReturnTypeRequired3202

[SRC]def 'should generate id if absent'() {

[MSG]Method "should generate id if absent" has a dynamic return type

VariableTypeRequired3204

[SRC]def document = new Document()

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3213

[SRC]def 'should not generate id if present'() {

[MSG]Method "should not generate id if present" has a dynamic return type

VariableTypeRequired3215

[SRC]def document = new Document('_id', 1)

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3224

[SRC]def 'should determine if id is present'() {

[MSG]Method "should determine if id is present" has a dynamic return type

MethodReturnTypeRequired3230

[SRC]def 'should get id if present'() {

[MSG]Method "should get id if present" has a dynamic return type

MethodReturnTypeRequired3236

[SRC]def 'should throw if getting id when absent'() {

[MSG]Method "should throw if getting id when absent" has a dynamic return type

➥ IterableCodecProviderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired326

[SRC]def 'should provide codec for Iterables'() {

[MSG]Method "should provide codec for Iterables" has a dynamic return type

VariableTypeRequired328

[SRC]def provider = new IterableCodecProvider()

[MSG]The type is not specified for variable "provider"

VariableTypeRequired329

[SRC]def registry = fromProviders(provider, new BsonValueCode..cProvider())

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired337

[SRC]def 'should not provide codec for non-Iterables'() {

[MSG]Method "should not provide codec for non-Iterables" has a dynamic return type

VariableTypeRequired339

[SRC]def provider = new IterableCodecProvider()

[MSG]The type is not specified for variable "provider"

VariableTypeRequired340

[SRC]def registry = fromProviders(provider, new BsonValueCode..cProvider())

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired346

[SRC]def 'identical instances should be equal and have same hash code'() {

[MSG]Method "identical instances should be equal and have same hash code" has a dynamic return type

VariableTypeRequired348

[SRC]def first = new IterableCodecProvider()

[MSG]The type is not specified for variable "first"

VariableTypeRequired349

[SRC]def second = new IterableCodecProvider()

[MSG]The type is not specified for variable "second"

MethodReturnTypeRequired358

[SRC]def 'unidentical instances should not be equal'() {

[MSG]Method "unidentical instances should not be equal" has a dynamic return type

VariableTypeRequired360

[SRC]def first = new IterableCodecProvider()

[MSG]The type is not specified for variable "first"

VariableTypeRequired361

[SRC]def second = new IterableCodecProvider(new BsonTypeClass..N: String]))

[MSG]The type is not specified for variable "second"

VariableTypeRequired362

[SRC]def third = new IterableCodecProvider(new BsonTypeClassM..ject from ->

[MSG]The type is not specified for variable "third"

➥ IterableCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired331

[SRC]static final REGISTRY = fromProviders(new ValueCodecProv..cProvider(),

[MSG]The type is not specified for field "REGISTRY"

MethodReturnTypeRequired334

[SRC]def 'should have Iterable encoding class'() {

[MSG]Method "should have Iterable encoding class" has a dynamic return type

VariableTypeRequired336

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())

[MSG]The type is not specified for variable "codec"

MethodReturnTypeRequired342

[SRC]def 'should encode an Iterable to a BSON array'() {

[MSG]Method "should encode an Iterable to a BSON array" has a dynamic return type

VariableTypeRequired344

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())

[MSG]The type is not specified for variable "codec"

VariableTypeRequired345

[SRC]def writer = new BsonDocumentWriter(new BsonDocument())

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired357

[SRC]def 'should decode a BSON array to an Iterable'() {

[MSG]Method "should decode a BSON array to an Iterable" has a dynamic return type

VariableTypeRequired359

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())

[MSG]The type is not specified for variable "codec"

VariableTypeRequired360

[SRC]def reader = new BsonDocumentReader(parse('{array : [1, ..3, null]}'))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired365

[SRC]def iterable = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "iterable"

MethodReturnTypeRequired372

[SRC]def 'should decode a BSON array of arrays to an Iterable..erables'() {

[MSG]Method "should decode a BSON array of arrays to an Iterable of Iterables" has a dynamic return type

VariableTypeRequired374

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap())

[MSG]The type is not specified for variable "codec"

VariableTypeRequired375

[SRC]def reader = new BsonDocumentReader(parse('{array : [[1,.., 4, 5]]}'))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired380

[SRC]def iterable = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "iterable"

MethodReturnTypeRequired387

[SRC]def 'should use provided transformer'() {

[MSG]Method "should use provided transformer" has a dynamic return type

VariableTypeRequired389

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClas..ject from ->

[MSG]The type is not specified for variable "codec"

VariableTypeRequired392

[SRC]def reader = new BsonDocumentReader(parse('{array : [1, 2, 3]}'))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired397

[SRC]def iterable = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "iterable"

MethodReturnTypeRequired3104

[SRC]def 'should decode binary subtypes for UUID'() {

[MSG]Method "should decode binary subtypes for UUID" has a dynamic return type

VariableTypeRequired3106

[SRC]def codec = new IterableCodec(REGISTRY, new BsonTypeClassMap(), null)

[MSG]The type is not specified for variable "codec"

VariableTypeRequired3107

[SRC]def reader = new BsonDocumentReader(parse(document))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired3112

[SRC]def iterable = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "iterable"

➥ MapCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired360

[SRC]def 'should encode and decode all default types with all..er writer) {

[MSG]Method "should encode and decode all default types with all readers and writers" has a dynamic return type

VariableTypeRequired362

[SRC]def originalDocument = [:]

[MSG]The type is not specified for variable "originalDocument"

VariableTypeRequired3104

[SRC]def decodedDoc = new MapCodec().decode(reader, DecoderCo..r().build())

[MSG]The type is not specified for variable "decodedDoc"

MethodReturnTypeRequired3142

[SRC]def 'should decode binary subtypes for UUID'() {

[MSG]Method "should decode binary subtypes for UUID" has a dynamic return type

VariableTypeRequired3144

[SRC]def reader = new BsonBinaryReader(ByteBuffer.wrap(bytes as byte[]))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired3147

[SRC]def document = new MapCodec().decode(reader, DecoderCont..r().build())

[MSG]The type is not specified for variable "document"

MethodReturnTypeRequired3160

[SRC]def 'should apply transformer to decoded values'() {

[MSG]Method "should apply transformer to decoded values" has a dynamic return type

VariableTypeRequired3162

[SRC]def codec = new MapCodec(fromProviders([new ValueCodecPr..rovider()]),

[MSG]The type is not specified for variable "codec"

VariableTypeRequired3166

[SRC]def doc = codec.decode(new BsonDocumentReader(new BsonDo..r().build())

[MSG]The type is not specified for variable "doc"

➥ RawBsonDocumentCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired333

[SRC]def codec = new RawBsonDocumentCodec()

[MSG]The type is not specified for field "codec"

FieldTypeRequired334

[SRC]def document = new BsonDocument([new BsonElement('b1', B..ean.FALSE)])

[MSG]The type is not specified for field "document"

FieldTypeRequired335

[SRC]def documentBytes = [15, 0, 0, 0, 8, 98, 49, 0, 1, 8, 98..] as byte[];

[MSG]The type is not specified for field "documentBytes"

MethodReturnTypeRequired337

[SRC]def 'should get encoder class'() {

[MSG]Method "should get encoder class" has a dynamic return type

MethodReturnTypeRequired342

[SRC]def 'should encode'() {

[MSG]Method "should encode" has a dynamic return type

VariableTypeRequired344

[SRC]def document = new BsonDocument()

[MSG]The type is not specified for variable "document"

VariableTypeRequired345

[SRC]def writer = new BsonDocumentWriter(document)

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired354

[SRC]def 'should decode'() {

[MSG]Method "should decode" has a dynamic return type

VariableTypeRequired356

[SRC]def reader = new BsonBinaryReader(new ByteBufferBsonInpu..entBytes))))

[MSG]The type is not specified for variable "reader"

VariableTypeRequired360

[SRC]def bytes = new byte[buffer.getByteBuffer().remaining()]

[MSG]The type is not specified for variable "bytes"

➥ UndefinedCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired329

[SRC]def 'should return Undefined class'() {

[MSG]Method "should return Undefined class" has a dynamic return type

MethodReturnTypeRequired334

[SRC]def 'should decode undefined type from BsonReader'() {

[MSG]Method "should decode undefined type from BsonReader" has a dynamic return type

VariableTypeRequired339

[SRC]def result = codec.decode(reader, DecoderContext.builder().build())

[MSG]The type is not specified for variable "result"

MethodReturnTypeRequired347

[SRC]def 'should encode undefined type to BsonWriter'() {

[MSG]Method "should encode undefined type to BsonWriter" has a dynamic return type

➥ UuidCodecSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired340

[SRC]def setup() {

[MSG]Method "setup" has a dynamic return type

MethodReturnTypeRequired345

[SRC]def 'should decode different types of UUID'(UuidCodec co..OException {

[MSG]Method "should decode different types of UUID" has a dynamic return type

BlockStartsWithBlankLine346

[MSG]Code block starts with a blank line.

BlockEndsWithBlankLine3107

[MSG]Code block ends with a blank line.

MethodReturnTypeRequired3110

[SRC]def 'should encode different types of UUIDs'(Byte bsonSubType,

[MSG]Method "should encode different types of UUIDs" has a dynamic return type

➥ ValueCodecProviderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired336

[SRC]private final provider = new ValueCodecProvider()

[MSG]The type is not specified for field "provider"

FieldTypeRequired337

[SRC]private final registry = CodecRegistries.fromProviders(provider)

[MSG]The type is not specified for field "registry"

MethodReturnTypeRequired339

[SRC]def 'should provide supported codecs'() {

[MSG]Method "should provide supported codecs" has a dynamic return type

Package: org.bson.codecs.configuration

➥ CodeRegistriesSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired333

[SRC]def 'fromCodec should return a SingleCodecRegistry'() {

[MSG]Method "fromCodec should return a SingleCodecRegistry" has a dynamic return type

VariableTypeRequired335

[SRC]def registry = fromCodecs(new UuidCodec(), new LongCodec())

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired343

[SRC]def 'fromProvider should return ProvidersCodecRegistry'() {

[MSG]Method "fromProvider should return ProvidersCodecRegistry" has a dynamic return type

VariableTypeRequired345

[SRC]def registry = fromProviders(new BsonValueCodecProvider())

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired352

[SRC]def 'fromProviders should return ProvidersCodecRegistry'() {

[MSG]Method "fromProviders should return ProvidersCodecRegistry" has a dynamic return type

VariableTypeRequired354

[SRC]def providers = fromProviders([new BsonValueCodecProvide..Provider()])

[MSG]The type is not specified for variable "providers"

MethodReturnTypeRequired362

[SRC]def 'fromRegistries should return ProvidersCodecRegistry'() {

[MSG]Method "fromRegistries should return ProvidersCodecRegistry" has a dynamic return type

VariableTypeRequired363

[SRC]def uuidCodec = new UuidCodec()

[MSG]The type is not specified for variable "uuidCodec"

VariableTypeRequired365

[SRC]def registry = fromRegistries(fromCodecs(uuidCodec), fro..Provider()))

[MSG]The type is not specified for variable "registry"

➥ CodecCacheSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired325

[SRC]def 'should return the cached codec if a codec for the c.. exists'() {

[MSG]Method "should return the cached codec if a codec for the class exists" has a dynamic return type

VariableTypeRequired327

[SRC]def codec = new MinKeyCodec()

[MSG]The type is not specified for variable "codec"

VariableTypeRequired328

[SRC]def cache = new CodecCache()

[MSG]The type is not specified for variable "cache"

MethodReturnTypeRequired335

[SRC]def 'should throw if codec for class does not exist'() {

[MSG]Method "should throw if codec for class does not exist" has a dynamic return type

VariableTypeRequired337

[SRC]def cache = new CodecCache()

[MSG]The type is not specified for variable "cache"

➥ ProvidersCodecRegistrySpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired341

[SRC]def 'should throw if supplied codecProviders is null or ..ty list'() {

[MSG]Method "should throw if supplied codecProviders is null or an empty list" has a dynamic return type

MethodReturnTypeRequired355

[SRC]def 'should throw a CodecConfigurationException if codec..t found'() {

[MSG]Method "should throw a CodecConfigurationException if codec not found" has a dynamic return type

MethodReturnTypeRequired363

[SRC]def 'get should return registered codec'() {

[MSG]Method "get should return registered codec" has a dynamic return type

VariableTypeRequired365

[SRC]def minKeyCodec = new MinKeyCodec()

[MSG]The type is not specified for variable "minKeyCodec"

VariableTypeRequired366

[SRC]def registry = new ProvidersCodecRegistry([new SingleCod..nKeyCodec)])

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired372

[SRC]def 'get should return the codec from the first source t..has one'() {

[MSG]Method "get should return the codec from the first source that has one" has a dynamic return type

VariableTypeRequired374

[SRC]def minKeyCodec1 = new MinKeyCodec()

[MSG]The type is not specified for variable "minKeyCodec1"

VariableTypeRequired375

[SRC]def minKeyCodec2 = new MinKeyCodec()

[MSG]The type is not specified for variable "minKeyCodec2"

VariableTypeRequired376

[SRC]def registry = new ProvidersCodecRegistry([new SingleCod..KeyCodec2)])

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired382

[SRC]def 'should handle cycles'() {

[MSG]Method "should handle cycles" has a dynamic return type

VariableTypeRequired384

[SRC]def registry = new ProvidersCodecRegistry([new ClassMode..Provider()])

[MSG]The type is not specified for variable "registry"

VariableTypeRequired393

[SRC]def top = new Top('Bob',

[MSG]The type is not specified for variable "top"

VariableTypeRequired396

[SRC]def writer = new BsonBinaryWriter(new BasicOutputBuffer())

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired3107

[SRC]def 'get should use the codecCache'() {

[MSG]Method "get should use the codecCache" has a dynamic return type

VariableTypeRequired3109

[SRC]def provider = Mock(CodecProvider)

[MSG]The type is not specified for variable "provider"

VariableTypeRequired3112

[SRC]def registry = new ProvidersCodecRegistry([provider])

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired3127

[SRC]def 'get with codec registry should return the codec fro..has one'() {

[MSG]Method "get with codec registry should return the codec from the first source that has one" has a dynamic return type

VariableTypeRequired3129

[SRC]def provider = new ProvidersCodecRegistry([new ClassMode..([Simple])])

[MSG]The type is not specified for variable "provider"

VariableTypeRequired3130

[SRC]def registry = Mock(CodecRegistry)

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired3136

[SRC]def 'get with codec registry should return null if codec..t found'() {

[MSG]Method "get with codec registry should return null if codec not found" has a dynamic return type

VariableTypeRequired3138

[SRC]def provider = new ProvidersCodecRegistry([new ClassMode..der([Top])])

[MSG]The type is not specified for variable "provider"

VariableTypeRequired3139

[SRC]def registry = Mock(CodecRegistry)

[MSG]The type is not specified for variable "registry"

MethodReturnTypeRequired3145

[SRC]def 'get with codec registry should pass the outer regis..oviders'() {

[MSG]Method "get with codec registry should pass the outer registry to its providers" has a dynamic return type

VariableTypeRequired3147

[SRC]def provider = new ProvidersCodecRegistry([new ClassMode..([Simple])])

[MSG]The type is not specified for variable "provider"

VariableTypeRequired3148

[SRC]def registry = Mock(CodecRegistry)

[MSG]The type is not specified for variable "registry"

VariableTypeRequired3245

[SRC]def name = reader.readString()

[MSG]The type is not specified for variable "name"

VariableTypeRequired3246

[SRC]def other = null

[MSG]The type is not specified for variable "other"

VariableTypeRequired3247

[SRC]def nested = null

[MSG]The type is not specified for variable "nested"

VariableTypeRequired3249

[SRC]def type = reader.readBsonType()

[MSG]The type is not specified for variable "type"

VariableTypeRequired3299

[SRC]def name = reader.readString()

[MSG]The type is not specified for variable "name"

VariableTypeRequired3300

[SRC]def type = reader.readBsonType()

[MSG]The type is not specified for variable "type"

VariableTypeRequired3302

[SRC]def top = null

[MSG]The type is not specified for variable "top"

MethodParameterTypeRequired3364

[SRC]boolean equals(final o) {

[MSG]"o" parameter of "equals" method is dynamically typed

MethodParameterTypeRequired3413

[SRC]boolean equals(final o) {

[MSG]"o" parameter of "equals" method is dynamically typed

Package: org.bson.io

➥ BasicOutputBufferSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired325

[SRC]def 'position and size should be 0 after constructor'() {

[MSG]Method "position and size should be 0 after constructor" has a dynamic return type

VariableTypeRequired327

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired334

[SRC]def 'should write a byte'() {

[MSG]Method "should write a byte" has a dynamic return type

VariableTypeRequired336

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired347

[SRC]def 'should write bytes'() {

[MSG]Method "should write bytes" has a dynamic return type

VariableTypeRequired349

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired360

[SRC]def 'should write bytes from offset until length'() {

[MSG]Method "should write bytes from offset until length" has a dynamic return type

VariableTypeRequired362

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired373

[SRC]def 'should write a little endian Int32'() {

[MSG]Method "should write a little endian Int32" has a dynamic return type

VariableTypeRequired375

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired386

[SRC]def 'should write a little endian Int64'() {

[MSG]Method "should write a little endian Int64" has a dynamic return type

VariableTypeRequired388

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired399

[SRC]def 'should write a double'() {

[MSG]Method "should write a double" has a dynamic return type

VariableTypeRequired3101

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3112

[SRC]def 'should write an ObjectId'() {

[MSG]Method "should write an ObjectId" has a dynamic return type

VariableTypeRequired3114

[SRC]def objectIdAsByteArray = [12, 11, 10, 9, 8, 7, 6, 5, 4,..1] as byte[]

[MSG]The type is not specified for variable "objectIdAsByteArray"

VariableTypeRequired3115

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3126

[SRC]def 'should write an empty string'() {

[MSG]Method "should write an empty string" has a dynamic return type

VariableTypeRequired3128

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3139

[SRC]def 'should write an ASCII string'() {

[MSG]Method "should write an ASCII string" has a dynamic return type

VariableTypeRequired3141

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3152

[SRC]def 'should write a UTF-8 string'() {

[MSG]Method "should write a UTF-8 string" has a dynamic return type

VariableTypeRequired3154

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3165

[SRC]def 'should write an empty CString'() {

[MSG]Method "should write an empty CString" has a dynamic return type

VariableTypeRequired3167

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3178

[SRC]def 'should write an ASCII CString'() {

[MSG]Method "should write an ASCII CString" has a dynamic return type

VariableTypeRequired3180

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3191

[SRC]def 'should write a UTF-8 CString'() {

[MSG]Method "should write a UTF-8 CString" has a dynamic return type

VariableTypeRequired3193

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3204

[SRC]def 'null character in CString should throw Serializatio..ception'() {

[MSG]Method "null character in CString should throw SerializationException" has a dynamic return type

VariableTypeRequired3206

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3215

[SRC]def 'null character in String should not throw Serializa..ception'() {

[MSG]Method "null character in String should not throw SerializationException" has a dynamic return type

VariableTypeRequired3217

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3226

[SRC]def 'write Int32 at position should throw with invalid position'() {

[MSG]Method "write Int32 at position should throw with invalid position" has a dynamic return type

VariableTypeRequired3228

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3244

[SRC]def 'should write Int32 at position'() {

[MSG]Method "should write Int32 at position" has a dynamic return type

VariableTypeRequired3246

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3266

[SRC]def 'truncate should throw with invalid position'() {

[MSG]Method "truncate should throw with invalid position" has a dynamic return type

VariableTypeRequired3268

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3284

[SRC]def 'should truncate to position'() {

[MSG]Method "should truncate to position" has a dynamic return type

VariableTypeRequired3286

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3298

[SRC]def 'should grow'() {

[MSG]Method "should grow" has a dynamic return type

VariableTypeRequired3300

[SRC]def bsonOutput = new BasicOutputBuffer(4)

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3312

[SRC]def 'should get byte buffer as little endian'() {

[MSG]Method "should get byte buffer as little endian" has a dynamic return type

VariableTypeRequired3314

[SRC]def bsonOutput = new BasicOutputBuffer(4)

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3323

[SRC]def 'should get internal buffer'() {

[MSG]Method "should get internal buffer" has a dynamic return type

VariableTypeRequired3325

[SRC]def bsonOutput = new BasicOutputBuffer(4)

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3334

[SRC]def 'should close'() {

[MSG]Method "should close" has a dynamic return type

VariableTypeRequired3336

[SRC]def bsonOutput = new BasicOutputBuffer()

[MSG]The type is not specified for variable "bsonOutput"

MethodReturnTypeRequired3346

[SRC]def getBytes(final BasicOutputBuffer basicOutputBuffer) {

[MSG]Method "getBytes" has a dynamic return type

➥ ByteBufferBsonInputSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired328

[SRC]def 'constructor should throw of buffer is null'() {

[MSG]Method "constructor should throw of buffer is null" has a dynamic return type

MethodReturnTypeRequired336

[SRC]def 'position should start at 0'() {

[MSG]Method "position should start at 0" has a dynamic return type

VariableTypeRequired338

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..w byte[4])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired344

[SRC]def 'should read a byte'() {

[MSG]Method "should read a byte" has a dynamic return type

VariableTypeRequired346

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired353

[SRC]def 'should read into a byte array'() {

[MSG]Method "should read into a byte array" has a dynamic return type

VariableTypeRequired355

[SRC]def bytes = [11, 12, 13] as byte[]

[MSG]The type is not specified for variable "bytes"

VariableTypeRequired356

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..rap(bytes)))

[MSG]The type is not specified for variable "stream"

VariableTypeRequired357

[SRC]def bytesRead = new byte[bytes.length]

[MSG]The type is not specified for variable "bytesRead"

BlockEndsWithBlankLine363

[MSG]Code block ends with a blank line.

MethodReturnTypeRequired366

[SRC]def 'should read into a byte array at offset until length'() {

[MSG]Method "should read into a byte array at offset until length" has a dynamic return type

VariableTypeRequired368

[SRC]def bytes = [11, 12, 13] as byte[]

[MSG]The type is not specified for variable "bytes"

VariableTypeRequired369

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..rap(bytes)))

[MSG]The type is not specified for variable "stream"

VariableTypeRequired370

[SRC]def bytesRead = new byte[bytes.length + 2]

[MSG]The type is not specified for variable "bytesRead"

MethodReturnTypeRequired378

[SRC]def 'should read a little endian Int32'() {

[MSG]Method "should read a little endian Int32" has a dynamic return type

VariableTypeRequired380

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired387

[SRC]def 'should read a little endian Int64'() {

[MSG]Method "should read a little endian Int64" has a dynamic return type

VariableTypeRequired389

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired396

[SRC]def 'should read a double'() {

[MSG]Method "should read a double" has a dynamic return type

VariableTypeRequired398

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3105

[SRC]def 'should read ObjectId'() {

[MSG]Method "should read ObjectId" has a dynamic return type

VariableTypeRequired3107

[SRC]def objectIdAsByteArray = [12, 11, 10, 9, 8, 7, 6, 5, 4,..1] as byte[]

[MSG]The type is not specified for variable "objectIdAsByteArray"

VariableTypeRequired3108

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..ByteArray)))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3115

[SRC]def 'should read an empty string'() {

[MSG]Method "should read an empty string" has a dynamic return type

VariableTypeRequired3117

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3124

[SRC]def 'should read a one byte string'() {

[MSG]Method "should read a one byte string" has a dynamic return type

VariableTypeRequired3126

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3136

[SRC]def 'should read an invalid one byte string'() {

[MSG]Method "should read an invalid one byte string" has a dynamic return type

VariableTypeRequired3138

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3145

[SRC]def 'should read an ASCII string'() {

[MSG]Method "should read an ASCII string" has a dynamic return type

VariableTypeRequired3147

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3154

[SRC]def 'should read a UTF-8 string'() {

[MSG]Method "should read a UTF-8 string" has a dynamic return type

VariableTypeRequired3156

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3163

[SRC]def 'should read an empty CString'() {

[MSG]Method "should read an empty CString" has a dynamic return type

VariableTypeRequired3165

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3172

[SRC]def 'should read a one byte CString'() {

[MSG]Method "should read a one byte CString" has a dynamic return type

VariableTypeRequired3174

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3184

[SRC]def 'should read an invalid one byte CString'() {

[MSG]Method "should read an invalid one byte CString" has a dynamic return type

VariableTypeRequired3186

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3193

[SRC]def 'should read an ASCII CString'() {

[MSG]Method "should read an ASCII CString" has a dynamic return type

VariableTypeRequired3195

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3202

[SRC]def 'should read a UTF-8 CString'() {

[MSG]Method "should read a UTF-8 CString" has a dynamic return type

VariableTypeRequired3204

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3211

[SRC]def 'should read from position'() {

[MSG]Method "should read from position" has a dynamic return type

VariableTypeRequired3213

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3222

[SRC]def 'should skip CString'() {

[MSG]Method "should skip CString" has a dynamic return type

VariableTypeRequired3224

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3233

[SRC]def 'should skip'() {

[MSG]Method "should skip" has a dynamic return type

VariableTypeRequired3235

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3244

[SRC]def 'reset should throw when there is no mark'() {

[MSG]Method "reset should throw when there is no mark" has a dynamic return type

VariableTypeRequired3246

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3255

[SRC]def 'should reset to the mark'() {

[MSG]Method "should reset to the mark" has a dynamic return type

VariableTypeRequired3257

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3273

[SRC]def 'should have remaining when there are more bytes'() {

[MSG]Method "should have remaining when there are more bytes" has a dynamic return type

VariableTypeRequired3275

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3281

[SRC]def 'should not have remaining when there are no more bytes'() {

[MSG]Method "should not have remaining when there are no more bytes" has a dynamic return type

VariableTypeRequired3283

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3289

[SRC]def 'should close the stream'() {

[MSG]Method "should close the stream" has a dynamic return type

VariableTypeRequired3291

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3301

[SRC]def 'should throw BsonSerializationException reading a b..ailable'() {

[MSG]Method "should throw BsonSerializationException reading a byte if no byte is available" has a dynamic return type

VariableTypeRequired3303

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3312

[SRC]def 'should throw BsonSerializationException reading an ..ailable'() {

[MSG]Method "should throw BsonSerializationException reading an Int32 if less than 4 bytes are available" has a dynamic return type

VariableTypeRequired3314

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3323

[SRC]def 'should throw BsonSerializationException reading an ..ailable'() {

[MSG]Method "should throw BsonSerializationException reading an Int64 if less than 8 bytes are available" has a dynamic return type

VariableTypeRequired3325

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3334

[SRC]def 'should throw BsonSerializationException reading a d..ailable'() {

[MSG]Method "should throw BsonSerializationException reading a double if less than 8 bytes are available" has a dynamic return type

VariableTypeRequired3336

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3345

[SRC]def 'should throw BsonSerializationException reading an ..ailable'() {

[MSG]Method "should throw BsonSerializationException reading an ObjectId if less than 12 bytes are available" has a dynamic return type

VariableTypeRequired3347

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3356

[SRC]def 'should throw BsonSerializationException reading int..ailable'() {

[MSG]Method "should throw BsonSerializationException reading into a byte array if not enough bytes are available" has a dynamic return type

VariableTypeRequired3358

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3367

[SRC]def 'should throw BsonSerializationException reading par..ailable'() {

[MSG]Method "should throw BsonSerializationException reading partially into a byte array if not enough bytes are available" has a dynamic return type

VariableTypeRequired3369

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3378

[SRC]def 'should throw BsonSerializationException if the leng..ositive'() {

[MSG]Method "should throw BsonSerializationException if the length of a BSON string is not positive" has a dynamic return type

VariableTypeRequired3380

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3389

[SRC]def 'should throw BsonSerializationException if a BSON s..minated'() {

[MSG]Method "should throw BsonSerializationException if a BSON string is not null-terminated" has a dynamic return type

VariableTypeRequired3391

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

MethodReturnTypeRequired3400

[SRC]def 'should throw BsonSerializationException if a one-by..minated'() {

[MSG]Method "should throw BsonSerializationException if a one-byte BSON string is not null-terminated" has a dynamic return type

VariableTypeRequired3402

[SRC]def stream = new ByteBufferBsonInput(new ByteBufNIO(Byte..as byte[])))

[MSG]The type is not specified for variable "stream"

Package: org.bson.json

➥ Base64Specification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired326

[SRC]def 'encodes #encoded into #decoded'() {

[MSG]Method "encodes #encoded into #decoded" has a dynamic return type

➥ JsonReaderSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired331

[SRC]def 'should skip value #value'() {

[MSG]Method "should skip value #value" has a dynamic return type

VariableTypeRequired333

[SRC]def document = new BsonDocument('name', value)

[MSG]The type is not specified for variable "document"

VariableTypeRequired334

[SRC]def reader = new JsonReader(document.toJson())

[MSG]The type is not specified for variable "reader"

➥ JsonWriterSettingsSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired324

[SRC]def 'test defaults'() {

[MSG]Method "test defaults" has a dynamic return type

VariableTypeRequired326

[SRC]def settings = new JsonWriterSettings();

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired342

[SRC]def 'test output mode'() {

[MSG]Method "test output mode" has a dynamic return type

VariableTypeRequired344

[SRC]def settings = JsonWriterSettings.builder().outputMode(J..ELL).build()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired350

[SRC]def 'test indent defaults'() {

[MSG]Method "test indent defaults" has a dynamic return type

VariableTypeRequired352

[SRC]def settings = JsonWriterSettings.builder().indent(true).build()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired360

[SRC]def 'test indent settings'() {

[MSG]Method "test indent settings" has a dynamic return type

VariableTypeRequired362

[SRC]def settings = JsonWriterSettings.builder()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired370

[SRC]def 'test max length setting'() {

[MSG]Method "test max length setting" has a dynamic return type

VariableTypeRequired372

[SRC]def settings = JsonWriterSettings.builder()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired379

[SRC]def 'test constructors'() {

[MSG]Method "test constructors" has a dynamic return type

VariableTypeRequired381

[SRC]def settings = new JsonWriterSettings()

[MSG]The type is not specified for variable "settings"

BlockEndsWithBlankLine3123

[MSG]Code block ends with a blank line.

MethodReturnTypeRequired3126

[SRC]def 'should use legacy extended json converters for strict mode'() {

[MSG]Method "should use legacy extended json converters for strict mode" has a dynamic return type

VariableTypeRequired3128

[SRC]def settings = JsonWriterSettings.builder().outputMode(J..ICT).build()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired3150

[SRC]def 'should use extended json converters for extended json mode'() {

[MSG]Method "should use extended json converters for extended json mode" has a dynamic return type

VariableTypeRequired3152

[SRC]def settings = JsonWriterSettings.builder().outputMode(J..DED).build()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired3174

[SRC]def 'should use shell converters for shell mode'() {

[MSG]Method "should use shell converters for shell mode" has a dynamic return type

VariableTypeRequired3176

[SRC]def settings = JsonWriterSettings.builder().outputMode(J..ELL).build()

[MSG]The type is not specified for variable "settings"

MethodReturnTypeRequired3198

[SRC]def 'should set converters'() {

[MSG]Method "should set converters" has a dynamic return type

VariableTypeRequired3200

[SRC]def binaryConverter = new ShellBinaryConverter()

[MSG]The type is not specified for variable "binaryConverter"

VariableTypeRequired3201

[SRC]def booleanConverter = new JsonBooleanConverter()

[MSG]The type is not specified for variable "booleanConverter"

VariableTypeRequired3202

[SRC]def dateTimeConverter = new ShellDateTimeConverter()

[MSG]The type is not specified for variable "dateTimeConverter"

VariableTypeRequired3203

[SRC]def decimal128Converter = new ShellDecimal128Converter()

[MSG]The type is not specified for variable "decimal128Converter"

VariableTypeRequired3204

[SRC]def doubleConverter = new JsonDoubleConverter()

[MSG]The type is not specified for variable "doubleConverter"

VariableTypeRequired3205

[SRC]def int32Converter = new JsonInt32Converter()

[MSG]The type is not specified for variable "int32Converter"

VariableTypeRequired3206

[SRC]def int64Converter = new ShellInt64Converter()

[MSG]The type is not specified for variable "int64Converter"

VariableTypeRequired3207

[SRC]def javaScriptConverter = new JsonJavaScriptConverter()

[MSG]The type is not specified for variable "javaScriptConverter"

VariableTypeRequired3208

[SRC]def maxKeyConverter = new ShellMaxKeyConverter()

[MSG]The type is not specified for variable "maxKeyConverter"

VariableTypeRequired3209

[SRC]def minKeyConverter = new ShellMinKeyConverter()

[MSG]The type is not specified for variable "minKeyConverter"

VariableTypeRequired3210

[SRC]def nullConverter = new JsonNullConverter()

[MSG]The type is not specified for variable "nullConverter"

VariableTypeRequired3211

[SRC]def objectIdConverter = new ShellObjectIdConverter()

[MSG]The type is not specified for variable "objectIdConverter"

VariableTypeRequired3212

[SRC]def regularExpressionConverter = new ShellRegularExpressionConverter()

[MSG]The type is not specified for variable "regularExpressionConverter"

VariableTypeRequired3213

[SRC]def stringConverter = new JsonStringConverter()

[MSG]The type is not specified for variable "stringConverter"

VariableTypeRequired3214

[SRC]def symbolConverter = new JsonSymbolConverter()

[MSG]The type is not specified for variable "symbolConverter"

VariableTypeRequired3215

[SRC]def timestampConverter = new ShellTimestampConverter()

[MSG]The type is not specified for variable "timestampConverter"

VariableTypeRequired3216

[SRC]def undefinedConverter = new ShellUndefinedConverter()

[MSG]The type is not specified for variable "undefinedConverter"

VariableTypeRequired3219

[SRC]def settings = JsonWriterSettings.builder()

[MSG]The type is not specified for variable "settings"

➥ JsonWriterSpecification.groovy

Rule NamePriorityLine #Source Line / Message
FieldTypeRequired333

[SRC]def stringWriter = new StringWriter();

[MSG]The type is not specified for field "stringWriter"

FieldTypeRequired334

[SRC]def writer = new JsonWriter(stringWriter)

[MSG]The type is not specified for field "writer"

FieldTypeRequired335

[SRC]def jsonWithValuesOfEveryType = documentWithValuesOfEver..r().build())

[MSG]The type is not specified for field "jsonWithValuesOfEveryType"

MethodReturnTypeRequired337

[SRC]def 'should pipe all types'() {

[MSG]Method "should pipe all types" has a dynamic return type

VariableTypeRequired339

[SRC]def reader = new BsonDocumentReader(documentWithValuesOfEveryType())

[MSG]The type is not specified for variable "reader"

MethodReturnTypeRequired348

[SRC]def 'should pipe all types with capped length'() {

[MSG]Method "should pipe all types with capped length" has a dynamic return type

VariableTypeRequired350

[SRC]def reader = new BsonDocumentReader(documentWithValuesOfEveryType())

[MSG]The type is not specified for variable "reader"

VariableTypeRequired351

[SRC]def writer = new JsonWriter(stringWriter, JsonWriterSett..th).build())

[MSG]The type is not specified for variable "writer"

MethodReturnTypeRequired365

[SRC]def shouldThrowAnExceptionWhenWritingNullName() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullName" has a dynamic return type

MethodReturnTypeRequired376

[SRC]def shouldThrowAnExceptionWhenWritingNullValue() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullValue" has a dynamic return type

MethodReturnTypeRequired3142

[SRC]def shouldThrowAnExceptionWhenWritingNullMemberValue() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullMemberValue" has a dynamic return type

MethodReturnTypeRequired3207

[SRC]def shouldThrowAnExceptionWhenWritingNullMemberName() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullMemberName" has a dynamic return type

➥ StrictCharacterStreamJsonWriterSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired330

[SRC]def setup() {

[MSG]Method "setup" has a dynamic return type

MethodReturnTypeRequired335

[SRC]def 'should write empty document'() {

[MSG]Method "should write empty document" has a dynamic return type

MethodReturnTypeRequired344

[SRC]def 'should write empty array'() {

[MSG]Method "should write empty array" has a dynamic return type

MethodReturnTypeRequired353

[SRC]def 'should write null'() {

[MSG]Method "should write null" has a dynamic return type

MethodReturnTypeRequired363

[SRC]def 'should write boolean'() {

[MSG]Method "should write boolean" has a dynamic return type

MethodReturnTypeRequired374

[SRC]def 'should write number'() {

[MSG]Method "should write number" has a dynamic return type

MethodReturnTypeRequired384

[SRC]def 'should write string'() {

[MSG]Method "should write string" has a dynamic return type

MethodReturnTypeRequired394

[SRC]def 'should write unquoted string'() {

[MSG]Method "should write unquoted string" has a dynamic return type

MethodReturnTypeRequired3104

[SRC]def 'should write document'() {

[MSG]Method "should write document" has a dynamic return type

MethodReturnTypeRequired3115

[SRC]def 'should write array'() {

[MSG]Method "should write array" has a dynamic return type

MethodReturnTypeRequired3126

[SRC]def 'should write array of values'() {

[MSG]Method "should write array of values" has a dynamic return type

MethodReturnTypeRequired3140

[SRC]def 'should write strings'() {

[MSG]Method "should write strings" has a dynamic return type

Indentation3156

[SRC]'abc\u0000def' | '"abc\\u0000def"'

[MSG]The statement on line 156 in class org.bson.json.StrictCharacterStreamJsonWriterSpecification is at the incorrect indent level: Expected column 9 but was 14

Indentation3166

[SRC]'\u0080' | '"\\u0080"'

[MSG]The statement on line 166 in class org.bson.json.StrictCharacterStreamJsonWriterSpecification is at the incorrect indent level: Expected column 9 but was 14

Indentation3167

[SRC]'\u0080\u0081' | '"\\u0080\\u0081"'

[MSG]The statement on line 167 in class org.bson.json.StrictCharacterStreamJsonWriterSpecification is at the incorrect indent level: Expected column 9 but was 19

Indentation3168

[SRC]'\u0080\u0081\u0082' | '"\\u0080\\u0081\\u0082"'

[MSG]The statement on line 168 in class org.bson.json.StrictCharacterStreamJsonWriterSpecification is at the incorrect indent level: Expected column 9 but was 24

MethodReturnTypeRequired3171

[SRC]def 'should indent one element'() {

[MSG]Method "should indent one element" has a dynamic return type

MethodReturnTypeRequired3184

[SRC]def 'should indent one element with indent and newline characters'() {

[MSG]Method "should indent one element with indent and newline characters" has a dynamic return type

MethodReturnTypeRequired3201

[SRC]def 'should indent two elements'() {

[MSG]Method "should indent two elements" has a dynamic return type

MethodReturnTypeRequired3215

[SRC]def 'should indent embedded document'() {

[MSG]Method "should indent embedded document" has a dynamic return type

MethodReturnTypeRequired3231

[SRC]def shouldThrowExceptionForBooleanWhenWritingBeforeStart..Document() {

[MSG]Method "shouldThrowExceptionForBooleanWhenWritingBeforeStartingDocument" has a dynamic return type

MethodReturnTypeRequired3239

[SRC]def shouldThrowExceptionForNameWhenWritingBeforeStartingDocument() {

[MSG]Method "shouldThrowExceptionForNameWhenWritingBeforeStartingDocument" has a dynamic return type

MethodReturnTypeRequired3247

[SRC]def shouldThrowExceptionForStringWhenStateIsValue() {

[MSG]Method "shouldThrowExceptionForStringWhenStateIsValue" has a dynamic return type

MethodReturnTypeRequired3258

[SRC]def shouldThrowExceptionWhenEndingAnArrayWhenStateIsValue() {

[MSG]Method "shouldThrowExceptionWhenEndingAnArrayWhenStateIsValue" has a dynamic return type

MethodReturnTypeRequired3269

[SRC]def shouldThrowExceptionWhenWritingASecondName() {

[MSG]Method "shouldThrowExceptionWhenWritingASecondName" has a dynamic return type

MethodReturnTypeRequired3281

[SRC]def shouldThrowExceptionWhenEndingADocumentBeforeValueIsWritten() {

[MSG]Method "shouldThrowExceptionWhenEndingADocumentBeforeValueIsWritten" has a dynamic return type

MethodReturnTypeRequired3293

[SRC]def shouldThrowAnExceptionWhenTryingToWriteAValue() {

[MSG]Method "shouldThrowAnExceptionWhenTryingToWriteAValue" has a dynamic return type

MethodReturnTypeRequired3301

[SRC]def shouldThrowAnExceptionWhenWritingANameInAnArray() {

[MSG]Method "shouldThrowAnExceptionWhenWritingANameInAnArray" has a dynamic return type

MethodReturnTypeRequired3313

[SRC]def shouldThrowAnExceptionWhenEndingDocumentInTheMiddleO..gAnArray() {

[MSG]Method "shouldThrowAnExceptionWhenEndingDocumentInTheMiddleOfWritingAnArray" has a dynamic return type

MethodReturnTypeRequired3325

[SRC]def shouldThrowAnExceptionWhenEndingAnArrayInASubDocument() {

[MSG]Method "shouldThrowAnExceptionWhenEndingAnArrayInASubDocument" has a dynamic return type

MethodReturnTypeRequired3338

[SRC]def shouldThrowAnExceptionWhenEndingAnArrayWhenValueIsExpected() {

[MSG]Method "shouldThrowAnExceptionWhenEndingAnArrayWhenValueIsExpected" has a dynamic return type

MethodReturnTypeRequired3350

[SRC]def shouldThrowAnExceptionWhenWritingANameInAnArrayEvenW..sInArray() {

[MSG]Method "shouldThrowAnExceptionWhenWritingANameInAnArrayEvenWhenSubDocumentExistsInArray" has a dynamic return type

MethodReturnTypeRequired3364

[SRC]def shouldThrowAnExceptionWhenAttemptingToEndAnArrayThat..tStarted() {

[MSG]Method "shouldThrowAnExceptionWhenAttemptingToEndAnArrayThatWasNotStarted" has a dynamic return type

MethodReturnTypeRequired3377

[SRC]def shouldThrowAnExceptionWhenWritingNullName() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullName" has a dynamic return type

BlockEndsWithBlankLine3386

[MSG]Code block ends with a blank line.

MethodReturnTypeRequired3389

[SRC]def shouldThrowAnExceptionWhenWritingNullValue() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullValue" has a dynamic return type

MethodReturnTypeRequired3413

[SRC]def shouldThrowAnExceptionWhenWritingNullMemberValue() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullMemberValue" has a dynamic return type

MethodReturnTypeRequired3436

[SRC]def shouldThrowAnExceptionWhenWritingNullMemberName() {

[MSG]Method "shouldThrowAnExceptionWhenWritingNullMemberName" has a dynamic return type

BlockEndsWithBlankLine3481

[MSG]Code block ends with a blank line.

MethodReturnTypeRequired3484

[SRC]def shouldStopAtMaxLength() {

[MSG]Method "shouldStopAtMaxLength" has a dynamic return type

VariableTypeRequired3486

[SRC]def fullJsonText = '{ "n" : null }'

[MSG]The type is not specified for variable "fullJsonText"

Package: org.bson.types

➥ Decimal128Specification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired332

[SRC]def 'should have correct constants'() {

[MSG]Method "should have correct constants" has a dynamic return type

MethodReturnTypeRequired341

[SRC]def 'should construct from high and low'() {

[MSG]Method "should construct from high and low" has a dynamic return type

VariableTypeRequired343

[SRC]def decimal = fromIEEE754BIDEncoding(0x3040000000000000L..0000000001L)

[MSG]The type is not specified for variable "decimal"

MethodReturnTypeRequired350

[SRC]def 'should construct from simple string'() {

[MSG]Method "should construct from simple string" has a dynamic return type

MethodReturnTypeRequired364

[SRC]def 'should round exactly'() {

[MSG]Method "should round exactly" has a dynamic return type

MethodReturnTypeRequired372

[SRC]def 'should clamp positive exponents'() {

[MSG]Method "should clamp positive exponents" has a dynamic return type

MethodReturnTypeRequired391

[SRC]def 'should clamp negative exponents'() {

[MSG]Method "should clamp negative exponents" has a dynamic return type

MethodReturnTypeRequired3106

[SRC]def 'should construct from long'() {

[MSG]Method "should construct from long" has a dynamic return type

MethodReturnTypeRequired3113

[SRC]def 'should construct from large BigDecimal'() {

[MSG]Method "should construct from large BigDecimal" has a dynamic return type

MethodReturnTypeRequired3122

[SRC]def 'should convert to simple BigDecimal'() {

[MSG]Method "should convert to simple BigDecimal" has a dynamic return type

MethodReturnTypeRequired3135

[SRC]def 'should convert to large BigDecimal'() {

[MSG]Method "should convert to large BigDecimal" has a dynamic return type

MethodReturnTypeRequired3153

[SRC]def 'should convert invalid representations of 0 as BigDecimal 0'() {

[MSG]Method "should convert invalid representations of 0 as BigDecimal 0" has a dynamic return type

MethodReturnTypeRequired3159

[SRC]def 'should detect infinity'() {

[MSG]Method "should detect infinity" has a dynamic return type

MethodReturnTypeRequired3173

[SRC]def 'should detect NaN'() {

[MSG]Method "should detect NaN" has a dynamic return type

MethodReturnTypeRequired3184

[SRC]def 'should convert NaN to string'() {

[MSG]Method "should convert NaN to string" has a dynamic return type

MethodReturnTypeRequired3189

[SRC]def 'should convert NaN from string'() {

[MSG]Method "should convert NaN from string" has a dynamic return type

MethodReturnTypeRequired3199

[SRC]def 'should not convert NaN to BigDecimal'() {

[MSG]Method "should not convert NaN to BigDecimal" has a dynamic return type

MethodReturnTypeRequired3207

[SRC]def 'should convert infinity to string'() {

[MSG]Method "should convert infinity to string" has a dynamic return type

MethodReturnTypeRequired3213

[SRC]def 'should convert infinity from string'() {

[MSG]Method "should convert infinity from string" has a dynamic return type

MethodReturnTypeRequired3235

[SRC]def 'should convert finite to string'() {

[MSG]Method "should convert finite to string" has a dynamic return type

MethodReturnTypeRequired3263

[SRC]def 'should convert invalid representations of 0 to string'() {

[MSG]Method "should convert invalid representations of 0 to string" has a dynamic return type

MethodReturnTypeRequired3270

[SRC]def 'test equals'() {

[MSG]Method "test equals" has a dynamic return type

VariableTypeRequired3272

[SRC]def d1 = fromIEEE754BIDEncoding(0x3040000000000000L, 0x0..0000000001L)

[MSG]The type is not specified for variable "d1"

VariableTypeRequired3273

[SRC]def d2 = fromIEEE754BIDEncoding(0x3040000000000000L, 0x0..0000000001L)

[MSG]The type is not specified for variable "d2"

VariableTypeRequired3274

[SRC]def d3 = fromIEEE754BIDEncoding(0x3040000000000001L, 0x0..0000000001L)

[MSG]The type is not specified for variable "d3"

VariableTypeRequired3275

[SRC]def d4 = fromIEEE754BIDEncoding(0x3040000000000000L, 0x0..0000000011L)

[MSG]The type is not specified for variable "d4"

MethodReturnTypeRequired3286

[SRC]def 'test hashCode'() {

[MSG]Method "test hashCode" has a dynamic return type

MethodReturnTypeRequired3291

[SRC]def 'should not convert infinity to BigDecimal'() {

[MSG]Method "should not convert infinity to BigDecimal" has a dynamic return type

MethodReturnTypeRequired3302

[SRC]def 'should not convert negative zero to BigDecimal'() {

[MSG]Method "should not convert negative zero to BigDecimal" has a dynamic return type

MethodReturnTypeRequired3313

[SRC]def 'should not round inexactly'() {

[MSG]Method "should not round inexactly" has a dynamic return type

MethodReturnTypeRequired3337

[SRC]def 'should not clamp large exponents if no extra precis..ailable'() {

[MSG]Method "should not clamp large exponents if no extra precision is available" has a dynamic return type

MethodReturnTypeRequired3355

[SRC]def 'should not clamp small exponents if no extra precis..scarded'() {

[MSG]Method "should not clamp small exponents if no extra precision can be discarded" has a dynamic return type

MethodReturnTypeRequired3373

[SRC]def 'should throw IllegalArgumentException if BigDecimal..o large'() {

[MSG]Method "should throw IllegalArgumentException if BigDecimal is too large" has a dynamic return type

➥ DocumentSpecification.groovy

Rule NamePriorityLine #Source Line / Message
MethodReturnTypeRequired329

[SRC]def 'should return correct type for each typed method'() {

[MSG]Method "should return correct type for each typed method" has a dynamic return type

MethodReturnTypeRequired368

[SRC]def 'should parse a valid JSON string to a Document'() {

[MSG]Method "should parse a valid JSON string to a Document" has a dynamic return type

MethodReturnTypeRequired388

[SRC]def 'test parse method with mode'() {

[MSG]Method "test parse method with mode" has a dynamic return type

MethodReturnTypeRequired3101

[SRC]def 'should throw an exception when parsing an invalid J.. String'() {

[MSG]Method "should throw an exception when parsing an invalid JSON String" has a dynamic return type

MethodReturnTypeRequired3109

[SRC]def 'should cast to correct type'() {

[MSG]Method "should cast to correct type" has a dynamic return type

MethodReturnTypeRequired3120

[SRC]def 'should throw ClassCastException when value is the wrong type'() {

[MSG]Method "should throw ClassCastException when value is the wrong type" has a dynamic return type

Rule Descriptions

#Rule NameDescription
1AbstractClassNameVerifies that the name of an abstract class matches a regular expression specified in the regex property. If that property is null or empty, then this rule is not applied (i.e., it does nothing). It defaults to null, so this rule must be explicitly configured to be active. This rule ignores interfaces.
2AbstractClassWithPublicConstructorChecks for abstract classes that define a public constructor, which is useless and confusing.
3AbstractClassWithoutAbstractMethodThe abstract class does not contain any abstract methods. An abstract class suggests an incomplete implementation, which is to be completed by subclasses implementing the abstract methods. If the class is intended to be used as a base class only (not to be instantiated direcly) a protected constructor can be provided prevent direct instantiation.
4AddEmptyStringFinds empty string literals which are being added. This is an inefficient way to convert any type to a String.
5AssertWithinFinallyBlockChecks for assert statements within a finally block. An assert can throw an exception, hiding the original exception, if there is one.
6AssignCollectionSortThe Collections.sort() method mutates the list and returns the list as a value. If you are assigning the result of sort() to a variable, then you probably don't realize that you're also modifying the original list as well. This is frequently the cause of subtle bugs.
7AssignCollectionUniqueThe Collections.unique() method mutates the list and returns the list as a value. If you are assigning the result of unique() to a variable, then you probably don't realize that you're also modifying the original list as well. This is frequently the cause of subtle bugs.
8AssignmentInConditionalAn assignment operator (=) was used in a conditional test. This is usually a typo, and the comparison operator (==) was intended.
9AssignmentToStaticFieldFromInstanceMethodChecks for assignment to a static field from an instance method.
10BigDecimalInstantiationChecks for calls to the BigDecimal constructors that take a double parameter, which may result in an unexpected BigDecimal value.
11BitwiseOperatorInConditionalChecks for bitwise operations in conditionals, if you need to do a bitwise operation then it is best practice to extract a temp variable.
12BlockEndsWithBlankLineChecks that code blocks such as method bodies, closures and control structure bodies do not end with an empty line.
13BlockStartsWithBlankLineChecks that code blocks such as method bodies, closures and control structure bodies do not start with an empty line.
14BooleanGetBooleanThis rule catches usages of java.lang.Boolean.getBoolean(String) which reads a boolean from the System properties. It is often mistakenly used to attempt to read user input or parse a String into a boolean. It is a poor piece of API to use; replace it with System.properties['prop'].
15BooleanMethodReturnsNullMethod with Boolean return type returns explicit null. A method that returns either Boolean.TRUE, Boolean.FALSE or null is an accident waiting to happen. This method can be invoked as though it returned a value of type boolean, and the compiler will insert automatic unboxing of the Boolean value. If a null value is returned, this will result in a NullPointerException.
16BracesForClassChecks the location of the opening brace ({) for classes. By default, requires them on the same line, but the sameLine property can be set to false to override this.
17BracesForForLoopChecks the location of the opening brace ({) for for loops. By default, requires them on the same line, but the sameLine property can be set to false to override this.
18BracesForIfElseChecks the location of the opening brace ({) for if statements. By default, requires them on the same line, but the sameLine property can be set to false to override this.
19BracesForMethodChecks the location of the opening brace ({) for constructors and methods. By default, requires them on the same line, but the sameLine property can be set to false to override this.
20BracesForTryCatchFinallyChecks the location of the opening brace ({) for try statements. By default, requires them on the line, but the sameLine property can be set to false to override this.
21BrokenNullCheckLooks for faulty checks for null that can cause a NullPointerException.
22BrokenOddnessCheckThe code uses x % 2 == 1 to check to see if a value is odd, but this won't work for negative numbers (e.g., (-5) % 2 == -1). If this code is intending to check for oddness, consider using x & 1 == 1, or x % 2 != 0.
23BuilderMethodWithSideEffectsA builder method is defined as one that creates objects. As such, they should never be of void return type. If a method is named build, create, or make, then it should always return a value.
24BusyWaitBusy waiting (forcing a Thread.sleep() while waiting on a condition) should be avoided. Prefer using the gate and barrier objects in the java.util.concurrent package.
25CatchArrayIndexOutOfBoundsExceptionCheck the size of the array before accessing an array element rather than catching ArrayIndexOutOfBoundsException.
26CatchErrorCatching Error is dangerous; it can catch exceptions such as ThreadDeath and OutOfMemoryError.
27CatchExceptionCatching Exception is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code.
28CatchIllegalMonitorStateExceptionDubious catching of IllegalMonitorStateException. IllegalMonitorStateException is generally only thrown in case of a design flaw in your code (calling wait or notify on an object you do not hold a lock on).
29CatchIndexOutOfBoundsExceptionCheck that an index is valid before accessing an indexed element rather than catching IndexOutOfBoundsException.
30CatchNullPointerExceptionCatching NullPointerException is never appropriate. It should be avoided in the first place with proper null checking, and it can mask underlying errors.
31CatchRuntimeExceptionCatching RuntimeException is often too broad or general. It should usually be restricted to framework or infrastructure code, rather than application code.
32CatchThrowableCatching Throwable is dangerous; it can catch exceptions such as ThreadDeath and OutOfMemoryError.
33ChainedTestA test method that invokes another test method is a chained test; the methods are dependent on one another. Tests should be isolated, and not be dependent on one another.
34ClassForNameUsing Class.forName(...) is a common way to add dynamic behavior to a system. However, using this method can cause resource leaks because the classes can be pinned in memory for long periods of time.
35ClassNameVerifies that the name of a class matches a regular expression. By default it checks that the class name starts with an uppercase letter and is followed by zero or more word characters (letters, numbers or underscores). The regex property specifies the regular expression used to validate the class name.
36ClassNameSameAsFilenameReports files containing only one top level class / enum / interface which is named differently than the file.
37ClassNameSameAsSuperclassChecks for any class that has an identical name to its superclass, other than the package. This can be very confusing.
38ClassSizeChecks if the size of a class exceeds the number of lines specified by the maxLines property (1000).
39CloneableWithoutCloneA class that implements java.lang.Cloneable should define a clone() method.
40CloseWithoutCloseableIf a class defines a "void close()" then that class should implement java.io.Closeable.
41ClosureAsLastMethodParameterIf a method is called and the last parameter is an inline closure then it can be declared outside of the method call brackets.
42ClosureStatementOnOpeningLineOfMultipleLineClosureChecks for closure logic on first line (after ->) for a multi-line closure.
43CollectAllIsDeprecatedcollectAll{} is deprecated since Groovy 1.8.1. Use collectNested instead{}.
44CompareToWithoutComparableIf you implement a compareTo method then you should also implement the Comparable interface. If you don't then you could possibly get an exception if the Groovy == operator is invoked on your object. This is an issue fixed in Groovy 1.8 but present in previous versions.
45ComparisonOfTwoConstantsChecks for expressions where a comparison operator or equals() or compareTo() is used to compare two constants to each other or two literals that contain only constant values., e.g.: 23 == 67, Boolean.FALSE != false, 0.17 <= 0.99, "abc" > "ddd", [a:1] <=> [a:2], [1,2].equals([3,4]) or [a:false, b:true].compareTo(['a':34.5, b:Boolean.TRUE].
46ConfusingClassNamedExceptionThis class is not derived from another exception, but ends with 'Exception'. This will be confusing to users of this class.
47ConfusingMethodNameChecks for confusing method names. The referenced methods have names that differ only by capitalization. This is very confusing because if the capitalization were identical then one of the methods would override the other.
48ConfusingMultipleReturnsMultiple return values can be used to set several variables at once. To use multiple return values, the left hand side of the assignment must be enclosed in parenthesis. If not, then you are not using multiple return values, you're only assigning the last element.
49ConfusingTernaryIn a ternary expression avoid negation in the test. For example, rephrase: "(x != y) ? diff : same" as: "(x == y) ? same : diff". Consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as "does the error case go first?" or "does the common case go first?".
50ConsecutiveLiteralAppendsViolations occur when method calls to append(Object) are chained together with literals as parameters. The chained calls can be joined into one invocation.
51ConsecutiveStringConcatenationCatches concatenation of two string literals on the same line. These can safely by joined.
52ConstantAssertExpressionChecks for assert statements where the assert boolean condition expression is a constant or literal value.
53ConstantIfExpressionChecks for if statements with a constant value for the if expression, such as true, false, null, or a literal constant value.
54ConstantTernaryExpressionChecks for ternary expressions with a constant value for the boolean expression, such as true, false, null, or a literal constant value.
55ConstantsOnlyInterfaceAn interface should be used only to model a behaviour of a class: using an interface as a container of constants is a poor usage pattern.
56CouldBeElvisCatch an if block that could be written as an elvis expression.
57CoupledTestCaseThis rule finds test cases that are coupled to other test cases, either by invoking static methods on another test case or by creating instances of another test case. If you require shared logic in test cases then extract that logic to a new class where it can properly be reused.
58CyclomaticComplexityChecks the cyclomatic complexity for methods/classes.A method (or "closure field") with a cyclomatic complexity value greater than the maxMethodComplexity property (20) causes a violation. Likewise, a class that has an (average method) cyclomatic complexityvalue greater than the maxClassAverageMethodComplexity property (20) causes a violation.
59DeadCodeDead code appears after a return statement or an exception is thrown. If code appears after one of these statements then it will never be executed and can be safely deleted.
60DoubleCheckedLockingThis rule detects double checked locking, where a 'lock hint' is tested for null before initializing an object within a synchronized block. Double checked locking does not guarantee correctness and is an anti-pattern.
61DoubleNegativeThere is no point in using a double negative, it is always positive. For instance !!x can always be simplified to x. And !(!x) can as well.
62DuplicateCaseStatementCheck for duplicate case statements in a switch block, such as two equal integers or strings.
63DuplicateImportDuplicate import statements are unnecessary.
64DuplicateListLiteralCode containing duplicate List literals can usually be improved by declaring the List as a constant field.
65DuplicateMapKeyA map literal is created with duplicated key. The map entry will be overwritten.
66DuplicateSetValueA Set literal is created with duplicate constant value. A set cannot contain two elements with the same value.
67ElseBlockBracesUse braces for else blocks, even for a single statement. By default, braces are not required for an else if it is followed immediately by an if. Set the bracesRequiredForElseIf property to true to require braces is that situation as well.
68EmptyCatchBlockIn most cases, exceptions should not be caught and ignored (swallowed).
69EmptyClassReports classes without methods, fields or properties. Why would you need a class like this?
70EmptyElseBlockEmpty else blocks are confusing and serve no purpose.
71EmptyFinallyBlockEmpty finally blocks are confusing and serve no purpose.
72EmptyForStatementEmpty for statements are confusing and serve no purpose.
73EmptyIfStatementEmpty if statements are confusing and serve no purpose.
74EmptyInstanceInitializerAn empty class instance initializer was found. It is safe to remove it.
75EmptyMethodA method was found without an implementation. If the method is overriding or implementing a parent method, then mark it with the @Override annotation.
76EmptyMethodInAbstractClassAn empty method in an abstract class should be abstract instead, as developer may rely on this empty implementation rather than code the appropriate one.
77EmptyStaticInitializerAn empty static initializer was found. It is safe to remove it.
78EmptySwitchStatementEmpty switch statements are confusing and serve no purpose.
79EmptySynchronizedStatementEmpty synchronized statements are confusing and serve no purpose.
80EmptyTryBlockEmpty try blocks are confusing and serve no purpose.
81EmptyWhileStatementEmpty while statements are confusing and serve no purpose.
82EnumCustomSerializationIgnoredChecks for enums that define writeObject() or writeReplace() methods, or declare serialPersistentFields or serialVersionUID fields, all of which are ignored for enums.
83EqualsAndHashCodeIf either the boolean equals(Object) or the int hashCode() methods are overridden within a class, then both must be overridden.
84EqualsOverloadedThe class has an equals method, but the parameter of the method is not of type Object. It is not overriding equals but instead overloading it.
85ExceptionExtendsErrorErrors are system exceptions. Do not extend them.
86ExceptionExtendsThrowableChecks for classes that extend java.lang.Throwable. Custom exception classes should subclass java.lang.Exception or one of its descendants.
87ExceptionNotThrownChecks for an exception constructor call without a throw as the last statement within a catch block.
88ExplicitArrayListInstantiationThis rule checks for the explicit instantiation of an ArrayList using the no-arg constructor. In Groovy, it is best to write new ArrayList() as [], which creates the same object.
89ExplicitCallToDivMethodThis rule detects when the div(Object) method is called directly in code instead of using the / operator. A groovier way to express this: a.div(b) is this: a / b
90ExplicitCallToGetAtMethodThis rule detects when the getAt(Object) method is called directly in code instead of using the [] index operator. A groovier way to express this: a.getAt(b) is this: a[b]
91ExplicitCallToLeftShiftMethodThis rule detects when the leftShift(Object) method is called directly in code instead of using the << operator. A groovier way to express this: a.leftShift(b) is this: a << b
92ExplicitCallToMinusMethodThis rule detects when the minus(Object) method is called directly in code instead of using the - operator. A groovier way to express this: a.minus(b) is this: a - b
93ExplicitCallToModMethodThis rule detects when the mod(Object) method is called directly in code instead of using the % operator. A groovier way to express this: a.mod(b) is this: a % b
94ExplicitCallToMultiplyMethodThis rule detects when the minus(Object) method is called directly in code instead of using the * operator. A groovier way to express this: a.multiply(b) is this: a * b
95ExplicitCallToOrMethodThis rule detects when the or(Object) method is called directly in code instead of using the | operator. A groovier way to express this: a.or(b) is this: a | b
96ExplicitCallToPlusMethodThis rule detects when the plus(Object) method is called directly in code instead of using the + operator. A groovier way to express this: a.plus(b) is this: a + b
97ExplicitCallToPowerMethodThis rule detects when the power(Object) method is called directly in code instead of using the ** operator. A groovier way to express this: a.power(b) is this: a ** b
98ExplicitCallToRightShiftMethodThis rule detects when the rightShift(Object) method is called directly in code instead of using the >> operator. A groovier way to express this: a.rightShift(b) is this: a >> b
99ExplicitCallToXorMethodThis rule detects when the xor(Object) method is called directly in code instead of using the ^ operator. A groovier way to express this: a.xor(b) is this: a ^ b
100ExplicitGarbageCollectionCalls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised. Code should have the same behavior whether the garbage collection is disabled using the option -Xdisableexplicitgc or not. Moreover, "modern" jvms do a very good job handling garbage collections. If memory usage issues unrelated to memory leaks develop within an application, it should be dealt with JVM options rather than within the code itself.
101ExplicitHashMapInstantiationThis rule checks for the explicit instantiation of a HashMap using the no-arg constructor. In Groovy, it is best to write new HashMap() as [:], which creates the same object.
102ExplicitHashSetInstantiationThis rule checks for the explicit instantiation of a HashSet using the no-arg constructor. In Groovy, it is best to write new HashSet() as [] as Set, which creates the same object.
103ExplicitLinkedHashMapInstantiationThis rule checks for the explicit instantiation of a LinkedHashMap using the no-arg constructor. In Groovy, it is best to write new LinkedHashMap() as [:], which creates the same object.
104ExplicitLinkedListInstantiationThis rule checks for the explicit instantiation of a LinkedList using the no-arg constructor. In Groovy, it is best to write new LinkedList() as [] as Queue, which creates the same object.
105ExplicitStackInstantiationThis rule checks for the explicit instantiation of a Stack using the no-arg constructor. In Groovy, it is best to write new Stack() as [] as Stack, which creates the same object.
106ExplicitTreeSetInstantiationThis rule checks for the explicit instantiation of a TreeSet using the no-arg constructor. In Groovy, it is best to write new TreeSet() as [] as SortedSet, which creates the same object.
107FieldNameVerifies that the name of each field matches a regular expression. By default it checks that non-'final' field names start with a lowercase letter and contains only letters or numbers, and 'final' field names start with an uppercase letter and contain only uppercase letters, numbers and underscores. The regex property specifies the default regular expression used to validate field names. The finalRegex property specifies the regular expression to validate 'final' field names. The staticRegex property specifies the regular expression to validate 'static' field names. The staticFinalRegex property specifies the regular expression to validate 'static final' field names. The ignoreFieldNames property (serialVersionUID)can specify field names that should be ignored, optionally containing wildcard characters ('*' or '?').
108FieldTypeRequiredChecks that field types are explicitly specified (and not using def).
109FileCreateTempFileThe File.createTempFile() method is insecure, and has been deprecated by the ESAPI secure coding library. It has been replaced by the ESAPI Randomizer.getRandomFilename(String) method.
110FinalClassWithProtectedMemberThis rule finds classes marked final that contain protected methods. If a class is final then it may not be subclassed, and there is therefore no point in having a method with protected visibility. Either the class should not be final or the method should be private or protected.
111ForLoopShouldBeWhileLoopA for loop without an init and update statement can be simplified to a while loop.
112ForStatementBracesUse braces for for statements, even for a single statement.
113GStringAsMapKeyA GString should not be used as a map key since its hashcode is not guaranteed to be stable. Consider calling key.toString().
114GStringExpressionWithinStringCheck for regular (single quote) strings containing a GString-type expression (${...}).
115GroovyLangImmutableThe groovy.lang.Immutable annotation has been deprecated and replaced by groovy.transform.Immutable. Do not use the Immutable in groovy.lang.
116HardCodedWindowsFileSeparatorThis rule finds usages of a Windows file separator within the constructor call of a File object. It is better to use the Unix file separator or use the File.separator constant.
117HardCodedWindowsRootDirectoryThis rule find cases where a File object is constructed with a windows-based path. This is not portable, and using the File.listRoots() method is a better alternative.
118HashtableIsObsoleteThe java.util.Hashtable class is effectively obsolete. Use the Java Collections Framework classes instead, including HashMap or ConcurrentHashMap. See the JDK javadoc.
119IfStatementBracesUse braces for if statements, even for a single statement.
120IfStatementCouldBeTernaryChecks for if statements where both the if and else blocks contain only a single return statement with a constant or literal value
121IllegalClassMemberChecks for classes containing fields/properties/methods matching configured illegal member modifiers or not matching any of the configured allowed member modifiers.
122IllegalClassReferenceChecks for reference to any of the classes configured in classNames.
123IllegalPackageReferenceChecks for reference to any of the packages configured in packageNames.
124IllegalRegexChecks for a specified illegal regular expression within the source code. The regex property specifies the regular expression to check for. It is required and cannot be null or empty.
125IllegalStringChecks for a specified illegal string within the source code.
126IllegalSubclassChecks for classes that extend one of the specified set of illegal superclasses configured in superclassNames.
127ImplementationAsTypeChecks for use of a predefined set of concrete classes (e.g. ArrayList, Hashtable, ConcurrentHashMap) when specifying the type of a method parameter, closure parameter, constructor parameter, method return type or field type. The associated interfaces should be used to specify the type instead.
128ImportFromSamePackageAn import of a class that is within the same package is unnecessary.
129ImportFromSunPackagesAvoid importing anything from the 'sun.*' packages. These packages are not portable and are likely to change.
130InconsistentPropertyLockingClass contains similarly-named get and set methods where one method of the pair is marked either @WithReadLock or @WithWriteLock and the other is not locked at all.
131InconsistentPropertySynchronizationClass contains similarly-named get and set methods where the set method is synchronized and the get method is not, or the get method is synchronized and the set method is not.
132IndentationCheck indentation for class and method declarations, and initial statements.
133InsecureRandomReports usages of java.util.Random, which can produce very predictable results. If two instances of Random are created with the same seed and sequence of method calls, they will generate the exact same results. Use java.security.SecureRandom instead, which provides a cryptographically strong random number generator. SecureRandom uses PRNG, which means they are using a deterministic algorithm to produce a pseudo-random number from a true random seed. SecureRandom produces non-deterministic output.
134InstanceofChecks for use of the instanceof operator. Use the ignoreTypeNames property to configure ignored type names.
135IntegerGetIntegerThis rule catches usages of java.lang.Integer.getInteger(String, ...) which reads an Integer from the System properties. It is often mistakenly used to attempt to read user input or parse a String into an Integer. It is a poor piece of API to use; replace it with System.properties['prop'].
136InterfaceNameVerifies that the name of an interface matches a regular expression specified in the regex property. If that property is null or empty, then this rule is not applied (i.e., it does nothing). It defaults to null, so this rule must be explicitly configured to be active.
137InterfaceNameSameAsSuperInterfaceChecks for any interface that has an identical name to its super-interface, other than the package. This can be very confusing.
138InvertedConditionAn inverted condition is one where a constant expression is used on the left hand side of the equals comparision. Such conditions can be confusing especially when used in assertions where the expected value is by convention placed on the right hand side of the comparision.
139InvertedIfElseAn inverted if-else statement is one in which there is a single if statement with a single else branch and the boolean test of the if is negated. For instance if (!x) false else true. It is usually clearer to write this as if (x) true else false.
140JUnitAssertAlwaysFailsChecks for JUnit assert() method calls with constant arguments such that the assertion always fails. This includes: assertTrue(false), assertFalse(true) and assertNull(CONSTANT).
141JUnitAssertAlwaysSucceedsChecks for JUnit assert() method calls with constant arguments such that the assertion always succeeds. This includes: assertTrue(true), assertFalse(false) and assertNull(null).
142JUnitFailWithoutMessageThis rule detects JUnit calling the fail() method without an argument. For better error reporting you should always provide a message.
143JUnitLostTestChecks for classes that import JUnit 4 classes and contain a public, instance, void, no-arg method named test* that is not annotated with @Test.
144JUnitPublicFieldChecks for public field on a JUnit test class
145JUnitPublicNonTestMethodChecks if a JUnit test class contains public methods other than standard test methods, JUnit framework methods or methods with JUnit annotations.
146JUnitPublicPropertyChecks for public properties defined on JUnit test classes. There should be no need to expose a public property on a test class.
147JUnitSetUpCallsSuperChecks that if the JUnit setUp() method is defined, that it includes a call to super.setUp().
148JUnitStyleAssertionsThis rule detects calling JUnit style assertions like assertEquals, assertTrue, assertFalse, assertNull, assertNotNull. Groovy 1.7 ships with a feature called the "power assert", which is an assert statement with better error reporting. This is preferable to the JUnit assertions.
149JUnitTearDownCallsSuperChecks that if the JUnit tearDown() method is defined, that it includes a call to super.tearDown().
150JUnitTestMethodWithoutAssertThis rule searches for test methods that do not contain assert statements. Either the test method is missing assert statements, which is an error, or the test method contains custom assert statements that do not follow a proper assert naming convention. Test methods are defined as public void methods that begin with the work test or have a @Test annotation. By default this rule applies to the default test class names, but this can be changed using the rule's applyToClassNames property.
151JUnitUnnecessarySetUpChecks for JUnit setUp() methods that contain only a call to super.setUp().
152JUnitUnnecessaryTearDownChecks for JUnit tearDown() methods that contain only a call to super.tearDown().
153JUnitUnnecessaryThrowsExceptionCheck for throws clauses on JUnit test methods. That is not necessary in Groovy.
154JavaIoPackageAccessThis rule reports violations of the Enterprise JavaBeans specification by using the java.io package to access files or the file system.
155LineLengthChecks the maximum length for each line of source code. It checks for number of characters, so lines that include tabs may appear longer than the allowed number when viewing the file. The maximum line length can be configured by setting the length property, which defaults to 120.
156LocaleSetDefaultChecks for calls to Locale.setDefault(), which sets the Locale across the entire JVM.
157LoggerForDifferentClassChecks for instantiating a logger (Log4J, SLF4J, Logback, Apache Commons Logging or Java Util Logging) for a class other than the current class.
158LoggerWithWrongModifiersLogger objects should be declared private, static and final. If subclasses should have access to a Logger in a parent class then the Logger should be declared protected, non-static and final. This rule find loggers that are not declared with these modifiers.
159LoggingSwallowsStacktraceIf you are logging an exception then the proper API is to call error(Object, Throwable), which will log the message and the exception stack trace. If you call error(Object) then the stacktrace may not be logged.
160LongLiteralWithLowerCaseLIn Java and Groovy, you can specify long literals with the L or l character, for instance 55L or 24l. It is best practice to always use an uppercase L and never a lowercase l. This is because 11l rendered in some fonts may look like 111 instead of 11L.
161MethodCountA class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.The maxMethods property (30) specifies the threshold.
162MethodParameterTypeRequiredChecks that method parameters are not dynamically typed, that is they are explicitly stated and different than def.
163MethodReturnTypeRequiredChecks that method return types are not dynamic, that is they are explicitly stated and different than def.
164MisorderedStaticImportsStatic imports should never be declared after nonstatic imports.
165MissingBlankLineAfterImportsMakes sure there is a blank line after the imports of a source code file.
166MissingBlankLineAfterPackageMakes sure there is a blank line after the package statement of a source code file.
167MissingNewInThrowStatementA common Groovy mistake when throwing exceptions is to forget the new keyword. For instance, "throw RuntimeException()" instead of "throw new RuntimeException()". If the error path is not unit tested then the production system will throw a Method Missing exception and hide the root cause. This rule finds constructs like "throw RuntimeException()" that look like a new keyword was meant to be used but forgotten.
168MultipleLoggersThis rule catches classes that have more than one logger object defined. Typically, a class has zero or one logger objects.
169MultipleUnaryOperatorsChecks for multiple consecutive unary operators. These are confusing, and are likely typos and bugs.
170NestedBlockDepthChecks for blocks or closures nested more than maxNestedBlockDepth (5) levels deep.
171NestedForLoopReports classes with nested for loops.
172NestedSynchronizationNested synchronized statements should be avoided. Nested synchronized statements are either useless (if the lock objects are identical) or prone to deadlock.
173NoTabCharacterChecks that all source files do not contain the tab character
174NoWildcardImportsWildcard imports, static or otherwise, should not be used.
175NonFinalPublicFieldFinds code that violates secure coding principles for mobile code by declaring a member variable public but not final.
176NonFinalSubclassOfSensitiveInterfaceThe permissions classes such as java.security.Permission and java.security.BasicPermission are designed to be extended. Classes that derive from these permissions classes, however, must prohibit extension. This prohibition ensures that malicious subclasses cannot change the properties of the derived class. Classes that implement sensitive interfaces such as java.security.PrivilegedAction and java.security.PrivilegedActionException must also be declared final for analogous reasons.
177ObjectFinalizeThe finalize() method should only be called by the JVM after the object has been garbage collected.
178ObjectOverrideMisspelledMethodNameVerifies that the names of the most commonly overridden methods of Object: equals, hashCode and toString, are correct.
179PackageNameVerifies that the package name for a class matches a regular expression. By default it checks that the package name consists of only lowercase letters, separated by periods. The regex property specifies the regular expression used to validate the package name. The packageNameRequired property indicates whether a package name declaration is required for all classes.
180PackageNameMatchesFilePathA package source file's path should match the package itself. To find the package-relevant subpath in the file path the groupId needs to be configured. It is expected in every package declaration.
181ParameterCountChecks if the number of parameters in method/constructor exceeds the number of parameters specified by the maxParameters property.
182ParameterNameVerifies that the name of each parameter matches a regular expression. This rule applies to method parameters, constructor parameters and closure parameters. By default it checks that parameter names start with a lowercase letter and contains only letters or numbers. The regex property specifies the default regular expression used to validate the parameter name. The ignoreParameterNames property (null) can specify parameter names that should be ignored, optionally containing wildcard characters ('*' or '?').
183ParameterReassignmentChecks for a method or closure parameter being reassigned to a new value within the body of the method/closure, which is a confusing and questionable practice. Use a temporary variable instead.
184PrintStackTraceChecks for calls to printStackTrace().
185PrintlnChecks for calls to this.print(), this.println() or this.printf().
186PrivateFieldCouldBeFinalChecks for private fields that are only set within a constructor or field initializer. Such fields can safely be made final.
187PropertyNameVerifies that the name of each property matches a regular expression. By default it checks that property names other than 'static final' start with a lowercase letter and contains only letters or numbers, and 'static final' property names start with an uppercase letter and contain only uppercase letters, numbers and underscores. The regex property specifies the default regular expression used to validate property names. The finalRegex property specifies the regular expression to validate 'final' property names. The staticRegex property specifies the regular expression to validate 'static' property names. The staticFinalRegex property specifies the regular expression to validate 'static final' property names. The ignorePropertyNames property (null) can specify property names that should be ignored, optionally containing wildcard characters ('*' or '?').
188PublicFinalizeMethodCreates a violation when the program violates secure coding principles by declaring a finalize() method public.
189PublicInstanceFieldUsing public fields is considered to be a bad design. Use properties instead.
190RandomDoubleCoercedToZeroThe Math.random() method returns a double result greater than or equal to 0.0 and less than 1.0. If you coerce this result into an Integer or int, then it is coerced to zero. Casting the result to int, or assigning it to an int field is probably a bug.
191RemoveAllOnSelfDon't use removeAll to clear a collection. If you want to remove all elements from a collection c, use c.clear, not c.removeAll(c). Calling c.removeAll(c) to clear a collection is less clear, susceptible to errors from typos, less efficient and for some collections, might throw a ConcurrentModificationException.
192RequiredRegexChecks for a specified regular expression that must exist within the source code. The regex property specifies the regular expression to check for. It is required and cannot be null or empty.
193RequiredStringChecks for a specified text string that must exist within the source code. The string property specifies the String to check for. It is required and cannot be null or empty.
194ReturnFromFinallyBlockReturning from a finally block is confusing and can hide the original exception.
195ReturnNullFromCatchBlockReturning null from a catch block often masks errors and requires the client to handle error codes. In some coding styles this is discouraged.
196ReturnsNullInsteadOfEmptyArrayConsider returning a zero length array rather than null. It is often a better design to return a length zero array rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method.
197ReturnsNullInsteadOfEmptyCollectionConsider returning a zero length collection rather than null. It is often a better design to return a length zero collection rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method.
198SerialPersistentFieldsTo use a Serializable object's serialPersistentFields correctly, it must be declared private, static, and final.
199SerialVersionUIDA serialVersionUID is normally intended to be used with Serialization. It needs to be of type long, static, and final. Also, it should have a visibility modifier such as public or private. Providing no modifier creates a Property and Groovy generates a getter, which is probably not intended.
200SerializableClassMustDefineSerialVersionUIDClasses that implement Serializable should define a serialVersionUID. If you don't define serialVersionUID, the system will make one by hashing most of your class's features. Then if you change anything, the UID will change and Java won't let you reload old data.
201SimpleDateFormatMissingLocaleBe sure to specify a Locale when creating a new instance of SimpleDateFormat; the class is locale-sensitive. If you instantiate SimpleDateFormat without a Locale parameter, it will format the date and time according to the default Locale. Both the pattern and the Locale determine the format. For the same pattern, SimpleDateFormat may format a date and time differently if the Locale varies.
202SpaceAfterCatchCheck that there is exactly one space (blank) after the catch keyword and before the opening parenthesis.
203SpaceAfterCommaChecks that there is at least one space or whitespace following each comma. That includes checks for method and closure declaration parameter lists, method call parameter lists, Map literals and List literals.
204SpaceAfterForCheck that there is exactly one space (blank) after the for keyword and before the opening parenthesis.
205SpaceAfterIfCheck that there is exactly one space (blank) after the if keyword and before the opening parenthesis.
206SpaceAfterOpeningBraceCheck that there is at least one space (blank) or whitespace after each opening brace ("{") for method/class/interface declarations, closure expressions and block statements.
207SpaceAfterSemicolonChecks that there is at least one space or whitespace following each semicolon separating multiple statements on a single line or the clauses within a classic for loop.
208SpaceAfterSwitchCheck that there is exactly one space (blank) after the switch keyword and before the opening parenthesis.
209SpaceAfterWhileCheck that there is exactly one space (blank) after the while keyword and before the opening parenthesis.
210SpaceAroundClosureArrowChecks that there is whitespace around the closure arrow (->) symbol
211SpaceAroundOperatorCheck that there is at least one space (blank) or whitespace around each binary operator.
212SpaceBeforeClosingBraceCheck that there is at least one space (blank) or whitespace before each closing brace ("}") for method/class/interface declarations, closure expressions and block statements.
213SpockIgnoreRestUsedIf Spock's @IgnoreRest appears on any method, all non-annotated test methods are not executed. This behaviour is almost always unintended. It's fine to use @IgnoreRest locally during development, but when committing code, it should be removed.
214StatelessClassChecks for fields on classes that should remain "stateless" and reentrant. The ignoreFieldNames property (null) specifies one or more field names that should be ignored. The ignoreFieldTypes property specifies one or more field type names that should be ignored. Both can optionally contain wildcard characters ('*' or '?').
215StatelessSingletonThere is no point in creating a stateless Singleton because there is nothing within the class that needs guarding and no side effects to calling the constructor. Just create new instances of the object or write a Utility class with static methods.
216StaticCalendarFieldCalendar objects should not be used as static fields. Calendars are inherently unsafe for multihtreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
217StaticConnectionCreates violations when a java.sql.Connection object is used as a static field. Database connections stored in static fields will be shared between threads, which is unsafe and can lead to race conditions.
218StaticDateFormatFieldDateFormat objects should not be used as static fields. DateFormat are inherently unsafe for multithreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
219StaticMatcherFieldMatcher objects should not be used as static fields. Matcher instances are inherently unsafe for multithreaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
220StaticSimpleDateFormatFieldSimpleDateFormat objects should not be used as static fields. SimpleDateFormat are inherently unsafe for multi-threaded use. Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the application.
221SwallowThreadDeathChecks for code that catches ThreadDeath without re-throwing it.
222SynchronizedMethodThis rule reports uses of the synchronized keyword on methods. Synchronized methods are the same as synchronizing on 'this', which effectively make your synchronization policy public and modifiable by other objects. To avoid possibilities of deadlock, it is better to synchronize on internal objects.
223SynchronizedOnBoxedPrimitiveThe code synchronizes on a boxed primitive constant, such as an Integer. Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
224SynchronizedOnGetClassSynchronization on getClass rather than class literal. This instance method synchronizes on this.getClass(). If this class is subclassed, subclasses will synchronize on the class object for the subclass, which isn't likely what was intended.
225SynchronizedOnReentrantLockSynchronizing on a ReentrantLock field is almost never the intended usage. A ReentrantLock should be obtained using the lock() method and released in a finally block using the unlock() method.
226SynchronizedOnStringSynchronization on a String field can lead to deadlock because Strings are interned by the JVM and can be shared.
227SynchronizedOnThisThis rule reports uses of the synchronized blocks where the synchronization reference is 'this'. Doing this effectively makes your synchronization policy public and modifiable by other objects. To avoid possibilities of deadlock, it is better to synchronize on internal objects.
228SynchronizedReadObjectMethodCatches Serializable classes that define a synchronized readObject method. By definition, an object created by deserialization is only reachable by one thread, and thus there is no need for readObject() to be synchronized. If the readObject() method itself is causing the object to become visible to another thread, that is an example of very dubious coding style.
229SystemErrPrintChecks for calls to System.err.print(), System.err.println() or System.err.printf().
230SystemExitWeb applications should never call System.exit(). A call to System.exit() is probably part of leftover debug code or code imported from a non-J2EE application.
231SystemOutPrintChecks for calls to System.out.print(), System.out.println() or System.out.printf().
232SystemRunFinalizersOnExitMethod calls to System.runFinalizersOnExit() should not be allowed. This method is inherently non-thread-safe, may result in data corruption, deadlock, and may effect parts of the program far removed from it's call point. It is deprecated, and it's use strongly discouraged.
233TernaryCouldBeElvisChecks for ternary expressions where the boolean and true expressions are the same. These can be simplified to an Elvis expression.
234ThisReferenceEscapesConstructorReports constructors passing the 'this' reference to other methods. This equals exposing a half-baked objects and can lead to race conditions during initialization. For reference, see Java Concurrency Gotchas by Alex Miller and Java theory and practice: Safe construction techniques by Brian Goetz.
235ThreadGroupAvoid using ThreadGroup; although it is intended to be used in a threaded environment it contains methods that are not thread safe.
236ThreadLocalNotStaticFinalThreadLocal fields should be static and final. In the most common case a java.lang.ThreadLocal instance associates state with a thread. A non-static non-final java.lang.ThreadLocal field associates state with an instance-thread combination. This is seldom necessary and often a bug which can cause memory leaks and possibly incorrect behavior.
237ThreadYieldMethod calls to Thread.yield() should not be allowed. This method has no useful guaranteed semantics, and is often used by inexperienced programmers to mask race conditions.
238ThrowErrorChecks for throwing an instance of java.lang.Error.
239ThrowExceptionChecks for throwing an instance of java.lang.Exception.
240ThrowExceptionFromFinallyBlockThrowing an exception from a finally block is confusing and can hide the original exception.
241ThrowNullPointerExceptionChecks for throwing an instance of java.lang.NullPointerException.
242ThrowRuntimeExceptionChecks for throwing an instance of java.lang.RuntimeException.
243ThrowThrowableChecks for throwing an instance of java.lang.Throwable.
244ToStringReturnsNullChecks for toString() methods that return null.
245TrailingWhitespaceChecks that no lines of source code end with whitespace characters.
246UnnecessaryBigIntegerInstantiationIt is unnecessary to instantiate BigInteger objects. Instead just use the literal with the 'G' identifier to force the type, such as 8G or 42G.
247UnnecessaryBooleanExpressionChecks for unnecessary boolean expressions, including ANDing (&&) or ORing (||) with true, false, null, or a Map/List/String/Number literal. Also checks for negation (!) of true, false, null, or a Map/List/String/Number literal.
248UnnecessaryBooleanInstantiationUse Boolean.valueOf() for variable values or Boolean.TRUE and Boolean.FALSE for constant values instead of calling the Boolean() constructor directly or calling Boolean.valueOf(true) or Boolean.valueOf(false).
249UnnecessaryCallForLastElementThis rule checks for excessively verbose methods of accessing the last element of an array or list. For instance, it is possible to access the last element of an array by performing array[array.length - 1], in Groovy it is simpler to either call array.last() or array[-1]. The same is true for lists. This violation is triggered whenever a get, getAt, or array-style access is used with an object size check.
250UnnecessaryCallToSubstringCalling String.substring(0) always returns the original string. This code is meaningless.
251UnnecessaryCastChecks for unnecessary cast operations
252UnnecessaryCatchBlockViolations are triggered when a catch block does nothing but throw the original exception. In this scenario there is usually no need for a catch block, just let the exception be thrown from the original code. This condition frequently occurs when catching an exception for debugging purposes but then forgetting to take the catch statement out.
253UnnecessaryCollectCallSome method calls to Object.collect(Closure) can be replaced with the spread operator. For instance, list.collect { it.multiply(2) } can be replaced by list*.multiply(2). Warning: if a collection is null, collect will return an empty list, while *. will return null.
254UnnecessaryCollectionCallUseless call to collections. This call doesn't make sense. For any collection c, calling c.containsAll(c) should always be true, and c.retainAll(c) should have no effect.
255UnnecessaryConstructorThis rule detects when a constructor is not necessary; i.e., when there's only one constructor, it's public, has an empty body, and takes no arguments.
256UnnecessaryDefInFieldDeclarationIf a field has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance, 'static def constraints = {}' is redundant and can be simplified to 'static constraints = {}.
257UnnecessaryDefInMethodDeclarationIf a method has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance 'def private method() {}' is redundant and can be simplified to 'private method() {}'.
258UnnecessaryDefInVariableDeclarationIf a variable has a visibility modifier or a type declaration, then the def keyword is unneeded. For instance 'def private n = 2' is redundant and can be simplified to 'private n = 2'.
259UnnecessaryDotClassTo make a reference to a class, it is unnecessary to specify the '.class' identifier. For instance String.class can be shortened to String.
260UnnecessaryDoubleInstantiationIt is unnecessary to instantiate Double objects. Instead just use the double literal or the 'D' identifier to force the type, such as 123.45d or 0.42d.
261UnnecessaryElseStatementWhen an if statement block ends with a return statement the else is unnecessary. The logic in the else branch can be run without being in a new scope.
262UnnecessaryFailIn a unit test, catching an exception and immediately calling Assert.fail() is pointless and hides the stack trace. It is better to rethrow the exception or not catch the exception at all.
263UnnecessaryFinalOnPrivateMethodA private method is marked final. Private methods cannot be overridden, so marking it final is unnecessary.
264UnnecessaryFloatInstantiationIt is unnecessary to instantiate Float objects. Instead just use the float literal with the 'F' identifier to force the type, such as 123.45F or 0.42f.
265UnnecessaryGStringString objects should be created with single quotes, and GString objects created with double quotes. Creating normal String objects with double quotes is confusing to readers.
266UnnecessaryGroovyImportA Groovy file does not need to include an import for classes from java.lang, java.util, java.io, java.net, groovy.lang and groovy.util, as well as the classes java.math.BigDecimal and java.math.BigInteger.
267UnnecessaryIfStatementChecks for if statements where the if and else blocks (or subsequent fall-through to a return) are merely returning true and false constants. These cases can be replaced by a simple return statement.
268UnnecessaryInstanceOfCheckThis rule finds instanceof checks that cannot possibly evaluate to true. For instance, checking that (!variable instanceof String) will never be true because the result of a not expression is always a boolean.
269UnnecessaryInstantiationToGetClassAvoid instantiating an object just to call getClass() on it; use the .class public member instead.
270UnnecessaryIntegerInstantiationIt is unnecessary to instantiate Integer objects. Instead just use the literal with the 'I' identifier to force the type, such as 8I or 42i.
271UnnecessaryLongInstantiationIt is unnecessary to instantiate Long objects. Instead just use the literal with the 'L' identifier to force the type, such as 8L or 42L.
272UnnecessaryModOneAny expression mod 1 (exp % 1) is guaranteed to always return zero. This code is probably an error, and should be either (exp & 1) or (exp % 2).
273UnnecessaryNullCheckGroovy contains the safe dereference operator, which can be used in boolean conditional statements to safely replace explicit "x == null" tests.
274UnnecessaryNullCheckBeforeInstanceOfThere is no need to check for null before an instanceof; the instanceof keyword returns false when given a null argument.
275UnnecessaryOverridingMethodThe overriding method merely calls the same method defined in a superclass
276UnnecessaryPackageReferenceChecks for explicit package reference for classes that Groovy imports by default, such as java.lang.String, java.util.Map and groovy.lang.Closure.
277UnnecessaryParenthesesForMethodCallWithClosureIf a method is called and the only parameter to that method is an inline closure then the parentheses of the method call can be omitted.
278UnnecessaryPublicModifierThe 'public' modifier is not required on methods or classes.
279UnnecessaryReturnKeywordIn Groovy, the return keyword is often optional. If a statement is the last line in a method or closure then you do not need to have the return keyword.
280UnnecessarySafeNavigationOperatorCheck for the safe navigation operator (?.) applied to constants and literals, which can never be null.
281UnnecessarySelfAssignmentMethod contains a pointless self-assignment to a variable or property.
282UnnecessaryStringInstantiationUse a String literal (e.g., "...") instead of calling the corresponding String constructor (new String("..")) directly.
283UnnecessarySubstringThis rule finds usages of String.substring(int) and String.substring(int, int) that can be replaced by use of the subscript operator. For instance, var.substring(5) can be replaced with var[5..-1].
284UnnecessaryTernaryExpressionChecks for ternary expressions where the conditional expression always evaluates to a boolean and the true and false expressions are merely returning true and false constants. Also checks for ternary expressions where both expressions are the same constant or variable.
285UnnecessaryToStringChecks for unnecessary calls to toString().
286UnnecessaryTransientModifierThe field is marked as transient, but the class isn't Serializable, so marking it as transient has no effect.
287UnsafeArrayDeclarationTriggers a violation when an array is declared public, final, and static. Secure coding principles state that, in most cases, an array declared public, final and static is a bug because arrays are mutable objects.
288UnusedArrayChecks for array allocations that are not assigned or used, unless it is the last statement within a block.
289UnusedImportImports for a class that is never referenced within the source file is unnecessary.
290UnusedMethodParameterThis rule finds instances of method parameters not being used. It does not analyze private methods (that is done by the UnusedPrivateMethodParameter rule) or methods marked @Override.
291UnusedObjectChecks for object allocations that are not assigned or used, unless it is the last statement within a block
292UnusedPrivateFieldChecks for private fields that are not referenced within the same class.
293UnusedPrivateMethodChecks for private methods that are not referenced within the same class.
294UnusedPrivateMethodParameterChecks for parameters to private methods that are not referenced within the method body.
295UnusedVariableChecks for variables that are never referenced. The ignoreVariableNames property (null) specifies one or more variable names that should be ignored, optionally containing wildcard characters ('*' or '?').
296UseAssertEqualsInsteadOfAssertTrueThis rule detects JUnit assertions in object equality. These assertions should be made by more specific methods, like assertEquals.
297UseAssertFalseInsteadOfNegationIn unit tests, if a condition is expected to be false then there is no sense using assertTrue with the negation operator. For instance, assertTrue(!condition) can always be simplified to assertFalse(condition)
298UseAssertNullInsteadOfAssertEqualsThis rule detects JUnit calling assertEquals where the first or second parameter is null. These assertion should be made against the assertNull method instead.
299UseAssertSameInsteadOfAssertTrueThis rule detects JUnit calling assertTrue where the first or second parameter is an Object#is() call testing for reference equality. These assertion should be made against the assertSame method instead.
300UseAssertTrueInsteadOfAssertEqualsThis rule detects JUnit calling assertEquals where the first parameter is a boolean. These assertions should be made by more specific methods, like assertTrue or assertFalse.
301UseAssertTrueInsteadOfNegationIn unit tests, if a condition is expected to be true then there is no sense using assertFalse with the negation operator. For instance, assertFalse(!condition) can always be simplified to assertTrue(condition)
302UseCollectManyIn many case collectMany() yields the same result as collect{}.flatten(). It is easier to understand and more clearly conveys the intent.
303UseCollectNestedInstead of nested collect{}-calls use collectNested{}
304UseOfNotifyMethodThis code calls notify() rather than notifyAll(). Java monitors are often used for multiple conditions. Calling notify() only wakes up one thread, meaning that the thread woken up might not be the one waiting for the condition that the caller just satisfied.
305VariableNameVerifies that the name of each method matches a regular expression. By default it checks that non-'final' variable names start with a lowercase letter and contains only letters or numbers, and 'final' variable names start with an uppercase letter and contain only uppercase letters, numbers and underscores. The regex property specifies the default regular expression used to validate a non-'final' variable name. The finalRegex property specifies the regular expression used to validate 'final' variable names. The ignoreVariableNames property (null) can specify variable names that should be ignored, optionally containing wildcard characters ('*' or '?').
306VariableTypeRequiredChecks that variable types are explicitly specified in declarations (and not using def)
307VectorIsObsoleteThe java.util.Vector class is effectively obsolete. Use the Java Collections Framework classes instead, including ArrayList or Collections.synchronizedList(). See the JDK javadoc.
308VolatileArrayFieldVolatile array fields are unsafe because the contents of the array are not treated as volatile. Changing the entire array reference is visible to other threads, but changing an array element is not.
309VolatileLongOrDoubleFieldLong or double fields should not be declared as volatile. Java specifies that reads and writes from such fields are atomic, but many JVM's have violated this specification. Unless you are certain of your JVM, it is better to synchronize access to such fields rather than declare them volatile. This rule flags fields marked volatile when their type is double or long or the name of their type is "Double" or "Long".
310WaitOutsideOfWhileLoopCalls to Object.wait() must be within a while loop. Consider using the Java concurrency utilities instead of wait() and notify().
311WhileStatementBracesUse braces for while statements, even for a single statement.