Skip to content

Commit

Permalink
update clio and other anchore deps
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman committed Nov 7, 2024
1 parent 4cd2cbc commit 1096df1
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 576 deletions.
68 changes: 43 additions & 25 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# TODO: enable this when we have coverage on docstring comments
#issues:
issues:
max-same-issues: 25

# TODO: enable this when we have coverage on docstring comments
# # The list of ids of default excludes to include or disable.
# include:
# - EXC0002 # disable excluding of issues about comments from golint

linters-settings:
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines: 80
# Checks the number of statements in a function.
# If lower than 0, disable the check.
# Default: 40
statements: 60

linters:
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- asciicheck
- bodyclose
- copyloopvar
- dogsled
- dupl
- errcheck
- exportloopref
- funlen
- gocognit
- goconst
Expand All @@ -49,24 +40,51 @@ linters:
- unused
- whitespace

linters-settings:
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines: 70
# Checks the number of statements in a function.
# If lower than 0, disable the check.
# Default: 40
statements: 50
gocritic:
enabled-checks:
- deferInLoop

gosec:
excludes:
- G115
output:
uniq-by-line: false
run:
timeout: 10m
tests: false

# do not enable...
# - deadcode # The owner seems to have abandoned the linter. Replaced by "unused".
# - depguard # We don't have a configuration for this yet
# - goprintffuncname # does not catch all cases and there are exceptions
# - nakedret # does not catch all cases and should not fail a build
# - gochecknoglobals
# - gochecknoinits # this is too aggressive
# - rowserrcheck disabled per generics https://github.com/golangci/golangci-lint/issues/2649
# - godot
# - godox
# - goerr113
# - golint # deprecated
# - gomnd # this is too aggressive
# - interfacer # this is a good idea, but is no longer supported and is prone to false positives
# - lll # without a way to specify per-line exception cases, this is not usable
# - maligned # this is an excellent linter, but tricky to optimize and we are not sensitive to memory layout optimizations
# - goimports # we're using gosimports now instead to account for extra whitespaces (see https://github.com/golang/go/issues/20818)
# - golint # deprecated
# - gomnd # this is too aggressive
# - interfacer # this is a good idea, but is no longer supported and is prone to false positives
# - lll # without a way to specify per-line exception cases, this is not usable
# - maligned # this is an excellent linter, but tricky to optimize and we are not sensitive to memory layout optimizations
# - nestif
# - prealloc # following this rule isn't consistently a good idea, as it sometimes forces unnecessary allocations that result in less idiomatic code
# - rowserrcheck # not in a repo with sql, so this is not useful
# - scopelint # deprecated
# - structcheck # The owner seems to have abandoned the linter. Replaced by "unused".
# - testpackage
# - wsl # this doens't have an auto-fixer yet and is pretty noisy (https://github.com/bombsimon/wsl/issues/90)
# - varcheck # deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - deadcode # deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - structcheck # deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
# - rowserrcheck # we're not using sql.Rows at all in the codebase
# - depguard # this requires additional configuration https://github.com/golangci/golangci-lint/issues/3877#issuecomment-1573760321
# - varcheck # The owner seems to have abandoned the linter. Replaced by "unused".
# - wsl # this doens't have an auto-fixer yet and is pretty noisy (https://github.com/bombsimon/wsl/issues/90)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GLOW_CMD = $(TEMP_DIR)/glow

