Skip to content

Commit 52a5582

Browse files
chore: lint files (#2)
* chore: lint files * chore: suppress warning * chore: disable suggest extensions * chore: do not stage changes in pre-commit * chore: remove git add from FE lint and `-a` flag from rubocop on husky
1 parent 1d6b15b commit 52a5582

32 files changed

+54
-51
lines changed

.husky/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
npx --no-install lint-staged
66

77
# lint only staged ruby files
8-
git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop --force-exclusion -a
8+
git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop --force-exclusion
99

1010
# stage rubocop changes to files
11-
git diff --name-only --cached | xargs git add
11+
# git diff --name-only --cached | xargs git add

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ CustomCopLocation:
154154

155155
AllCops:
156156
NewCops: enable
157+
SuggestExtensions: false
157158
Exclude:
158159
- 'bin/**/*'
159160
- 'db/schema.rb'
@@ -166,3 +167,6 @@ AllCops:
166167
- 'tmp/**/*'
167168
- 'storage/**/*'
168169
- 'db/migrate/20230426130150_init_schema.rb'
170+
171+
Layout/LeadingCommentSpace:
172+
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ gem 'down'
4040
# authentication type to fetch and send mail over oauth2.0
4141
gem 'gmail_xoauth'
4242
# Lock net-smtp to 0.3.4 to avoid issues with gmail_xoauth2
43-
gem 'net-smtp', '~> 0.3.4'
43+
gem 'net-smtp', '~> 0.3.4'
4444
# Prevent CSV injection
4545
gem 'csv-safe'
4646

app/actions/contact_identify_action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def existing_phone_number_contact
6969
end
7070

7171
def merge_contacts?(existing_contact, key)
72-
return if existing_contact.blank?
72+
return false if existing_contact.blank?
7373

7474
return true if params[:identifier].blank?
7575

app/builders/messages/instagram/message_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def already_sent_from_chatwoot?
166166
end
167167

168168
def all_unsupported_files?
169-
return if attachments.empty?
169+
return false if attachments.empty?
170170

171171
attachments_type = attachments.pluck(:type).uniq.first
172172
unsupported_file_type?(attachments_type)

app/controllers/api/v1/accounts/automation_rules_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def update
2424
ActiveRecord::Base.transaction do
2525
automation_rule_update
2626
process_attachments
27-
2827
rescue StandardError => e
2928
Rails.logger.error e
3029
render json: { error: @automation_rule.errors.messages }.to_json, status: :unprocessable_entity

app/controllers/api/v1/widget/conversations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def trigger_typing_event(event)
8282
end
8383

8484
def render_not_found_if_empty
85-
return head :not_found if conversation.nil?
85+
head :not_found if conversation.nil?
8686
end
8787

8888
def permitted_params

app/controllers/api_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def index
1212

1313
def redis_status
1414
r = Redis.new(Redis::Config.app)
15-
return 'ok' if r.ping
15+
'ok' if r.ping
1616
rescue Redis::CannotConnectError
1717
'failing'
1818
end

app/controllers/super_admin/account_users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def create
66
resource = resource_class.new(resource_params)
77
authorize_resource(resource)
88

9-
notice = resource.save ? translate_with_resource('create.success') : resource.errors.full_messages.first
9+
notice = resource.save ? translate_with_resource('create.success') : resource.errors.full_messages.first
1010
redirect_back(fallback_location: [namespace, resource.account], notice: notice)
1111
end
1212

app/helpers/reporting_event_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def working_hour_range(working_hour)
5252
end
5353

5454
def format_time(hour, minute)
55-
hour = hour < 10 ? "0#{hour}" : hour
56-
minute = minute < 10 ? "0#{minute}" : minute
55+
hour = "0#{hour}" if hour < 10
56+
minute = "0#{minute}" if minute < 10
5757
"#{hour}:#{minute}"
5858
end
5959
end

0 commit comments

Comments
 (0)