RuboCop: Lint/Void

[skip-stages=Flakey]

all manual

Change-Id: I28e1f1528640da64269ae5ad046215b1ad54ceea
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277556
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-05 14:04:54 -06:00
parent 20533e467f
commit 34d15f5e08
20 changed files with 16 additions and 23 deletions

View File

@ -96,6 +96,8 @@ Lint/UnusedBlockArgument:
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true # there's no way to mark a kwarg as unused
Severity: error
Lint/Void:
Severity: error
Metrics:
Enabled: false # SnR is just too low to have this enabled

View File

@ -391,7 +391,6 @@ class UserObserveesController < ApplicationController
ra_id_map[user_id] ||= []
ra_id_map[user_id] << ra_id
end
ra_id_map
user_rows.each do |row|
row['observation_link_root_account_ids'] = ra_id_map[row['id']] || []

View File

@ -104,7 +104,6 @@ class AuthenticationProvider::OpenIDConnect < AuthenticationProvider::OAuth2
settings_will_change!
settings['userinfo_endpoint'] = value
end
value
end
protected

View File

@ -602,7 +602,6 @@ class CalendarEvent < ActiveRecord::Base
write_attribute(:participants_per_appointment, limit)
self.override_participants_per_appointment = true
end
limit
end
def update_matching_days=(update)

View File

@ -35,7 +35,6 @@ class Profile < ActiveRecord::Base
def title=(title)
write_attribute(:title, title)
write_attribute(:path, infer_path) if path.nil?
title
end
def infer_path

View File

@ -908,7 +908,6 @@ class User < ActiveRecord::Base
p = Pseudonym.find(p)
p.move_to_top
self.reload
p
end
def email_channel
@ -2875,7 +2874,6 @@ class User < ActiveRecord::Base
else
self.otp_secret_key_enc = self.otp_secret_key_salt = nil
end
key
end
def crocodoc_id!

View File

@ -102,7 +102,6 @@ class BookmarkedCollection::Collection < Array
def current_page=(page)
self.current_bookmark = page_to_bookmark(page)
page
end
def first_page

View File

@ -62,7 +62,7 @@ module CanvasCache
# and therefore the top bit is set
digest_length = result.values.sum.to_s(2).length
max = 1 << digest_length
result[ring[sorted_keys.last]] + max - last
result[ring[sorted_keys.last]] = max - last
result.map { |k, v| [k, v.to_f / max] }.sort_by(&:last).to_h
end

View File

@ -134,8 +134,7 @@ describe EventStream::AttrConfig do
it "requires setting non-defaulted fields before validation" do
value = double('value')
@class.attr_config :field
obj = @class.new(:field => value)
obj.field.== value
@class.new(:field => value)
expect {
@class.new
}.to raise_exception ArgumentError

View File

@ -70,7 +70,6 @@ module Canvas::ICU
ICU::Lib.check_error do |error|
ICU::Lib.ucol_setAttribute(@c, ATTRIBUTES[attribute], ATTRIBUTE_VALUES[value], error)
end
value
end
ATTRIBUTES = {

View File

@ -1427,7 +1427,6 @@ describe "Accounts API", type: :request do
@t1 = @teacher
course_with_teacher(:account => @a1, :user => @t1, :course_name => 'c1b')
course_with_teacher(:account => @a1, :course_name => 'c2')
@teacher
course_with_teacher(:account => @a1, :course_name => 'c3')
@t3 = @teacher
@user = @me

View File

@ -712,7 +712,7 @@ describe "Outcome Results API", type: :request do
expect(json['rollups'].size).to eq 1
json['rollups'].each do |rollup|
expect(rollup.keys.sort).to eq %w(links scores)
rollup['links']['course'] == @course.id.to_s
expect(rollup['links']['course']).to eq @course.id.to_s
expect(rollup['scores'].size).to eq 1
rollup['scores'].each do |score|
expect(score.keys.sort).to eq %w(count hide_points links score submitted_at title)

View File

@ -46,8 +46,6 @@ RSpec.shared_examples 'a soft-deletable model' do
end
end
# ensure this is loaded
ConditionalRelease
module ConditionalRelease
module SpecHelper
def setup_course_with_native_conditional_release(course: nil)

View File

@ -777,8 +777,11 @@ describe AssignmentOverrideApplicator do
end
describe "assignment_with_overrides" do
around do |example|
Time.use_zone('Alaska', &example)
end
before :each do
Time.zone == 'Alaska'
@assignment = create_assignment(
:due_at => 5.days.from_now,
:unlock_at => 4.days.from_now,

View File

@ -179,7 +179,10 @@ describe "MessageableUser::Calculator" do
context "concluded enrollment" do
before do
@enrollment.workflow_state == 'completed'
# specifically, the workflow_state assignment below was accidentally a comparison
# https://github.com/instructure/canvas-lms/commit/c106826889469f8faa08847d4002c6b5d074fa13
skip "VICE-2235: specs broken since inception"
@enrollment.workflow_state = "completed"
@enrollment.save!
end

View File

@ -55,7 +55,6 @@ describe MicrosoftSync::GraphService do
allow(InstStatsd::Statsd).to receive(:count).and_call_original
# Test retry on intermittent errors without internal retry
MicrosoftSync::GraphService::Http # need to load before stubbing
stub_const('MicrosoftSync::GraphService::Http::DEFAULT_N_INTERMITTENT_RETRIES', 0)
end

View File

@ -1321,8 +1321,7 @@ describe Course do
end
describe "#reset_content" do
before do
:once
before(:once) do
course_with_student
end

View File

@ -174,7 +174,7 @@ def test_question_import(hash_name, system)
db_aq = AssessmentQuestion.where(migration_id: q[:migration_id]).first
expect(db_aq.migration_id).to eq q[:migration_id]
db_aq.name == q[:question_name]
expect(db_aq.name).to eq q[:question_name]
bank = AssessmentQuestionBank.where(context_type: context.class.to_s, context_id: context, title: AssessmentQuestionBank.default_imported_title).first
bank_aq = bank.assessment_questions.first

View File

@ -29,7 +29,7 @@ describe Quizzes::QuizQuestion do
expect(q.question_data).not_to be_nil
expect(q.question_data.class).to eq Quizzes::QuizQuestion::QuestionData
expect(q.assessment_question_id).to eql(a.id)
q.question_data == qd
q.question_data = qd
data = q.data
expect(data[:assessment_question_id]).to eql(a.id)

View File

@ -620,7 +620,6 @@ describe "people" do
new_role = @account.roles.new(:name => old_role.name)
new_role.base_role_type = "StudentEnrollment"
new_role.save!
new_role
student_in_course(:course => @course, :role => new_role, :name => "number2")