Skip to content

Commit

Permalink
fix: add Rubocop linting
Browse files Browse the repository at this point in the history
  • Loading branch information
freesteph committed Feb 12, 2020
1 parent 882a4e7 commit 49c1e03
Show file tree
Hide file tree
Showing 80 changed files with 750 additions and 514 deletions.
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
inherit_from: .rubocop_todo.yml

require: rubocop-rails

AllCops:
Exclude:
- 'db/**/*'
- 'bin/*'
- 'tmp/**/*'
69 changes: 69 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-02-12 18:39:43 +0000 using RuboCop version 0.79.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: AllowComments.
Lint/SuppressedException:
Exclude:
- 'app/models/theme.rb'

# Offense count: 7
Metrics/AbcSize:
Max: 31

# Offense count: 13
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 208

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 124

# Offense count: 1
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 9
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 29

# Offense count: 5
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'lib/retrieval.rb'
- 'lib/tasks/themes.rake'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'lib/capistrano/tasks/grab_db_credentials.rake'

# Offense count: 18
Style/Documentation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 56
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 112
22 changes: 12 additions & 10 deletions Capfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

# Load DSL and set up stages
require "capistrano/setup"
require 'capistrano/setup'

# Include default deployment tasks
require "capistrano/deploy"
require 'capistrano/deploy'

# Load the SCM plugin appropriate to your project:
#
Expand All @@ -12,11 +14,11 @@ require "capistrano/deploy"
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
require 'capistrano/scm/git'
install_plugin Capistrano::SCM::Git

require 'capistrano/puma'
install_plugin Capistrano::Puma # Default puma tasks
install_plugin Capistrano::Puma # Default puma tasks

# Include tasks from other gems included in your Gemfile
#
Expand All @@ -30,15 +32,15 @@ install_plugin Capistrano::Puma # Default puma tasks
# https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
require "capistrano/rbenv"
require 'capistrano/rbenv'
# require "capistrano/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require "capistrano/dotenv"
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/dotenv'
# require "capistrano/passenger"

set :rbenv_ruby, File.read('.ruby-version').strip

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
38 changes: 19 additions & 19 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source 'https://rubygems.org'
# frozen_string_literal: true

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
Expand All @@ -24,38 +25,37 @@ gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'therubyracer'
gem 'haml-rails'
gem 'image_processing'
gem 'aws-sdk-s3', require: false
gem 'faker'
gem 'haml-rails'
gem 'image_processing'
gem 'therubyracer'

group :production do
gem "bcrypt_pbkdf"
gem "ed25519"
gem "pg"
gem 'bcrypt_pbkdf'
gem 'ed25519'
gem 'pg'
end

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem "sqlite3"
gem 'byebug', platform: :mri
gem 'rspec-rails'
gem 'guard-rspec'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-rails'
gem 'sqlite3'
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'bootsnap'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'guard-livereload', '~> 2.5', require: false
gem 'rack-livereload'
gem 'capistrano-dotenv'
gem 'capistrano-rails'
gem 'capistrano-rbenv'
gem 'capistrano-dotenv'
gem 'capistrano3-puma'
gem 'guard-livereload', '~> 2.5', require: false
gem 'listen', '~> 3.0.5'
gem 'rack-livereload'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'web-console'
end
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ GEM
zeitwerk (~> 2.2)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
ast (2.4.0)
aws-eventstream (1.0.3)
aws-partitions (1.269.0)
aws-sdk-core (3.89.1)
Expand Down Expand Up @@ -156,6 +157,7 @@ GEM
image_processing (1.10.3)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
jaro_winkler (1.5.4)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
jmespath (1.4.0)
Expand Down Expand Up @@ -193,6 +195,9 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
pg (1.2.2)
pry (0.12.2)
coderay (~> 1.1.0)
Expand Down Expand Up @@ -230,6 +235,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.1)
Expand All @@ -256,6 +262,17 @@ GEM
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rails (2.4.2)
rack (>= 1.1)
rubocop (>= 0.72.0)
ruby-progressbar (1.10.1)
ruby-vips (2.0.17)
ffi (~> 1.9)
ruby_parser (3.14.1)
Expand Down Expand Up @@ -299,6 +316,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1)
web-console (4.0.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -335,6 +353,8 @@ DEPENDENCIES
rack-livereload
rails
rspec-rails
rubocop
rubocop-rails
sassc-rails
spring
spring-watcher-listen (~> 2.0.0)
Expand Down
16 changes: 8 additions & 8 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

Expand All @@ -24,12 +26,10 @@
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'

guard :rspec, cmd: "bundle exec rspec -f doc", notification: false do
require "guard/rspec/dsl"
guard :rspec, cmd: 'bundle exec rspec -f doc', notification: false do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# Feel free to open issues for suggestions and improvements

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
Expand All @@ -41,7 +41,7 @@ guard :rspec, cmd: "bundle exec rspec -f doc", notification: false do
dsl.watch_spec_files_for(ruby.lib_files)

# Rails files
rails = dsl.rails(view_extensions: %w(erb haml slim))
rails = dsl.rails(view_extensions: %w[erb haml slim])
dsl.watch_spec_files_for(rails.app_files)
dsl.watch_spec_files_for(rails.views)

Expand All @@ -65,7 +65,7 @@ guard :rspec, cmd: "bundle exec rspec -f doc", notification: false do
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
end
end

Expand All @@ -79,11 +79,11 @@ guard 'livereload' do
png: :png,
gif: :gif,
jpg: :jpg,
jpeg: :jpeg,
jpeg: :jpeg
# less: :less, # uncomment if you want LESS stylesheets done in browser
}

rails_view_exts = %w(erb haml slim)
rails_view_exts = %w[erb haml slim]

# file types LiveReload may optimize refresh for
compiled_exts = extensions.values.uniq
Expand Down
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# 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.
# 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.

require_relative 'config/application'

Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

Expand All @@ -9,7 +11,6 @@ def set_modes
@modes = Mode.all
end


def set_page_title_for(descriptor, args = {})
@title = t("pages.#{descriptor}.title", args)
@description = t("pages.#{descriptor}.description", args)
Expand Down
Loading

0 comments on commit 49c1e03

Please sign in to comment.