mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 11:08:04 +00:00 
			
		
		
		
	fix: remove rubocop rule (#8985)
* fix: remove rubocop rule * chore: remove ignore comment * chore: remove ignore comment
This commit is contained in:
		| @@ -2,7 +2,6 @@ require: | ||||
|   - rubocop-performance | ||||
|   - rubocop-rails | ||||
|   - rubocop-rspec | ||||
|   - ./lib/rubocop/user_find_by.rb | ||||
|  | ||||
| Layout/LineLength: | ||||
|   Max: 150 | ||||
| @@ -141,10 +140,6 @@ RSpec/MultipleExpectations: | ||||
| RSpec/MultipleMemoizedHelpers: | ||||
|   Max: 14 | ||||
|  | ||||
| # custom rules | ||||
| UseFromEmail: | ||||
|   Enabled: true | ||||
|  | ||||
| AllCops: | ||||
|   NewCops: enable | ||||
|   Exclude: | ||||
|   | ||||
| @@ -168,9 +168,7 @@ class Contact < ApplicationRecord | ||||
|   end | ||||
|  | ||||
|   def self.from_email(email) | ||||
|     # rubocop:disable UseFromEmail,Migration/DepartmentName | ||||
|     find_by(email: email.downcase) | ||||
|     # rubocop:enable UseFromEmail,Migration/DepartmentName | ||||
|   end | ||||
|  | ||||
|   private | ||||
|   | ||||
| @@ -157,9 +157,7 @@ class User < ApplicationRecord | ||||
|   end | ||||
|  | ||||
|   def self.from_email(email) | ||||
|     # rubocop:disable UseFromEmail,Migration/DepartmentName | ||||
|     find_by(email: email.downcase) | ||||
|     # rubocop:enable UseFromEmail,Migration/DepartmentName | ||||
|   end | ||||
|  | ||||
|   private | ||||
|   | ||||
| @@ -1,16 +0,0 @@ | ||||
| require 'rubocop' | ||||
|  | ||||
| # Enforces use of from_email for email attribute lookups | ||||
| class UseFromEmail < RuboCop::Cop::Cop | ||||
|   MSG = 'Use `from_email` for email lookups to ensure case insensitivity.'.freeze | ||||
|  | ||||
|   def_node_matcher :find_by_email?, <<~PATTERN | ||||
|     (send _ :find_by (hash (pair (sym :email) _))) | ||||
|   PATTERN | ||||
|  | ||||
|   def on_send(node) | ||||
|     return unless find_by_email?(node) | ||||
|  | ||||
|     add_offense(node, message: MSG) | ||||
|   end | ||||
| end | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mishra
					Shivam Mishra