categories_command.ex (2036B)
1 defmodule Credo.CLI.Command.Categories.CategoriesCommand do 2 @moduledoc false 3 4 alias Credo.CLI.Command.Categories.CategoriesOutput 5 alias Credo.CLI.Switch 6 7 use Credo.CLI.Command, 8 short_description: "Show and explain all issue categories", 9 cli_switches: [ 10 Switch.string("format"), 11 Switch.boolean("help", alias: :h) 12 ] 13 14 @categories [ 15 %{ 16 id: :readability, 17 name: "readability", 18 color: :blue, 19 title: "Code Readability", 20 description: """ 21 Readability checks do not concern themselves with the technical correctness 22 of your code, but how easy it is to digest. 23 """ 24 }, 25 %{ 26 id: :design, 27 name: "design", 28 color: :olive, 29 title: "Software Design", 30 description: """ 31 While refactor checks show you possible problems, these checks try to 32 highlight possibilities, like - potentially intended - duplicated code or 33 TODO and FIXME comments. 34 """ 35 }, 36 %{ 37 id: :refactor, 38 name: "refactor", 39 color: :yellow, 40 title: "Refactoring opportunities", 41 description: """ 42 The Refactor checks show you opportunities to avoid future problems and 43 technical debt. 44 """ 45 }, 46 %{ 47 id: :warning, 48 name: "warning", 49 color: :red, 50 title: "Warnings - please take a look", 51 description: """ 52 These checks warn you about things that are potentially dangerous, like a 53 missed call to `IEx.pry` you put in during a debugging session or a call 54 to String.downcase without using the result. 55 """ 56 }, 57 %{ 58 id: :consistency, 59 name: "consistency", 60 color: :cyan, 61 title: "Consistency", 62 description: """ 63 These checks take a look at your code and ensure a consistent coding style. 64 Using tabs or spaces? Both is fine, just don't mix them or Credo will tell 65 you. 66 """ 67 } 68 ] 69 70 @doc false 71 def call(exec, _opts) do 72 CategoriesOutput.print_categories(exec, @categories) 73 74 exec 75 end 76 end