autonolint

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 10 Imported by: 0

README

autonolint

Insert //nolint comment automatically for golangci-lint

Installation

$ go install github.com/utgwkk/autonolint/cmd/autonolint

Usage

  1. Run golangci-lint with --out-format=json.
  2. (Optional) Extract Issues field of JSON.
  3. Pass to autonolint with standard input.
$ golangci-lint run --out-format=json | autonolint

# Or:
$ golangci-lint run --out-format=json | jq .Issues | autonolint

You can specify content of a comment for //nolint directive via -comment option.

$ golangci-lint run --out-format=json | autonolint -comment "TODO: refactor"

DEMO

Image from Gyazo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(issues []Issue, comment string) error

Types

type ExecResult

type ExecResult struct {
	Issues []Issue
}

type InsertComment

type InsertComment struct {
	Filename string

	Line int

	FromLinter string

	Reason string
}

func (*InsertComment) Comment

func (c *InsertComment) Comment() string

type Issue

type Issue struct {
	FromLinter string

	Text string

	Pos Pos
}

func ParseInput

func ParseInput(in []byte) ([]Issue, error)

type Pos

type Pos struct {
	Filename string

	Offset int
	Line   int
	Column int
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL