@@ -44,7 +44,12 @@ fn is_cursor_rules_file(path: &Path) -> bool {
4444 return true ;
4545 }
4646
47- ( filename. ends_with ( ".md" ) || filename. ends_with ( ".mdc" ) ) && is_path_under_cursor_rules ( path)
47+ path. extension ( )
48+ . and_then ( |extension| extension. to_str ( ) )
49+ . is_some_and ( |extension| {
50+ extension. eq_ignore_ascii_case ( "md" ) || extension. eq_ignore_ascii_case ( "mdc" )
51+ } )
52+ && is_path_under_cursor_rules ( path)
4853}
4954
5055impl Validator for ClaudeMdValidator {
@@ -404,28 +409,29 @@ mod tests {
404409 fn test_cursor_rules_mdc_gets_rules ( ) {
405410 let content = "Be helpful and accurate when responding." ;
406411 let validator = ClaudeMdValidator ;
407- let diagnostics = validator. validate (
408- Path :: new ( ".cursor/rules/typescript.mdc" ) ,
409- content,
410- & LintConfig :: default ( ) ,
411- ) ;
412412
413- assert ! ( !diagnostics. is_empty( ) ) ;
414- assert ! ( diagnostics. iter( ) . any( |d| d. rule == "CC-MEM-005" ) ) ;
413+ for path in [
414+ ".cursor/rules/typescript.mdc" ,
415+ ".cursor/rules/typescript.MDC" ,
416+ ] {
417+ let diagnostics = validator. validate ( Path :: new ( path) , content, & LintConfig :: default ( ) ) ;
418+
419+ assert ! ( !diagnostics. is_empty( ) ) ;
420+ assert ! ( diagnostics. iter( ) . any( |d| d. rule == "CC-MEM-005" ) ) ;
421+ }
415422 }
416423
417424 #[ test]
418425 fn test_cursor_rules_md_gets_rules ( ) {
419426 let content = "Be helpful and accurate when responding." ;
420427 let validator = ClaudeMdValidator ;
421- let diagnostics = validator. validate (
422- Path :: new ( ".cursor/rules/typescript.md" ) ,
423- content,
424- & LintConfig :: default ( ) ,
425- ) ;
426428
427- assert ! ( !diagnostics. is_empty( ) ) ;
428- assert ! ( diagnostics. iter( ) . any( |d| d. rule == "CC-MEM-005" ) ) ;
429+ for path in [ ".cursor/rules/typescript.md" , ".cursor/rules/typescript.MD" ] {
430+ let diagnostics = validator. validate ( Path :: new ( path) , content, & LintConfig :: default ( ) ) ;
431+
432+ assert ! ( !diagnostics. is_empty( ) ) ;
433+ assert ! ( diagnostics. iter( ) . any( |d| d. rule == "CC-MEM-005" ) ) ;
434+ }
429435 }
430436
431437 #[ test]
0 commit comments