Skip to content

Commit

Permalink
feat: add queries for Julia
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Aug 25, 2024
1 parent 5837698 commit 871dafd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/errata-ai/ini v1.63.0
github.com/errata-ai/regexp2 v1.7.0
github.com/gobwas/glob v0.2.3
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d
github.com/jdkato/twine v0.10.1
github.com/karrick/godirwalk v1.16.1
github.com/mholt/archiver/v3 v3.5.1
Expand Down Expand Up @@ -45,6 +44,7 @@ require (
github.com/gookit/color v1.5.4 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/jdkato/go-tree-sitter-julia v0.1.0 // indirect
github.com/klauspost/compress v1.11.4 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/kr/pretty v0.3.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d h1:nc/Dgjp4Zr3drV44bz2+fUaCb1ZZvFtNnudyuaWL7uQ=
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d/go.mod h1:lXNEZorcvU63DcANEklLMbDRjwam4VQ44MIV1Cck0w8=
github.com/jdkato/go-tree-sitter-julia v0.1.0 h1:z+6zTbd6PHMKAge7GJx9QIwPQX2NOKb4Pj5jteJvaYY=
github.com/jdkato/go-tree-sitter-julia v0.1.0/go.mod h1:lXNEZorcvU63DcANEklLMbDRjwam4VQ44MIV1Cck0w8=
github.com/jdkato/twine v0.10.1 h1:Jexy1dua9nRyr45AQ3Bml1nCVYq3VIi9g09MOkg2Wwk=
github.com/jdkato/twine v0.10.1/go.mod h1:bYejIksa/MD4jxI5/o+DFxMb7Bw7JcGZDoA6ib4j+dg=
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
Expand Down
5 changes: 0 additions & 5 deletions internal/core/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ var CommentsByNormedExt = map[string]map[string]string{
"blockStart": `(\{-.*)`,
"blockEnd": `(.*-\})`,
},
".jl": {
"inline": `(# .+)`,
"blockStart": `(^#=)|(^(?:@doc )?(?:raw)?["']{3}.*)`,
"blockEnd": `(^=#)|(.*["']{3})`,
},
}

// FormatByExtension associates a file extension with its "normed" extension
Expand Down
9 changes: 6 additions & 3 deletions internal/lint/code/jl.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import (

func Julia() *Language {
return &Language{
Delims: regexp.MustCompile(`#|#=|=#`),
Parser: julia.GetLanguage(),
Queries: []string{`(comment)+ @comment`},
Delims: regexp.MustCompile(`#|#=|=#`),
Parser: julia.GetLanguage(),
Queries: []string{
`(line_comment)+ @comment`,
`(block_comment)+ @comment`,
},
Padding: func(s string) int {
return computePadding(s, []string{"#", `#=`, `=#`})
},
Expand Down
4 changes: 0 additions & 4 deletions testdata/features/lint.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ Feature: Lint
test.jl:1:3:vale.Annotations:'NOTE' left in text
test.jl:4:3:vale.Annotations:'NOTE' left in text
test.jl:9:7:vale.Annotations:'NOTE' left in text
test.jl:16:51:vale.Annotations:'TODO' left in text
test.jl:19:1:vale.Annotations:'TODO' left in text
test.jl:21:17:vale.Annotations:'NOTE' left in text
test.jl:29:1:vale.Annotations:'XXX' left in text
test.jl:41:1:vale.Annotations:'NOTE' left in text
test.jl:47:3:vale.Annotations:'XXX' left in text
"""

Expand Down

0 comments on commit 871dafd

Please sign in to comment.