Skip to content

Commit

Permalink
Change revive cognitive-complexity settings (#2316)
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden authored Nov 17, 2023
1 parent c0abd84 commit 137f80d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint

on:
pull_request:

jobs:
install:
name: Lint
runs-on: ubuntu-latest
env:
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
path: go/src/github.com/${{ github.repository }}

- name: Lint
working-directory: ${{ env.working-directory }}
run: make lint

2 changes: 2 additions & 0 deletions components/dm/ansible/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ func instancDeployDir(comp string, port int, hostDir string, globalDir string) s
}

// ImportFromAnsibleDir generate the metadata from ansible deployed cluster.
//
//revive:disable
func (im *Importer) ImportFromAnsibleDir(ctx context.Context) (clusterName string, meta *spec.Metadata, err error) {
dir := im.dir
inventoryFileName := im.inventoryFileName
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/ansible/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func ParseAndImportInventory(ctx context.Context, dir, ansCfgFile string, clsMet
return defaults.Set(clsMeta)
}

//revive:disable
func parseGroupVars(ctx context.Context, dir, ansCfgFile string, clsMeta *spec.ClusterMeta, inv *aini.InventoryData) error {
logger := ctx.Value(logprinter.ContextKeyLogger).(*logprinter.Logger)

Expand Down
2 changes: 2 additions & 0 deletions pkg/cluster/ansible/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var (
)

// parseDirs sets values of directories of component
//
//revive:disable
func parseDirs(ctx context.Context, user string, ins spec.InstanceSpec, sshTimeout uint64, sshType executor.SSHType) (spec.InstanceSpec, error) {
logger := ctx.Value(logprinter.ContextKeyLogger).(*logprinter.Logger)
hostName, sshPort := ins.SSH()
Expand Down
2 changes: 2 additions & 0 deletions pkg/cluster/operation/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func ScaleIn(
}

// ScaleInCluster scales in the cluster
//
//revive:disable
func ScaleInCluster(
ctx context.Context,
cluster *spec.Specification,
Expand Down
4 changes: 2 additions & 2 deletions tools/check/revive.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ warningCode = 0
[rule.use-any]

[rule.cognitive-complexity]
severity = "warning"
arguments =[48]
severity = "error"
arguments =[100]
#[rule.cyclomatic]
# severity = "warning"
# arguments = [48]
Expand Down

0 comments on commit 137f80d

Please sign in to comment.