88from all_repos .config import Config
99from all_repos .grep import repos_matching
1010
11-
12- APPVEYOR = 'appveyor.yml'
13- TRAVIS = '.travis.yml'
11+ REPLACES = (
12+ (
13+ 'appveyor.yml' ,
14+ r'%USERPROFILE%\.pre-commit' ,
15+ r'%USERPROFILE%\.cache\pre-commit' ,
16+ ),
17+ (
18+ '.travis.yml' ,
19+ '$HOME/.pre-commit' ,
20+ '$HOME/.cache/pre-commit' ,
21+ ),
22+ )
1423
1524
1625def find_repos (config : Config ) -> set [str ]:
17- return (
18- repos_matching (config , ('$HOME/.pre-commit' , '--' , TRAVIS )) |
19- repos_matching (config , (r'%USERPROFILE%\\.pre-commit' , '--' , APPVEYOR ))
20- )
26+ return {
27+ repo
28+ for fname , pattern , _ in REPLACES
29+ for repo in repos_matching (config , ('-F' , pattern , '--' , fname ))
30+ }
2131
2232
2333def _replace_if_exists (filename : str , s1 : str , s2 : str ) -> None :
@@ -30,11 +40,8 @@ def _replace_if_exists(filename: str, s1: str, s2: str) -> None:
3040
3141
3242def apply_fix () -> None :
33- _replace_if_exists (TRAVIS , '$HOME/.pre-commit' , '$HOME/.cache/pre-commit' )
34- _replace_if_exists (
35- APPVEYOR ,
36- r'%USERPROFILE%\.pre-commit' , r'%USERPROFILE%\.cache\pre-commit' ,
37- )
43+ for fname , find , replace in REPLACES :
44+ _replace_if_exists (fname , find , replace )
3845
3946
4047def main (argv : Sequence [str ] | None = None ) -> int :
0 commit comments