rubocop
Inspecting 19 files
CWCCCC.CCC.CCCCCWWC
Offenses:
Gemfile:12:22: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
gem 'activesupport', "~>4.1"
^^^^^^^
Gemfile:13:21: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
gem 'activerecord', "~>4.1"
^^^^^^^
Gemfile:23:1: C: 1 trailing blank lines detected.
environment.rb:6:33: W: File.exists? is deprecated in favor of File.exist?.
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
^^^^^^^
environment.rb:20:9: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
require "sinatra/reloader" if development?
^^^^^^^^^^^^^^^^^^
environment.rb:22:1: C: Extra blank line detected.
config.ru:2:52: C: Unnecessary spacing detected.
require ::File.expand_path('../config/environment', __FILE__)
^
config.ru:11:21: C: Trailing whitespace detected.
# Set the views to
^
config.ru:12:52: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
set :views, File.join(Sinatra::Application.root, "app", "views")
^^^^^
config.ru:12:59: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
set :views, File.join(Sinatra::Application.root, "app", "views")
^^^^^^^
Rakefile:4:1: C: Extra blank line detected.
Rakefile:11:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Create an empty model in app/models, e.g., rake generate:model NAME=User"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:11:81: C: Line is too long. [81/80]
desc "Create an empty model in app/models, e.g., rake generate:model NAME=User"
^
Rakefile:13:16: C: Hash#has_key? is deprecated in favor of Hash#key?.
unless ENV.has_key?('NAME')
^^^^^^^^
Rakefile:14:13: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
raise "Must specificy model name, e.g., rake generate:model NAME=User"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:35:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Create an empty migration in db/migrate, e.g., rake generate:migration NAME=create_tasks"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:35:81: C: Line is too long. [97/80]
desc "Create an empty migration in db/migrate, e.g., rake generate:migration NAME=create_tasks"
^^^^^^^^^^^^^^^^^
Rakefile:37:16: C: Hash#has_key? is deprecated in favor of Hash#key?.
unless ENV.has_key?('NAME')
^^^^^^^^
Rakefile:38:13: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
raise "Must specificy migration name, e.g., rake generate:migration NAME=create_tasks"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:38:81: C: Line is too long. [92/80]
raise "Must specificy migration name, e.g., rake generate:migration NAME=create_tasks"
^^^^^^^^^^^^
Rakefile:42:16: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
filename = "%s_%s.rb" % [Time.now.strftime('%Y%m%d%H%M%S'), ENV['NAME'].underscore]
^^^^^^^^^^
Rakefile:42:27: C: Favor format over String#%.
filename = "%s_%s.rb" % [Time.now.strftime('%Y%m%d%H%M%S'), ENV['NAME'].underscore]
^
Rakefile:42:81: C: Line is too long. [87/80]
filename = "%s_%s.rb" % [Time.now.strftime('%Y%m%d%H%M%S'), ENV['NAME'].underscore]
^^^^^^^
Rakefile:45:5: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if File.exist?(path)
^^
Rakefile:60:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Create an empty model spec in spec, e.g., rake generate:spec NAME=user"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:62:16: C: Hash#has_key? is deprecated in favor of Hash#key?.
unless ENV.has_key?('NAME')
^^^^^^^^
Rakefile:63:13: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
raise "Must specificy migration name, e.g., rake generate:spec NAME=user"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:67:16: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
filename = "%s_spec.rb" % ENV['NAME'].underscore
^^^^^^^^^^^^
Rakefile:67:29: C: Favor format over String#%.
filename = "%s_spec.rb" % ENV['NAME'].underscore
^
Rakefile:70:5: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if File.exist?(path)
^^
Rakefile:85:1: C: Extra empty line detected at block body end.
Rakefile:95:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Create the database for test env"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:98:10: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
exec("createdb testasign_test")
^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:107:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:109:81: C: Line is too long. [84/80]
ActiveRecord::Migrator.migrations_paths << File.dirname(__FILE__) + 'db/migrate'
^^^^
Rakefile:110:43: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
^^^^^^^^^
Rakefile:110:60: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
^^^^^^^^^
Rakefile:110:74: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
^^^^^^
Rakefile:110:81: C: Line is too long. [86/80]
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
^^^^^^
Rakefile:111:81: C: Line is too long. [134/80]
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:111:81: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
^^^^^^^^^
Rakefile:111:98: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
^^^^^^^^^
Rakefile:112:11: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
^^^^^^^
Rakefile:112:35: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
^^^^^^^
Rakefile:116:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Populate the database with dummy data by running db/seeds.rb"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:121:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Returns the current schema version number"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:128:6: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
task "console" do
^^^^^^^^^
Rakefile:129:8: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
exec "irb -r./config/environment"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rakefile:132:6: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
desc "Run the specs"
^^^^^^^^^^^^^^^
Rakefile:135:6: C: Use the new Ruby 1.9 hash syntax.
task :default => :specs
^^^^^^^^^^^^
Rakefile:135:16: C: Operator => should be surrounded by a single space.
task :default => :specs
^^
app/models/message.rb:1:2: C: Missing top-level class documentation comment.
class Message < ActiveRecord::Base
^^^^^
app/models/message.rb:2:1: C: Extra empty line detected at class body beginning.
app/models/message.rb:7:1: C: Extra empty line detected at class body end.
app/models/message.rb:9:1: C: 2 trailing blank lines detected.
app/models/user.rb:1:1: C: Missing top-level class documentation comment.
class EmailValidator < ActiveModel::EachValidator
^^^^^
app/models/user.rb:4:57: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
record.errors[attribute] << (options[:message] || "is not an email")
^^^^^^^^^^^^^^^^^
app/models/user.rb:9:1: C: Missing top-level class documentation comment.
class User < ActiveRecord::Base
^^^^^
app/models/user.rb:10:1: C: Extra empty line detected at class body beginning.
app/models/user.rb:26:5: C: Redundant return detected.
return self.password == password_plaintext
^^^^^^
app/models/user.rb:26:12: C: Redundant self detected.
return self.password == password_plaintext
^^^^^^^^^^^^^
app/controllers/sys/sessions.rb:17:14: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
@error = "Please check your email address and password and try again."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/sys/users.rb:11:81: C: Line is too long. [105/80]
@user = User.new(first_name: params[:first_name], last_name: params[:last_name], email: params[:email])
^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/messages.rb:9:81: C: Line is too long. [91/80]
params[:message]['content'] = AES.encrypt(params[:message]['content'], params[:password])
^^^^^^^^^^^
app/controllers/messages.rb:23:81: C: Line is too long. [187/80]
if (@message.mode == 'after_visit' && @message.visit_count < @message.visits) || (@message.mode == 'after_time' && Time.new < (@message.created_at + (@usertime*60))) #ВРЕМЯ : 1 МИНУТА
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/messages.rb:23:164: C: Surrounding space missing for operator *.
if (@message.mode == 'after_visit' && @message.visit_count < @message.visits) || (@message.mode == 'after_time' && Time.new < (@message.created_at + (@usertime*60))) #ВРЕМЯ : 1 МИНУТА
^
app/controllers/messages.rb:23:171: C: Use only ascii symbols in comments.
if (@message.mode == 'after_visit' && @message.visit_count < @message.visits) || (@message.mode == 'after_time' && Time.new < (@message.created_at + (@usertime*60))) #ВРЕМЯ : 1 МИНУТА
^^^^^^^^^^^^^^^^^
app/controllers/messages.rb:23:171: C: Missing space after #.
if (@message.mode == 'after_visit' && @message.visit_count < @message.visits) || (@message.mode == 'after_time' && Time.new < (@message.created_at + (@usertime*60))) #ВРЕМЯ : 1 МИНУТА
^^^^^^^^^^^^^^^^^
app/controllers/messages.rb:38:5: C: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
if @message.mode == 'after_visit'
^^
app/controllers/messages.rb:45:4: C: Final newline missing.
end
spec/models/messages_spec.rb:4:1: C: Extra empty line detected at block body beginning.
spec/models/messages_spec.rb:5:6: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
it "encrypt/decrypt content" do
^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/messages_spec.rb:14:6: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
it "encrypt/decrypt id to safe links" do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/messages_spec.rb:20:4: C: Final newline missing.
end
spec/spec_helper.rb:10:26: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
require File.expand_path("../../config/environment", __FILE__)
^^^^^^^^^^^^^^^^^^^^^^^^^^
db/migrate/20150613100555_create_users.rb:1:1: C: Missing top-level class documentation comment.
class CreateUsers < ActiveRecord::Migration
^^^^^
db/migrate/20150613100555_create_users.rb:9:29: C: Use the new Ruby 1.9 hash syntax.
t.string :first_name, :null => false
^^^^^^^^
db/migrate/20150613100555_create_users.rb:10:28: C: Use the new Ruby 1.9 hash syntax.
t.string :last_name, :null => false
^^^^^^^^
db/migrate/20150613100555_create_users.rb:11:24: C: Use the new Ruby 1.9 hash syntax.
t.string :email, :null => false
^^^^^^^^
db/migrate/20150613100555_create_users.rb:12:32: C: Use the new Ruby 1.9 hash syntax.
t.string :password_hash, :null => false
^^^^^^^^
db/migrate/20150613100555_create_users.rb:15:31: C: Use the new Ruby 1.9 hash syntax.
add_index :users, :email, :unique => true
^^^^^^^^^^
db/migrate/20161109114038_create_message.rb:1:2: C: Missing top-level class documentation comment.
class CreateMessage < ActiveRecord::Migration
^^^^^
db/migrate/20161109114038_create_message.rb:12:4: C: Trailing whitespace detected.
end
^
db/migrate/20161109144709_add_status_column.rb:1:2: C: Missing top-level class documentation comment.
class AddStatusColumn < ActiveRecord::Migration
^^^^^
db/seeds.rb:5:1: C: Missing space after #.
#create 10 dummy users
^^^^^^^^^^^^^^^^^^^^^^
db/seeds.rb:6:1: W: Useless assignment to variable - users.
users = 10.times.map do
^^^^^
db/seeds.rb:6:9: C: Use Array.new with a block instead of .times.map.
users = 10.times.map do ...
^^^^^^^^^^^^^^^
db/seeds.rb:7:16: C: Space inside parentheses detected.
User.create!( :first_name => Faker::Name.first_name,
^
db/seeds.rb:7:17: C: Use the new Ruby 1.9 hash syntax.
User.create!( :first_name => Faker::Name.first_name,
^^^^^^^^^^^^^^
db/seeds.rb:8:17: C: Use the new Ruby 1.9 hash syntax.
:last_name => Faker::Name.last_name,
^^^^^^^^^^^^^^
db/seeds.rb:9:17: C: Use the new Ruby 1.9 hash syntax.
:email => Faker::Internet.email,
^^^^^^^^^^^^^^
db/seeds.rb:10:17: C: Use the new Ruby 1.9 hash syntax.
:password => 'password' )
^^^^^^^^^^^^^^
db/seeds.rb:10:42: C: Space inside parentheses detected.
:password => 'password' )
^
db/seeds.rb:11:4: C: Final newline missing.
end
config/environment.rb:6:33: W: File.exists? is deprecated in favor of File.exist?.
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
^^^^^^^
config/environment.rb:20:9: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
require "sinatra/reloader" if development?
^^^^^^^^^^^^^^^^^^
config/environment.rb:22:1: C: Extra blank line detected.
config/database.rb:24:81: C: Line is too long. [94/80]
# Heroku controls what database we connect to by setting the DATABASE_URL environment variable
^^^^^^^^^^^^^^
config/database.rb:25:81: C: Line is too long. [91/80]
# We need to respect that if we want our Sinatra apps to run on Heroku without modification
^^^^^^^^^^^
config/database.rb:26:81: C: Line is too long. [109/80]
db = URI.parse(ENV['DATABASE_URL'] || "postgres://localhost/#{APP_NAME}_#{Sinatra::Application.environment}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
config/database.rb:36:3: C: Use the new Ruby 1.9 hash syntax.
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
^^^^^^^^^^^^
config/database.rb:37:3: C: Use the new Ruby 1.9 hash syntax.
:host => db.host,
^^^^^^^^^^^^
config/database.rb:38:3: C: Use the new Ruby 1.9 hash syntax.
:port => db.port,
^^^^^^^^^^^^
config/database.rb:39:3: C: Use the new Ruby 1.9 hash syntax.
:username => db.user,
^^^^^^^^^^^^
config/database.rb:40:3: C: Use the new Ruby 1.9 hash syntax.
:password => db.password,
^^^^^^^^^^^^
config/database.rb:41:3: C: Use the new Ruby 1.9 hash syntax.
:database => DB_NAME,
^^^^^^^^^^^^
config/database.rb:42:3: C: Use the new Ruby 1.9 hash syntax.
:encoding => 'utf8'
^^^^^^^^^^^^
19 files inspected, 107 offenses detected