Repository navigation
fix: declare ex_doc as an optional dependency of the validator - #91
Merged
Merged
Conversation
The validator branches on ex_doc's presence at usage_rules' own compile
time, but ex_doc was declared only: [:dev, :test], which does not
propagate to consumers. Two failures followed:
* Mix could compile usage_rules before ex_doc, baking in the stub
validate/1; adding ex_doc later never triggered a recompile, so
mix usage_rules.validate kept failing with a misleading
:earmark_parser_unavailable error until a forced recompile.
* Consumers inherited no ex_doc version constraint, so an ex_doc
without the 0.40 formatter API (ExDoc.Extras.build/2,
ExDoc.Formatter.autolink/5) crashed at runtime with
UndefinedFunctionError instead of an actionable message.
Declaring {:ex_doc, "~> 0.40", optional: true, runtime: false} fixes
both: Mix compiles ex_doc before usage_rules and recompiles usage_rules
when ex_doc is added, and the Hex resolver enforces the ~> 0.40 floor
for any consumer that also depends on ex_doc.
leonqadirie
marked this pull request as ready for review
October 27, 2026 16:46
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UsageRules.Validatorchecks for ex_doc at compile time and uses formatter APIs introduced in ex_doc 0.40. Declaring ex_doc withonly: [:dev, :test]hid this dependency from consumers, causing two failures:validate/1. Adding ex_doc later did not trigger recompilation, so validation failed with a misleading:earmark_parser_unavailableerror until usage_rules was forcibly recompiled.UndefinedFunctionErrorinstead of an actionable error.Declaring
{:ex_doc, "~> 0.40", optional: true, runtime: false}gives Mix the dependency information needed for compilation and recompilation, and lets Hex reject incompatible ex_doc versions duringmix deps.get. It also keeps ex_doc out of application startup.ensure_ex_doc!/1now recommends~> 0.40.mix.lockis unchanged.