nomicode/wip-lintfree

Wrap `diff` functionality into Obelist

Opened this issue · 0 comments

At the moment, I can generate line-based annotations from tools that produce diff-based output. This approach is clumsy, and I don't want to re-implement this multiple times in multiple repositories.

Problems:

  • Some tools will only modify files in place. These tools need to be wrapped so that a temporary copy of the file is created, modified, and then compared to the original. Other tools can print diffs without modifying the files. Both types of tools need to be accommodated.

  • Some tools can only be used on one file at a time. Other tools can be run on multiple files at once. Both types of tools need to be accommodated.

Possible approaches:

  • A new subcommand that genericizes the job of a wrapper script (i.e., handles copying files, producing diffs, and so on) and can be used with any third-party tool.

  • A new diff parser that reads in a diff (or diffs) and produces a set of line-based annotations.

  • Extend the parser configuration for tools like this so that you can specify the command to run, how the diffs should be generated, and so on. Then, instead of running the lint command with a wrapper and passing the results to obelist parse. You could do something like obelist run and have the end-to-end process handled for you.