I’m using the https://github.com/GoogleCloudPlatform/elixir-google-api/tree/master/clients/sheets project (a thin wrapper over the Google Sheets API) to create a Google sheet. The module that creates the sheets for us has a number of Dialyzer warnings but they are all the same root cause I’d imagine. The warning is “Function get_spreadsheet/1 will never be called” (where get_spreadsheet/1 is just an example).
This functions fine. We’ve been running it in production for a month or so and it does exactly what we want but it bothers me that I don’t understand what dialyzer is trying to tell me. Any suggestions on what to look at?
Dialyzed doesn’t see a valid way that create_google_sheet/1 will ever be called with nil argument therefore it assumes functions called from it will never be called.
At least that’s my assumption from what you have shown.
The first warning that Dialyzer outputs is related to that get_spreadsheet/1 call. it does not warn about the create_google_connection/0 or the Spreadsheets.sheets_spreadsheets_create function calls. If I make that get_spreadsheet function public it doesn’t change the warnings that dialyzer produces.
I’m kind of thinking it dies on the Spreadsheets.sheets_spreadsheets_create call from just an initial look?
EDIT: This is the dialyzer results if anyone is curious on that repo:
lib/google_spreadsheet.ex:22: Function deployments_sheet/0 has no local return
lib/google_spreadsheet.ex:34: Function create_google_sheet/1 has no local return
lib/google_spreadsheet.ex:55: Function get_spreadsheet/1 will never be called
lib/google_api/sheets/v4/api/spreadsheets.ex:114: Function sheets_spreadsheets_create/1 has no local return
lib/google_api/sheets/v4/api/spreadsheets.ex:114: Function sheets_spreadsheets_create/2 has no local return