lint

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 12 Imported by: 0

README

POSH lint provider

Adds configured linters to your project.

Usage

Plugin
package main

import (
  "github.com/foomo/posh/provider/foomo/gotsrpc"
  "github.com/foomo/posh/pkg/command"
  "github.com/foomo/posh/pkg/log"
  "github.com/foomo/posh/pkg/plugin"
  "github.com/spf13/viper"
)

type Plugin struct {
  l        log.Logger
  cache    cache.Cache
  commands command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  var err error
  inst := &Plugin{
    l:        l,
    cache:    &cache.MemoryCache{},
    commands: command.Commands{},
  }

	// ...

  inst.commands.Add(lint.NewCommand(l, inst.cache,
    lint.CommandWithGo(),
    lint.CommandWithTSC(),
    lint.CommandWithHelm(),
    lint.CommandWithESLint(),
    lint.CommandWithGherkin(),
    lint.CommandWithTerraform(),
    lint.CommandWithTerrascan(),
	))

  // ...

  return inst, nil
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(l log.Logger, c cache.Cache, opts ...CommandOption) *Command

func (*Command) Complete

func (c *Command) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest

func (*Command) Description

func (c *Command) Description() string

func (*Command) Execute

func (c *Command) Execute(ctx context.Context, r *readline.Readline) error

func (*Command) Help

func (c *Command) Help(ctx context.Context, r *readline.Readline) string

func (*Command) Name

func (c *Command) Name() string

type CommandOption

type CommandOption func(command *Command)

func CommandWithESLint

func CommandWithESLint() CommandOption

func CommandWithGherkin

func CommandWithGherkin() CommandOption

func CommandWithGo

func CommandWithGo() CommandOption

func CommandWithHelm

func CommandWithHelm() CommandOption

func CommandWithName

func CommandWithName(v string) CommandOption

func CommandWithTSC

func CommandWithTSC() CommandOption

func CommandWithTerraform

func CommandWithTerraform() CommandOption

func CommandWithTerrascan

func CommandWithTerrascan() CommandOption

type Linter

type Linter string

Jump to

Keyboard shortcuts

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