Skip to content

Commit

Permalink
Fix additional rubocop errors found by Rails cop
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeweaver committed Oct 25, 2016
1 parent c93f999 commit cbbbfbe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/callbacks/github_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Api
module Callbacks
class GithubController < ApplicationController
protect_from_forgery with: :null_session
before_filter :parse_request
before_action :parse_request

def push
Rails.logger.info(
Expand Down
6 changes: 3 additions & 3 deletions app/models/branch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def self.create_from_git_data!(branch_data)
repository = Repository.create!(branch_data.repository_name)
branch = Branch.where(repository: repository, name: branch_data.name).first_or_initialize
branch.git_updated_at = branch_data.last_modified_date
branch.updated_at = Time.now # force updated time
branch.updated_at = Time.current # force updated time
branch.author = User.create_from_git_data!(branch_data)
branch.save!
branch
end

def mark_as_tested!
update_column(:git_tested_at, Time.now)
update_column(:git_tested_at, Time.current)
end

scope :untested_branches, lambda {
Expand All @@ -44,7 +44,7 @@ def to_s
name
end

def =~(other)
def =~(other) # rubocop:disable Rails/Delegate
name =~ other
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/notification_suppression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def self.by_user(user)
end

def self.not_expired
where('suppress_until IS NULL OR suppress_until >= ?', Time.now)
where('suppress_until IS NULL OR suppress_until >= ?', Time.current)
end
end
2 changes: 1 addition & 1 deletion app/models/push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Push < ActiveRecord::Base
timestamps
end

validates_inclusion_of :status, in: Github::Api::Status::STATES.map(&:to_s)
validates :status, inclusion: Github::Api::Status::STATES.map(&:to_s)

belongs_to :head_commit, class_name: 'Commit', required: true
has_many :commits_and_pushes, class_name: :CommitsAndPushes, inverse_of: :push
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.users_with_emails(email_filter_list)
end

def self.unsubscribe_by_id!(user_id)
User.where(id: user_id).first.unsubscribe!
User.find_by(id: user_id).unsubscribe!
end

def unsubscribe!
Expand Down

0 comments on commit cbbbfbe

Please sign in to comment.