These are chat archives for coala/coala-bears

10th
Feb 2017
Satwik Kansal
@satwikkansal
Feb 10 2017 21:47
If any external linter outputs a patch file, is it possible to directly create a coalib.results.Diff object from it? The executable only returns the patch diff instead of the corrected file.
Satwik Kansal
@satwikkansal
Feb 10 2017 21:54
The only solution I can think of is :
  1. Save the contents of the file before executing any command
  2. Make the executable apply the patch on the file (there's a direct option for this)
  3. Load the modified file (corrected file by the executable)
  4. Replace the file with initial version
  5. Create a coalib.results.Diff object and then yield the results
Mischa Krüger
@Makman2
Feb 10 2017 21:55
@satwikkansal in this case we should implement a new output-format, like unified-diff or so (or maybe just diff)
@satwikkansal open an issue :)
@satwikkansal do you want to give it a shot also? :)
(then you don't need to hack around :3)
Satwik Kansal
@satwikkansal
Feb 10 2017 21:56
@Makman2 Okay! I'll try to resolve it :)
Mischa Krüger
@Makman2
Feb 10 2017 21:56
linter is not that easy, so if you've questions, ask :)
Satwik Kansal
@satwikkansal
Feb 10 2017 21:57
@Makman2 sure!
Satwik Kansal
@satwikkansal
Feb 10 2017 22:10
cobot new issue coala Add new output-format diff to @linter
Some executables like https://github.com/myint/docformatter output only the diff, so we need a output format to handle such outputs.
coala-bot
@coala-bot
Feb 10 2017 22:10
Here you go : coala/coala#3733
Satwik Kansal
@satwikkansal
Feb 10 2017 22:19
@Makman2 Just a quick question, is there any implementation of unified-diff parser in coalib, and in case there isn't any, should we prefer pip package like https://pypi.python.org/pypi/patch or have our own implementation?
Mischa Krüger
@Makman2
Feb 10 2017 23:46
@satwikkansal we don't have sth self-written
@satwikkansal maybe you can use https://docs.python.org/3.5/library/difflib.html