fmcgeough

fmcgeough

I’m using the elixir-google-api/clients/sheets at main · googleapis/elixir-google-api · GitHub 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).

Here’s the lead to that issue:

  defp create_google_sheet(nil) do
    Logger.info("No spreadsheet exists, creating one")
    month = @months[DateTime.utc_now().month]

    create_google_connection()
    |> Spreadsheets.sheets_spreadsheets_create(
      body: %{properties: %{title: "#{month}-#{DateTime.utc_now().year}-Deployment/Build Report"}}
    )
    |> get_spreadsheet()
end

The get_spreadsheet is just a shim to parse out the {:ok, response} or :error returned by sheets_spreadsheets_create. Here’s the one

  defp get_spreadsheet(result) do
    case result do
      {:ok, response} -> response
      {:error, _env} -> nil
    end
  end

Spreadsheets.sheets_spreadsheets_create spec is:

@spec sheets_spreadsheets_create(Tesla.Env.client, keyword()) :: {:ok, GoogleApi.Sheets.V4.Model.Spreadsheet.t} | {:error, Tesla.Env.t}

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?

Showing Posts 1 to 9

dom

dom

“Function get_spreadsheet/1 will never be called” is just fallout from the real error. What does dialyzer say before that?

NobbZ

NobbZ

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.

fmcgeough

fmcgeough OP

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.

NobbZ

NobbZ

Can you provide a minified project that produces similar warnings?

Or is the original projects source publicly available?

fmcgeough

fmcgeough OP

thanks. Let me get that together. its a private project for my company but I can extract this issue. will post again when its available.

fmcgeough

fmcgeough OP

Here’s a public repo that demos the issue. https://github.com/fmcgeough/google_sheet_dialyer

NobbZ

NobbZ

The PLT is building right now, I’ll take a look at it as my family gives me the time :wink:

OvermindDL1

OvermindDL1

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
NobbZ

NobbZ

Its an upstream issue:

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

edit

I took the freedom to file an issue:

https://github.com/GoogleCloudPlatform/elixir-google-api/issues/73

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews