mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Merge pull request #438 from crystal-ameba/add-error-as-allowed-variable-name
Add `error` to the `RescuedExceptionsVariableName#allowed_names`
This commit is contained in:
		
						commit
						46a42ee9e8
					
				
					 2 changed files with 4 additions and 4 deletions
				
			
		|  | @ -21,7 +21,7 @@ module Ameba::Rule::Naming | ||||||
|         def foo |         def foo | ||||||
|           raise "foo" |           raise "foo" | ||||||
|         rescue wtf |         rescue wtf | ||||||
|         # ^^^^^^^^ error: Disallowed variable name, use one of these instead: 'e', 'ex', 'exception' |         # ^^^^^^^^ error: Disallowed variable name, use one of these instead: 'e', 'ex', 'exception', 'error' | ||||||
|           nil |           nil | ||||||
|         end |         end | ||||||
|         CRYSTAL |         CRYSTAL | ||||||
|  | @ -31,7 +31,7 @@ module Ameba::Rule::Naming | ||||||
|       context "#allowed_names" do |       context "#allowed_names" do | ||||||
|         it "returns sensible defaults" do |         it "returns sensible defaults" do | ||||||
|           rule = RescuedExceptionsVariableName.new |           rule = RescuedExceptionsVariableName.new | ||||||
|           rule.allowed_names.should eq %w[e ex exception] |           rule.allowed_names.should eq %w[e ex exception error] | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         it "allows setting custom names" do |         it "allows setting custom names" do | ||||||
|  |  | ||||||
|  | @ -22,12 +22,12 @@ module Ameba::Rule::Naming | ||||||
|   # ``` |   # ``` | ||||||
|   # Naming/RescuedExceptionsVariableName: |   # Naming/RescuedExceptionsVariableName: | ||||||
|   #   Enabled: true |   #   Enabled: true | ||||||
|   #   AllowedNames: [e, ex, exception] |   #   AllowedNames: [e, ex, exception, error] | ||||||
|   # ``` |   # ``` | ||||||
|   class RescuedExceptionsVariableName < Base |   class RescuedExceptionsVariableName < Base | ||||||
|     properties do |     properties do | ||||||
|       description "Makes sure that rescued exceptions variables are named as expected" |       description "Makes sure that rescued exceptions variables are named as expected" | ||||||
|       allowed_names %w[e ex exception] |       allowed_names %w[e ex exception error] | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     MSG          = "Disallowed variable name, use one of these instead: '%s'" |     MSG          = "Disallowed variable name, use one of these instead: '%s'" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue