reid-rigo
Hello, I’m new to Elixir and created this package, which is the adaptation of some Ruby code I wrote, as a learning exercise: codeowners | Hex
I’m looking for feedback on:
- How to make this code more idiomatic
- More appropriate functions/modules to use
- Best practices for libraries
Feedback is welcome here or in Github
Trending in Questions
One of my LiveView view’s has a very heavy javascript dependency so I want to avoid loading it for every page on the site, while still us...
New
Hi all!
I know that quite a few people use Phoenix LiveView but it is hard to get a more up-to-date list of folks/companies using it. I ...
New
Hello everyone!
I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++.
Does anyone ...
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
I don’t suppose you can lazy load a library depending on runtime data? For example if it’s a certain user they can lazy load ‘library A’ ...
New
Hi all,
I’m trying to get Pi working well as an external agent inside Tidewave.ai via ACP.
Tidewave’s settings make it possible to add ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hi everyone :waving_hand:
I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New
On November 23, 2026, an unauthorized third party exploited a vulnerability in hex.pm (CVE-2026-129514, CVSS 10.0) that let them run comm...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #code-sync
- #exunit
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #ai
- #authentication
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-eu
- #distillery
- #security
- #processes
- #api
- #forms
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
RudManusachi
Hi, @reid-rigo
and welcome!
I’d point you to this style guide: GitHub - christopheradams/elixir_style_guide: A community driven style guide for Elixir · GitHub
It might look weird at first (becuase of double underscores and all caps) but it’s very common to refer to the module itself.
al2o3cr
Some thoughts, in no particular order:
rule_for_pathcould be slightly more efficient if theEnum.reversewas moved intobuildto avoid doing the same computation more than oncethe typespec for
Codeowners.Ruleis not satisfied by the default values in thedefstruct.rule_for_pathcan return a struct containing unexpected types in the “no rule matched” case.the use of
File.cwd!inbuildis odd; consider allowing callers to either supply a root directly or as an override. To reduce the need for most callers to pass a root,loadcould do some guessing based on if the supplied file is in adocor.githubdirectory.reid-rigo
I’m not seeing the full benefits of
__MODULE__. It appears to help for future refactoring, but what about all of the references in docs?reid-rigo
I’m really torn on this one. Reversing appears to take a few microseconds, and so for a CODEOWNERS file of significant size, it looks like most of the rule searching time will be spent in
Regex.match?Will ppl be surprised to load their CODEOWNERS and then see all of their rules in reverse order? I could reverse the list again for inspect purposes, but that feels like shenanigans.
Thank you, fixed.
The
!definitely feels gross, though an exception appears to be a truly rare circumstance. I like your idea of doing some ‘guessing’ - Github specifies 3 possible locations for the file so it wouldn’t be hard to figure out which one was used and derive root from that.Edit: Because
Path.expandusesFile.cwd!, I’m not sure there’s anything to be gained here. People should be able to callCodeowners.load(".github/CODEOWNERS")dimitarvp
What problems does using
__MODULE__introduce for you in docs?reid-rigo
Based on a suggestion in another thread I tried
#{__MODULE__}, but that outputsElixir.Codeownerswhen I run mix docs.sodapopcan
For me it’s not about refactoring—a global rename is a global rename—it’s about ease of reading. When I see
If it weren’t for the few legitimate uses cases it has, I wouldn’t be upset if the
__MODULE__I immediately think “local.” Seeing a fully-qualified self-referencing module name always causes a bit of a jarring pause where I have to go and confirm that it is indeed referencing itself. This is indeed on the minor end of readability issues and is not a hill I’d die on. I do, however, vehemently disagree with the advice in that guide to use an alias if you want “a prettier name”:asoption foraliaswere removed from the language.RudManusachi
One of the point you were asking:
So I just pointed to what seemed more idiomatic to me
So it does with any module name, such as:
#{Logger}would print"Elixir.Logger". If you want to nicely disregard the prefixElixir.you couldinspect/1it:See example: elixir/lib/elixir/lib/kernel/utils.ex at c5816a227f5ad295ccbfcc5571308f76190d6bfe · elixir-lang/elixir · GitHub
reid-rigo
Thanks for helping me work through the
__MODULE__stuff. Updated in this commit.reid-rigo
I made a change to accept root as an option in this commit