mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Refactor rules’ default group severity handling
This commit is contained in:
		
							parent
							
								
									e7a6b6b153
								
							
						
					
					
						commit
						3b7cd3723c
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -255,9 +255,8 @@ class Ameba::Config
 | 
				
			||||||
      {% end %}
 | 
					      {% end %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      {% if properties["severity".id] == nil %}
 | 
					      {% if properties["severity".id] == nil %}
 | 
				
			||||||
        {% default = @type.name.starts_with?("Ameba::Rule::Lint") ? "Ameba::Severity::Warning".id : "Ameba::Severity::Convention".id %}
 | 
					 | 
				
			||||||
        @[YAML::Field(key: "Severity", converter: Ameba::SeverityYamlConverter)]
 | 
					        @[YAML::Field(key: "Severity", converter: Ameba::SeverityYamlConverter)]
 | 
				
			||||||
        property severity = {{ default }}
 | 
					        property severity = {{ @type }}.default_severity
 | 
				
			||||||
      {% end %}
 | 
					      {% end %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      {% if properties["excluded".id] == nil %}
 | 
					      {% if properties["excluded".id] == nil %}
 | 
				
			||||||
| 
						 | 
					@ -267,6 +266,14 @@ class Ameba::Config
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    macro included
 | 
					    macro included
 | 
				
			||||||
 | 
					      GROUP_SEVERITY = {
 | 
				
			||||||
 | 
					        Lint: Ameba::Severity::Warning,
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      class_getter default_severity : Ameba::Severity do
 | 
				
			||||||
 | 
					        GROUP_SEVERITY[group_name]? || Ameba::Severity::Convention
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      macro inherited
 | 
					      macro inherited
 | 
				
			||||||
        include YAML::Serializable
 | 
					        include YAML::Serializable
 | 
				
			||||||
        include YAML::Serializable::Strict
 | 
					        include YAML::Serializable::Strict
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue