Skip to content

Commit 3763e1a

Browse files
committed
review
1 parent 94073d2 commit 3763e1a

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

pkg/golinters/internal/diff.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,13 @@ func parseDiffLines(h *diffpkg.Hunk) []diffLine {
214214
return diffLines
215215
}
216216

217-
func ExtractDiagnosticFromPatch(pass *analysis.Pass, file *ast.File, patch string,
218-
lintCtx *linter.Context, formatter fmtTextFormatter) error {
217+
func ExtractDiagnosticFromPatch(
218+
pass *analysis.Pass,
219+
file *ast.File,
220+
patch string,
221+
lintCtx *linter.Context,
222+
formatter fmtTextFormatter,
223+
) error {
219224
diffs, err := diffpkg.ParseMultiFileDiff([]byte(patch))
220225
if err != nil {
221226
return fmt.Errorf("can't parse patch: %w", err)

pkg/golinters/nolintlint/internal/nolintlint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (l Linter) Run(pass *analysis.Pass) ([]goanalysis.Issue, error) {
134134
if lintersText != "" && !strings.HasPrefix(lintersText, "all") {
135135
lls := strings.Split(lintersText, ",")
136136
linters = make([]string, 0, len(lls))
137-
rangeStart := (pos.Column - 1) + len("//") + len(leadingSpace) + len("nolint:")
137+
rangeStart := (pos.Column - 1) + len(commentMark) + len(leadingSpace) + len("nolint:")
138138
for i, ll := range lls {
139139
rangeEnd := rangeStart + len(ll)
140140
if i < len(lls)-1 {
@@ -202,7 +202,7 @@ func (l Linter) Run(pass *analysis.Pass) ([]goanalysis.Issue, error) {
202202
}
203203
}
204204

205-
if (l.needs&NeedsExplanation) != 0 && (explanation == "" || strings.TrimSpace(explanation) == "//") {
205+
if (l.needs&NeedsExplanation) != 0 && (explanation == "" || strings.TrimSpace(explanation) == commentMark) {
206206
needsExplanation := len(linters) == 0 // if no linters are mentioned, we must have explanation
207207
// otherwise, check if we are excluding all the mentioned linters
208208
for _, ll := range linters {

pkg/golinters/nolintlint/nolintlint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func New(settings *config.NoLintLintSettings) *goanalysis.Linter {
3333

3434
lnt, err := nolintlint.NewLinter(needs, settings.AllowNoExplanation)
3535
if err != nil {
36-
internal.LinterLogger.Fatalf("asasalint: create analyzer: %v", err)
36+
internal.LinterLogger.Fatalf("%s: create analyzer: %v", nolintlint.LinterName, err)
3737
}
3838

3939
analyzer := &analysis.Analyzer{

0 commit comments

Comments
 (0)