Skip to content

Commit db25029

Browse files
authored
Merge pull request #773 from lcreid/add-frozen-string
Add frozen_string_literal and RuboCop rule
2 parents 8005407 + 7dde3a5 commit db25029

37 files changed

+91
-8
lines changed

.rubocop.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ AllCops:
2525
- gemfiles/vendor/bundle/**/*
2626
- vendor/bundle/**/*
2727
- Guardfile
28+
- test/dummy/**/*
2829
- vendor/**/*
2930

3031
Layout/LineLength:
@@ -97,9 +98,6 @@ Style/DoubleNegation:
9798
Style/EmptyMethod:
9899
Enabled: false
99100

100-
Style/FrozenStringLiteralComment:
101-
Enabled: false
102-
103101
Style/NumericPredicate:
104102
Enabled: false
105103

@@ -108,3 +106,18 @@ Style/StringLiterals:
108106

109107
Style/TrivialAccessors:
110108
AllowPredicates: true
109+
110+
Style/FrozenStringLiteralComment:
111+
Enabled: true
112+
EnforcedStyle: always # or 'always' or 'never' depending on your preference
113+
SafeAutoCorrect: true # Set to true for safe autocorrection, false if you need to review changes
114+
Exclude:
115+
- ./**/Gemfile*
116+
- bootstrap_form.gemspec
117+
- Dangerfile
118+
- demo/config/**/*
119+
- demo/config.ru
120+
- demo/db/migrate/**/*
121+
- gemfiles/*
122+
- Rakefile
123+
- Vagrantfile

.yarnrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# yarn lockfile v1
33

44

5-
lastUpdateCheck 1762373771610
5+
lastUpdateCheck 1762552807228
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
class ApplicationController < ActionController::Base
24
end

demo/app/controllers/bootstrap_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class BootstrapController < ApplicationController
24
def form
35
load_models

demo/app/controllers/users_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class UsersController < ApplicationController
24
def create
35
redirect_to root_path

demo/app/helpers/bootstrap_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module BootstrapHelper
24
def form_with_source(&)
35
form_html = capture(&)

demo/app/models/address.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Address < ApplicationRecord
24
belongs_to :user
35

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class ApplicationRecord < ActiveRecord::Base
24
self.abstract_class = true
35
end

demo/app/models/faux_user.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class FauxUser
24
attr_accessor :email, :password, :comments, :misc
35

demo/app/models/model_user.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class ModelUser
24
include ActiveModel::Model
35

0 commit comments

Comments
 (0)