mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Reports also methods not ending with ? suffix in PredicateName rule
				
					
				
			This commit is contained in:
		
							parent
							
								
									633ed7538e
								
							
						
					
					
						commit
						b3f11913ed
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		|  | @ -30,6 +30,10 @@ module Ameba::Rule::Naming | ||||||
|         def is_valid?(x) |         def is_valid?(x) | ||||||
|           # ^^^^^^^^^ error: Favour method name 'valid?' over 'is_valid?' |           # ^^^^^^^^^ error: Favour method name 'valid?' over 'is_valid?' | ||||||
|         end |         end | ||||||
|  | 
 | ||||||
|  |         def is_valid(x) | ||||||
|  |           # ^^^^^^^^ error: Favour method name 'valid?' over 'is_valid' | ||||||
|  |         end | ||||||
|         CRYSTAL |         CRYSTAL | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ module Ameba::Rule::Naming | ||||||
|     MSG = "Favour method name '%s?' over '%s'" |     MSG = "Favour method name '%s?' over '%s'" | ||||||
| 
 | 
 | ||||||
|     def test(source, node : Crystal::Def) |     def test(source, node : Crystal::Def) | ||||||
|       return unless node.name =~ /^is_([a-z]\w*)\?$/ |       return unless node.name =~ /^is_([a-z]\w*)\??$/ | ||||||
|       alternative = $1 |       alternative = $1 | ||||||
| 
 | 
 | ||||||
|       issue_for node, MSG % {alternative, node.name}, prefer_name_location: true |       issue_for node, MSG % {alternative, node.name}, prefer_name_location: true | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue