Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 544 Bytes

AddEmptyString.md

File metadata and controls

23 lines (15 loc) · 544 Bytes

Pattern: Concatenation of empty string

Issue: -

Description

Finds empty string literals which are being added. This is an inefficient way to convert any type to a String.

Examples:

// do not add empty strings to things
def a = '' + 123
def b = method('' + property)

// these examples are OK and do not trigger violations
def c = 456.toString()
def d = property?.toString() ?: ""

Further Reading