Inspectopedia Help

Unnecessary use of double quotes in string

Reports double-quoted strings that can be converted to single-quoted. Any string that doesn't contain any expression substitutions, or special symbols may be converted.

Example:

# Bad practice "Hello world" "Hello \"John Doe\""

A quick-fix to convert a double-quoted string is available. After the quick-fix is applied, the result looks like this:

# Good practice 'Hello world' 'Hello "John Doe"' "Hello 'John Doe'"

Use the Ignore strings containing single quotes checkbox to ignore strings that require escaping.

Inspired by 'RuboCop'

Inspection options

Option

Type

Default

Ignore strings containing single quotes

Checkbox

false

Inspection Details

Available in:

Qodana for Ruby 2023.3, RubyMine 2023.3

Plugin:

Ruby, 233.SNAPSHOT

Last modified: 13 July 2023