···11+# This file contains the configuration for Credo and you are probably reading
22+# this after creating it with `mix credo.gen.config`.
33+#
44+# If you find anything wrong or unclear in this file, please report an
55+# issue on GitHub: https://github.com/rrrene/credo/issues
66+#
77+%{
88+ #
99+ # You can have as many configs as you like in the `configs:` field.
1010+ configs: [
1111+ %{
1212+ #
1313+ # Run any config using `mix credo -C <name>`. If no config name is given
1414+ # "default" is used.
1515+ #
1616+ name: "default",
1717+ #
1818+ # These are the files included in the analysis:
1919+ files: %{
2020+ #
2121+ # You can give explicit globs or simply directories.
2222+ # In the latter case `**/*.{ex,exs}` will be used.
2323+ #
2424+ included: [
2525+ "lib/",
2626+ "src/",
2727+ "test/",
2828+ "web/",
2929+ "scripts/*.exs",
3030+ "apps/*/lib/",
3131+ "apps/*/src/",
3232+ "apps/*/test/",
3333+ "apps/*/web/"
3434+ ],
3535+ excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
3636+ },
3737+ #
3838+ # Load and configure plugins here:
3939+ #
4040+ plugins: [],
4141+ #
4242+ # If you create your own checks, you must specify the source files for
4343+ # them here, so they can be loaded by Credo before running the analysis.
4444+ #
4545+ requires: [],
4646+ #
4747+ # If you want to enforce a style guide and need a more traditional linting
4848+ # experience, you can change `strict` to `true` below:
4949+ #
5050+ strict: true,
5151+ #
5252+ # To modify the timeout for parsing files, change this value:
5353+ #
5454+ parse_timeout: 5000,
5555+ #
5656+ # If you want to use uncolored output by default, you can change `color`
5757+ # to `false` below:
5858+ #
5959+ color: true,
6060+ #
6161+ # You can customize the parameters of any check by adding a second element
6262+ # to the tuple.
6363+ #
6464+ # To disable a check put `false` as second element:
6565+ #
6666+ # {Credo.Check.Design.DuplicatedCode, false}
6767+ #
6868+ checks: %{
6969+ enabled: [
7070+ #
7171+ ## Consistency Checks
7272+ #
7373+ {Credo.Check.Consistency.ExceptionNames, []},
7474+ {Credo.Check.Consistency.LineEndings, []},
7575+ {Credo.Check.Consistency.ParameterPatternMatching, []},
7676+ {Credo.Check.Consistency.SpaceAroundOperators, []},
7777+ {Credo.Check.Consistency.SpaceInParentheses, []},
7878+ {Credo.Check.Consistency.TabsOrSpaces, []},
7979+8080+ #
8181+ ## Design Checks
8282+ #
8383+ # You can customize the priority of any check
8484+ # Priority values are: `low, normal, high, higher`
8585+ #
8686+ {Credo.Check.Design.AliasUsage,
8787+ [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
8888+ {Credo.Check.Design.TagFIXME, []},
8989+ # You can also customize the exit_status of each check.
9090+ # If you don't want TODO comments to cause `mix credo` to fail, just
9191+ # set this value to 0 (zero).
9292+ #
9393+ # TODOs are allowed as intentional markers for future work.
9494+ {Credo.Check.Design.TagTODO, [exit_status: 0]},
9595+9696+ #
9797+ ## Readability Checks
9898+ #
9999+ {Credo.Check.Readability.AliasOrder, []},
100100+ {Credo.Check.Readability.BlockPipe, []},
101101+ {Credo.Check.Readability.FunctionNames, []},
102102+ {Credo.Check.Readability.ImplTrue, []},
103103+ {Credo.Check.Readability.LargeNumbers, []},
104104+ {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
105105+ {Credo.Check.Readability.ModuleAttributeNames, []},
106106+ {Credo.Check.Readability.ModuleDoc, []},
107107+ {Credo.Check.Readability.ModuleNames, []},
108108+ {Credo.Check.Readability.MultiAlias, []},
109109+ {Credo.Check.Readability.OneArityFunctionInPipe, []},
110110+ {Credo.Check.Readability.OnePipePerLine, []},
111111+ {Credo.Check.Readability.ParenthesesInCondition, []},
112112+ {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
113113+ {Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
114114+ {Credo.Check.Readability.PredicateFunctionNames, []},
115115+ {Credo.Check.Readability.PreferImplicitTry, []},
116116+ {Credo.Check.Readability.RedundantBlankLines, []},
117117+ {Credo.Check.Readability.Semicolons, []},
118118+ {Credo.Check.Readability.SeparateAliasRequire, []},
119119+ {Credo.Check.Readability.SingleFunctionToBlockPipe, []},
120120+ {Credo.Check.Readability.SinglePipe, []},
121121+ {Credo.Check.Readability.SpaceAfterCommas, []},
122122+ {Credo.Check.Readability.StrictModuleLayout, []},
123123+ {Credo.Check.Readability.StringSigils, []},
124124+ {Credo.Check.Readability.TrailingBlankLine, []},
125125+ {Credo.Check.Readability.TrailingWhiteSpace, []},
126126+ {Credo.Check.Readability.UnnecessaryAliasExpansion, []},
127127+ {Credo.Check.Readability.VariableNames, []},
128128+ {Credo.Check.Readability.WithCustomTaggedTuple, []},
129129+ {Credo.Check.Readability.WithSingleClause, []},
130130+131131+ #
132132+ ## Refactoring Opportunities
133133+ #
134134+ {Credo.Check.Refactor.Apply, []},
135135+ {Credo.Check.Refactor.CondStatements, []},
136136+ {Credo.Check.Refactor.CyclomaticComplexity, []},
137137+ {Credo.Check.Refactor.DoubleBooleanNegation, []},
138138+ {Credo.Check.Refactor.FilterCount, []},
139139+ {Credo.Check.Refactor.FilterFilter, []},
140140+ {Credo.Check.Refactor.FunctionArity, []},
141141+ {Credo.Check.Refactor.LongQuoteBlocks, []},
142142+ {Credo.Check.Refactor.MapJoin, []},
143143+ {Credo.Check.Refactor.MatchInCondition, []},
144144+ {Credo.Check.Refactor.NegatedConditionsInUnless, []},
145145+ {Credo.Check.Refactor.NegatedConditionsWithElse, []},
146146+ {Credo.Check.Refactor.Nesting, [max_nesting: 3]},
147147+ {Credo.Check.Refactor.PassAsyncInTestCases, []},
148148+ {Credo.Check.Refactor.PipeChainStart, []},
149149+ {Credo.Check.Refactor.RedundantWithClauseResult, []},
150150+ {Credo.Check.Refactor.RejectReject, []},
151151+ {Credo.Check.Refactor.UnlessWithElse, []},
152152+ {Credo.Check.Refactor.WithClauses, []},
153153+154154+ #
155155+ ## Warnings
156156+ #
157157+ {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
158158+ {Credo.Check.Warning.BoolOperationOnSameValues, []},
159159+ {Credo.Check.Warning.Dbg, []},
160160+ {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
161161+ {Credo.Check.Warning.IExPry, []},
162162+ {Credo.Check.Warning.IoInspect, []},
163163+ {Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
164164+ {Credo.Check.Warning.MixEnv, []},
165165+ {Credo.Check.Warning.OperationOnSameValues, []},
166166+ {Credo.Check.Warning.OperationWithConstantResult, []},
167167+ {Credo.Check.Warning.RaiseInsideRescue, []},
168168+ {Credo.Check.Warning.SpecWithStruct, []},
169169+ {Credo.Check.Warning.UnsafeExec, []},
170170+ {Credo.Check.Warning.UnusedEnumOperation, []},
171171+ {Credo.Check.Warning.UnusedFileOperation, []},
172172+ {Credo.Check.Warning.UnusedKeywordOperation, []},
173173+ {Credo.Check.Warning.UnusedListOperation, []},
174174+ {Credo.Check.Warning.UnusedPathOperation, []},
175175+ {Credo.Check.Warning.UnusedRegexOperation, []},
176176+ {Credo.Check.Warning.UnusedStringOperation, []},
177177+ {Credo.Check.Warning.UnusedTupleOperation, []},
178178+ {Credo.Check.Warning.WrongTestFileExtension, []}
179179+ ],
180180+ disabled: [
181181+ #
182182+ # Checks scheduled for next check update (opt-in for now)
183183+ {Credo.Check.Refactor.UtcNowTruncate, []},
184184+185185+ #
186186+ # Controversial and experimental checks (opt-in, just move the check to `:enabled`
187187+ # and be sure to use `mix credo --strict` to see low priority checks)
188188+ #
189189+ {Credo.Check.Consistency.MultiAliasImportRequireUse, []},
190190+ {Credo.Check.Consistency.UnusedVariableNames, []},
191191+ {Credo.Check.Design.DuplicatedCode, []},
192192+ {Credo.Check.Design.SkipTestWithoutComment, []},
193193+ {Credo.Check.Readability.AliasAs, []},
194194+ {Credo.Check.Readability.NestedFunctionCalls, []},
195195+ {Credo.Check.Readability.Specs, []},
196196+ {Credo.Check.Refactor.ABCSize, []},
197197+ {Credo.Check.Refactor.AppendSingleItem, []},
198198+ {Credo.Check.Refactor.FilterReject, []},
199199+ {Credo.Check.Refactor.IoPuts, []},
200200+ {Credo.Check.Refactor.MapMap, []},
201201+ {Credo.Check.Refactor.ModuleDependencies, []},
202202+ {Credo.Check.Refactor.NegatedIsNil, []},
203203+ {Credo.Check.Refactor.RejectFilter, []},
204204+ {Credo.Check.Refactor.VariableRebinding, []},
205205+ {Credo.Check.Warning.LazyLogging, []},
206206+ {Credo.Check.Warning.LeakyEnvironment, []},
207207+ {Credo.Check.Warning.MapGetUnsafePass, []},
208208+ {Credo.Check.Warning.UnsafeToAtom, []}
209209+210210+ # {Credo.Check.Refactor.MapInto, []},
211211+212212+ #
213213+ # Custom checks can be created using `mix credo.gen.check`.
214214+ #
215215+ ]
216216+ }
217217+ }
218218+ ]
219219+}
+2-2
lib/annot_at/application.ex
···5566 use Application
7788- @impl true
88+ @impl Application
99 def start(_type, _args) do
1010 children = [
1111 AnnotAtWeb.Telemetry,
···26262727 # Tell Phoenix to update the endpoint configuration
2828 # whenever the application is updated.
2929- @impl true
2929+ @impl Application
3030 def config_change(changed, _new, removed) do
3131 AnnotAtWeb.Endpoint.config_change(changed, removed)
3232 :ok
+1-1
lib/annot_at_web.ex
···8888 import AnnotAtWeb.CoreComponents
89899090 # Common modules used in templates
9191- alias Phoenix.LiveView.JS
9291 alias AnnotAtWeb.Layouts
9292+ alias Phoenix.LiveView.JS
93939494 # Routes generation with the ~p sigil
9595 unquote(verified_routes())
+2-1
lib/annot_at_web/components/core_components.ex
···2929 use Phoenix.Component
3030 use Gettext, backend: AnnotAtWeb.Gettext
31313232+ alias Phoenix.HTML.Form
3233 alias Phoenix.LiveView.JS
33343435 @doc """
···208209 def input(%{type: "checkbox"} = assigns) do
209210 assigns =
210211 assign_new(assigns, :checked, fn ->
211211- Phoenix.HTML.Form.normalize_value("checkbox", assigns[:value])
212212+ Form.normalize_value("checkbox", assigns[:value])
212213 end)
213214214215 ~H"""
+1-1
lib/annot_at_web/telemetry.ex
···66 Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
77 end
8899- @impl true
99+ @impl Supervisor
1010 def init(_arg) do
1111 children = [
1212 # Telemetry poller will execute the given period measurements
···11defmodule AnnotAtWeb.PageControllerTest do
22- use AnnotAtWeb.ConnCase
22+ use AnnotAtWeb.ConnCase, async: true
3344 test "GET /", %{conn: conn} do
55 conn = get(conn, ~p"/")
+7-3
test/support/data_case.ex
···16161717 use ExUnit.CaseTemplate
18181919+ alias Ecto.Adapters.SQL.Sandbox
2020+1921 using do
2022 quote do
2123 alias AnnotAt.Repo
···3638 Sets up the sandbox based on the test tags.
3739 """
3840 def setup_sandbox(tags) do
3939- pid = Ecto.Adapters.SQL.Sandbox.start_owner!(AnnotAt.Repo, shared: not tags[:async])
4040- on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end)
4141+ pid = Sandbox.start_owner!(AnnotAt.Repo, shared: not tags[:async])
4242+ on_exit(fn -> Sandbox.stop_owner(pid) end)
4143 end
42444345 @doc """
···5153 def errors_on(changeset) do
5254 Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
5355 Regex.replace(~r"%{(\w+)}", message, fn _, key ->
5454- opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
5656+ opts
5757+ |> Keyword.get(String.to_existing_atom(key), key)
5858+ |> to_string()
5559 end)
5660 end)
5761 end