Skip to content

chore: fix linter configuration #4610

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6ac017b
chore: fix linter configuration
Mar 25, 2025
a17ac34
FIx linters
remyleone Mar 27, 2025
f61770d
Fix
remyleone Apr 1, 2025
ab66efc
feat(vpc_gw): enable CLI generation for v2 (#4612)
scaleway-bot Mar 25, 2025
3ba4b8a
docs(iam): remove beta mentions (#4614)
scaleway-bot Mar 26, 2025
bf40b4e
fix(vpc): fix capitalization (#4616)
scaleway-bot Mar 26, 2025
ca778cf
feat(vpcgw) support v2 (#4615)
yfodil Mar 26, 2025
059580c
feat(instance): redirect to scw login when no credentials are provide…
Mia-Cross Mar 26, 2025
3567403
feat(interlink): add connection & revamp doc (#4618)
scaleway-bot Mar 26, 2025
fce56b9
docs(iam): create user spec (#4619)
scaleway-bot Mar 28, 2025
b3d2833
fix(docs): update doc build workflow (#4541)
SamyOubouaziz Mar 28, 2025
6004ede
feat(core): support positional args as dynamic args as well (#4621)
kindermoumoute Mar 31, 2025
d404628
docs: add section for command namespaces (#4620)
remyleone Mar 31, 2025
3b5a26b
chore(lb): update cassette on attach/detach private network (#4623)
kindermoumoute Mar 31, 2025
efb9d6e
chore(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.78.2…
dependabot[bot] Apr 1, 2025
b3083e6
fix(arg-spec): revert multi positional arg definition (#4627)
kindermoumoute Apr 1, 2025
be2e88e
fix(go.mod): set go minor version (#4629)
kindermoumoute Apr 1, 2025
a0c21c0
fix(docs): downgrade awscli version for docs workflow (#4630)
SamyOubouaziz Apr 2, 2025
b85d792
feat(instance): add fetch-keys to ssh commands (#4622)
Mia-Cross Apr 2, 2025
8d719c6
FIx linters
remyleone Mar 27, 2025
8baf06c
delete .DS_Store
Laure-di Apr 3, 2025
9974b0c
generate doc
Laure-di Apr 3, 2025
05a52f0
fix regex issue
Laure-di Apr 4, 2025
14e6312
fix linter
Laure-di Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
docker run --rm -i -v ${PWD}/docs:/docs squidfunk/mkdocs-material build
- name: Download and set up AWS CLI
run: |
apt update
apt install curl unzip -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
sudo apt update
sudo apt install curl unzip -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.20.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
Expand Down
72 changes: 28 additions & 44 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
# Golang CI pipeline configuration
#
# To execute linters in local the ./scripts/lint.sh script can be used.
version: "2"

formatters:
enable:
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. [fast: true, auto-fix: true]
- golines

linters:
default: none
# Run golangci-lint linters to see the list of all linters
# Please keep them sorted alphabetically
enable:
Expand All @@ -16,25 +26,18 @@ linters:
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted. [fast: false, auto-fix: false]
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. [fast: false, auto-fix: false]
- exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions. [auto-fix]
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid. [fast: true, auto-fix: false]
- gochecksumtype # Run exhaustiveness checks on Go "sum types" [fast: false, auto-fix: false]
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
- gocritic # Provides diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false]
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- goheader # Checks is file header matches to pattern [fast: true, auto-fix: false]
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. [fast: true, auto-fix: true]
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
- gosimple #(megacheck): Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
- govet #(vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
- importas # Enforces consistent import aliases [fast: false, auto-fix: false]
Expand All @@ -59,14 +62,11 @@ linters:
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false]
- staticcheck
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes [fast: false, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
Expand All @@ -76,42 +76,22 @@ linters:
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]

disable:
- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- gochecknoglobals # check that no global variables exist [fast: true, auto-fix: false]
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
- godot # Check if comments end in a period [fast: true, auto-fix: true]
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
- err113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
- lll # Reports long lines [fast: true, auto-fix: false]
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
- wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
settings:
goconst:
min-len: 5
gosec:
excludes:
- G115
revive:
rules:
- name: exported
disabled: true

linters-settings:
goconst:
min-len: 5
gosec:
excludes:
- G115
exclusions:
paths:
- internal/pkg

issues:
exclude-dirs:
- internal/pkg

max-issues-per-linter: 0
max-same-issues: 0

exclude-rules:
rules:
- path: _test\.go
linters:
- stylecheck
Expand Down Expand Up @@ -156,3 +136,7 @@ issues:
- path: internal/namespaces/k8s/v1/types/types.go
linters:
- tagalign

issues:
max-issues-per-linter: 0
max-same-issues: 0
3 changes: 1 addition & 2 deletions cmd/scw-wasm-tester/human.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
package main

import (
"syscall/js"

"github.com/hashicorp/go-version"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/core/human"
"syscall/js"
)

func wasmTestMarshalBuildInfo(_ js.Value, _ []js.Value) any {
Expand Down
3 changes: 1 addition & 2 deletions cmd/scw-wasm-tester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
package main

import (
"syscall/js"

"github.com/scaleway/scaleway-cli/v2/internal/jshelpers"
"syscall/js"
)

type jsFunction func(js.Value, []js.Value) any
Expand Down
3 changes: 1 addition & 2 deletions cmd/scw-wasm-tester/slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
package main

import (
"syscall/js"

"github.com/scaleway/scaleway-cli/v2/internal/jshelpers"
"syscall/js"
)

func wasmTestFromSlice(_ js.Value, _ []js.Value) any {
Expand Down
7 changes: 5 additions & 2 deletions cmd/scw-wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ package main
import (
"runtime"
"runtime/debug"
"syscall/js"

"github.com/hashicorp/go-version"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/jshelpers"
"github.com/scaleway/scaleway-cli/v2/internal/wasm"
"syscall/js"
)

var (
Expand Down Expand Up @@ -62,7 +62,10 @@ func main() {
if args.targetObject != "" {
cliPackage := js.ValueOf(map[string]any{})
cliPackage.Set("run", js.FuncOf(jshelpers.AsPromise(wasm.RunWithBuildInfo(buildInfo))))
cliPackage.Set("complete", js.FuncOf(jshelpers.AsPromise(wasm.AutocompleteWithBuildInfo(buildInfo))))
cliPackage.Set(
"complete",
js.FuncOf(jshelpers.AsPromise(wasm.AutocompleteWithBuildInfo(buildInfo))),
)
cliPackage.Set("configureOutput", js.FuncOf(jshelpers.AsPromise(wasm.ConfigureOutput)))
cliPackage.Set("stop", js.FuncOf(jshelpers.AsyncJsFunc(stop)))
js.Global().Set(args.targetObject, cliPackage)
Expand Down
2 changes: 1 addition & 1 deletion cmd/scw-wasm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package main

import (
"fmt"
"syscall/js"

"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/jshelpers"
"github.com/scaleway/scaleway-cli/v2/internal/wasm"
"syscall/js"
)

func wasmRun(this js.Value, args []js.Value) (any, error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/scw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ func main() {

func mainNoExit() int {
buildInfo := &core.BuildInfo{
Version: version.Must(version.NewSemver(buildVersion())), // panic when version does not respect semantic versioning
Version: version.Must(
version.NewSemver(buildVersion()),
), // panic when version does not respect semantic versioning
BuildDate: BuildDate,
GoVersion: GoVersion,
GitBranch: GitBranch,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a new user. You must define the `organization_id` and the `email` in your request.
Create a new user. You must define the `organization_id` in your request. If you are adding a member, enter the member's details. If you are adding a guest, you must define the `email` and not add the member attribute.

USAGE:
scw iam user create [arg=value ...]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update an user's password. Private Beta feature.
Update an user's password.

USAGE:
scw iam user update-password <user-id ...> [arg=value ...]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update an user's username. Private Beta feature.
Update an user's username.

USAGE:
scw iam user update-username <user-id ...> [arg=value ...]
Expand Down
4 changes: 2 additions & 2 deletions cmd/scw/testdata/test-all-usage-iam-user-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ AVAILABLE COMMANDS:
get Get a given user
list List users of an Organization
update Update a user
update-password Update an user's password. Private Beta feature.
update-username Update an user's username. Private Beta feature.
update-password Update an user's password.
update-username Update an user's username.

FLAGS:
-h, --help help for user
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Keys registered via the Scaleway Console will be propagated to the selected servers.
The command 'ssh <server-ip> -t -l <username> scw-fetch-ssh-keys --upgrade' will be run on the servers matching the zone and project filters.
Keep in mind that you need to be able to connect to your server with another key than the one you want to add.
Keep in mind that SSH keys are scoped by project.

USAGE:
scw instance ssh fetch-keys [arg=value ...]

ARGS:
[project-id] Fetch the keys on all servers in the given Project
[username=root] Username used for the SSH connection
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)

FLAGS:
-h, --help help for fetch-keys

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
--web open console page for the current ressource
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ USAGE:
scw instance ssh list-keys <server-id ...> [arg=value ...]

ARGS:
server-id Server to add your key to
server-id Server which keys are to be listed
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)

FLAGS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ USAGE:

UTILITY COMMANDS:
add-key Add a public key to a server
fetch-keys Fetch SSH keys from the console and install them on multiple servers
list-keys List manually added public keys
remove-key Remove a manually added public key from a server

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Connection commands.

USAGE:
scw interlink connection

FLAGS:
-h, --help help for connection

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a link (InterLink connection) in a given PoP, specifying its various configuration details. For the moment only hosted links (faciliated by partners) are available, though in the future dedicated and shared links will also be possible.
Create a link (InterLink session / logical InterLink resource) in a given PoP, specifying its various configuration details. Links can either be hosted (faciliated by partners' shared physical connections) or self-hosted (for users who have purchased a dedicated physical connection).

USAGE:
scw interlink link create [arg=value ...]
Expand All @@ -10,10 +10,9 @@ ARGS:
name Name of the link
[tags.{index}] List of tags to apply to the link
pop-id PoP (location) where the link will be created
bandwidth-mbps Desired bandwidth for the link. Must be compatible with available link bandwidths and remaining bandwidth capacity of the port
[dedicated] If true, a dedicated link (1 link per port, dedicated to one customer) will be crated. It is not necessary to specify a `port_id` or `partner_id`. A new port will created and assigned to the link. Note that Scaleway has not yet enabled the creation of dedicated links, this field is reserved for future use.
[port-id] If set, a shared link (N links per port, one of which is this customer's port) will be created. As the customer, specify the ID of the port you already have for this link. Note that shared links are not currently available. Note that Scaleway has not yet enabled the creation of shared links, this field is reserved for future use.
[partner-id] If set, a hosted link (N links per port on a partner port) will be created. Specify the ID of the chosen partner, who already has a shareable port with available bandwidth. Note that this is currently the only type of link offered by Scaleway, and therefore this field must be set when creating a link.
bandwidth-mbps Desired bandwidth for the link. Must be compatible with available link bandwidths and remaining bandwidth capacity of the connection
[connection-id] If set, creates a self-hosted link using this dedicated physical connection. As the customer, specify the ID of the physical connection you already have for this link.
[partner-id] If set, creates a hosted link on a partner's connection. Specify the ID of the chosen partner, who already has a shared connection with available bandwidth.
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get a link (InterLink connection) for the given link ID. The response object includes information about the link's various configuration details.
Get a link (InterLink session / logical InterLink resource) for the given link ID. The response object includes information about the link's various configuration details.

USAGE:
scw interlink link get <link-id ...> [arg=value ...]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ ARGS:
[status] Link status to filter for (unknown_link_status | configuring | failed | requested | refused | expired | provisioning | active | limited_connectivity | all_down | deprovisioning | deleted | locked)
[bgp-v4-status] BGP IPv4 status to filter for (unknown_bgp_status | up | down)
[bgp-v6-status] BGP IPv6 status to filter for (unknown_bgp_status | up | down)
[pop-id] Filter for links attached to this PoP (via ports)
[pop-id] Filter for links attached to this PoP (via connections)
[bandwidth-mbps] Filter for link bandwidth (in Mbps)
[partner-id] Filter for links hosted by this partner
[vpc-id] Filter for links attached to this VPC
[routing-policy-id] Filter for links using this routing policy
[pairing-key] Filter for the link with this pairing_key
[kind] Filter for hosted or self-hosted links (hosted | self_hosted)
[connection-id] Filter for links self-hosted on this connection
[organization-id] Organization ID to filter for
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Links commands.
Link commands.

USAGE:
scw interlink link <command>
Expand Down
Loading
Loading