Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Apr 17, 2024
1 parent 34b158a commit 98da17c
Show file tree
Hide file tree
Showing 28 changed files with 1,017 additions and 965 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ on:
jobs:
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
with:
custom_paths: "provider/providerutils"
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:

- name: Run tests
run: |
make test
make testacc
109 changes: 72 additions & 37 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,74 @@
linters:
enable-all: true
linters-settings:
goconst:
min-len: 2
min-occurrences: 3
gocyclo:
min-complexity: 20
gosec:
excludes:
- G402
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 160
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
revive:
rules:
- name: unexported-return
disabled: true
- name: unused-parameter
stylecheck:
checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]

disable:
# Abandoned, replaced by `unused`.
- deadcode
# 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
linters:
disable-all: true
enable:
- dogsled
- errcheck
- exportloopref
- gocheckcompilerdirectives
- gochecknoinits
- goconst
- gocritic
- gocyclo
- cyclop
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules: []

run:
timeout: 5m
skip-dirs: []
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
go build -o terraform-provider-ansible

test: build
cd tests/terraform_tests && ./run_tftest.sh
testacc:
TF_ACC=1 go test -v ./...
7 changes: 7 additions & 0 deletions changelogs/fragments/20240417-refactor-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
minor_changes:
- Code refactoring in order for the provider to be easier to test. Aggregate redundant functions into `utils.go` (https://github.com/ansible/terraform-provider-ansible/pull/110).
- Add unit tests for critical functions (https://github.com/ansible/terraform-provider-ansible/pull/110).
- Replace integration tests by acceptance tests, this is the Terraform recommended way for testing providers (https://github.com/ansible/terraform-provider-ansible/pull/110).
bugfixes:
- resource/ansible_playbook - On `resourcePlaybookUpdate()` function, remove the call to the `Wait()` function as the command is start using `CombinedOutput` (https://github.com/ansible/terraform-provider-ansible/pull/110).
27 changes: 12 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/ansible/terraform-provider-ansible
go 1.21

require (
github.com/Jeffail/gabs v1.4.0
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.32.0
github.com/stretchr/testify v1.8.1
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-plugin-testing v1.7.0
gopkg.in/ini.v1 v1.67.0
)

Expand All @@ -15,13 +15,12 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand All @@ -36,13 +35,12 @@ require (
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.6.2 // indirect
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/hashicorp/hc-install v0.6.3 // indirect
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.20.0 // indirect
github.com/hashicorp/terraform-json v0.21.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.21.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.22.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand All @@ -57,7 +55,6 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -67,18 +64,18 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.2 // indirect
golang.org/x/crypto v0.19.0 // indirect
github.com/zclconf/go-cty v1.14.3 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 98da17c

Please sign in to comment.