# Tool versions #################################
QUILL_VERSION = latest
GOLANG_CI_VERSION = v1.57.2
GOLANG_CI_VERSION = v1.61.0
GOBOUNCER_VERSION = v0.4.0
GORELEASER_VERSION = v1.17.0
GOSIMPORTS_VERSION = v0.3.8
Expand Down
8 changes: 4 additions & 4 deletions cmd/quill/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ func New(id clio.Identification) clio.Application {
WithConfigInRootHelp(). // --help on the root command renders the full application config in the help text
WithUIConstructor(
// select a UI based on the logging configuration and state of stdin (if stdin is a tty)
func(cfg clio.Config) ([]clio.UI, error) {
func(cfg clio.Config) (*clio.UICollection, error) {
noUI := ui.None()
if !cfg.Log.AllowUI(os.Stdin) {
return []clio.UI{noUI}, nil
return clio.NewUICollection(noUI), nil
}

return []clio.UI{
return clio.NewUICollection(
ui.New(false, cfg.Log.Quiet),
noUI,
}, nil
), nil
},
).
WithInitializers(
Expand Down
1 change: 0 additions & 1 deletion cmd/quill/cli/commands/extract_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func extractCertificates(binPath string, leaf bool) (string, error) {
buf := strings.Builder{}
certSet := strset.New()
for _, b := range decodedCerts {
b := b
singleBuf := strings.Builder{}
if err := pem.Encode(&singleBuf, &b); err != nil {
return "", err
Expand Down
12 changes: 6 additions & 6 deletions cmd/quill/cli/ui/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ func (m *Handler) State() *State {
return m.state
}

func (m *Handler) handleInputPrompt(e partybus.Event) []tea.Model {
func (m *Handler) handleInputPrompt(e partybus.Event) ([]tea.Model, tea.Cmd) {
writer, err := event.ParseCLIInputPromptType(e)
if err != nil {
log.Warnf("unable to parse event: %+v", err)
return nil
return nil, nil
}

return []tea.Model{prompt.New(writer)}
return []tea.Model{prompt.New(writer)}, nil
}

func (m *Handler) handleTask(e partybus.Event) []tea.Model {
func (m *Handler) handleTask(e partybus.Event) ([]tea.Model, tea.Cmd) {
cmd, prog, err := event.ParseTaskType(e)
if err != nil {
log.Warnf("unable to parse event: %+v", err)
return nil
return nil, nil
}

return m.handleStagedProgressable(prog, taskprogress.Title{
Default: cmd.Title.Default,
Running: cmd.Title.WhileRunning,
Success: cmd.Title.OnSuccess,
Failed: cmd.Title.OnFail,
}, cmd.Context)
}, cmd.Context), nil
}

func (m *Handler) handleStagedProgressable(prog progress.StagedProgressable, title taskprogress.Title, context ...string) []tea.Model {
Expand Down
6 changes: 5 additions & 1 deletion cmd/quill/internal/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
}

for _, newModel := range m.handler.Handle(msg) {
newModels, cmd := m.handler.Handle(msg)
if cmd != nil {
cmds = append(cmds, cmd)
}
for _, newModel := range newModels {
if newModel == nil {
continue
}
Expand Down
74 changes: 38 additions & 36 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/anchore/quill

go 1.18
go 1.22.0

require (
github.com/PuerkitoBio/goquery v1.9.2
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/anchore/bubbly v0.0.0-20230518153401-87b6af8ccf22
github.com/anchore/clio v0.0.0-20230802135737-4778c80552e5
github.com/anchore/fangs v0.0.0-20230628163043-a51c5a39b097
github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a
github.com/anchore/bubbly v0.0.0-20241107060245-f2a5536f366a
github.com/anchore/clio v0.0.0-20241029130133-ceccbddab86f
github.com/anchore/fangs v0.0.0-20241031222233-81506aed5251
github.com/anchore/go-logger v0.0.0-20241005132348-65b4486fbb28
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb
github.com/aws/aws-sdk-go v1.55.5
github.com/blacktop/go-macho v1.1.231
github.com/charmbracelet/bubbletea v0.26.6
github.com/charmbracelet/lipgloss v0.12.1
github.com/charmbracelet/bubbletea v1.2.0
github.com/charmbracelet/lipgloss v1.0.0
github.com/gabriel-vasile/mimetype v1.4.5
github.com/github/smimesign v0.2.0
github.com/go-restruct/restruct v1.2.0-alpha
Expand All @@ -31,39 +31,38 @@ require (
)

require (
github.com/adrg/xdg v0.4.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/adrg/xdg v0.5.3 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blacktop/go-dwarf v1.0.10 // indirect
github.com/charmbracelet/bubbles v0.11.0 // indirect
github.com/charmbracelet/bubbles v0.20.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/x/ansi v0.1.4 // indirect
github.com/charmbracelet/x/input v0.1.0 // indirect
github.com/charmbracelet/x/term v0.1.1 // indirect
github.com/charmbracelet/x/windows v0.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/charmbracelet/x/ansi v0.4.5 // indirect
github.com/charmbracelet/x/term v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/erikgeiser/promptkit v0.7.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gkampitakis/go-snaps v0.4.5 // indirect
github.com/erikgeiser/promptkit v0.9.0 // indirect
github.com/felixge/fgprof v0.9.5 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-openapi/errors v0.20.2 // indirect
github.com/go-openapi/strfmt v0.21.3 // indirect
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-localereader v0.0.2-0.20220822084749-2491eb6c1c75 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -73,27 +72,30 @@ require (
github.com/muesli/termenv v0.15.2 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pborman/indent v1.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.mongodb.org/mongo-driver v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 1096df1

Please sign in to comment.