Skip to content

Commit

Permalink
Add frozen string literal magic comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kxmbrian committed Apr 3, 2018
1 parent f7e9458 commit 93a2886
Show file tree
Hide file tree
Showing 127 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source 'https://rubygems.org'

# For Windows devs
Expand Down
1 change: 1 addition & 0 deletions Rakefile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

Expand Down
1 change: 1 addition & 0 deletions app/controllers/components/course/duplication_component.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::DuplicationComponent < SimpleDelegator
include Course::ControllerComponentHost::Component

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Assessment::SkillBranchesController < Course::ComponentController
load_and_authorize_resource :skill_branch, class: Course::Assessment::SkillBranch.name,
through: :course,
Expand Down
1 change: 1 addition & 0 deletions app/helpers/course/assessment/answer/programming_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Course::Assessment::Answer::ProgrammingHelper
# Generates HTML with formatted code and annotations.
#
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Course::Assessment::Answer::ProgrammingTestCaseHelper
# Get a hint message. Use the one from test_result if available, else fallback to the one from
# the test case.
Expand Down
1 change: 1 addition & 0 deletions app/jobs/course/assessment/closing_reminder_job.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Assessment::ClosingReminderJob < ApplicationJob
rescue_from(ActiveJob::DeserializationError) do |_|
# Prevent the job from retrying due to deleted records
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Conditional::ConditionalSatisfiabilityEvaluationJob < ApplicationJob
include TrackableJob

Expand Down
1 change: 1 addition & 0 deletions app/jobs/course/video/closing_reminder_job.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Video::ClosingReminderJob < ApplicationJob
rescue_from(ActiveJob::DeserializationError) do |_|
# Prevent the job from retrying due to deleted records
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Course::Discussion::Post::OrderingConcern
extend ActiveSupport::Concern

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Course::Discussion::Topic::PostsConcern
extend ActiveSupport::Concern
include Course::Discussion::Post::OrderingConcern
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/achievement_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::AchievementNotifier < Notifier::Base
# To be called when user gained an achievement.
def achievement_gained(user, achievement)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/announcement_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::AnnouncementNotifier < Notifier::Base
# To be called when an announcement is made.
def new_announcement(user, announcement)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/assessment/answer/comment_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Assessment::Answer::CommentNotifier < Notifier::Base
# To be called when user adds a post to a programming annotation.
def annotation_replied(user, post)
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Assessment::SubmissionQuestion::CommentNotifier < Notifier::Base
# To be called when user comments on an submission_question.
def post_replied(user, post)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/assessment_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::AssessmentNotifier < Notifier::Base
# To be called when user attempted an assessment.
def assessment_attempted(user, assessment)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/forum/post_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Forum::PostNotifier < Notifier::Base
# To be called when user replied a forum post.
def post_replied(user, post)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/forum/topic_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Forum::TopicNotifier < Notifier::Base
# To be called when user created a new forum topic.
def topic_created(user, topic)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/level_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::LevelNotifier < Notifier::Base
# To be called when user reached a new level.
def level_reached(user, level)
Expand Down
1 change: 1 addition & 0 deletions app/notifiers/course/video_notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::VideoNotifier < Notifier::Base
def video_attempted(user, video)
create_activity(actor: user, object: video, event: :attempted).
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Conditional::ConditionalSatisfiabilityEvaluationService
class << self
# Evaluate the satifisability of the conditionals for the given course user
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Conditional::SatisfiabilityGraphBuildService
class << self
# Build and cache the satisfiability graph for the given course.
Expand Down
1 change: 1 addition & 0 deletions app/services/course/video/reminder_service.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Course::Video::ReminderService
class << self
delegate :closing_reminder, to: :new
Expand Down
1 change: 1 addition & 0 deletions app/views/attachments/_attachment_reference.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.name attachment_reference.name
json.path attachment_reference.path
json.updater_name attachment_reference.updater.name
1 change: 1 addition & 0 deletions app/views/attachments/create.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.success !@attachment.nil?

if @attachment
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.attributes do
json.(@achievement, :id, :title, :description, :published)
json.badge do
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.fields do
json.questionId answer.question_id
json.id answer.acting_as.id
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
submission = answer.submission
assessment = submission.assessment
question = answer.question.specific
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.scribing_answer do
json.image_url attachment_reference_url(answer.question.actable.attachment_references[0])
json.user_id current_user.id
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.fields do
json.questionId answer.question_id
json.id answer.acting_as.id
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.fields do
json.questionId answer.question_id
json.id answer.acting_as.id
Expand Down
1 change: 1 addition & 0 deletions app/views/course/assessment/answers/_answer.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.id answer.id
json.questionId answer.question_id
json.createdAt answer.created_at
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.partial! 'course/lesson_plan/items/item.json.jbuilder', item: item

json.lesson_plan_item_type @assessment_tabs_titles_hash[item.tab_id]
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.attributes do
json.(@assessment, :id, :title, :description, :start_at, :end_at, :bonus_end_at, :base_exp,
:time_bonus_exp, :published, :autograded, :show_private, :show_evaluation, :skippable,
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.(category, :id, :title, :weight)

json.tabs do
Expand Down
1 change: 1 addition & 0 deletions app/views/course/assessment/categories/index.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.categories do
json.partial! 'category.json', collection: @categories, as: :category
end
@@ -1,2 +1,3 @@
# frozen_string_literal: true
json.(programming_evaluation, :id, :memory_limit, :time_limit)
json.language programming_evaluation.language.class.name
@@ -1,2 +1,3 @@
# frozen_string_literal: true
json.partial! 'programming_evaluation', collection: @programming_evaluations,
as: :programming_evaluation
@@ -1 +1,2 @@
# frozen_string_literal: true
json.partial! 'programming_evaluation', programming_evaluation: @programming_evaluation
@@ -1 +1,2 @@
# frozen_string_literal: true
json.message @programming_evaluation.errors.full_messages.to_sentence
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.autogradable question.auto_gradable?

json.options question.options do |option|
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.import_result do
json.alert import_result_alert(json: true)

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.package_ui do
json.templates @programming_question.template_files do |file|
json.(file, :id, :filename)
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.language question.language.name
json.fileSubmission question.multiple_file_submission
json.attemptLimit question.attempt_limit if question.attempt_limit
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.partial! 'question'
json.partial! 'package_ui'
json.partial! 'test_ui'
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.question do
json.(@programming_question, :id, :title, :description, :staff_only_comments, :maximum_grade,
:language_id, :memory_limit, :time_limit)
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
if check_import_job?
json.import_job_url job_path(@programming_question.import_job)

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
if @meta
json.test_ui do
json.mode @meta[:editor_mode]
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.form_data do
json.method 'PATCH'
json.auth_token form_authenticity_token
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.form_data do
json.method 'POST'
json.auth_token form_authenticity_token
Expand Down
@@ -1 +1,2 @@
# frozen_string_literal: true
json.autogradable question.auto_gradable?
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.question do
json.(@scribing_question, :id, :title, :description, :staff_only_comments, :maximum_grade)

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.allowAttachment question.allow_attachment? unless question.hide_text?
json.comprehension question.comprehension_question?
json.autogradable question.auto_gradable?
Expand Down
@@ -1 +1,2 @@
# frozen_string_literal: true
json.autogradable question.auto_gradable?
1 change: 1 addition & 0 deletions app/views/course/assessment/skills/_index.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.skills current_course.assessment_skills.order_by_title do |skill|
json.(skill, :id, :title)
end
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.answers answers do |answer|
json.partial! answer, answer: answer
end
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.history do
answer_history = submission.answer_history

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This partial is required to DRY up the code because the abstract question model
# directly renders the actable partial by delegating :to_partial_path to the actable.

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
answer_ids_hash = answers.map do |a|
[a.question_id, a.id]
end.to_h
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.submission do
json.id submission.id
json.canGrade can_grade
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.topics submission.submission_questions do |submission_question|
topic = submission_question.discussion_topic
json.id topic.id
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
can_grade = can?(:grade, @submission)
can_update = can?(:update, @submission)

Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
submissions_hash ||= @submissions.map { |s| [s.course_user_id, s] }.to_h

json.assessment do
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.answers answers do |answer|
json.partial! answer, answer: answer
end
1 change: 1 addition & 0 deletions app/views/course/condition/_conditions.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.condition_attributes do
json.new_condition_urls Course::Condition::ALL_CONDITIONS do |condition|
next unless component_enabled?(condition)
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
achievement_condition = condition
json.type t('course.condition.achievement.title')
json.description format_inline_text(achievement_condition.title)
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
assessment_condition = condition
json.type t('course.condition.assessment.title')
json.description format_inline_text(assessment_condition.title)
Expand Down
1 change: 1 addition & 0 deletions app/views/course/condition/levels/_level.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
level_condition = condition
json.type t('course.condition.level.title')
json.description format_inline_text(level_condition.title)
Expand Down
1 change: 1 addition & 0 deletions app/views/course/discussion/posts/_post.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.(post, :id, :title, :text)
json.formattedText format_html(simple_format(post.text))
creator = post.creator
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.partial! 'course/lesson_plan/items/item.json.jbuilder', item: item

json.eventId item.id
Expand Down
1 change: 1 addition & 0 deletions app/views/course/lesson_plan/items/_item.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# These are the common fields to be displayed for all lesson plan items
json.id item.acting_as.id
json.(item, :title, :published, :start_at, :bonus_end_at, :end_at)
1 change: 1 addition & 0 deletions app/views/course/lesson_plan/items/index.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.milestones @milestones, partial: 'course/lesson_plan/milestones/milestone.json.jbuilder', as: :milestone

json.items @items.map(&:specific) do |actable|
Expand Down
@@ -1 +1,2 @@
# frozen_string_literal: true
json.(milestone, :id, :title, :description, :start_at)
1 change: 1 addition & 0 deletions app/views/course/levels/index.json.jbuilder
@@ -1 +1,2 @@
# frozen_string_literal: true
json.levels @levels.pluck(:experience_points_threshold)
1 change: 1 addition & 0 deletions app/views/course/material/_material.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.(material, :id, :updated_at)
json.name format_inline_text(material.name)
json.url url_for([current_course, folder, material])
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Response with the uploaded materials
json.materials @materials do |material|
json.partial! 'course/material/material', material: material, folder: @folder
Expand Down
1 change: 1 addition & 0 deletions app/views/course/object_duplications/new.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.currentHost current_tenant.host

json.currentCourse do
Expand Down
1 change: 1 addition & 0 deletions app/views/course/survey/questions/_option.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.(option, :id, :weight)
json.option format_html(option.option)
unless option.attachment.nil?
Expand Down
1 change: 1 addition & 0 deletions app/views/course/survey/questions/_question.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.(question, :id, :required, :question_type, :max_options, :min_options, :weight,
:grid_view, :section_id)
json.description format_html(question.description)
Expand Down
1 change: 1 addition & 0 deletions app/views/course/survey/responses/_response.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.survey do
json.partial! 'course/survey/surveys/survey_with_questions', survey: survey
end
Expand Down
1 change: 1 addition & 0 deletions app/views/course/survey/responses/_see_other.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
json.responseId @response.id
json.canModify can?(:modify, @response)
json.canSubmit can?(:submit, @response)
1 change: 1 addition & 0 deletions app/views/course/survey/responses/index.json.jbuilder
@@ -1,3 +1,4 @@
# frozen_string_literal: true
responses = @responses.map { |r| [r.course_user_id, r] }.to_h
json.responses @course_students do |student|
response = responses[student.id]
Expand Down

0 comments on commit 93a2886

Please sign in to comment.