From 417d0ba59c56cb9261505f0353f9d93e9f1abfac Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 31 Jan 2025 16:13:27 +0100 Subject: [PATCH] docs: add new-from-merge-base inside FAQ --- docs/src/docs/welcome/faq.mdx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/src/docs/welcome/faq.mdx b/docs/src/docs/welcome/faq.mdx index a04162201954..a8372a774759 100644 --- a/docs/src/docs/welcome/faq.mdx +++ b/docs/src/docs/welcome/faq.mdx @@ -76,17 +76,20 @@ Or you can create a [GitHub Issue](https://github.com/golangci/golangci-lint/iss We are sure that every project can easily integrate `golangci-lint`, even the large one. -The idea is to not fix all existing issues. Fix only newly added issue: issues in new code. -To do this setup CI to run `golangci-lint` with option `--new-from-rev=HEAD~1`. +The idea is to not fix all existing issues. +Fix only newly added issue: issues in new code. -Also, take a look at option `--new`, but consider that CI scripts that generate unstaged files will make `--new` only point out issues in those files and not in the last commit. -In that regard `--new-from-rev=HEAD~1` is safer. +To do this setup CI to run `golangci-lint` with options `--new-from-merge-base=main` or `--new-from-rev=HEAD~1`. + +Also, take a look at option `--new`, +but consider that CI scripts that generate unstaged files will make `--new` only point out issues in those files and not in the last commit. +In that regard `--new-from-merge-base=main` or `--new-from-rev=HEAD~1` are safer. By doing this you won't create new issues in your code and can choose fix existing issues (or not). -## Why `--new-from-rev` or `--new-from-patch` don't seem to be working in some cases? +## Why `--new-from-xxx` don't seem to be working in some cases? -The options `--new-from-rev` and `--new-from-patch` work by comparing `git diff` output and issues. +The options `--new-from-merge-base`, `--new-from-rev`, and `--new-from-patch` work by comparing `git diff` output and issues. If an issue is not reported as the same line as the changes then the issue will be skipped. This is the line of the issue is not inside the lines changed.