@@ -144,31 +144,28 @@ fn load_teams(project_root: &Path, team_file_globs: &[String]) -> std::result::R
144144}
145145
146146lazy_static ! {
147- static ref TOP_OF_FILE_TEAM_AT_REGEX : Option <Regex > = Regex :: new( r#"^(?:#|//)\s*@team\s+(.+)$"# ) . ok( ) ;
148- static ref TOP_OF_FILE_TEAM_COLON_REGEX : Option <Regex > = Regex :: new( r#"(?i)^(?:#|//)\s*team\s*:\s*(.+)$"# ) . ok( ) ;
147+ // Allow optional leading whitespace before the comment marker
148+ static ref TOP_OF_FILE_TEAM_AT_REGEX : Option <Regex > = Regex :: new( r#"^\s*(?:#|//)\s*@team\s+(.+)$"# ) . ok( ) ;
149+ static ref TOP_OF_FILE_TEAM_COLON_REGEX : Option <Regex > = Regex :: new( r#"(?i)^\s*(?:#|//)\s*team\s*:\s*(.+)$"# ) . ok( ) ;
149150}
150151
151152fn read_top_of_file_team ( path : & Path ) -> Option < String > {
152153 let content = fs:: read_to_string ( path) . ok ( ) ?;
153- for line in content. lines ( ) . take ( 15 ) {
154- if let Some ( re ) = & * TOP_OF_FILE_TEAM_AT_REGEX {
155- if let Some ( cap ) = re . captures ( line ) {
156- if let Some ( m ) = cap . get ( 1 ) {
157- return Some ( m. as_str ( ) . to_string ( ) ) ;
158- }
154+ let line = content. lines ( ) . next ( ) ? ;
155+
156+ if let Some ( re ) = & * TOP_OF_FILE_TEAM_AT_REGEX {
157+ if let Some ( cap ) = re . captures ( line ) {
158+ if let Some ( m) = cap . get ( 1 ) {
159+ return Some ( m . as_str ( ) . to_string ( ) ) ;
159160 }
160161 }
161- if let Some ( re ) = & * TOP_OF_FILE_TEAM_COLON_REGEX {
162- if let Some ( cap ) = re . captures ( line ) {
163- if let Some ( m ) = cap . get ( 1 ) {
164- return Some ( m. as_str ( ) . to_string ( ) ) ;
165- }
162+ }
163+ if let Some ( re ) = & * TOP_OF_FILE_TEAM_COLON_REGEX {
164+ if let Some ( cap ) = re . captures ( line ) {
165+ if let Some ( m) = cap . get ( 1 ) {
166+ return Some ( m . as_str ( ) . to_string ( ) ) ;
166167 }
167168 }
168- let trimmed = line. trim_start ( ) ;
169- if !( trimmed. starts_with ( '#' ) || trimmed. starts_with ( "//" ) || trimmed. is_empty ( ) ) {
170- break ;
171- }
172169 }
173170 None
174171}
0 commit comments