Skip to content

Support for absolute paths in linter output #125

@perlun

Description

@perlun

Hi,

Thanks for a nice tool. 👍

When trying to set up buf for linting inside IntellIJ, as an external tool, I found out that buf's current semantics of printing the relative paths does not play so well with IntelliJ's expectation that paths should be absolute (https://www.jetbrains.com/help/idea/settings-tools-create-edit-copy-tool-dialog.html, under "Output Filters").

I managed to work around this by using the following script, which makes the linter errors be clickable references in IntelliJ which is really nice. However, it feels like a bit of a hack. Any other ways to support this?

#!/bin/sh

#
# Wrapper for buf, to make it usable inside IntelliJ IDEA.
#
# By using the "External Tool" functionality, it is possible to make IntelliJ understand the output 
# from the 'buf' tool. However, for this to work, the paths printed must be absolute paths. This 
# script works around this, adding $(pwd)/ as prefix to each line printed in the buf output.
#

buf check lint | sed -e "s%^%$(pwd)/%"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions