Skip to content

Commit d8945dd

Browse files
committed
Auto lint and some minor manual updates
1 parent c309157 commit d8945dd

File tree

147 files changed

+1216
-1189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+1216
-1189
lines changed

Gemfile

+76-76
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

55
git_source(:github) do |repo_name|
66
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
@@ -14,125 +14,125 @@ git_source :github do |name|
1414
end
1515

1616
# Core
17-
if ENV["RAILS_MASTER"] == '1'
18-
gem 'rails', git: 'https://github.com/rails/rails.git'
17+
if ENV["RAILS_MASTER"] == "1"
18+
gem "rails", git: "https://github.com/rails/rails.git"
1919
else
20-
gem 'rails', '7.0.8'
20+
gem "rails", "7.0.8"
2121
end
2222

2323
# API & Networking
24-
gem 'git_hub_bub'
24+
gem "git_hub_bub"
2525

2626
# Application server & middleware
27-
gem 'puma'
28-
gem 'puma_worker_killer'
29-
gem 'rack-timeout'
30-
gem 'rack-canonical-host'
27+
gem "puma"
28+
gem "puma_worker_killer"
29+
gem "rack-timeout"
30+
gem "rack-canonical-host"
3131

3232
# Assets
33-
gem 'autoprefixer-rails'
34-
gem 'babel-transpiler'
35-
gem 'bourbon'
36-
gem 'coffee-rails', '~> 5.0.0'
37-
gem 'neat', '~> 1.7'
38-
gem 'normalize-rails'
39-
gem 'sassc'
40-
gem 'sassc-rails'
41-
gem 'slim-rails'
42-
gem 'sprockets'
43-
gem 'sprockets-rails'
44-
gem 'uglifier', '>= 1.0.3'
33+
gem "autoprefixer-rails"
34+
gem "babel-transpiler"
35+
gem "bourbon"
36+
gem "coffee-rails", "~> 5.0.0"
37+
gem "neat", "~> 1.7"
38+
gem "normalize-rails"
39+
gem "sassc"
40+
gem "sassc-rails"
41+
gem "slim-rails"
42+
gem "sprockets"
43+
gem "sprockets-rails"
44+
gem "uglifier", ">= 1.0.3"
4545

4646
# Authentication & Authorization
47-
gem 'devise'
48-
gem 'omniauth'
49-
gem 'omniauth-rails_csrf_protection'
50-
gem 'omniauth-github'
47+
gem "devise"
48+
gem "omniauth"
49+
gem "omniauth-rails_csrf_protection"
50+
gem "omniauth-github"
5151

5252
# Backgroud jobs
53-
gem 'sidekiq'
54-
gem 'sinatra'
53+
gem "sidekiq"
54+
gem "sinatra"
5555

5656
# Caching
57-
gem 'dalli'
57+
gem "dalli"
5858

5959
# Database
60-
gem 'pg'
60+
gem "pg"
6161

6262
# Email
63-
gem 'mail', require: ['mail', 'mail/utilities', 'mail/parsers'] # parsers is used by `valid_email` and may be causing https://github.com/mikel/mail/issues/912#issuecomment-170121429
64-
gem 'premailer-rails'
65-
gem 'valid_email'
63+
gem "mail", require: ["mail", "mail/utilities", "mail/parsers"] # parsers is used by `valid_email` and may be causing https://github.com/mikel/mail/issues/912#issuecomment-170121429
64+
gem "premailer-rails"
65+
gem "valid_email"
6666

6767
# File Handling & Data Processing
68-
gem 'mime-types', require: 'mime/types/columnar'
68+
gem "mime-types", require: "mime/types/columnar"
6969

7070
# JavaScript
71-
gem 'jquery-rails'
72-
gem 'render_async'
71+
gem "jquery-rails"
72+
gem "render_async"
7373

7474
# JSON
75-
gem 'oj'
75+
gem "oj"
7676

