Skip to content

Commit

Permalink
Fix linting errors (#79)
Browse files Browse the repository at this point in the history
* Fix linting

Signed-off-by: Alina Buzachis <[email protected]>

* Update go version

Signed-off-by: Alina Buzachis <[email protected]>

* Update lint action

Signed-off-by: Alina Buzachis <[email protected]>

* Update actions

Signed-off-by: Alina Buzachis <[email protected]>

* Update upon review

Signed-off-by: Alina Buzachis <[email protected]>

* Update integration.yml

---------

Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis authored Feb 13, 2024
1 parent 12baf15 commit e9c3190
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 58 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/github-actions-lint.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Integration
on:
push:
branches:
- main
- stable-*
pull_request:

jobs:
tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: '1.3.6'
terraform_wrapper: false

- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: |
pip install ansible-core
- uses: actions/setup-go@v3
with:
go-version: '^1.21'

- name: Run tests
run: |
make test
32 changes: 32 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Linters
on:
push:
branches:
- main
- stable-*
pull_request:

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
version: v1.54
# Optional: golangci-lint command line arguments.
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
args: --timeout=10m --config=.golangci.yml
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
skip-pkg-cache: true
16 changes: 15 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,38 @@ linters:
enable-all: true

disable:
# Abandoned, replaced by `unused`.
- deadcode
- exhaustivestruct
# Checks if package imports are in a list of acceptable packages.
- depguard
# Forces to handle more cases.
- exhaustivestruct # Deprecated, replaced by check below.
- exhaustruct
# Drop-in replacement of `golint`.
- revive
- golint
# Deprecated.
- ifshort
- interfacer
# Deprecated. Use govet `fieldalignment`.
- maligned
# Deprecated. Replaced by `revive`.
- nosnakecase
- scopelint
- structcheck
- varcheck
# Imports order
- gci
- funlen
# Tool for code clone detection.
- dupl
- rowserrcheck
- sqlclosecheck
# Finds wasted assignment statements.
- wastedassign
# Deeply nested if statements.
- nestif
# Same as `cyclop` linter.
- gocognit
- gocyclo
- cyclop
4 changes: 2 additions & 2 deletions provider/resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func resourceGroupCreate(ctx context.Context, data *schema.ResourceData, meta in
return diags
}

func resourceGroupRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceGroupRead(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics {
return nil
}

func resourceGroupUpdate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
return resourceGroupRead(ctx, data, meta)
}

func resourceGroupDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceGroupDelete(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
data.SetId("")

return nil
Expand Down
4 changes: 2 additions & 2 deletions provider/resource_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func resourceHostCreate(ctx context.Context, data *schema.ResourceData, meta int
return diags
}

func resourceHostRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceHostRead(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics {
return nil
}

func resourceHostUpdate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
return resourceHostRead(ctx, data, meta)
}

func resourceHostDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceHostDelete(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
data.SetId("")

return nil
Expand Down
4 changes: 2 additions & 2 deletions provider/resource_playbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func resourcePlaybookRead(ctx context.Context, data *schema.ResourceData, meta i
return diags
}

func resourcePlaybookUpdate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePlaybookUpdate(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
var diags diag.Diagnostics

name, okay := data.Get("name").(string)
Expand Down Expand Up @@ -699,7 +699,7 @@ func resourcePlaybookUpdate(ctx context.Context, data *schema.ResourceData, meta
}

// On "terraform destroy", every resource removes its temporary inventory file.
func resourcePlaybookDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourcePlaybookDelete(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
data.SetId("")

return nil
Expand Down
4 changes: 2 additions & 2 deletions provider/resource_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func resourceVaultCreate(ctx context.Context, data *schema.ResourceData, meta in
return diags
}

func resourceVaultRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceVaultRead(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
var diags diag.Diagnostics

vaultFile, okay := data.Get("vault_file").(string)
Expand Down Expand Up @@ -183,7 +183,7 @@ func resourceVaultUpdate(ctx context.Context, data *schema.ResourceData, meta in
return resourceVaultRead(ctx, data, meta)
}

func resourceVaultDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
func resourceVaultDelete(_ context.Context, data *schema.ResourceData, _ interface{}) diag.Diagnostics {
data.SetId("")

return nil
Expand Down

0 comments on commit e9c3190

Please sign in to comment.