Fork me on GitHub
#code-reviews
<
2022-12-30
>
eyalch22:12:19

Hi! I wrote a script using Babashka to read some public data from a GraphQL API and write it into a CSV file. I’d love to get some comments as I’m sure it can be improved. Happy new year!

babashka 1
vlad_poh01:12:38

per chatgpt Overall, the code appears to be well organized and easy to understand. Here are a few suggestions for improvement: 1. Add documentation to the functions explaining what they do and their arguments and return values. 2. Consider moving the HTTP request logic and the parsing of the response into separate functions to make the code more modular and easier to test. 3. Use with-open to properly close the file when writing to the CSV file. 4. Consider adding error handling for when the HTTP request or CSV file writing fails. 5. Consider using the as-> macro to make the code in the run function more readable and concise. What do you think?

Rupert (All Street)13:01:57

My review on the ChatGPT review. Regarding each bullet point above: 1. Reasonably generic/low value advice - mentioning "more documentation" during code reviews often just adds noise 2. A more reasonable suggestion. but the context here is a BB script - so effectiveness might be more important trade off than adding extra lines to break up functions. 3. with-open is being used to close the file so this suggestion appears wrong. 4. Again the context is this is a script - the OP likely just wants it to fail if there is an issue rather than do error handling. So error handling suggestion feels like noise again. 5. There is no run function so this seems to be a ChatGPT hallucination.

💯 4
eyalch10:01:31

Seems that machines aren’t going to replace us after all!

💯 2