Skip to content

Commit

Permalink
add frozen_string_literal comment to straggling lib files
Browse files Browse the repository at this point in the history
mostly rake tasks

Change-Id: Ia354de53f66b0707edac6db56a296c9005351922
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261817
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Rob Orton <[email protected]>
QA-Review: Rob Orton <[email protected]>
Product-Review: Rob Orton <[email protected]>
  • Loading branch information
ccutrer committed Mar 30, 2021
1 parent 64ea9b4 commit e783fa5
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 36 deletions.
6 changes: 4 additions & 2 deletions lib/canvas/errors/log_entry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#
# Copyright (C) 2020 - present Instructure, Inc.
#
Expand Down Expand Up @@ -42,7 +44,7 @@ def initialize(exception, data_hash)
end

def message
msg = ""
msg = +""
ActiveSupport::Deprecation.silence do
msg << "\n\n[CANVAS_ERRORS] EXCEPTION LOG"
if @ex.is_a?(String) || @ex.is_a?(Symbol)
Expand All @@ -62,7 +64,7 @@ def message
end

def log_entry_for_exception(e)
entry = ""
entry = +""
entry << "\n#{e.class}"
begin
entry << " (#{e.message}):" if e.respond_to?(:message)
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/brand_configs.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :brand_configs do
desc "Writes the .css (css variables), .js & .json files that are used to load the theme editor variables for each brand " +
"Set BRAND_CONFIG_MD5=<whatever> to save just that one, otherwise writes a file for each BrandConfig in db."
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/canvas.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rake/task_graph'
require 'parallel'

Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/canvas/cdn.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :canvas do
namespace :cdn do
desc 'Push static assets to s3'
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/canvas/quizzes.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :canvas do
namespace :quizzes do
desc 'Generate events from snapshots for submissions to a quiz.'
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/ci.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :ci do
desc "set up test shards if they don't already exist"
task prepare_test_shards: :environment do
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/css.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :css do
desc "Generate styleguide"
task :styleguide do
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/db.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rake::Task['db:drop'].enhance do
GuardRail.activate(:deploy) { Canvas.redis.flushdb }
end
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/db_backend_migration.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :db do
desc "migrate the page views in the database to cassandra"
task :migrate_pageviews_to_cassandra, [:shard_id] => :environment do |t,args|
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/db_create_data.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :db do
desc "Create a new user"
task :create_user => :environment do
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/db_load_data.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'securerandom'

def ping
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/db_nuke.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :db do
task :nuke => :environment do
# dont kill db:nuke if it dies with destoying all the attachments.
Expand Down
71 changes: 37 additions & 34 deletions lib/tasks/docs.rake
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
# frozen_string_literal: true

begin
require 'yard'
require 'yard-appendix'
require 'config/initializers/json'

namespace :doc do
DOC_DIR = File.join(%w[public doc api])
API_DOC_DIR = File.expand_path(Rails.root + DOC_DIR)
DOC_OPTIONS = {
# turning this on will show all the appendixes of all
# controllers in the All Resources page
:all_resource_appendixes => false
}
namespace :doc do
DOC_DIR = File.join(%w[public doc api])
API_DOC_DIR = File.expand_path(Rails.root + DOC_DIR)
DOC_OPTIONS = {
# turning this on will show all the appendixes of all
# controllers in the All Resources page
:all_resource_appendixes => false
}.freeze

YARD::Tags::Library.define_tag("A Data Model", :model)
YARD::Rake::YardocTask.new(:api) do |t|
t.before = proc { FileUtils.rm_rf(API_DOC_DIR) }
t.before = proc { `script/generate_lti_variable_substitution_markdown` }
t.files = %w[
app/controllers/**/*.rb
{gems,vendor}/plugins/*/app/controllers/*.rb
{gems,vendor}/plugins/*/lib/*.rb
]
YARD::Tags::Library.define_tag("A Data Model", :model)
YARD::Rake::YardocTask.new(:api) do |t|
t.before = proc { FileUtils.rm_rf(API_DOC_DIR) }
t.before = proc { `script/generate_lti_variable_substitution_markdown` }
t.files = %w[
app/controllers/**/*.rb
{gems,vendor}/plugins/*/app/controllers/*.rb
{gems,vendor}/plugins/*/lib/*.rb
]

t.options = %W[
-e doc/api/api_routes.rb
--title "Canvas REST API"
-p doc
-t api
--readme doc/api/README.md
-o #{API_DOC_DIR}
--asset doc/images:images
--asset doc/examples:examples
]
t.options = %W[
-e doc/api/api_routes.rb
--title "Canvas REST API"
-p doc
-t api
--readme doc/api/README.md
-o #{API_DOC_DIR}
--asset doc/images:images
--asset doc/examples:examples
]

# t.options << '--verbose'
# t.options << '--debug'
end
# t.options << '--verbose'
# t.options << '--debug'
end

task 'api' do |t|
puts "API Documentation successfully generated in #{DOC_DIR}\n" <<
"See #{DOC_DIR}/index.html"
task 'api' do |t|
puts "API Documentation successfully generated in #{DOC_DIR}\n" \
"See #{DOC_DIR}/index.html"
end
end
end

rescue LoadError
# tasks not enabled
nil
end
2 changes: 2 additions & 0 deletions lib/tasks/graphql.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

namespace :graphql do
desc "Dump GraphQL schema and fragment types"
task schema: :environment do
Expand Down
1 change: 1 addition & 0 deletions lib/tasks/i18nliner.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

require "i18nliner/processors/abstract_processor"
require "i18nliner/scope"
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/js.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'json'

namespace :js do
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/pact.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

if Gem.loaded_specs.has_key?('pact')
require 'pact/tasks'
end
2 changes: 2 additions & 0 deletions lib/tasks/pact_broker.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

unless Rails.env.production?
require 'pact_broker/client/tasks'
require_relative '../../spec/contracts/service_consumers/pact_config'
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/remove_schema_sig.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

desc 'Removes the schema line in fixtures, models, and specs.'
task :remove_schema_signature do
models = Dir.glob(File.join(File.dirname(__FILE__), %w(.. .. app models)) + "/*.rb")
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/rspec.rake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Don't load rspec if running "rake gems:*"
unless Rails.env.production? || ARGV.any? { |a| a =~ /\Agems/ }

Expand Down

0 comments on commit e783fa5

Please sign in to comment.