Make upstream's remove_unused_imports.py to be usable at Brave repo (#18903)

This PR introduces remove_unused_imports.sh script which wraps the same
upstream's tool and makes it usable at Brave repo.

Fixes brave/brave-browser#31045
This commit is contained in:
AlexeyBarabash
2023-06-16 12:05:56 +03:00
committed by GitHub
parent 92e8bf8394
commit 16169dfe09
3 changed files with 48 additions and 5 deletions
+1 -5
View File
@@ -391,15 +391,11 @@ def CheckJavaStyle(_original_check, input_api, output_api):
if warnings:
ret.append(output_api.PresubmitPromptWarning('\n'.join(warnings)))
if errors:
remove_unused_imports_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), 'tools', 'android', 'checkstyle',
'remove_unused_imports.py')
msg = '\n'.join(errors)
if 'Unused import:' in msg or 'Duplicate import' in msg:
msg += """
To remove unused imports: """ + input_api.os_path.relpath(
remove_unused_imports_path, local_path)
To remove unused imports: ./tools/android/checkstyle/remove_unused_imports.sh"""
ret.append(output_api.PresubmitError(msg))
return ret