This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-30
Channels
- # aleph (25)
- # announcements (20)
- # babashka (29)
- # babashka-sci-dev (12)
- # beginners (27)
- # biff (3)
- # clojure (29)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojurescript (3)
- # clr (5)
- # code-reviews (4)
- # data-science (7)
- # datahike (6)
- # datascript (3)
- # emacs (9)
- # fulcro (5)
- # graalvm (10)
- # malli (15)
- # nbb (7)
- # off-topic (17)
- # pathom (9)
- # polylith (4)
- # practicalli (15)
- # reitit (3)
- # releases (2)
- # rum (1)
- # shadow-cljs (73)
- # squint (34)
- # tools-deps (3)
- # xtdb (11)
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!
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?
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.