Ir al contenido

File name matches type (ARCH6005)

Esta página aún no está disponible en tu idioma.

Key ruby.naming.file-name-matches-type · Severity info · Category naming

When a file’s name does not match its primary type, the code becomes harder to navigate. In Ruby a UserAccount class belongs in user_account.rb, the snake_case form of the type. The rule is off for languages where multi-type files are idiomatic.

account.rb
class UserAccount
def initialize(name)
@name = name
end
end
user_account.rb
class UserAccount
def initialize(name)
@name = name
end
end

Rename the file to the snake_case form of its primary type (UserAccount → user_account.rb).