Reduce rubocop diff

This commit is contained in:
Sojan Jose
2026-01-16 01:09:07 -08:00
parent 9ef476c6d8
commit 7061c3dde0
14 changed files with 29 additions and 61 deletions
+14 -48
View File
@@ -2,8 +2,8 @@ plugins:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-factory_bot
- rubocop-rspec_rails
- rubocop-factory_bot
require:
- ./rubocop/use_from_email.rb
@@ -130,13 +130,12 @@ Rails/InverseOf:
Rails/UniqueValidationWithoutIndex:
Exclude:
- 'app/models/canned_response.rb'
- 'app/models/telegram_bot.rb'
- 'enterprise/app/models/captain_inbox.rb'
- app/models/canned_response.rb
- app/models/telegram_bot.rb
- enterprise/app/models/captain_inbox.rb
- 'app/models/channel/twitter_profile.rb'
- 'app/models/webhook.rb'
- 'app/models/contact.rb'
- 'app/models/integrations/hook.rb'
Style/ClassAndModuleChildren:
EnforcedStyle: compact
@@ -169,27 +168,6 @@ Naming/MemoizedInstanceVariableName:
Exclude:
- 'app/models/message.rb'
Naming/PredicateName:
Exclude:
- 'app/builders/messages/instagram/base_message_builder.rb'
- 'app/controllers/public/api/v1/csat_survey_controller.rb'
- 'app/controllers/public/api/v1/inboxes/messages_controller.rb'
- 'app/jobs/webhooks/line_events_job.rb'
- 'app/services/account/sign_up_email_validation_service.rb'
- 'app/services/automation_rules/condition_validation_service.rb'
- 'app/services/line/incoming_message_service.rb'
- 'app/services/search_service.rb'
- 'app/services/telegram/send_attachments_service.rb'
- 'app/services/twitter/webhook_subscribe_service.rb'
- 'app/services/whatsapp/template_parameter_converter_service.rb'
- 'enterprise/app/jobs/captain/conversation/response_builder_job.rb'
- 'enterprise/app/services/captain/tools/base_service.rb'
- 'enterprise/lib/captain/tool.rb'
- 'lib/chatwoot_app.rb'
- 'lib/custom_markdown_renderer.rb'
- 'lib/linear.rb'
- 'lib/redis/lock_manager.rb'
Style/GuardClause:
Exclude:
- 'app/builders/account_builder.rb'
@@ -201,6 +179,10 @@ Metrics/AbcSize:
Exclude:
- 'app/controllers/concerns/auth_helper.rb'
- 'app/models/integrations/hook.rb'
- 'app/models/canned_response.rb'
- 'app/models/telegram_bot.rb'
Rails/RenderInline:
Exclude:
- 'app/controllers/swagger_controller.rb'
@@ -222,6 +204,12 @@ RSpec/MultipleExpectations:
RSpec/MultipleMemoizedHelpers:
Max: 14
RSpecRails/InferredSpecType:
Enabled: false
RSpecRails/NegationBeValid:
Enabled: false
# custom rules
UseFromEmail:
Enabled: true
@@ -367,25 +355,3 @@ FactoryBot/RedundantFactoryOption:
FactoryBot/FactoryAssociationWithStrategy:
Enabled: false
# Rules disabled to keep Rails upgrade PR focused on functional changes only
Layout/EmptyLineAfterGuardClause:
Enabled: false
Performance/Count:
Enabled: false
RSpec/PredicateMatcher:
Enabled: false
RSpec/DescribeClass:
Enabled: false
Performance/MapCompact:
Enabled: false
Performance/CollectionLiteralInLoop:
Enabled: false
Style/RedundantAssignment:
Enabled: false
+2
View File
@@ -1,6 +1,8 @@
require 'rails_helper'
# rubocop:disable RSpec/DescribeClass
describe 'Markdown Embeds Configuration' do
# rubocop:enable RSpec/DescribeClass
let(:config) { YAML.load_file(Rails.root.join('config/markdown_embeds.yml')) }
describe 'YAML structure' do
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe DeviseOverrides::SessionsController do
RSpec.describe DeviseOverrides::SessionsController, type: :controller do
include Devise::Test::ControllerHelpers
before do
+1 -1
View File
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe ReportingEventHelper do
RSpec.describe ReportingEventHelper, type: :helper do
describe '#last_non_human_activity' do
let(:account) { create(:account) }
let(:inbox) { create(:inbox, account: account) }
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe AutoAssignment::AssignmentJob do
RSpec.describe AutoAssignment::AssignmentJob, type: :job do
let(:account) { create(:account) }
let(:inbox) { create(:inbox, account: account, enable_auto_assignment: true) }
let(:agent) { create(:user, account: account, role: :agent, availability: :online) }
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe AutoAssignment::PeriodicAssignmentJob do
RSpec.describe AutoAssignment::PeriodicAssignmentJob, type: :job do
let(:account) { create(:account) }
let(:inbox) { create(:inbox, account: account, enable_auto_assignment: true) }
let(:assignment_policy) { create(:assignment_policy, account: account) }
+1 -1
View File
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe Contacts::BulkActionJob do
RSpec.describe Contacts::BulkActionJob, type: :job do
let(:account) { create(:account) }
let(:user) { create(:user, account: account) }
let(:params) { { 'ids' => [1], 'labels' => { 'add' => ['vip'] } } }
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe ConversationReplyEmailJob do
RSpec.describe ConversationReplyEmailJob, type: :job do
let(:conversation) { create(:conversation) }
let(:mailer) { double }
let(:mailer_action) { double }
+1 -1
View File
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe DeleteObjectJob do
RSpec.describe DeleteObjectJob, type: :job do
describe '#perform' do
context 'when object is heavy (Inbox)' do
let!(:account) { create(:account) }
+2 -2
View File
@@ -143,13 +143,13 @@ RSpec.describe Account do
context 'when auto_resolve_after' do
it 'validates minimum value' do
account.settings = { auto_resolve_after: 4 }
expect(account).not_to be_valid
expect(account).to be_invalid
expect(account.errors.messages).to eq({ auto_resolve_after: ['must be greater than or equal to 10'] })
end
it 'validates maximum value' do
account.settings = { auto_resolve_after: 1_439_857 }
expect(account).not_to be_valid
expect(account).to be_invalid
expect(account.errors.messages).to eq({ auto_resolve_after: ['must be less than or equal to 1439856'] })
end
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe 'Conversation Audit' do
RSpec.describe 'Conversation Audit', type: :model do
let(:account) { create(:account) }
let(:conversation) { create(:conversation, account: account) }
+1 -1
View File
@@ -41,7 +41,7 @@ end
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_paths = [Rails.root.join('spec/fixtures')]
config.fixture_path = Rails.root.join('spec/fixtures')
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe 'Api::V1::Accounts::BaseController' do
RSpec.describe 'Api::V1::Accounts::BaseController', type: :request do
let(:account) { create(:account) }
let(:inbox) { create(:inbox, account: account) }
let!(:conversation) { create(:conversation, account: account, inbox: inbox) }
@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe 'MFA API' do
RSpec.describe 'MFA API', type: :request do
before do
skip('Skipping since MFA is not configured in this environment') unless Chatwoot.encryption_configured?
allow(Chatwoot).to receive(:mfa_enabled?).and_return(true)