qbantek/freshdesk_apiclient

View on GitHub
lib/core_extensions/string/camelize.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use unary plus to get an unfrozen string literal.
Open

  unless String.new.respond_to?(:camelize)

In Ruby 2.3 or later, use unary plus operator to unfreeze a string literal instead of String#dup and String.new. Unary plus operator is faster than String#dup.

Note: String.new (without operator) is not exactly the same as +''. These differ in encoding. String.new.encoding is always ASCII-8BIT. However, (+'').encoding is the same as script encoding(e.g. UTF-8). So, if you expect ASCII-8BIT encoding, disable this cop.

Example:

# bad
''.dup
"something".dup
String.new
String.new('')
String.new('something')

# good
+'something'
+''

Add an empty line after magic comments.
Open

module StringExtensions

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

There are no issues that match your filters.

Category
Status