Permalink
Browse files

Move config to module_attributes

  • Loading branch information...
rrrene committed Nov 16, 2015
1 parent 91a1e4c commit fb1640c9a46f7513591dc5b7194cf35d4d1f1ccd
@@ -22,129 +22,3 @@ use Mix.Config
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
config :bunt, color_aliases: [
_category_consistency: :cyan,
_category_readability: :blue,
_category_design: :olive,
_category_refactor: :yellow,
_category_warning: :red,
_code: :cyan,
_explain_code: :yellow
]
config :credo, :category_order, [:design, :readability, :refactor, :warning, :consistency]
config :credo, :category_colors, [
design: :_category_design,
readability: :_category_readability,
refactor: :_category_refactor,
warning: :_category_warning,
consistency: :_category_consistency,
]
config :credo, :category_titles, [
design: "Software Design",
readability: "Code Readability",
refactor: "Refactoring opportunities",
warning: "Warnings - please take a look",
consistency: "Consistency",
]
config :credo, :cry_for_help, "Please report incorrect results: https://github.com/rrrene/credo/issues"
config :credo, :base_priority_map, %{ignore: -100, low: -10, normal: 1,
high: +10, higher: +20}
config :credo, :def_ops, [:def, :defp, :defmacro]
config :credo, :kernel_fun_names, [
:abs,
:apply,
:binary_part,
:bit_size,
:byte_size,
:div,
:elem,
:exit,
:function_exported?,
:get_and_update_in,
:get_in,
:hd,
:inspect,
:is_atom,
:is_binary,
:is_bitstring,
:is_boolean,
:is_float,
:is_function,
:is_integer,
:is_list,
:is_map,
:is_number,
:is_pid,
:is_port,
:is_reference,
:is_tuple,
:length,
:macro_exported?,
:make_ref,
:map_size,
:max,
:min,
:node,
:not,
:put_elem,
:put_in,
:rem,
:round,
:self,
:send,
:spawn,
:spawn_link,
:spawn_monitor,
:struct,
:throw,
:tl,
:trunc,
:tuple_size,
:update_in,
]
config :credo, :kernel_macro_names, [
:alias!,
:and,
:binding,
:def,
:defdelegate,
:defexception,
:defimpl,
:defmacro,
:defmacrop,
:defmodule,
:defoverridable,
:defp,
:defprotocol,
:defstruct,
:destructure,
:get_and_update_in,
:if,
:in,
:is_nil,
:match?,
:or,
:put_in,
:raise,
:reraise,
:sigil_C,
:sigil_R,
:sigil_S,
:sigil_W,
:sigil_c,
:sigil_r,
:sigil_s,
:sigil_w,
:to_char_list,
:to_string,
:unless,
:update_in,
:use,
:var!,
]
@@ -1,5 +1,5 @@
defmodule Credo.Check do
@base_priority_map Application.get_env(:credo, :base_priority_map)
@base_priority_map %{ignore: -100, low: -10, normal: 1, high: +10, higher: +20}
defmacro __using__(opts) do
quote do
@@ -14,7 +14,7 @@ defmodule Credo.Check.CodeHelper do
alias Credo.Service.SourceFileWithoutStringAndSigils
alias Credo.SourceFile
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
defdelegate do_block?(ast), to: Block, as: :do_block?
defdelegate do_block_for!(ast), to: Block, as: :do_block_for!
@@ -18,7 +18,7 @@ defmodule Credo.Check.Readability.FunctionNames do
"""
@explanation [check: @moduledoc]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
alias Credo.Code.Name
@@ -12,7 +12,7 @@ defmodule Credo.Check.Readability.MaxLineLength do
ignore_strings: true
]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
use Credo.Check, base_priority: :low
@@ -28,7 +28,7 @@ defmodule Credo.Check.Readability.PredicateFunctionNames do
"""
@explanation [check: @moduledoc]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
use Credo.Check, base_priority: :high
@@ -13,7 +13,7 @@ defmodule Credo.Check.Refactor.ABCSize do
@explanation [check: @moduledoc]
@default_params [max_size: 30]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
@branch_ops [:.]
@condition_ops [:if, :unless, :for, :try, :case, :cond, :and, :or, :&&, :||]
@@ -12,7 +12,7 @@ defmodule Credo.Check.Refactor.CyclomaticComplexity do
@explanation [check: @moduledoc]
@default_params [max_complexity: 9]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
# these have two outcomes: it succeds or does not
@double_condition_ops [:if, :unless, :for, :try, :and, :or, :&&, :||]
# these can have multiple outcomes as they are defined in their do blocks
@@ -23,7 +23,7 @@ defmodule Credo.Check.Refactor.Nesting do
@explanation [check: @moduledoc]
@default_params [max_nesting: 2]
@def_ops Application.get_env(:credo, :def_ops)
@def_ops [:def, :defp, :defmacro]
@nest_ops [:if, :unless, :case, :cond, :fn]
alias Credo.Check.CodeHelper
@@ -29,8 +29,99 @@ defmodule Credo.Check.Warning.NameRedeclarationByAssignment do
"""
@explanation [check: @moduledoc]
@kernel_fun_names Application.get_env(:credo, :kernel_fun_names)
@kernel_macro_names Application.get_env(:credo, :kernel_macro_names)
@kernel_fun_names [
:abs,
:apply,
:binary_part,
:bit_size,
:byte_size,
:div,
:elem,
:exit,
:function_exported?,
:get_and_update_in,
:get_in,
:hd,
:inspect,
:is_atom,
:is_binary,
:is_bitstring,
:is_boolean,
:is_float,
:is_function,
:is_integer,
:is_list,
:is_map,
:is_number,
:is_pid,
:is_port,
:is_reference,
:is_tuple,
:length,
:macro_exported?,
:make_ref,
:map_size,
:max,
:min,
:node,
:not,
:put_elem,
:put_in,
:rem,
:round,
:self,
:send,
:spawn,
:spawn_link,
:spawn_monitor,
:struct,
:throw,
:tl,
:trunc,
:tuple_size,
:update_in,
]
@kernel_macro_names [
:alias!,
:and,
:binding,
:def,
:defdelegate,
:defexception,
:defimpl,
:defmacro,
:defmacrop,
:defmodule,
:defoverridable,
:defp,
:defprotocol,
:defstruct,
:destructure,
:get_and_update_in,
:if,
:in,
:is_nil,
:match?,
:or,
:put_in,
:raise,
:reraise,
:sigil_C,
:sigil_R,
:sigil_S,
:sigil_W,
:sigil_c,
:sigil_r,
:sigil_s,
:sigil_w,
:to_char_list,
:to_string,
:unless,
:update_in,
:use,
:var!,
]
@excluded_names [:_]
alias Credo.Code.Module
Oops, something went wrong.

0 comments on commit fb1640c

Please sign in to comment.