Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update non-major deps #500

Merged
merged 7 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To ensure that all developers follow the same guidelines for development, we hav
- Clone this repository to your Go workspace:

```sh
# Make sure you are running go 1.21 or later
# Make sure you are running go 1.22 or later

# Clone the project
git clone [email protected]:target/flottbot.git somepath/flottbot
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3
uses: github/codeql-action/init@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3
uses: github/codeql-action/autobuild@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -70,4 +70,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3
uses: github/codeql-action/analyze@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3
92 changes: 45 additions & 47 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,42 @@ output:
linters:
disable-all: true
enable:
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # check the function whether use a non-inherited context
- dupl # code clone detection
- errcheck # checks for unchecked errors
- errorlint # find misuses of errors
- exportloopref # check for exported loop vars
- funlen # detects long functions
- gci # consistent import order
- goconst # finds repeated strings that could be replaced by a constant
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- gofmt # checks whether code was gofmt-ed
- goheader # checks is file header matches to pattern
- goimports # fixes imports and formats code in same style as gofmt
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects code for security problems
- gosimple # linter that specializes in simplifying a code
- govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
- ineffassign # detects when assignments to existing variables aren't used
- makezero # finds slice declarations with non-zero initial length
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
- nilerr # finds the code that returns nil even if it checks that the error is not nil
- noctx # noctx finds sending http request without context.Context
- nolintlint # reports ill-formed or insufficient nolint directives
- revive # linter for go
- staticcheck # applies static analysis checks, go vet on steroids
- stylecheck # replacement for golint
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- typecheck # parses and type-checks go code, like the front-end of a go compiler
- unconvert # remove unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- whitespace # detects leading and trailing whitespace
- wsl # forces code to use empty lines
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # check the function whether use a non-inherited context
- dupl # code clone detection
- errcheck # checks for unchecked errors
- errorlint # find misuses of errors
- exportloopref # check for exported loop vars
- funlen # detects long functions
- gci # consistent import order
- goconst # finds repeated strings that could be replaced by a constant
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- gofmt # checks whether code was gofmt-ed
- goheader # checks is file header matches to pattern
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects code for security problems
- gosimple # linter that specializes in simplifying a code
- govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
- ineffassign # detects when assignments to existing variables aren't used
- makezero # finds slice declarations with non-zero initial length
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
- nilerr # finds the code that returns nil even if it checks that the error is not nil
- noctx # noctx finds sending http request without context.Context
- nolintlint # reports ill-formed or insufficient nolint directives
- revive # linter for go
- staticcheck # applies static analysis checks, go vet on steroids
- stylecheck # replacement for golint
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- typecheck # parses and type-checks go code, like the front-end of a go compiler
- unconvert # remove unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- whitespace # detects leading and trailing whitespace
- wsl # forces code to use empty lines

# static list of linters we know golangci can run but we've
# chosen to leave disabled for now
Expand All @@ -78,21 +77,21 @@ linters:
# - exhaustivestruct - style preference
# - forbidigo - unused
# - forcetypeassert - unused
# - gci - use goimports
# - gochecknoinits - unused
# - gochecknoglobals - global variables allowed
# - gocognit - unused complexity metric
# - gocognit - unused complexity metric
# - gocritic - style preference
# - godox - to be used in the future
# - goerr113 - to be used in the future
# - goimports - use gci instead
# - golint - archived, replaced with revive
# - gofumpt - use gofmt
# - gomnd - get too many false-positives
# - gomodguard - unused
# - ifshort - use both styles
# - ireturn - allow interfaces to be returned
# - importas - want flexibility with naming
# - lll - not too concerned about line length
# - lll - not too concerned about line length
# - interfacer - archived
# - nestif - non-critical
# - nilnil - style preference
Expand All @@ -101,7 +100,7 @@ linters:
# - paralleltest - false-positives
# - prealloc - don't use
# - predeclared - unused
# - promlinter - style preference
# - promlinter - style preference
# - rowserrcheck - unused
# - scopelint - deprecated - replaced with exportloopref
# - sqlclosecheck - unused
Expand All @@ -128,6 +127,7 @@ linters-settings:
statements: 70

# https://github.com/daixiang0/gci
# gci write --skip-generated -s standard -s default -s prefix(github.com/target/flottbot)
gci:
sections:
- standard
Expand All @@ -140,16 +140,14 @@ linters-settings:

# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
nolintlint:
allow-unused: false # allow nolint directives that don't address a linting issue
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
allow-unused: false # allow nolint directives that don't address a linting issue
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped

# https://github.com/denis-tingaikin/go-header
goheader:
template: |-
Copyright (c) {{ YEAR }} Target Brands, Inc. All rights reserved.

Use of this source code is governed by the LICENSE file in this repository.
SPDX-License-Identifier: Apache-2.0

# This section provides the configuration for how golangci
# will report the issues it finds.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
BUILD_LDFLAGS := -s -w
BUILD_LDFLAGS += -X github.com/target/flottbot/version.Version=${VERSION}
GOLANGCI_LINT_VERSION := "v1.55.2"
GOLANGCI_LINT_VERSION := "v1.56.1"
PACKAGES := $(shell go list ./... | grep -v /config-example/)
PLATFORM := "linux/amd64,linux/arm64"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ We currently provide a few Docker images:

[target/flottbot:ruby](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and ruby v3.2 installed

[target/flottbot:golang](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and golang v1.21 installed
[target/flottbot:golang](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and golang v1.22 installed

[target/flottbot:python](https://hub.docker.com/r/target/flottbot) - Alpine image, flottbot binary, and python v3.11 installed

Expand Down
4 changes: 1 addition & 3 deletions cmd/flottbot/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

Expand Down
4 changes: 0 additions & 4 deletions config-example/scripts/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.

package main

import "fmt"
Expand Down
4 changes: 1 addition & 3 deletions core/configure.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package core

Expand Down
11 changes: 8 additions & 3 deletions core/configure_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package core

Expand Down Expand Up @@ -138,6 +136,7 @@ func Test_configureChatApplication(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
configureChatApplication(tt.args.bot)

if tt.shouldRunChat != tt.args.bot.RunChat {
t.Errorf("configureChatApplication() wanted RunChat set to %v, but got %v", tt.shouldRunChat, tt.args.bot.RunChat)
}
Expand All @@ -162,12 +161,15 @@ func Test_setSlackListenerPort(t *testing.T) {
t.Run("slack listener port reads from env var config", func(t *testing.T) {
bot := baseBot()
bot.SlackListenerPort = "${TEST_SLACK_LISTENER_PORT}"

t.Setenv("TEST_SLACK_LISTENER_PORT", "TESTPORT")

validateRemoteSetup(bot)
configureChatApplication(bot)

expected := "TESTPORT"
actual := bot.SlackListenerPort

if expected != actual {
t.Errorf("configureChatApplication() wanted SlackListenerPort set to %v, but got %v", expected, actual)
}
Expand All @@ -180,6 +182,7 @@ func Test_setSlackListenerPort(t *testing.T) {

expected := defaultSlackListenerPort
actual := bot.SlackListenerPort

if expected != actual {
t.Errorf("configureChatApplication() wanted SlackListenerUnsetPortVar set to %v, but got %v", expected, actual)
}
Expand All @@ -193,6 +196,7 @@ func Test_setSlackListenerPort(t *testing.T) {

expected := defaultSlackListenerPort
actual := bot.SlackListenerPort

if expected != actual {
t.Errorf("configureChatApplication() wanted SlackListenerNoPort set to %v, but got %v", expected, actual)
}
Expand Down Expand Up @@ -254,6 +258,7 @@ func Test_validateRemoteSetup(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
validateRemoteSetup(tt.args.bot)

if tt.shouldRunChat != tt.args.bot.RunChat {
t.Errorf("validateRemoteSetup() wanted RunChat set to %v, but got %v", tt.shouldRunChat, tt.args.bot.RunChat)
}
Expand Down
4 changes: 1 addition & 3 deletions core/matcher.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package core

Expand Down
Loading