anc95 / ChatGPT-CodeReview

🐥 A code review bot powered by ChatGPT
https://github.com/apps/cr-gpt
ISC License
3.78k stars 361 forks source link

Language is not support #39

Closed headless-kjh closed 1 year ago

headless-kjh commented 1 year ago

yaml

name: Code Review

permissions: contents: read pull-requests: write

on: pull_request: types: [opened, reopened]

jobs: review: runs-on: ubuntu-latest steps:


run

Bellow is the code patch, please help me do a brief code review, if any bug risk and improvement suggestion are welcome class ElasticQueryServiceImpl(

 override fun addSplitListQuery(value: String?, fieldName: String): BoolQueryBuilder? {
     if (value.isNullOrEmpty()) return null
   val codes = listOf(value.split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
    val codes = value.split(",".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
     val boolQueryBuilder = QueryBuilders.boolQuery()
     codes.forEach { boolQueryBuilder.should(QueryBuilders.matchQuery(fieldName, it).operator(Operator.AND)) }
     return boolQueryBuilder

code-review cost: 4.652s gpt cost: 5.9


result

!

Code Review:

The code looks generally good. The changes made are valid and the logic is sound.

However, there is one small bug risk I see. The listOf() function creates an immutable list, but the code expects to modify it, so it should be changed to a mutable list. Also, the value.split() returns an array of strings, so the codes variable should be declared as an array instead of a list.

Overall, the code looks good and should work as expected.

anc95 commented 1 year ago

@headless-kjh Hi, It's a known issue. will try to solve this ASAP

anc95 commented 1 year ago

@headless-kjh It was fixed

image
headless-kjh commented 1 year ago

Thank you! for quickly resolving the issue!