Skip to content

Commit a4b0901

Browse files
authored
Update tools/maint/find_unused_settings.py. NFC (#25686)
Now it also find settings that are not used in JS, so we can potentially move them from `settings_internal.js` to python-only.
1 parent ea48160 commit a4b0901

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/maint/find_unused_settings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@
1818

1919

2020
def main():
21+
print(f'Searching {len(settings.internal_settings)} internal settings')
22+
for key in settings.internal_settings:
23+
cmd = ['git', 'grep', '-q', f'\\<{key}\\>', '*.mjs', '*.js', ':(exclude)src/settings.js', ':(exclude)src/settings_internal.js']
24+
if subprocess.run(cmd, check=False).returncode:
25+
print('NOT FOUND IN JS:', key)
26+
2127
print(f'Searching {len(settings.attrs)} settings')
2228
for key in settings.attrs:
2329
cmd = ['git', 'grep', '-q', f'\\<{key}\\>', ':(exclude)src/settings.js', ':(exclude)src/settings_internal.js']
24-
print('CHECKING:', key)
2530
# git grep returns 0 if there is a match and non-zero when there is not
2631
if subprocess.run(cmd, check=False).returncode:
27-
print('NOT FOUND: ', key)
32+
print('NOT FOUND ANYWHERE:', key)
2833

2934

3035
if __name__ == '__main__':

0 commit comments

Comments
 (0)