@@ -7,7 +7,7 @@ class QcWarning
77
88 # Attributes supported for warnings
99 @@attributes = %i[
10- scope validity_test
10+ scope failure
1111 message link_text link_to rules recommendations rule_notes
1212 can_endorse link_public checklist area
1313 ]
@@ -46,7 +46,7 @@ class QcWarning
4646 candidatus_modifier : {
4747 message : 'The name has a Candidatus modifier that should be removed' ,
4848 area : :nomenclature ,
49- validity_test : lambda { |w | w . name . candidatus? }
49+ failure : lambda { |w | w . name . candidatus? }
5050 } . merge ( @@link_to_edit_spelling ) ,
5151 inconsistent_syllabification : {
5252 message : 'The syllabification does not correspond to the proposed ' \
@@ -121,7 +121,8 @@ class QcWarning
121121 link_text : 'Define rank' ,
122122 link_to : lambda { |w | [ :edit_rank , w . name ] } ,
123123 recommendations : %w[ 7 ] ,
124- rules : %w[ 26.4 ]
124+ rules : %w[ 26.4 ] ,
125+ failure : lambda { |w | !w . name . rank? }
125126 } ,
126127 missing_parent : {
127128 message : 'The taxon has not been assigned to a higher classification' ,
@@ -874,14 +875,16 @@ def <<(qc)
874875
875876 ##
876877 # Uses the quality check definition to evaluate it in the current name and
877- # returns +false+ if it's out of scope or the test is valid (i.e., not a
878- # concern for the present name), +true+ if it's in scope and the test is not
879- # valid (i.e., a concern), or +nil+ if no validity test is defined
878+ # returns:
879+ # - +nil+ if the failure test is undefined
880+ # - +false+ if the name is out of scope or the failure test is not triggered
881+ # (i.e., not a concern)
882+ # - +true+ if the name is in scope and the failure test is triggered
883+ # (i.e., a concern)
880884 def evaluate ( type , opts = { } )
881885 qc = QcWarning . new ( type , opts . merge ( name : name ) )
882- return unless qc . variable_validity_test
883- return false unless qc . scope
884- return false unless qc . validity_test
886+ return unless qc . variable_failure
887+ return false unless qc . scope && qc . failure
885888
886889 self << qc
887890 true
@@ -953,7 +956,6 @@ def qc_warnings
953956 @qc_warnings = QcWarningSet . new ( self )
954957 return @qc_warnings if inferred_rank == 'domain'
955958
956- #@qc_warnings.add(:candidatus_modifier) if candidatus?
957959 @qc_warnings . evaluate ( :candidatus_modifier )
958960 @qc_warnings . add ( :missing_rank ) unless rank?
959961 @qc_warnings . add ( :identical_base_name ) unless identical_base_name . nil?
0 commit comments