Skip to content

Commit 878e42c

Browse files
committed
rubocop -a
1 parent fa91aeb commit 878e42c

File tree

154 files changed

+401
-111
lines changed

Some content is hidden

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

154 files changed

+401
-111
lines changed

.rubocop.yml

+33-30
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
inherit_gem:
2+
rubocop-rails:
3+
- config/rails.yml
4+
15
AllCops:
26
TargetRubyVersion: 2.4
3-
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4-
# to ignore them, so only the ones explicitly set in this file are enabled.
5-
DisabledByDefault: true
6-
Exclude:
7-
- '**/templates/**/*'
8-
- '**/vendor/**/*'
7+
8+
# frozen_string_literal: true
9+
Style/FrozenStringLiteralComment:
10+
Enabled: true
11+
EnforcedStyle: when_needed
912

1013
# Prefer &&/|| over and/or.
1114
Style/AndOr:
@@ -17,78 +20,78 @@ Style/BracesAroundHashParameters:
1720
Enabled: true
1821

1922
# Align `when` with `case`.
20-
Style/CaseIndentation:
23+
Layout/CaseIndentation:
2124
Enabled: true
2225

2326
# Align comments with method definitions.
24-
Style/CommentIndentation:
27+
Layout/CommentIndentation:
2528
Enabled: true
2629

2730
# No extra empty lines.
28-
Style/EmptyLines:
31+
Layout/EmptyLines:
2932
Enabled: true
3033

3134
# In a regular class definition, no empty lines around the body.
32-
Style/EmptyLinesAroundClassBody:
35+
Layout/EmptyLinesAroundClassBody:
3336
Enabled: true
3437

3538
# In a regular method definition, no empty lines around the body.
36-
Style/EmptyLinesAroundMethodBody:
39+
Layout/EmptyLinesAroundMethodBody:
3740
Enabled: true
3841

3942
# In a regular module definition, no empty lines around the body.
40-
Style/EmptyLinesAroundModuleBody:
43+
Layout/EmptyLinesAroundModuleBody:
4144
Enabled: true
4245

43-
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
46+
# Use Ruby >= 1.9 syntax for hashes. Prefer {a: :b} over { :a => :b }.
4447
Style/HashSyntax:
4548
Enabled: true
4649

4750
# Method definitions after `private` or `protected` isolated calls need one
4851
# extra level of indentation.
49-
Style/IndentationConsistency:
52+
Layout/IndentationConsistency:
5053
Enabled: true
51-
EnforcedStyle: rails
54+
EnforcedStyle: normal
5255

5356
# Two spaces, no tabs (for indentation).
54-
Style/IndentationWidth:
57+
Layout/IndentationWidth:
5558
Enabled: true
5659

57-
Style/SpaceAfterColon:
60+
Layout/SpaceAfterColon:
5861
Enabled: true
5962

60-
Style/SpaceAfterComma:
63+
Layout/SpaceAfterComma:
6164
Enabled: true
6265

63-
Style/SpaceAroundEqualsInParameterDefault:
66+
Layout/SpaceAroundEqualsInParameterDefault:
6467
Enabled: true
6568

66-
Style/SpaceAroundKeyword:
69+
Layout/SpaceAroundKeyword:
6770
Enabled: true
6871

69-
Style/SpaceAroundOperators:
72+
Layout/SpaceAroundOperators:
7073
Enabled: true
7174

72-
Style/SpaceBeforeFirstArg:
73-
Enabled: true
75+
Layout/SpaceBeforeFirstArg:
76+
Enabled: true
7477

7578
# Defining a method with parameters needs parentheses.
7679
Style/MethodDefParentheses:
7780
Enabled: true
7881

7982
# Use `foo {}` not `foo{}`.
80-
Style/SpaceBeforeBlockBraces:
83+
Layout/SpaceBeforeBlockBraces:
8184
Enabled: true
8285

8386
# Use `foo { bar }` not `foo {bar}`.
84-
Style/SpaceInsideBlockBraces:
87+
Layout/SpaceInsideBlockBraces:
8588
Enabled: true
8689

8790
# Use `{a: 1}` not `{ a:1 }`.
88-
Style/SpaceInsideHashLiteralBraces:
91+
Layout/SpaceInsideHashLiteralBraces:
8992
Enabled: false
9093

91-
Style/SpaceInsideParens:
94+
Layout/SpaceInsideParens:
9295
Enabled: true
9396

9497
# Check quotes usage according to lint rule below.
@@ -97,15 +100,15 @@ Style/StringLiterals:
97100
EnforcedStyle: double_quotes
98101

99102
# Detect hard tabs, no hard tabs.
100-
Style/Tab:
103+
Layout/Tab:
101104
Enabled: true
102105

103106
# Blank lines should not have any spaces.
104-
Style/TrailingBlankLines:
107+
Layout/TrailingBlankLines:
105108
Enabled: true
106109

107110
# No trailing whitespace.
108-
Style/TrailingWhitespace:
111+
Layout/TrailingWhitespace:
109112
Enabled: true
110113

111114
# Use quotes for string literals when they are enough.

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
# Declare your gem"s dependencies in form_core.gemspec.

Rakefile

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1+
# frozen_string_literal: true
2+
13
begin
2-
require 'bundler/setup'
4+
require "bundler/setup"
35
rescue LoadError
4-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
57
end
68

7-
require 'rdoc/task'
9+
require "rdoc/task"
810

911
RDoc::Task.new(:rdoc) do |rdoc|
10-
rdoc.rdoc_dir = 'rdoc'
11-
rdoc.title = 'FormCore'
12-
rdoc.options << '--line-numbers'
13-
rdoc.rdoc_files.include('README.md')
14-
rdoc.rdoc_files.include('lib/**/*.rb')
12+
rdoc.rdoc_dir = "rdoc"
13+
rdoc.title = "FormCore"
14+
rdoc.options << "--line-numbers"
15+
rdoc.rdoc_files.include("README.md")
16+
rdoc.rdoc_files.include("lib/**/*.rb")
1517
end
1618

1719
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18-
load 'rails/tasks/engine.rake'
19-
20-
21-
load 'rails/tasks/statistics.rake'
20+
load "rails/tasks/engine.rake"
2221

22+
load "rails/tasks/statistics.rake"
2323

24+
require "bundler/gem_tasks"
2425

25-
require 'bundler/gem_tasks'
26-
27-
require 'rake/testtask'
26+
require "rake/testtask"
2827

2928
Rake::TestTask.new(:test) do |t|
30-
t.libs << 'test'
31-
t.pattern = 'test/**/*_test.rb'
29+
t.libs << "test"
30+
t.pattern = "test/**/*_test.rb"
3231
t.verbose = false
3332
end
3433

35-
3634
task default: :test

app/models/form_core/application_record.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
class ApplicationRecord < ActiveRecord::Base
35
self.abstract_class = true

app/models/form_core/field.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
class Field < ApplicationRecord
35
include FormCore::Concerns::Models::Field

app/models/form_core/form.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
class Form < ApplicationRecord
35
include FormCore::Concerns::Models::Form

bin/rails

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
# This command will automatically be run when you run "rails" with Rails gems
35
# installed from the root of your application.
46

5-
ENGINE_ROOT = File.expand_path('../..', __FILE__)
6-
ENGINE_PATH = File.expand_path('../../lib/form_core/engine', __FILE__)
7-
APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
7+
ENGINE_ROOT = File.expand_path("../..", __FILE__)
8+
ENGINE_PATH = File.expand_path("../../lib/form_core/engine", __FILE__)
9+
APP_PATH = File.expand_path("../../test/dummy/config/application", __FILE__)
810

911
# Set up gems listed in the Gemfile.
10-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
11-
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
13+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
1214

13-
require 'rails/all'
14-
require 'rails/engine/commands'
15+
require "rails/all"
16+
require "rails/engine/commands"

form_core.gemspec

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$:.push File.expand_path("../lib", __FILE__)
24

35
# Maintain your gem's version:
@@ -15,7 +17,7 @@ Gem::Specification.new do |s|
1517
A Rails engine providing ability to generate dynamic form.
1618
It's would make such as dynamic fields of model or questionnaire easily.
1719
TEXT
18-
s.license = "MIT"
20+
s.license = "MIT"
1921

2022
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
2123

lib/form_core.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "form_core/engine"
24
require "form_core/errors"
35

lib/form_core/coder.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
class Coder
35
attr_reader :object_class

lib/form_core/coders/hash_coder.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "yaml"
24

35
module FormCore

lib/form_core/coders/yaml_coder.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "yaml"
24

35
module FormCore

lib/form_core/concerns/models/field.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore::Concerns
24
module Models
35
module Field
@@ -74,7 +76,6 @@ def interpret_validations_to(model, accessibility, overrides = {})
7476
end
7577

7678
def interpret_extra_to(_model, _accessibility, _overrides = {})
77-
7879
end
7980

8081
def check_model_validity!(model)

lib/form_core/concerns/models/form.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore::Concerns
24
module Models
35
module Form

lib/form_core/engine.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
class Engine < ::Rails::Engine
35
isolate_namespace FormCore

lib/form_core/errors.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
# = Form Core Errors
35
#

lib/form_core/version.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module FormCore
24
VERSION = "0.0.5"
35
end

lib/form_core/virtual_model.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "duck_record"
24

35
module FormCore

lib/tasks/form_core_tasks.rake

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# desc "Explaining what the task does"
23
# task :form_core do
34
# # Task goes here

test/dummy/Rakefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# frozen_string_literal: true
2+
13
# Add your own tasks in files placed in lib/tasks ending in .rake,
24
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
35

4-
require_relative 'config/application'
6+
require_relative "config/application"
57

68
Rails.application.load_tasks

test/dummy/app/channels/application_cable/channel.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ApplicationCable
24
class Channel < ActionCable::Channel::Base
35
end

test/dummy/app/channels/application_cable/connection.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ApplicationCable
24
class Connection < ActionCable::Connection::Base
35
end
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class ApplicationController < ActionController::Base
24
protect_from_forgery with: :exception
35
end

test/dummy/app/controllers/dictionaries_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class DictionariesController < ApplicationController
24
before_action :set_dictionary, only: %i[edit update destroy]
35

test/dummy/app/controllers/fields/application_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Fields::ApplicationController < ApplicationController
24
before_action :set_field
35

test/dummy/app/controllers/fields/data_source_options_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
# frozen_string_literal: true
2+
13
class Fields::DataSourceOptionsController < Fields::ApplicationController
24
before_action :require_data_source_options
35
before_action :set_options
46

57
def edit
6-
78
end
89

910
def update

test/dummy/app/controllers/fields/options_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
# frozen_string_literal: true
2+
13
class Fields::OptionsController < Fields::ApplicationController
24
before_action :set_options
35

46
def edit
5-
67
end
78

89
def update

0 commit comments

Comments
 (0)