File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
LeanCamCombi/Mathlib/Combinatorics/Additive Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 2626 run : |
2727 ! (find LeanCamCombi -name "*.lean" -type f -print0 | xargs -0 grep -E -n '^import Mathlib$')
2828
29+
2930 build_project :
3031 runs-on : ubuntu-latest
3132 name : Build project
3637 - name : Copy README.md to website/index.md
3738 run : cp README.md website/index.md
3839
40+ - name : Check LeanCamCombi.Mathlib only imports from Mathlib or LeanCamCombi.Mathlib
41+ run : |
42+ python3 scripts/check_mathlib_imports.py
43+
3944 - name : Upstreaming dashboard
4045 run : |
4146 mkdir -p website/_includes
Original file line number Diff line number Diff line change 11import Mathlib.Algebra.Order.BigOperators.Ring.Finset
22import Mathlib.Combinatorics.Additive.ApproximateSubgroup
33import Mathlib.Tactic.Bound
4+ import LeanCamCombi.ExtrProbCombi.BernoulliSeq
45
56open scoped Finset Pointwise
67
Original file line number Diff line number Diff line change 1+ import os
2+
3+ def list_files_by_type_recursive (folder_path , file_extension ):
4+ """Recursively lists all files in a folder and subfolders with the specified file extension."""
5+ matching_files = []
6+ for root , _ , files in os .walk (folder_path ):
7+ matching_files .extend (os .path .join (root , f ) for f in files if f .endswith (file_extension ))
8+ return matching_files
9+
10+ folder = "LeanCamCombi/Mathlib"
11+ extension = ".lean"
12+ files = list_files_by_type_recursive (folder , extension )
13+
14+ for file in files :
15+ code = None
16+ with open (file , "r" ) as reader :
17+ code = reader .read ()
18+ lines = code .split ("\n " )
19+ header = [line for line in lines if line .lstrip ().startswith ("import" )]
20+
21+ for imp in header :
22+ imp_file = imp .lstrip ()[len ("import" ):].strip ()
23+ if (not imp_file .startswith ("Mathlib." )) and \
24+ (not imp_file .startswith ("LeanCamCombi.Mathlib" )):
25+ raise IOError ("A file in LeanCamCombi.Mathlib imports a file not in Mathlib or LeanCamCombi.Mathlib" )
You can’t perform that action at this time.
0 commit comments