blob: 2009d0e29a3dbe8e21308b4b59ec1618b2064248 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import os
def get_ruff_config(path, config_paths, arc_root):
# type(str, dict, str) -> Optional[str]
relative_path = os.path.relpath(path, arc_root)
# find longest path
deepest_path = ''
for p in config_paths.keys():
if relative_path.startswith(p) and len(p) > len(deepest_path):
deepest_path = p
if deepest_path:
config = config_paths[deepest_path]
full_config_path = os.path.join(arc_root, config)
return full_config_path
return None
|