7777
# Views
78-
gem 'bluecloth'
79-
gem 'local_time'
80-
gem 'maildown'
81-
gem 'wicked'
78+
gem "bluecloth"
79+
gem "local_time"
80+
gem "maildown"
81+
gem "wicked"
8282

8383
# Pagination
84-
gem 'will_paginate'
84+
gem "will_paginate"
8585

8686
# Performance & Monitoring
87-
gem 'bootsnap', require: false
88-
gem 'flamegraph'
89-
gem 'matrix'
90-
gem 'prawn'
91-
gem 'rack-mini-profiler'
92-
gem 'rails-autoscale-web'
93-
gem 'rbtrace'
94-
gem 'sentry-raven'
95-
gem 'scout_apm'
96-
gem 'skylight'
97-
gem 'stackprof'
87+
gem "bootsnap", require: false
88+
gem "flamegraph"
89+
gem "matrix"
90+
gem "prawn"
91+
gem "rack-mini-profiler"
92+
gem "rails-autoscale-web"
93+
gem "rbtrace"
94+
gem "sentry-raven"
95+
gem "scout_apm"
96+
gem "skylight"
97+
gem "stackprof"
9898

9999
# SEO & Sitemaps
100-
gem 'sitemap_generator'
100+
gem "sitemap_generator"
101101

102102
# Storage
103-
gem 'aws-sdk-s3'
103+
gem "aws-sdk-s3"
104104

105105
# Utilities
106-
gem 'rake'
107-
gem 'rrrretry'
106+
gem "rake"
107+
gem "rrrretry"
108108

109109
# Parse Ruby documentation
110-
gem 'yard', '~> 0.9.28'
110+
gem "yard", "~> 0.9.28"
111111

112112
group :development do
113-
gem 'foreman'
114-
gem 'listen'
115-
gem 'memory_profiler'
116-
gem 'web-console'
113+
gem "foreman"
114+
gem "listen"
115+
gem "memory_profiler"
116+
gem "web-console"
117117
end
118118

119119
group :test do
120-
gem 'capybara'
121-
gem 'launchy' # Not essential but helpful for save_and_open_page
122-
gem 'minitest'
123-
gem 'mocha', require: false
124-
gem 'rails-controller-testing'
125-
gem 'simplecov', require: false
126-
gem 'test-prof'
127-
gem 'vcr'
128-
gem 'webmock'
120+
gem "capybara"
121+
gem "launchy" # Not essential but helpful for save_and_open_page
122+
gem "minitest"
123+
gem "mocha", require: false
124+
gem "rails-controller-testing"
125+
gem "simplecov", require: false
126+
gem "test-prof"
127+
gem "vcr"
128+
gem "webmock"
129129
end
130130

131131
group :development, :test do
132-
gem 'derailed_benchmarks'
133-
gem 'dotenv-rails'
134-
gem 'faker', require: false
135-
gem 'pry'
136-
gem 'standardrb', require: false
137-
gem 'rubocop-performance'
132+
gem "derailed_benchmarks"
133+
gem "dotenv-rails"
134+
gem "faker", require: false
135+
gem "pry"
136+
gem "standardrb", require: false
137+
gem "rubocop-performance"
138138
end

Rakefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ if ENV["DEADLOCK_DEBUG"]
1212
puts
1313
puts "## Deadlock Debug"
1414
puts
15-
Thread.list.each { |t| puts "=" * 80; puts t.backtrace }
15+
Thread.list.each { |t|
16+
puts "=" * 80
17+
puts t.backtrace
18+
}
1619
end
1720
end
1821
end
1922

20-
require File.expand_path('../config/application', __FILE__)
23+
require File.expand_path("../config/application", __FILE__)
2124

2225
begin
2326
require "rubocop/rake_task"
2427

2528
RuboCop::RakeTask.new(:rubocop) do |task|
26-
task.options = ['--display-cop-names']
29+
task.options = ["--display-cop-names"]
2730
end
2831
rescue LoadError
2932
# We are in the production environment, where Rubocop is not required.

app/controllers/api_info_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ApiInfoController < RepoBasedController
66
include ActionView::Helpers::DateHelper
77

88
def show
9-
@repo = find_repo(params)
9+
@repo = find_repo(params)
1010
added_by = @repo.subscribers.where(private: false).order(:created_at).first&.github
1111
count = @repo.subscribers_count
1212
count = 0 if added_by.nil?

app/controllers/application_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
55
protect_from_forgery
66

77
before_action do
8-
if current_user && current_user.admin?
8+
if current_user&.admin?
99
Rack::MiniProfiler.authorize_request
1010
end
1111
end
@@ -29,6 +29,6 @@ def authenticate_user!
2929
end
3030

3131
def after_sign_in_path_for(resource)
32-
request.env['omniauth.origin'] || stored_location_for(resource) || root_path
32+
request.env["omniauth.origin"] || stored_location_for(resource) || root_path
3333
end
3434
end

app/controllers/badges_controller.rb

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
class BadgesController < ApplicationController
44
def show
55
repo = Repo.where(full_name: permitted[:full_name])
6-
.select(:subscribers_count, :issues_count, :updated_at)
7-
.first
8-
raise ActionController::RoutingError.new('Not Found') if repo.blank?
6+
.select(:subscribers_count, :issues_count, :updated_at)
7+
.first
8+
raise ActionController::RoutingError.new("Not Found") if repo.blank?
99

1010
case permitted[:badge_type]
1111
when "users"
1212
count = repo.subscribers_count
13-
svg = make_shield(name: "code helpers", count: count, color_b: repo.color)
13+
svg = make_shield(name: "code helpers", count: count, color_b: repo.color)
1414
else
15-
raise ActionController::RoutingError.new('Not Found')
15+
raise ActionController::RoutingError.new("Not Found")
1616
end
1717

1818
# Set Cache-Control header
@@ -59,10 +59,10 @@ def width_of(string)
5959
end
6060

