Last active
February 11, 2018 15:35
-
-
Save dafi/aa76122e0eea10775f523a39b7cc18db to your computer and use it in GitHub Desktop.
Show ktlint results on logcat to simplify navigation between warnings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Run klint (https://github.com/shyiko/ktlint) and then write the result to logcat | |
# The file names are clickeable from Android Studio | |
tag_name="klint" | |
tmpfile=$(mktemp) | |
chmod +x $tmpfile | |
dquote='"' | |
ktlint "app/src/**/*kt" \ | |
| sed -nE 's/^.*\/(.*):([0-9]+):([0-9]+):/$tag_name: (\1:\2) column \3/p' \ | |
| sed -e 's/(/\\(/g' -e 's/)/\\)/g' \ | |
| while read -r line; do echo adb shell "log -p v -t $tag_name ${dquote}${line}${dquote}" >> $tmpfile; done | |
$tmpfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment