Fl4m3Ph03n1x

Fl4m3Ph03n1x

Credo for umbrella apps

Background

Following my question on Umbrella projects:

I know have it clear that the mix.exs file of my umbrella should be for general tooling and tasks my projects directly don’t depend on.

One such tool is credo: GitHub - rrrene/credo: A static code analysis tool for the Elixir language with a focus on code consistency and teaching. · GitHub

Problem

My projects don’t depend or need credo, but I sure like having it around. My objective would therefore be to have mix credo --strict evaluate all my umbrella applications, without me having to specifically install it in every single app.

I understand this is possible, however when I do mix credo --strict it always shows I have 0 problems, even though I have the code with TODO tags and other issue that I know trigger it.

Obviously my configuration is not set up correctly.

Configuration

This is my folder structure:

.
├── README.md
├── apps
│   ├── auction_house
│   │   ├── README.md
│   │   ├── config
│   │   ├── cover
│   │   ├── lib
│   │   ├── mix.exs
│   │   └── test
│   ├── store
│   │   ├── README.md
│   │   ├── lib
│   │   ├── mix.exs
│   │   └── test
├── config
│   ├── config.exs
│   ├── dev.exs
│   ├── prod.exs
│   └── test.exs
├── mix.exs
└── mix.lock

So as you can see, each app has its own mix.exs file which only has the very specific dependencies the projects depends on.

Then on a higher level (apps folder) I have a mix.exs file for the umbrella project. This is what that file looks like:

defmodule MarketManager.MixProject do
  use Mix.Project

  ##########
  # Public #
  ##########

  def project do
    [
      apps_path: "apps",
      version: "1.0.0",
      elixir: "~> 1.10",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      ]
  end

  def application do
    [
      extra_applications: [:logger],
      mod: {MarketManager.Application, [env: Mix.env()]} # No idea what to put here, really
    ]
  end

  ###########
  # Private #
  ###########

  defp deps do
    [
      # Testing and Dev
      {:credo, "~> 1.4", only: [:test, :dev], runtime: false}
    ]
  end

end

Question

What am I doing wrong?

Marked As Solved

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Turns out several things were wrong. To start, my umbrella mix.exs file has stuff it doesn’t need:

defmodule MarketManager.MixProject do
  use Mix.Project

  def project do
    [
      apps_path: "apps",
      version: "1.0.0",
      elixir: "~> 1.10",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      ]
  end

  defp deps do
    [
      # Testing and Dev
      {:credo, "~> 1.4", only: [:test, :dev], runtime: false}
    ]
  end

end

Done. This is all that it should have.

With that fixed, turns out my auction_house app should not have a config folder. Instead, it should use the config folder of the umbrella project itself.

With these two issues fixed, credo now works as expected !

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New

We're in Beta

About us Mission Statement