Congrats on the RC! I’ve played with the new formatter and have a couple of questions about what it’s doing.
- @spec setup_customer(TwitterApi.oauth_creds, map) :: %Account.Customer{}
+ @spec setup_customer(TwitterApi.oauth_creds(), map) :: %Account.Customer{}
Why does oauth_creds
get ()
added when map
doesn’t?
Likely related to above:
def sync_finished(customer) do
- Logger.info "[SYNC] #{customer.id} (#{customer.twitter_id}) finished"
- GenServer.cast({:via, Registry, {Account.ManagerRegistry, customer.twitter_id}}, :sync_finished)
+ Logger.info("[SYNC] #{customer.id} (#{customer.twitter_id}) finished")
+
+ GenServer.cast(
+ {:via, Registry, {Account.ManagerRegistry, customer.twitter_id}},
+ :sync_finished
+ )
end
The .cast
call change is fine by me, but I’m definitely not used to/don’t like the Logger call having to have brackets. Same with Ecto macros e.g.:
def oauth_creds(twitter_id) do
query =
- from c in Customer,
- where: c.twitter_id == ^twitter_id,
- select: {c.oauth_token, c.oauth_token_secret}
+ from(
+ c in Customer,
+ where: c.twitter_id == ^twitter_id,
+ select: {c.oauth_token, c.oauth_token_secret}
+ )
+
Repo.one!(query)
end
and:
schema "customers" do
- has_many :relationships, Twitter.Relationship
- has_many :users, through: [:relationships, :user]
- has_many :lists, Twitter.List
+ has_many(:relationships, Twitter.Relationship)
+ has_many(:users, through: [:relationships, :user])
+ has_many(:lists, Twitter.List)
I realise that I could just type the non bracket version and have an editor plugin format it but I find the non bracket form easier to parse as a human (this is just my personal opinion of course). In general I’ve found the formatter:
- Does a lot of nice things with e.g. too long lines, case statements
- Adds brackets in a lot of places I don’t consider them useful/necessary
Thanks again to everyone involved in the new RC for all the hard work.