Skip to content

Commit

Permalink
Fix params type for step ref request. (#1858)
Browse files Browse the repository at this point in the history
* Fix params type for step ref request.

Signed-off-by: BugDiver <vinaysh@thoughtworks.com>

* Bump release version

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

* Upgrade golangci lint version

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

* Fix lint issues

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

* Add the right import statement

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

* Upgrade libraries

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>
  • Loading branch information
3 people authored Apr 1, 2021
1 parent df1f019 commit b1501f4
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.29
version: v1.39

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand All @@ -26,4 +26,4 @@ jobs:
args: --disable=staticcheck

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# only-new-issues: true
2 changes: 1 addition & 1 deletion api/lang/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func validateConcepts(diagnostics map[lsp.DocumentURI][]lsp.Diagnostic) (*gauge.
return nil, fmt.Errorf("unable to read file %s", err)
}
cpts, pRes := new(parser.ConceptParser).Parse(content, conceptFile)
pErrs, err := parser.AddConcept(cpts, conceptFile, conceptDictionary)
pErrs, err := parser.AddConcept(cpts, conceptFile, conceptDictionary) // nolint
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions api/lang/references.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
)

func stepReferences(req *jsonrpc2.Request) (interface{}, error) {
var params string
var params []string
if err := json.Unmarshal(*req.Params, &params); err != nil {
return nil, fmt.Errorf("failed to parse request %v", err)
}
return getLocationFor(params)
return getLocationFor(params[0])
}

