Skip to content

Commit 09ccbee

Browse files
Add PRQL (#69)
* Add PRQL * Update README.md * Update analyzer_test.go * Update scanner_test.go * Update README.md Co-authored-by: João Daniel Rufino <[email protected]> --------- Co-authored-by: João Daniel Rufino <[email protected]>
1 parent 8b12162 commit 09ccbee

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ $ gcloc languages
191191
PowerShell | .ps1 | # |
192192
Processing | .pde | // | /* */
193193
Protocol Buffers | .proto | // |
194+
PRQL | .prql | # |
194195
Python | .py | # | """ """
195196
R | .r .R | # |
196197
Rego | .rego | # |

internal/constants/languages.go

+5
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ var Languages = language.Languages{
183183
MultiLineComments: [][]string{{"\"\"\"", "\"\"\""}},
184184
Extensions: []string{".py"},
185185
},
186+
"PRQL": {
187+
LineComments: []string{"#"},
188+
MultiLineComments: [][]string{},
189+
Extensions: []string{".prql"},
190+
},
186191
"R": {
187192
LineComments: []string{"#"},
188193
MultiLineComments: [][]string{},

pkg/analyzer/analyzer_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func TestMatchingFiles(t *testing.T) {
9292
Extension: ".py",
9393
Language: "Python",
9494
},
95+
{
96+
FilePath: filepath.Join(codeSamplesDir, "example.prql"),
97+
Extension: ".prql",
98+
Language: "PRQL",
99+
},
95100
{
96101
FilePath: filepath.Join(codeSamplesDir, "main.rb"),
97102
Extension: ".rb",
@@ -189,6 +194,11 @@ func TestMatchingFiles(t *testing.T) {
189194
Extension: ".py",
190195
Language: "Python",
191196
},
197+
{
198+
FilePath: filepath.Join(codeSamplesDir, "example.prql"),
199+
Extension: ".prql",
200+
Language: "PRQL",
201+
},
192202
{
193203
FilePath: filepath.Join(codeSamplesDir, "main.rb"),
194204
Extension: ".rb",
@@ -287,6 +297,11 @@ func TestMatchingFiles(t *testing.T) {
287297
Extension: ".py",
288298
Language: "Python",
289299
},
300+
{
301+
FilePath: filepath.Join(codeSamplesDir, "example.prql"),
302+
Extension: ".prql",
303+
Language: "PRQL",
304+
},
290305
{
291306
FilePath: filepath.Join(codeSamplesDir, "main.rb"),
292307
Extension: ".rb",

pkg/scanner/scanner_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ func TestScan(t *testing.T) {
113113
Extension: ".txt",
114114
Language: "Plain Text",
115115
},
116+
{
117+
FilePath: filepath.Join(codeSamplesDir, "example.prql"),
118+
Extension: ".prql",
119+
Language: "PRQL",
120+
},
116121
}
117122

118123
expected := []scanResult{
@@ -242,6 +247,13 @@ func TestScan(t *testing.T) {
242247
BlankLines: 13,
243248
Comments: 0,
244249
},
250+
{
251+
Metadata: files[18],
252+
Lines: 5,
253+
CodeLines: 4,
254+
BlankLines: 0,
255+
Comments: 1,
256+
},
245257
}
246258

247259
result, err := scanner.Scan(files)
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This is a comment
2+
from track_plays
3+
filter plays > 10_000
4+
sort length
5+
take 10

0 commit comments

Comments
 (0)