defmodule AshCredo.MixProject do use Mix.Project @version "0.13.0" @description "Credo checks for Ash Framework" def project do [ app: :ash_credo, version: @version, description: @description, elixir: "~> 1.15", start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), elixirc_paths: elixirc_paths(Mix.env()), test_ignore_filters: [~r{^test/integration/fixtures/}], package: package(), docs: docs(), source_url: "https://github.com/leonqadirie/ash_credo", homepage_url: "https://github.com/leonqadirie/ash_credo" ] end def application do [extra_applications: [:logger], mod: {AshCredo.Application, []}] end defp aliases do [ lint: [ "format --check-formatted", "credo", "lint.no_emdash", "lint.credence", "lint.reach", "xref graph --format cycles --fail-above 0" ] ] end defp elixirc_paths(:dev), do: ["lib/", "dev/"] defp elixirc_paths(:test), do: ["lib/", "test/support/"] defp elixirc_paths(_), do: ["lib/"] defp deps do [ {:ash, "~> 3.0", only: [:dev, :test], runtime: false}, {:boxart, "~> 0.3", only: [:dev, :test], runtime: false}, {:credence, "~> 0.5", only: [:dev, :test], runtime: false}, {:credo, "~> 1.7", runtime: false}, {:ex_dna, "~> 1.5", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.40", only: :dev, runtime: false}, {:ex_slop, "~> 0.4", only: [:dev, :test], runtime: false}, {:igniter, "~> 0.8", optional: true, runtime: false}, {:quokka, "~> 2.12", only: [:dev, :test], runtime: false}, {:reach, "~> 2.3", only: [:dev, :test], runtime: false}, {:simple_sat, "~> 0.1", only: [:dev, :test], runtime: false} ] end defp package do [ licenses: ["MIT"], files: ~w(lib .formatter.exs mix.exs README* LICENSE* CHANGELOG*), exclude_patterns: [~r/\.expert/], links: %{"GitHub" => "https://github.com/leonqadirie/ash_credo"} ] end defp docs do [ main: "readme", source_ref: "v#{@version}", extras: ["README.md", "CHANGELOG.md", "LICENSE"], filter_modules: &public_module?/2, groups_for_modules: [ "Mix Tasks": ~r/^Mix\.Tasks\./, "Checks: Warning": ~r/^AshCredo\.Check\.Warning\./, "Checks: Refactor": ~r/^AshCredo\.Check\.Refactor\./, "Checks: Design": ~r/^AshCredo\.Check\.Design\./, "Checks: Readability": ~r/^AshCredo\.Check\.Readability\./ ], nest_modules_by_prefix: [ AshCredo.Check.Warning, AshCredo.Check.Refactor, AshCredo.Check.Design, AshCredo.Check.Readability ] ] end # Hidden from hexdocs: internal cache/orchestration/introspection plumbing, # the self-check modules whose docstrings are generated by `use Credo.Check`, # and the dev-only `mix lint.*` tasks under `dev/`. defp public_module?(module, _metadata) do case Module.split(module) do ["AshCredo"] -> true ["AshCredo", "Check" | _] -> true ["Mix", "Tasks", "AshCredo" | _] -> true _ -> false end rescue ArgumentError -> false end end