rubocop 最佳实践

阅读更多
# class definition is too long
# This likely means that your class definition takes more than 100 lines of code.

# missing top-level class documentation comment
# 

# use only ascii symbols in comments(不能使用中文)
# 

 

# favor modifier if usage when having a single-line body
if token_reg =~ res.to_s
  @token = $1
end

@token = $1 if token_reg =~ res.to_s
# but Avoid using Perl-style special variables (like $0-9, $, etc. ). They are quite cryptic and their use in anything but one-liner scripts is discouraged. Prefer long form versions such as $PROGRAM_NAME.

 

# use def with parentheses when there are parameters

 

你可能感兴趣的:(rubocop)