@@ -200,6 +200,41 @@ The output will be similar to this:
200
200
+-----------------+--------------------------------------+---------------+------------------+--------------------+
201
201
```
202
202
203
+ ## Get miscelaneous information about lines with a "// TODO" comment in HEAD
204
+
205
+ ``` sql
206
+ SELECT repository_id,
207
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.commit" )),
208
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.file" )),
209
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.linenum" )),
210
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.author" )),
211
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.text" ))
212
+ FROM (SELECT repository_id,
213
+ EXPLODE(BLAME(repository_id, commit_hash)) AS bl
214
+ FROM ref_commits
215
+ NATURAL JOIN blobs
216
+ WHERE ref_name = ' HEAD'
217
+ AND NOT IS_BINARY(blob_content)
218
+ ) as p
219
+ WHERE JSON_EXTRACT(bl, " $.text" ) LIKE ' %// TODO%' ;
220
+ ```
221
+
222
+ ## Report of authors with more lines authored in HEAD
223
+
224
+ ``` sql
225
+ SELECT
226
+ JSON_UNQUOTE(JSON_EXTRACT(bl, " $.author" )),
227
+ COUNT (JSON_UNQUOTE(JSON_EXTRACT(bl, " $.author" )))
228
+
229
+ FROM (SELECT EXPLODE(BLAME(repository_id, commit_hash)) AS bl
230
+ FROM ref_commits
231
+ NATURAL JOIN blobs
232
+ WHERE ref_name = ' HEAD'
233
+ AND NOT IS_BINARY(blob_content)
234
+ ) AS p
235
+ GROUP BY JSON_UNQUOTE(JSON_EXTRACT(bl, " $.author" ));
236
+ ```
237
+
203
238
# UAST UDFs Examples
204
239
205
240
First of all, you should check out the [ bblfsh documentation] ( https://docs.sourced.tech/babelfish ) to get yourself familiar with UAST concepts.
0 commit comments