~chimo/dotfiles

a6db1a5e46347f5694d2855dc8c726ec50fbd644 — chimo a month ago 7966955
Fix ruff error parsing, remove "fix" related lines.
2 files changed, 4 insertions(+), 13 deletions(-)

M .local/bin/libs/ruff.sh
M .vim/compiler/ruff.vim
M .local/bin/libs/ruff.sh => .local/bin/libs/ruff.sh +3 -12
@@ 19,18 19,9 @@ main() (
    # ex: "foo.sh" to "/home/samsepi0l/foo.sh"
    filepath=$(readlink -f -- "${file}")

    set +e
    output=$(incus exec "${container_name}" -- sh -c "ruff check -" < "${filepath}")
    set -e

    # Replace "-" with the actual filepath of the file.
    # ruff returns it as "-" since it validated from stdin, but in the
    # error message, we need it to be the filepath so that vim can jump to
    # the proper error location in the file.
    #
    # Note: not using `sed` here because the variable could inevitably contain
    #       the chosen sed delimiter.
    echo "${output}" | awk '{sub(/^-:/, "'"${filepath}"':"); print}'
    incus exec "${container_name}" -- sh -c "ruff check -e --stdin-filename ${file} -" < "${filepath}" | 
        sed -E '/^Found [0-9]+ errors.$/d' |
        sed -E '/^\[\*\] [0-9]+ fixable/d'
)



M .vim/compiler/ruff.vim => .vim/compiler/ruff.vim +1 -1
@@ 4,5 4,5 @@ endif
let current_compiler = "ruff"

CompilerSet makeprg=ruff.sh\ \"%:p\"
CompilerSet errorformat=%f:%l:%c:\ %t%n\ %m
CompilerSet errorformat=%f:%l:%c:\ %m