Last active
February 27, 2023 17:17
-
-
Save lazymutt/ab2d5af02917683d60991b945c251055 to your computer and use it in GitHub Desktop.
Runs pylint against the current window/tab in BBEdit, displays results in new window. Now allows longer maximum line length!
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
-- Copyright (c) 2017 University of Utah Student Computing Labs. | |
-- All Rights Reserved. | |
-- | |
-- Permission to use, copy, modify, and distribute this software and | |
-- its documentation for any purpose and without fee is hereby granted, | |
-- provided that the above copyright notice appears in all copies and | |
-- that both that copyright notice and this permission notice appear | |
-- in supporting documentation, and that the name of The University | |
-- of Utah not be used in advertising or publicity pertaining to | |
-- distribution of the software without specific, written prior | |
-- permission. This software is supplied as is without expressed or | |
-- implied warranties of any kind. | |
-- | |
-- | |
-- pylint.scpt | |
-- 04/17/17, v1.0, todd.mcdaniel@utah.edu | |
-- | |
-- Runs pylint against the current BBEdit document, displays results in new window. | |
-- Requires pylint to be installed. | |
-- Save this script in ~/Library/Application\ Support/BBEdit/Scripts/pylint.scpt | |
-- | |
-- | |
tell application "BBEdit" | |
activate | |
set filename to file of text window 1 | |
set docname to name of text window 1 | |
end tell | |
set this_date to current date | |
set window_name to "pylint output for " & docname & " on " & this_date | |
do shell script "/usr/local/bin/pylint --max-line-length=240 -ry " & quoted form of the POSIX path of filename & " | /usr/bin/pbcopy" | |
tell application "BBEdit" | |
activate | |
do shell script "pbpaste | /usr/local/bin/bbedit --clean --new-window -t '" & window_name & "'" | |
tell application "System Events" to key code 115 | |
end tell |
Thank you for figuring that out! I realized my script isn't what I currently use, so I edited the gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you revise the pipe output in the shell script command you can avoid overwriting the contents of the clipboard
set result to do shell script "/usr/local/bin/pylint --max-line-length=240 -ry " & quoted form of the POSIX path of filename & " | more"
then instead of the
paste
command you can callset text of front document to result
For whatever reason, if you do not pipe the output of pylint and use the
set result to
command, Applescript returns an error.