Page MenuHomePhorge

Looking for docs/info on SEVERITY_AUTOFIX
Closed, ResolvedPublic

Asked by blundell on Aug 9 2022, 09:45.

Details

I've got my linter setup to run KtLint and then pass back the results to arc

KtLint will update my files to fix minor problems, and so I assume using SEVERITY_AUTOFIX tells arc that this was an issue but now its fixed. Then arc can offer to commit/amend the change?

$message->setLine($error->line + 1);
$message->setChar($error->column_start + 1);
$message->setDescription($error->message);
$message->setOriginalText($error->code_line);
$message->setReplacementText($error->fixed_code_line);
$message->setSeverity(ArcanistLintSeverity::SEVERITY_AUTOFIX);

However I am see'ing some strange behaviour where code is getting mangled and removed/replaced by arc.

Am I mistaken and this is not how autofix works? Is arc taking the original text and replacement text and also attempting to change my code?

I read the original patch: https://we.phorge.it/rARC14d49d25658f15e8e6ac94bbb7533565135175dc but that did not clear it up for me.

Does arc modify your code when you set the severity to AUTOFIX? And if so can I disable that whilst still showing automatically fixed lint errors and having arc prompt to amend the commit?

Answers

blundell
Updated 55 Days Ago

Of course, as soon as you ask a question you figure the answer.

arc lint --never-apply-patches

never-apply-patches stops arc from patching :-) (because Ktlint already did it).

The source which shows arc patching the changes: https://github.com/phacility/arcanist/blob/master/src/workflow/ArcanistLintWorkflow.php#L285-L320

New Answer

Answer

This question has been marked as closed, but you can still leave a new answer.