6161
def make_shield(name:, count:, color_a: "555", color_b: "4c1", logo_width: 0, logo_padding: 0)
62-
name_width = (width_of(name) + 10).to_f
62+
name_width = (width_of(name) + 10).to_f
6363
count_width = (width_of(count) + 10).to_f
6464
total_width = name_width + count_width
65-
svg = <<~EOS
65+
<<~EOS
6666
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="#{total_width}" height="20">
6767
<linearGradient id="smooth" x2="0" y2="100%">
6868
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
@@ -87,7 +87,6 @@ def make_shield(name:, count:, color_a: "555", color_b: "4c1", logo_width: 0, lo
8787
</g>
8888
</svg>
8989
EOS
90-
return svg
9190
end
9291

9392
def permitted

app/controllers/doc_methods_controller.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
class DocMethodsController < ApplicationController
44
def show
5-
@doc = DocMethod.where(id: params[:id])
6-
.select(:id, :repo_id, :path, :line, :file, :doc_comments_count)
7-
.includes(:repo)
8-
.first!
5+
@doc = DocMethod.where(id: params[:id])
6+
.select(:id, :repo_id, :path, :line, :file, :doc_comments_count)
7+
.includes(:repo)
8+
.first!
99
@comment = @doc.doc_comments.select(:comment).first
10-
@repo = @doc.repo
10+
@repo = @doc.repo
1111
@username = current_user.present? ? current_user.github : "<your name>"
12-
@branch = GitBranchnameGenerator.new(username: @username, doc_path: @doc.path).branchname
12+
@branch = GitBranchnameGenerator.new(username: @username, doc_path: @doc.path).branchname
1313

1414
set_title("Help Writing docs #{@doc.path} - #{@repo.full_name} #{@repo.language}")
15-
set_description("#{@doc.missing_docs? ? 'Write' : 'Read'} docs for #{@repo.name} starting with #{@doc.path}.")
15+
set_description("#{@doc.missing_docs? ? "Write" : "Read"} docs for #{@repo.name} starting with #{@doc.path}.")
1616
end
1717

1818
def click_method_redirect
19-
doc = DocMethod.find(params[:id])
20-
sub = RepoSubscription.where(user_id: params[:user_id], repo: doc.repo).first
19+
doc = DocMethod.find(params[:id])
20+
sub = RepoSubscription.where(user_id: params[:user_id], repo: doc.repo).first
2121
assignment = DocAssignment.where(doc_method_id: doc.id, repo_subscription_id: sub.id).first
2222

2323
if assignment&.user&.id.to_s == params[:user_id]
@@ -34,8 +34,8 @@ def click_method_redirect
3434
end
3535

3636
def click_source_redirect
37-
doc = DocMethod.find(params[:id])
38-
sub = RepoSubscription.find_by!(user_id: params[:user_id], repo: doc.repo)
37+
doc = DocMethod.find(params[:id])
38+
sub = RepoSubscription.find_by!(user_id: params[:user_id], repo: doc.repo)
3939
assignment = DocAssignment.find_by!(doc_method_id: doc.id, repo_subscription_id: sub.id)
4040

4141
if assignment&.user&.id.to_s == params[:user_id]

app/controllers/issue_assignments_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class IssueAssignmentsController < ApplicationController
44
def create
55
repo_sub = current_user.repo_subscriptions.find(params[:id])
66
SendSingleTriageEmailJob.perform_later(repo_sub.id)
7-
redirect_to repo_path(repo_sub.repo), notice: 'You will receive an email with your new issue shortly'
7+
redirect_to repo_path(repo_sub.repo), notice: "You will receive an email with your new issue shortly"
88
end
99

1010
# get "/issue_assignments/:id/users/:user_id/click/:created_at", to: "issue_assignments#click"

app/controllers/pages_controller.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def index
3131
@covid_repos = get_covid_repos
3232

3333
@repos = Repo.with_some_issues
34-
.select(:id, :updated_at, :issues_count, :language, :full_name, :name, :description)
34+
.select(:id, :updated_at, :issues_count, :language, :full_name, :name, :description)
3535
if (language = valid_params[:language] || current_user.try(:favorite_languages))
3636
@repos = @repos.where(language: language)
3737
end
@@ -45,17 +45,17 @@ def index
4545
respond_to do |format|
4646
format.html {}
4747
format.json do
48-
htmlForPage = render_to_string(partial: "repos_with_pagination", locals: { repos: @repos }, formats: ['html'])
49-
render json: { html: htmlForPage }.to_json
48+
html_for_page = render_to_string(partial: "repos_with_pagination", locals: {repos: @repos}, formats: ["html"])
49+
render json: {html: html_for_page}.to_json
5050
end
5151
end
5252
end
5353

5454
private def description
5555
Rails.cache.fetch("pages#index/description", expires_in: 1.hour) do
5656
"Discover the easiest way to get started contributing to open source. " \
57-
"Over #{number_with_delimiter(User.count, delimiter: ',')} devs are " \
58-
"helping #{number_with_delimiter(Repo.count, delimiter: ',')} projects " \
57+
"Over #{number_with_delimiter(User.count, delimiter: ",")} devs are " \
58+
"helping #{number_with_delimiter(Repo.count, delimiter: ",")} projects " \
5959
"with our free, community developed tools"
6060
end
6161
end

app/controllers/repo_based_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class RepoBasedController < ApplicationController
44
protected
55

66
def name_from_params(options)
7-
[options[:name], options[:format]].compact.join('.')
7+
[options[:name], options[:format]].compact.join(".")
88
end
99

1010
def find_repo(options, only_active: true)

0 commit comments

Comments
 (0)