func stepValueAt(req *jsonrpc2.Request) (interface{}, error) {
Expand Down
2 changes: 1 addition & 1 deletion api/lang/references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Scenario Heading
openFilesCache = &files{cache: make(map[lsp.DocumentURI][]string)}
openFilesCache.add(uri, specText)

b, _ := json.Marshal("Say {} to {}")
b, _ := json.Marshal([]string{"Say {} to {}"})
params := json.RawMessage(b)
want := []lsp.Location{
{URI: uri, Range: lsp.Range{
Expand Down
5 changes: 1 addition & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import (
"fmt"
"os"
"strconv"

"github.com/getgauge/gauge/gauge"

"strings"

gauge "github.com/getgauge/gauge/gauge"
"github.com/getgauge/gauge/config"
"github.com/getgauge/gauge/env"
"github.com/getgauge/gauge/execution"
Expand Down
4 changes: 3 additions & 1 deletion execution/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ func mergeResults(results []*result.SpecResult) *result.SpecResult {
if res.GetFailed() {
specResult.IsFailed = true
}
var tableRows []*m.ProtoTableRow

var tableRows []*m.ProtoTableRow // nolint

for _, item := range res.ProtoSpec.Items {
switch item.ItemType {
case m.ProtoItem_Scenario:
Expand Down
4 changes: 2 additions & 2 deletions execution/result/specResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (specResult *SpecResult) AddTableDrivenScenarioResult(r *ScenarioResult, t
specResult.ScenarioFailedCount++
}
specResult.AddExecTime(r.ExecTime())
pItem := &gauge_messages.ProtoItem{
pItem := &gauge_messages.ProtoItem{ // nolint
ItemType: gauge_messages.ProtoItem_TableDrivenScenario,
TableDrivenScenario: &gauge_messages.ProtoTableDrivenScenario{
Scenario: r.Item().(*gauge_messages.ProtoScenario),
Expand Down Expand Up @@ -88,7 +88,7 @@ func (specResult *SpecResult) AddTableRelatedScenarioResult(scenarioResults [][]
TableRowIndex: int32(index),
ScenarioTableRow: eachRow[scenarioIndex].(*ScenarioResult).ScenarioDataTableRow,
}
protoItem := &gauge_messages.ProtoItem{ItemType: gauge_messages.ProtoItem_TableDrivenScenario, TableDrivenScenario: protoTableDrivenScenario}
protoItem := &gauge_messages.ProtoItem{ItemType: gauge_messages.ProtoItem_TableDrivenScenario, TableDrivenScenario: protoTableDrivenScenario} // nolint
specResult.ProtoSpec.Items = append(specResult.ProtoSpec.Items, protoItem)
}
if scenarioFailed {
Expand Down
2 changes: 1 addition & 1 deletion gauge/protoConverters.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func ConvertToProtoTable(table *Table) *gauge_messages.ProtoTable {
}
protoTableParam := &gauge_messages.ProtoTable{Rows: make([]*gauge_messages.ProtoTableRow, 0)}
protoTableParam.Headers = &gauge_messages.ProtoTableRow{Cells: table.Headers}
for _, row := range table.Rows() {
for _, row := range table.Rows() { // nolint
protoTableParam.Rows = append(protoTableParam.Rows, &gauge_messages.ProtoTableRow{Cells: row})
}
return protoTableParam
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
Expand All @@ -150,6 +151,7 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP
github.com/magiconair/properties v1.8.4 h1:8KGKTcQQGm0Kv7vEbKFErAoAOFyyacLStRtQSeYtvkY=
github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
Expand Down Expand Up @@ -209,6 +211,7 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
Expand Down Expand Up @@ -346,6 +349,7 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
google.golang.org/grpc v1.34.1 h1:ugq+9++ZQPFzM2pKUMCIK8gj9M0pFyuUWO9Q8kwEDQw=
google.golang.org/grpc v1.34.1/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.0 h1:o1bcQ6imQMIOpdrO3SWf2z5RV72WbDwdXuK0MDlc8As=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down Expand Up @@ -373,6 +377,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
2 changes: 1 addition & 1 deletion logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/getgauge/gauge/config"
"github.com/getgauge/gauge/plugin/pluginInfo"
"github.com/getgauge/gauge/version"
"github.com/op/go-logging"
logging "github.com/op/go-logging"
)

func TestGetLoggerShouldGetTheLoggerForGivenModule(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser/dataTableSpecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetSpecsForDataTableRows(s []*gauge.Specification, errMap *gauge.BuildError
if len(tableRelatedScenarios) > 0 {
s := createSpecsForTableRows(spec, tableRelatedScenarios, errMap)
s[0].Scenarios = append(s[0].Scenarios, nonTableRelatedScenarios...)
for _, scn := range nonTableRelatedScenarios {
for _, scn := range nonTableRelatedScenarios { // nolint
s[0].Items = append(s[0].Items, scn)
}
specs = append(specs, s...)
Expand Down
2 changes: 1 addition & 1 deletion runner/grpcRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/getgauge/gauge/config"
"github.com/getgauge/gauge/logger"
"github.com/getgauge/gauge/manifest"
"google.golang.org/genproto/googleapis/rpc/errdetails"
errdetails "google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
4 changes: 2 additions & 2 deletions validation/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func fillScenarioErrors(scenario *gauge.Scenario, errMap *gauge.BuildErrors, ste
if step.IsConcept {
fillScenarioErrors(scenario, errMap, step.ConceptSteps)
}
if err, ok := errMap.StepErrs[step]; ok {
if err, ok := errMap.StepErrs[step]; ok { // nolint
errMap.ScenarioErrs[scenario] = append(errMap.ScenarioErrs[scenario], err)
}
}
Expand All @@ -230,7 +230,7 @@ func fillSpecErrors(spec *gauge.Specification, errMap *gauge.BuildErrors, steps
if context.IsConcept {
fillSpecErrors(spec, errMap, context.ConceptSteps)
}
if err, ok := errMap.StepErrs[context]; ok {
if err, ok := errMap.StepErrs[context]; ok { // nolint
errMap.SpecErrs[spec] = append(errMap.SpecErrs[spec], err)
for _, scenario := range spec.Scenarios {
if _, ok := errMap.ScenarioErrs[scenario]; !ok {
Expand Down
4 changes: 2 additions & 2 deletions validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Scenario 2
`
p := new(parser.SpecParser)
spec, _, _ := p.Parse(specText, gauge.NewConceptDictionary(), "")
err := gauge_messages.StepValidateResponse_STEP_IMPLEMENTATION_NOT_FOUND
err := gauge_messages.StepValidateResponse_STEP_IMPLEMENTATION_NOT_FOUND // nolint
errs := validationErrors{spec: []error{
NewStepValidationError(spec.Scenarios[0].Steps[0], "", "", &err, ""),
NewStepValidationError(spec.Scenarios[1].Steps[0], "", "", &err, ""),
Expand All @@ -67,7 +67,7 @@ Scenario 2
`
p := new(parser.SpecParser)
spec, _, _ := p.Parse(specText, gauge.NewConceptDictionary(), "")
err := gauge_messages.StepValidateResponse_STEP_IMPLEMENTATION_NOT_FOUND
err := gauge_messages.StepValidateResponse_STEP_IMPLEMENTATION_NOT_FOUND // nolint

errs := validationErrors{spec: []error{
NewStepValidationError(spec.Scenarios[0].Steps[0], "", "", &err, ""),
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// CurrentGaugeVersion represents the current version of Gauge
var CurrentGaugeVersion = &Version{1, 1, 7}
var CurrentGaugeVersion = &Version{1, 1, 8}

// BuildMetadata represents build information of current release (e.g, nightly build information)
var BuildMetadata = ""
Expand Down

0 comments on commit b1501f4

Please sign in to comment.