Skip to content

Commit

Permalink
chore: update tree sitter (#1324)
Browse files Browse the repository at this point in the history
* chore: update tree sitter

* chore: update custom parsers

* chore: account for grammar changes

* test: ignore bearer env vars in e2e tests

* fix: use field names for wildcard nodes

* fix: update php string leaf content type

* test: update snapshots following pattern field name change
  • Loading branch information
didroe authored Oct 23, 2023
1 parent 47d26da commit 6c0a0ae
Show file tree
Hide file tree
Showing 65 changed files with 1,010,149 additions and 2,673,967 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ temp/
.cache/

# docs
docs/yarn.lock
docs/yarn.lock

/internal/parser/sitter/config_variables/build
13 changes: 13 additions & 0 deletions e2e/internal/testhelper/testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,23 @@ func CreateCommand(arguments []string) (*exec.Cmd, context.CancelFunc) {
}

cmd.Dir = GetCWD()
cmd.Env = getEnvironment()

return cmd, cancel
}

func getEnvironment() []string {
var result []string

for _, variable := range os.Environ() {
if !strings.HasPrefix(variable, "BEARER_") {
result = append(result, variable)
}
}

return result
}

func executablePath() string {
if value, ok := os.LookupEnv("BEARER_EXECUTABLE_PATH"); ok {
return value
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/schollz/progressbar/v3 v3.13.1
github.com/shirou/gopsutil/v3 v3.23.9
github.com/smacker/go-tree-sitter v0.0.0-20220829074436-0a7a807924f2
github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8
github.com/stretchr/testify v1.8.4
github.com/tangzero/inflector v1.0.0
github.com/weppos/publicsuffix-go v0.30.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smacker/go-tree-sitter v0.0.0-20220829074436-0a7a807924f2 h1:p+xxTsHssBdE21bzntBWAKjNyZ7BpuxynngfAe4hTHg=
github.com/smacker/go-tree-sitter v0.0.0-20220829074436-0a7a807924f2/go.mod h1:q99oHDsbP0xRwmn7Vmob8gbSMNyvJ83OauXPSuHQuKE=
github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 h1:DxgjlvWYsb80WEN2Zv3WqJFAg2DKjUQJO6URGdf1x6Y=
github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8/go.mod h1:q99oHDsbP0xRwmn7Vmob8gbSMNyvJ83OauXPSuHQuKE=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
Expand Down
5 changes: 3 additions & 2 deletions internal/detectors/dependencies/ivy/ivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"regexp"
"strings"

"github.com/rs/zerolog/log"

"github.com/bearer/bearer/internal/detectors/dependencies/depsbase"
"github.com/bearer/bearer/internal/parser"
xml "github.com/bearer/bearer/internal/parser/sitter/xml2"
"github.com/bearer/bearer/internal/parser/sitter/xml"
"github.com/bearer/bearer/internal/util/file"
"github.com/bearer/bearer/internal/util/stringutil"
"github.com/rs/zerolog/log"
)

var language = xml.GetLanguage()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package packageconfig

import (
"github.com/rs/zerolog/log"

"github.com/bearer/bearer/internal/detectors/dependencies/depsbase"
"github.com/bearer/bearer/internal/parser"
xml "github.com/bearer/bearer/internal/parser/sitter/xml2"
"github.com/bearer/bearer/internal/parser/sitter/xml"
"github.com/bearer/bearer/internal/util/file"
"github.com/bearer/bearer/internal/util/stringutil"
"github.com/rs/zerolog/log"
)

var language = xml.GetLanguage()
Expand Down
5 changes: 3 additions & 2 deletions internal/detectors/dependencies/poetry/poetry.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package poetry

import (
"github.com/rs/zerolog/log"
"github.com/smacker/go-tree-sitter/toml"

"github.com/bearer/bearer/internal/detectors/dependencies/depsbase"
"github.com/bearer/bearer/internal/parser"
"github.com/bearer/bearer/internal/parser/sitter/toml"
"github.com/bearer/bearer/internal/util/file"
"github.com/bearer/bearer/internal/util/stringutil"
"github.com/rs/zerolog/log"
)

var language = toml.GetLanguage()
Expand Down
5 changes: 3 additions & 2 deletions internal/detectors/dependencies/pom-xml/pom-xml.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package pomxml

import (
"github.com/rs/zerolog/log"

"github.com/bearer/bearer/internal/detectors/dependencies/depsbase"
"github.com/bearer/bearer/internal/parser"
xml "github.com/bearer/bearer/internal/parser/sitter/xml2"
"github.com/bearer/bearer/internal/parser/sitter/xml"
"github.com/bearer/bearer/internal/util/file"
"github.com/bearer/bearer/internal/util/stringutil"
"github.com/rs/zerolog/log"
)

var language = xml.GetLanguage()
Expand Down
5 changes: 3 additions & 2 deletions internal/detectors/dependencies/pyproject/pyproject.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package pyproject

import (
"github.com/rs/zerolog/log"
"github.com/smacker/go-tree-sitter/toml"

"github.com/bearer/bearer/internal/detectors/dependencies/depsbase"
"github.com/bearer/bearer/internal/parser"
"github.com/bearer/bearer/internal/parser/sitter/toml"
"github.com/bearer/bearer/internal/util/file"
"github.com/bearer/bearer/internal/util/stringutil"
"github.com/rs/zerolog/log"
)

var language = toml.GetLanguage()
Expand Down
Loading

0 comments on commit 6c0a0ae

Please sign in to comment.