Skip to content

Commit

Permalink
introduced rubocop
Browse files Browse the repository at this point in the history
... and cleaned up accordingly.
  • Loading branch information
biwek committed Jul 28, 2018
1 parent 021dc21 commit 6de41fb
Show file tree
Hide file tree
Showing 29 changed files with 307 additions and 42 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inherit_from: .rubocop_todo.yml
222 changes: 222 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-07-28 10:55:24 +0100 using RuboCop version 0.58.2.
# 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.

Bundler/OrderedGems:
Enabled: false

# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/AlignHash:
Enabled: true

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Layout/AlignParameters:
Enabled: true

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
# SupportedStyles: case, end
Layout/CaseIndentation:
Enabled: true

# Cop supports --auto-correct.
Layout/CommentIndentation:
Enabled: true

# Cop supports --auto-correct.
Layout/EmptyLines:
Enabled: true

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Enabled: true

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: empty_lines

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Exclude:
- 'config/puma.rb'

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Layout/IndentHash:
Enabled: true

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented
Layout/MultilineOperationIndentation:
Enabled: false

# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceAroundOperators:
Enabled: true

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceBeforeFirstArg:
Exclude:
- 'config/puma.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: require_no_space, require_space
Layout/SpaceInLambdaLiteral:
Exclude:
- 'app/models/list_item.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBrackets: space, no_space
Layout/SpaceInsideArrayLiteralBrackets:
EnforcedStyle: no_space

# Offense count: 46
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Enabled: true

# Offense count: 1
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'app/controllers/pages_controller.rb'

# Offense count: 1
Metrics/AbcSize:
Max: 19

# Offense count: 2
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 139

# Offense count: 5
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 20

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'test/test_helper.rb'

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

# Offense count: 3
# Cop supports --auto-correct.
Style/ExpandPathArguments:
Exclude:
- 'bin/rails'
- 'bin/rake'
- 'test/test_helper.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
Enabled: true

# Disabled as prefer use of: -> { .. } and -> do .. end
Style/Lambda:
Enabled: false

# Offense count: 2
Style/MixinUsage:
Exclude:
- 'bin/setup'
- 'bin/update'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Strict.
Style/NumericLiterals:
MinDigits: 15

# Offense count: 1
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'config/initializers/simple_form.rb'

# Offense count: 2
# Cop supports --auto-correct.
Style/StderrPuts:
Exclude:
- 'bin/yarn'

# Offense count: 177
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: MinSize.
# SupportedStyles: percent, brackets
Style/SymbolArray:
EnforcedStyle: brackets

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
Exclude:
- db/schema.rb

# Offense count: 107
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 154
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ group :development, :test do
gem "pry"
gem "pry-rails" # show-routes/show-models/show-middleware, etc
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # Call 'byebug' anywhere in the code to stop execution and get a debugger console

# code analyzer and formatter
gem 'rubocop', require: false
end

group :development do
Expand Down
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ GEM
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (9.0.0)
ast (2.4.0)
bcrypt (3.1.12)
bindex (0.5.0)
bootsnap (1.3.0)
Expand Down Expand Up @@ -100,6 +101,7 @@ GEM
i18n (1.0.1)
concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
jaro_winkler (1.5.1)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -134,9 +136,13 @@ GEM
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
parallel (1.12.1)
parser (2.5.1.2)
ast (~> 2.4.0)
pg (1.0.0)
polyamorous (1.3.3)
activerecord (>= 3.0)
powerpack (0.1.2)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand Down Expand Up @@ -173,6 +179,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (12.3.1)
ransack (1.8.8)
actionpack (>= 3.0)
Expand All @@ -187,6 +194,15 @@ GEM
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rolify (5.2.0)
rubocop (0.58.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.6)
Expand Down Expand Up @@ -231,6 +247,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.1.14)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.0)
unicode_utils (1.4.0)
warden (1.2.7)
rack (>= 1.0)
Expand Down Expand Up @@ -273,6 +290,7 @@ DEPENDENCIES
rails (~> 5.2.0)
ransack
rolify
rubocop
sass-rails (~> 5.0)
selenium-webdriver
simple_form
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,4 +1,6 @@
module ApplicationCable

class Channel < ActionCable::Channel::Base
end

end
2 changes: 2 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module ApplicationCable

class Connection < ActionCable::Connection::Base
end

end
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
class ApplicationController < ActionController::Base

protect_from_forgery with: :exception

end
4 changes: 2 additions & 2 deletions app/controllers/scholars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class ScholarsController < ApplicationController
def index
if params[:sid]
@scholar = Scholar.find(params[:sid])
params[:q]= {name_or_description_cont: @scholar.name,
discipline_id_or_discipline_parent_id_eq: @scholar.discipline_id}
params[:q] = {name_or_description_cont: @scholar.name,
discipline_id_or_discipline_parent_id_eq: @scholar.discipline_id}
end
set_searching

Expand Down
2 changes: 2 additions & 0 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ApplicationMailer < ActionMailer::Base

default from: '[email protected]'
layout 'mailer'

end
2 changes: 1 addition & 1 deletion app/models/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Role < ApplicationRecord
belongs_to :resource, polymorphic: true, optional: true
has_and_belongs_to_many :users, join_table: :users_roles

validates :resource_type, inclusion: { in: Rolify.resource_types }, allow_nil: true
validates :resource_type, inclusion: {in: Rolify.resource_types}, allow_nil: true

scopify

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ class User < ApplicationRecord
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :confirmable, :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
# :registerable # disable sign_up
# :registerable # disable sign_up

end
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
module AbhinavNepal

class Application < Rails::Application

# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1

Expand All @@ -24,6 +25,7 @@ def name
def stage
(ENV["STAGE"] || "dev").inquiry
end

end

end
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
config.action_mailer.default_url_options = {host: "localhost", port: 3000}

# Send emails to mailcatcher (http://mailcatcher.me/)
config.action_mailer.delivery_method = :smtp
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
config.log_level = :info

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand Down
Loading

0 comments on commit 6de41fb

Please sign in to comment.