diff --git a/apps/plataforma_digital/deps/blankable/.fetch b/apps/plataforma_digital/deps/blankable/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/blankable/.hex b/apps/plataforma_digital/deps/blankable/.hex
deleted file mode 100644
index f9d3ed0d..00000000
Binary files a/apps/plataforma_digital/deps/blankable/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/blankable/LICENSE b/apps/plataforma_digital/deps/blankable/LICENSE
deleted file mode 100644
index ace983b9..00000000
--- a/apps/plataforma_digital/deps/blankable/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2017 Sam Davies
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/apps/plataforma_digital/deps/blankable/README.md b/apps/plataforma_digital/deps/blankable/README.md
deleted file mode 100644
index 3d0dee49..00000000
--- a/apps/plataforma_digital/deps/blankable/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# Blankable
-
-Implementation of `blank?` in Elixir. Aims to work in a practically identical fashion to [ActiveSupport's #blank? method](http://api.rubyonrails.org/files/activesupport/lib/active_support/core_ext/object/blank_rb.html).
-
-## Installation
-
-Add `blankable` to your list of dependencies in `mix.exs`:
-
-```elixir
-def deps do
- [{:blankable, "~> 0.0.1"}]
-end
-```
-
-## Usage
-
-```
-iex> Blankable.blank?(nil)
-true
-iex> Blankable.blank?("")
-true
-iex> Blankable.blank?([])
-true
-iex> Blankable.blank?("Hello")
-false
-```
-
-You can also get behaviour similar to ActiveSupport's `present?` method like so:
-
-```elixir
-def present?(term) do
- !Blankable.blank?(term)
-end
-```
diff --git a/apps/plataforma_digital/deps/blankable/hex_metadata.config b/apps/plataforma_digital/deps/blankable/hex_metadata.config
deleted file mode 100644
index bdc69d5a..00000000
--- a/apps/plataforma_digital/deps/blankable/hex_metadata.config
+++ /dev/null
@@ -1,13 +0,0 @@
-{<<"app">>,<<"blankable">>}.
-{<<"build_tools">>,[<<"mix">>]}.
-{<<"description">>,
- <<"Implementation of `blank?` in Elixir. Aims to work in a practically identical fashion to ActiveSupport's #blank? method.">>}.
-{<<"elixir">>,<<"~> 1.3">>}.
-{<<"files">>,
- [<<"lib">>,<<"lib/blankable.ex">>,<<"mix.exs">>,<<"README.md">>,
- <<"LICENSE">>]}.
-{<<"licenses">>,[<<"MIT">>]}.
-{<<"links">>,[{<<"GitHub">>,<<"https://github.com/samphilipd/blankable">>}]}.
-{<<"name">>,<<"blankable">>}.
-{<<"requirements">>,[]}.
-{<<"version">>,<<"1.0.0">>}.
diff --git a/apps/plataforma_digital/deps/blankable/lib/blankable.ex b/apps/plataforma_digital/deps/blankable/lib/blankable.ex
deleted file mode 100644
index 8dde0b18..00000000
--- a/apps/plataforma_digital/deps/blankable/lib/blankable.ex
+++ /dev/null
@@ -1,63 +0,0 @@
-defprotocol Blankable do
- @fallback_to_any true
- @moduledoc """
- Elixir implementation of `blank?`, with similar behaviour to ActiveSupport's
- implementation
-
- ## Examples
-
- iex> Blankable.blank?(nil)
- true
- iex> Blankable.blank?("")
- true
- iex> Blankable.blank?([])
- true
- iex> Blankable.blank?("Hello")
- false
-
- """
-
- def blank?(term)
-end
-
-defimpl Blankable, for: List do
- def blank?([]), do: true
- def blank?(_), do: false
-end
-
-defimpl Blankable, for: Map do
- # Keep in mind we could not pattern match on %{} because it matches on all
- # maps. We can however check if the size is zero (and size is a fast
- # operation).
- def blank?(map), do: map_size(map) == 0
-end
-
-defimpl Blankable, for: Tuple do
- def blank?({}), do: true
- def blank?(_), do: false
-end
-
-defimpl Blankable, for: BitString do
- @blank_regex ~r/\A[[:space:]]*\z/u
-
- @doc "Optimise this common use case"
- def blank?(""), do: true
- def blank?(string) do
- Regex.match?(@blank_regex, string)
- end
-end
-
-defimpl Blankable, for: Any do
- def blank?(nil), do: true
- def blank?(false), do: true
- def blank?(atom) when is_atom(atom), do: false
- def blank?(function) when is_function(function), do: false
- def blank?(number) when is_number(number), do: false
- def blank?(term) do
- try do
- Enum.empty?(term)
- rescue
- Protocol.UndefinedError -> false
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/blankable/mix.exs b/apps/plataforma_digital/deps/blankable/mix.exs
deleted file mode 100644
index dfdad9c6..00000000
--- a/apps/plataforma_digital/deps/blankable/mix.exs
+++ /dev/null
@@ -1,44 +0,0 @@
-defmodule Blankable.Mixfile do
- use Mix.Project
-
- def project do
- [app: :blankable,
- version: "1.0.0",
- elixir: "~> 1.3",
- build_embedded: Mix.env == :prod,
- start_permanent: Mix.env == :prod,
- deps: deps(),
- package: package()]
- end
-
- # Configuration for the OTP application
- #
- # Type "mix help compile.app" for more information
- def application do
- # Specify extra applications you'll use from Erlang/Elixir
- [extra_applications: [:logger]]
- end
-
- # Dependencies can be Hex packages:
- #
- # {:my_dep, "~> 0.3.0"}
- #
- # Or git/path repositories:
- #
- # {:my_dep, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
- #
- # Type "mix help deps" for more examples and options
- defp deps do
- [{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}]
- end
-
- defp package do
- [
- files: ["lib", "mix.exs", "README.md", "LICENSE"],
- maintainers: ["Sam Davies"],
- licenses: ["MIT"],
- links: %{"GitHub" => "https://github.com/samphilipd/blankable"},
- description: "Implementation of `blank?` in Elixir. Aims to work in a practically identical fashion to ActiveSupport's #blank? method."
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/bunt/.fetch b/apps/plataforma_digital/deps/bunt/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/bunt/.formatter.exs b/apps/plataforma_digital/deps/bunt/.formatter.exs
deleted file mode 100644
index 69637278..00000000
--- a/apps/plataforma_digital/deps/bunt/.formatter.exs
+++ /dev/null
@@ -1,3 +0,0 @@
-[
- inputs: ["*.{ex,exs}", "{config,lib,test,script}/**/*.{ex,exs}"]
-]
diff --git a/apps/plataforma_digital/deps/bunt/.hex b/apps/plataforma_digital/deps/bunt/.hex
deleted file mode 100644
index 331b37f1..00000000
Binary files a/apps/plataforma_digital/deps/bunt/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/bunt/LICENSE b/apps/plataforma_digital/deps/bunt/LICENSE
deleted file mode 100644
index f826a473..00000000
--- a/apps/plataforma_digital/deps/bunt/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2015 René Föhring
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/apps/plataforma_digital/deps/bunt/README.md b/apps/plataforma_digital/deps/bunt/README.md
deleted file mode 100644
index 9aca101f..00000000
--- a/apps/plataforma_digital/deps/bunt/README.md
+++ /dev/null
@@ -1,124 +0,0 @@
-![Bunt](https://raw.github.com/rrrene/bunt/master/assets/logo.png)
-
-Enables 256 color ANSI coloring in the terminal and gives you the ability to alias colors to more semantic and application-specfic names.
-
-
-## Installation
-
-It's available via Hex:
-
- 1. Add bunt to your list of dependencies in `mix.exs`:
-
- def deps do
- [{:bunt, "~> 0.1.0"}]
- end
-
- 2. Ensure bunt is started before your application:
-
- def application do
- [applications: [:bunt]]
- end
-
-
-
-## Usage
-
-
-
-### 256 colors
-
-![Colors](https://raw.github.com/rrrene/bunt/master/assets/colors.png)
-
-`IO.ANSI` provides an interface to write text to the terminal in eight different colors like this:
-
- ["Hello, ", :red, :bright, "world!"]
- |> IO.ANSI.format
- |> IO.puts
-
-This will put the word "world!" in bright red.
-
-To cause as little friction as possible, the interface of `Bunt.ANSI` is 100% adapted from `IO.ANSI`.
-
-We can use `Bunt` in the same way:
-
- ["Hello, ", :color202, :bright, "world!"]
- |> Bunt.ANSI.format
- |> IO.puts
-
-which puts a bright orange-red `"world!"` on the screen.
-
-`Bunt` also provides a shortcut so we can skip the `format` call.
-
- ["Hello, ", :color202, :bright, "world!"]
- |> Bunt.puts
-
-and since nobody can remember that `:color202` is basically `:orangered`, you can use `:orangered` directly.
-
-
-
-### Named colors
-
-The following colors were given names, so you can use them in style:
-
- [:gold, "Look, it's really gold text!"]
- |> Bunt.puts
-
-Replace `:gold` with any of these values:
-
- darkblue mediumblue darkgreen darkslategray darkcyan
- deepskyblue springgreen aqua dimgray steelblue
- darkred darkmagenta olive chartreuse aquamarine
- greenyellow chocolate goldenrod lightgray beige
- lightcyan fuchsia orangered hotpink darkorange
- coral orange gold khaki moccasin
- mistyrose lightyellow
-
-You can see all supported colors by cloning the repo and running:
-
- $ mix run script/colors.exs
-
-### User-defined color aliases
-
-But since all these colors are hard to remember, you can alias them in your config.exs:
-
- # I tend to start the names of my color aliases with an underscore
- # but this is, naturally, not a must.
-
- config :bunt, color_aliases: [_cupcake: :color205]
-
-Then you can use these keys instead of the standard colors in your code:
-
- [:_cupcake, "Hello World!"]
- |> Bunt.puts
-
-Use this to give your colors semantics. They get easier to change later that way. (A colleague of mine shouted "It's CSS for console applications!" when he saw this and although that is ... well, not true, I really like the sentiment! :+1:)
-
-
-
-
-## Contributing
-
-1. [Fork it!](http://github.com/rrrene/bunt/fork)
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
-
-
-
-## Author
-
-René Föhring (@rrrene)
-
-
-
-## License
-
-Bunt is released under the MIT License. See the LICENSE file for further
-details.
-
-"Elixir" and the Elixir logo are copyright (c) 2012 Plataformatec.
-
-Elixir source code is released under Apache 2 License.
-
-Check NOTICE, ELIXIR-LICENSE and LICENSE files for more information.
diff --git a/apps/plataforma_digital/deps/bunt/hex_metadata.config b/apps/plataforma_digital/deps/bunt/hex_metadata.config
deleted file mode 100644
index 9a0de715..00000000
--- a/apps/plataforma_digital/deps/bunt/hex_metadata.config
+++ /dev/null
@@ -1,12 +0,0 @@
-{<<"app">>,<<"bunt">>}.
-{<<"build_tools">>,[<<"mix">>]}.
-{<<"description">>,<<"256 color ANSI coloring in the terminal">>}.
-{<<"elixir">>,<<"~> 1.1">>}.
-{<<"files">>,
- [<<"lib">>,<<"lib/bunt.ex">>,<<"lib/bunt_ansi.ex">>,<<".formatter.exs">>,
- <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}.
-{<<"licenses">>,[<<"MIT">>]}.
-{<<"links">>,[{<<"GitHub">>,<<"https://github.com/rrrene/bunt">>}]}.
-{<<"name">>,<<"bunt">>}.
-{<<"requirements">>,[]}.
-{<<"version">>,<<"0.2.1">>}.
diff --git a/apps/plataforma_digital/deps/bunt/lib/bunt.ex b/apps/plataforma_digital/deps/bunt/lib/bunt.ex
deleted file mode 100644
index 39bb1e6d..00000000
--- a/apps/plataforma_digital/deps/bunt/lib/bunt.ex
+++ /dev/null
@@ -1,38 +0,0 @@
-defmodule Bunt do
- use Application
-
- alias Bunt.ANSI
-
- @version Mix.Project.config()[:version]
-
- def puts(value \\ "") do
- value
- |> format
- |> IO.puts()
- end
-
- def warn(value \\ "") do
- formatted_value = format(value)
- IO.puts(:stderr, formatted_value)
- end
-
- def write(value \\ "") do
- value
- |> format
- |> IO.write()
- end
-
- def format, do: format("")
- def format(nil), do: format("")
- def format(text) when is_binary(text), do: text
-
- def format(list) when is_list(list) do
- list
- |> List.flatten()
- |> ANSI.format()
- end
-
- def start(_, _), do: {:ok, self()}
-
- def version, do: @version
-end
diff --git a/apps/plataforma_digital/deps/bunt/lib/bunt_ansi.ex b/apps/plataforma_digital/deps/bunt/lib/bunt_ansi.ex
deleted file mode 100644
index eb2f4522..00000000
--- a/apps/plataforma_digital/deps/bunt/lib/bunt_ansi.ex
+++ /dev/null
@@ -1,503 +0,0 @@
-defmodule Bunt.ANSI.Sequence do
- @moduledoc false
-
- defmacro defalias(alias_name, original_name) do
- quote bind_quoted: [alias_name: alias_name, original_name: original_name] do
- def unquote(alias_name)() do
- unquote(original_name)()
- end
-
- defp format_sequence(unquote(alias_name)) do
- unquote(original_name)()
- end
- end
- end
-
- defmacro defsequence(name, code, prefix \\ "", terminator \\ "m") do
- quote bind_quoted: [name: name, code: code, prefix: prefix, terminator: terminator] do
- def unquote(name)() do
- "\e[#{unquote(prefix)}#{unquote(code)}#{unquote(terminator)}"
- end
-
- defp format_sequence(unquote(name)) do
- unquote(name)()
- end
- end
- end
-end
-
-defmodule Bunt.ANSI do
- @moduledoc """
- Functionality to render ANSI escape sequences.
-
- [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code)
- are characters embedded in text used to control formatting, color, and
- other output options on video text terminals.
- """
-
- import Bunt.ANSI.Sequence
-
- @color_tuples [
- {nil, :color16, 16, {0, 0, 0}},
- {nil, :color17, 17, {0, 0, 95}},
- {"darkblue", :color18, 18, {0, 0, 135}},
- {nil, :color19, 19, {0, 0, 175}},
- {"mediumblue", :color20, 20, {0, 0, 215}},
- {nil, :color21, 21, {0, 0, 255}},
- {"darkgreen", :color22, 22, {0, 95, 0}},
- {"darkslategray", :color23, 23, {0, 95, 95}},
- {nil, :color24, 24, {0, 95, 135}},
- {nil, :color25, 25, {0, 95, 175}},
- {nil, :color26, 26, {0, 95, 215}},
- {nil, :color27, 27, {0, 95, 255}},
- {nil, :color28, 28, {0, 135, 0}},
- {nil, :color29, 29, {0, 135, 95}},
- {"darkcyan", :color30, 30, {0, 135, 135}},
- {nil, :color31, 31, {0, 135, 175}},
- {nil, :color32, 32, {0, 135, 215}},
- {nil, :color33, 33, {0, 135, 255}},
- {nil, :color34, 34, {0, 175, 0}},
- {nil, :color35, 35, {0, 175, 95}},
- {nil, :color36, 36, {0, 175, 135}},
- {nil, :color37, 37, {0, 175, 175}},
- {nil, :color38, 38, {0, 175, 215}},
- {"deepskyblue", :color39, 39, {0, 175, 255}},
- {nil, :color40, 40, {0, 215, 0}},
- {nil, :color41, 41, {0, 215, 95}},
- {nil, :color42, 42, {0, 215, 135}},
- {nil, :color43, 43, {0, 215, 175}},
- {nil, :color44, 44, {0, 215, 215}},
- {nil, :color45, 45, {0, 215, 255}},
- {nil, :color46, 46, {0, 255, 0}},
- {nil, :color47, 47, {0, 255, 95}},
- {"springgreen", :color48, 48, {0, 255, 135}},
- {nil, :color49, 49, {0, 255, 175}},
- {nil, :color50, 50, {0, 255, 215}},
- {"aqua", :color51, 51, {0, 255, 255}},
- {nil, :color52, 52, {95, 0, 0}},
- {nil, :color53, 53, {95, 0, 95}},
- {nil, :color54, 54, {95, 0, 135}},
- {nil, :color55, 55, {95, 0, 175}},
- {nil, :color56, 56, {95, 0, 215}},
- {nil, :color57, 57, {95, 0, 255}},
- {nil, :color58, 58, {95, 95, 0}},
- {"dimgray", :color59, 59, {95, 95, 95}},
- {nil, :color60, 60, {95, 95, 135}},
- {nil, :color61, 61, {95, 95, 175}},
- {nil, :color62, 62, {95, 95, 215}},
- {nil, :color63, 63, {95, 95, 255}},
- {nil, :color64, 64, {95, 135, 0}},
- {nil, :color65, 65, {95, 135, 95}},
- {nil, :color66, 66, {95, 135, 135}},
- {"steelblue", :color67, 67, {95, 135, 175}},
- {nil, :color68, 68, {95, 135, 215}},
- {nil, :color69, 69, {95, 135, 255}},
- {nil, :color70, 70, {95, 175, 0}},
- {nil, :color71, 71, {95, 175, 95}},
- {nil, :color72, 72, {95, 175, 135}},
- {nil, :color73, 73, {95, 175, 175}},
- {nil, :color74, 74, {95, 175, 215}},
- {nil, :color75, 75, {95, 175, 255}},
- {nil, :color76, 76, {95, 215, 0}},
- {nil, :color77, 77, {95, 215, 95}},
- {nil, :color78, 78, {95, 215, 135}},
- {nil, :color79, 79, {95, 215, 175}},
- {nil, :color80, 80, {95, 215, 215}},
- {nil, :color81, 81, {95, 215, 255}},
- {nil, :color82, 82, {95, 255, 0}},
- {nil, :color83, 83, {95, 255, 95}},
- {nil, :color84, 84, {95, 255, 135}},
- {nil, :color85, 85, {95, 255, 175}},
- {nil, :color86, 86, {95, 255, 215}},
- {nil, :color87, 87, {95, 255, 255}},
- {"darkred", :color88, 88, {135, 0, 0}},
- {nil, :color89, 89, {135, 0, 95}},
- {"darkmagenta", :color90, 90, {135, 0, 135}},
- {nil, :color91, 91, {135, 0, 175}},
- {nil, :color92, 92, {135, 0, 215}},
- {nil, :color93, 93, {135, 0, 255}},
- {nil, :color94, 94, {135, 95, 0}},
- {nil, :color95, 95, {135, 95, 95}},
- {nil, :color96, 96, {135, 95, 135}},
- {nil, :color97, 97, {135, 95, 175}},
- {nil, :color98, 98, {135, 95, 215}},
- {nil, :color99, 99, {135, 95, 255}},
- {"olive", :color100, 100, {135, 135, 0}},
- {nil, :color101, 101, {135, 135, 95}},
- {nil, :color102, 102, {135, 135, 135}},
- {nil, :color103, 103, {135, 135, 175}},
- {nil, :color104, 104, {135, 135, 215}},
- {nil, :color105, 105, {135, 135, 255}},
- {nil, :color106, 106, {135, 175, 0}},
- {nil, :color107, 107, {135, 175, 95}},
- {nil, :color108, 108, {135, 175, 135}},
- {nil, :color109, 109, {135, 175, 175}},
- {nil, :color110, 110, {135, 175, 215}},
- {nil, :color111, 111, {135, 175, 255}},
- {nil, :color112, 112, {135, 215, 0}},
- {nil, :color113, 113, {135, 215, 95}},
- {nil, :color114, 114, {135, 215, 135}},
- {nil, :color115, 115, {135, 215, 175}},
- {nil, :color116, 116, {135, 215, 215}},
- {nil, :color117, 117, {135, 215, 255}},
- {"chartreuse", :color118, 118, {135, 255, 0}},
- {nil, :color119, 119, {135, 255, 95}},
- {nil, :color120, 120, {135, 255, 135}},
- {nil, :color121, 121, {135, 255, 175}},
- {"aquamarine", :color122, 122, {135, 255, 215}},
- {nil, :color123, 123, {135, 255, 255}},
- {nil, :color124, 124, {175, 0, 0}},
- {nil, :color125, 125, {175, 0, 95}},
- {nil, :color126, 126, {175, 0, 135}},
- {nil, :color127, 127, {175, 0, 175}},
- {nil, :color128, 128, {175, 0, 215}},
- {nil, :color129, 129, {175, 0, 255}},
- {nil, :color130, 130, {175, 95, 0}},
- {nil, :color131, 131, {175, 95, 95}},
- {nil, :color132, 132, {175, 95, 135}},
- {nil, :color133, 133, {175, 95, 175}},
- {nil, :color134, 134, {175, 95, 215}},
- {nil, :color135, 135, {175, 95, 255}},
- {nil, :color136, 136, {175, 135, 0}},
- {nil, :color137, 137, {175, 135, 95}},
- {nil, :color138, 138, {175, 135, 135}},
- {nil, :color139, 139, {175, 135, 175}},
- {nil, :color140, 140, {175, 135, 215}},
- {nil, :color141, 141, {175, 135, 255}},
- {nil, :color142, 142, {175, 175, 0}},
- {nil, :color143, 143, {175, 175, 95}},
- {nil, :color144, 144, {175, 175, 135}},
- {nil, :color145, 145, {175, 175, 175}},
- {nil, :color146, 146, {175, 175, 215}},
- {nil, :color147, 147, {175, 175, 255}},
- {nil, :color148, 148, {175, 215, 0}},
- {nil, :color149, 149, {175, 215, 95}},
- {nil, :color150, 150, {175, 215, 135}},
- {nil, :color151, 151, {175, 215, 175}},
- {nil, :color152, 152, {175, 215, 215}},
- {nil, :color153, 153, {175, 215, 255}},
- {"greenyellow", :color154, 154, {175, 255, 0}},
- {nil, :color155, 155, {175, 255, 95}},
- {nil, :color156, 156, {175, 255, 135}},
- {nil, :color157, 157, {175, 255, 175}},
- {nil, :color158, 158, {175, 255, 215}},
- {nil, :color159, 159, {175, 255, 255}},
- {nil, :color160, 160, {215, 0, 0}},
- {nil, :color161, 161, {215, 0, 95}},
- {nil, :color162, 162, {215, 0, 135}},
- {nil, :color163, 163, {215, 0, 175}},
- {nil, :color164, 164, {215, 0, 215}},
- {nil, :color165, 165, {215, 0, 255}},
- {nil, :color166, 166, {215, 95, 0}},
- {nil, :color167, 167, {215, 95, 95}},
- {nil, :color168, 168, {215, 95, 135}},
- {nil, :color169, 169, {215, 95, 175}},
- {nil, :color170, 170, {215, 95, 215}},
- {nil, :color171, 171, {215, 95, 255}},
- {"chocolate", :color172, 172, {215, 135, 0}},
- {nil, :color173, 173, {215, 135, 95}},
- {nil, :color174, 174, {215, 135, 135}},
- {nil, :color175, 175, {215, 135, 175}},
- {nil, :color176, 176, {215, 135, 215}},
- {nil, :color177, 177, {215, 135, 255}},
- {"goldenrod", :color178, 178, {215, 175, 0}},
- {nil, :color179, 179, {215, 175, 95}},
- {nil, :color180, 180, {215, 175, 135}},
- {nil, :color181, 181, {215, 175, 175}},
- {nil, :color182, 182, {215, 175, 215}},
- {nil, :color183, 183, {215, 175, 255}},
- {nil, :color184, 184, {215, 215, 0}},
- {nil, :color185, 185, {215, 215, 95}},
- {nil, :color186, 186, {215, 215, 135}},
- {nil, :color187, 187, {215, 215, 175}},
- {"lightgray", :color188, 188, {215, 215, 215}},
- {nil, :color189, 189, {215, 215, 255}},
- {nil, :color190, 190, {215, 255, 0}},
- {nil, :color191, 191, {215, 255, 95}},
- {nil, :color192, 192, {215, 255, 135}},
- {nil, :color193, 193, {215, 255, 175}},
- {"beige", :color194, 194, {215, 255, 215}},
- {"lightcyan", :color195, 195, {215, 255, 255}},
- {nil, :color196, 196, {255, 0, 0}},
- {nil, :color197, 197, {255, 0, 95}},
- {nil, :color198, 198, {255, 0, 135}},
- {nil, :color199, 199, {255, 0, 175}},
- {nil, :color200, 200, {255, 0, 215}},
- {"fuchsia", :color201, 201, {255, 0, 255}},
- {"orangered", :color202, 202, {255, 95, 0}},
- {nil, :color203, 203, {255, 95, 95}},
- {nil, :color204, 204, {255, 95, 135}},
- {"hotpink", :color205, 205, {255, 95, 175}},
- {nil, :color206, 206, {255, 95, 215}},
- {nil, :color207, 207, {255, 95, 255}},
- {"darkorange", :color208, 208, {255, 135, 0}},
- {"coral", :color209, 209, {255, 135, 95}},
- {nil, :color210, 210, {255, 135, 135}},
- {nil, :color211, 211, {255, 135, 175}},
- {nil, :color212, 212, {255, 135, 215}},
- {nil, :color213, 213, {255, 135, 255}},
- {"orange", :color214, 214, {255, 175, 0}},
- {nil, :color215, 215, {255, 175, 95}},
- {nil, :color216, 216, {255, 175, 135}},
- {nil, :color217, 217, {255, 175, 175}},
- {nil, :color218, 218, {255, 175, 215}},
- {nil, :color219, 219, {255, 175, 255}},
- {"gold", :color220, 220, {255, 215, 0}},
- {nil, :color221, 221, {255, 215, 95}},
- {"khaki", :color222, 222, {255, 215, 135}},
- {"moccasin", :color223, 223, {255, 215, 175}},
- {"mistyrose", :color224, 224, {255, 215, 215}},
- {nil, :color225, 225, {255, 215, 255}},
- {nil, :color226, 226, {255, 255, 0}},
- {nil, :color227, 227, {255, 255, 95}},
- {nil, :color228, 228, {255, 255, 135}},
- {nil, :color229, 229, {255, 255, 175}},
- {"lightyellow", :color230, 230, {255, 255, 215}},
- {nil, :color231, 231, {255, 255, 255}},
- {nil, :color232, 232, {255, 255, 255}},
- {nil, :color233, 233, {255, 255, 255}},
- {nil, :color234, 234, {255, 255, 255}},
- {nil, :color235, 235, {255, 255, 255}},
- {nil, :color236, 236, {255, 255, 255}},
- {nil, :color237, 237, {255, 255, 255}},
- {nil, :color238, 238, {255, 255, 255}},
- {nil, :color239, 239, {255, 255, 255}},
- {nil, :color240, 240, {255, 255, 255}},
- {nil, :color241, 241, {255, 255, 255}},
- {nil, :color242, 242, {255, 255, 255}},
- {nil, :color243, 243, {255, 255, 255}},
- {nil, :color244, 244, {255, 255, 255}},
- {nil, :color245, 245, {255, 255, 255}},
- {nil, :color246, 246, {255, 255, 255}},
- {nil, :color247, 247, {255, 255, 255}},
- {nil, :color248, 248, {255, 255, 255}},
- {nil, :color249, 249, {255, 255, 255}},
- {nil, :color250, 250, {255, 255, 255}},
- {nil, :color251, 251, {255, 255, 255}},
- {nil, :color252, 252, {255, 255, 255}},
- {nil, :color253, 253, {255, 255, 255}},
- {nil, :color254, 254, {255, 255, 255}},
- {nil, :color255, 255, {255, 255, 255}}
- ]
-
- def color_tuples, do: @color_tuples
-
- for {name, color, code, _} <- @color_tuples do
- @doc "Sets foreground color to #{color}"
- defsequence(color, code, "38;5;")
-
- @doc "Sets background color to #{color}"
- defsequence(:"#{color}_background", code, "48;5;")
-
- if name do
- @doc "Sets foreground color to #{name}"
- defsequence(:"#{name}", code, "38;5;")
-
- @doc "Sets background color to #{name}"
- defsequence(:"#{name}_background", code, "48;5;")
- end
- end
-
- if Version.match?(System.version(), ">= 1.14.0-dev") do
- @color_aliases Application.compile_env(:bunt, :color_aliases, [])
- else
- function = :get_env
- @color_aliases apply(Application, function, [:bunt, :color_aliases, []])
- end
-
- def color_aliases, do: @color_aliases
-
- for {alias_name, original_name} <- @color_aliases do
- defalias(alias_name, original_name)
- defalias(:"#{alias_name}_background", :"#{original_name}_background")
- end
-
- @typep ansicode :: atom()
- @typep ansilist ::
- maybe_improper_list(
- char() | ansicode() | binary() | ansilist(),
- binary() | ansicode() | []
- )
- @type ansidata :: ansilist() | ansicode() | binary()
-
- @doc """
- Checks if ANSI coloring is supported and enabled on this machine.
-
- This function simply reads the configuration value for
- `:ansi_enabled` in the `:elixir` application. The value is by
- default `false` unless Elixir can detect during startup that
- both `stdout` and `stderr` are terminals.
- """
- @spec enabled? :: boolean
- def enabled? do
- Application.get_env(:elixir, :ansi_enabled, false)
- end
-
- @doc "Resets all attributes"
- defsequence(:reset, 0)
-
- @doc "Bright (increased intensity) or Bold"
- defsequence(:bright, 1)
-
- @doc "Faint (decreased intensity), not widely supported"
- defsequence(:faint, 2)
-
- @doc "Italic: on. Not widely supported. Sometimes treated as inverse"
- defsequence(:italic, 3)
-
- @doc "Underline: Single"
- defsequence(:underline, 4)
-
- @doc "Blink: Slow. Less than 150 per minute"
- defsequence(:blink_slow, 5)
-
- @doc "Blink: Rapid. MS-DOS ANSI.SYS; 150 per minute or more; not widely supported"
- defsequence(:blink_rapid, 6)
-
- @doc "Image: Negative. Swap foreground and background"
- defsequence(:inverse, 7)
-
- @doc "Image: Negative. Swap foreground and background"
- defsequence(:reverse, 7)
-
- @doc "Conceal. Not widely supported"
- defsequence(:conceal, 8)
-
- @doc "Crossed-out. Characters legible, but marked for deletion. Not widely supported"
- defsequence(:crossed_out, 9)
-
- @doc "Sets primary (default) font"
- defsequence(:primary_font, 10)
-
- for font_n <- [1, 2, 3, 4, 5, 6, 7, 8, 9] do
- @doc "Sets alternative font #{font_n}"
- defsequence(:"font_#{font_n}", font_n + 10)
- end
-
- @doc "Normal color or intensity"
- defsequence(:normal, 22)
-
- @doc "Not italic"
- defsequence(:not_italic, 23)
-
- @doc "Underline: None"
- defsequence(:no_underline, 24)
-
- @doc "Blink: off"
- defsequence(:blink_off, 25)
-
- colors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white]
-
- for {color, code} <- Enum.with_index(colors) do
- @doc "Sets foreground color to #{color}"
- defsequence(color, code + 30)
-
- @doc "Sets background color to #{color}"
- defsequence(:"#{color}_background", code + 40)
- end
-
- @doc "Default text color"
- defsequence(:default_color, 39)
-
- @doc "Default background color"
- defsequence(:default_background, 49)
-
- @doc "Framed"
- defsequence(:framed, 51)
-
- @doc "Encircled"
- defsequence(:encircled, 52)
-
- @doc "Overlined"
- defsequence(:overlined, 53)
-
- @doc "Not framed or encircled"
- defsequence(:not_framed_encircled, 54)
-
- @doc "Not overlined"
- defsequence(:not_overlined, 55)
-
- @doc "Sends cursor home"
- defsequence(:home, "", "H")
-
- @doc "Clears screen"
- defsequence(:clear, "2", "J")
-
- @doc "Clears line"
- defsequence(:clear_line, "2", "K")
-
- defp format_sequence(other) do
- raise ArgumentError, "invalid ANSI sequence specification: #{other}"
- end
-
- @doc ~S"""
- Formats a chardata-like argument by converting named ANSI sequences into actual
- ANSI codes.
-
- The named sequences are represented by atoms.
-
- It will also append an `IO.ANSI.reset/0` to the chardata when a conversion is
- performed. If you don't want this behaviour, use `format_fragment/2`.
-
- An optional boolean parameter can be passed to enable or disable
- emitting actual ANSI codes. When `false`, no ANSI codes will emitted.
- By default checks if ANSI is enabled using the `enabled?/0` function.
-
- ## Examples
-
- iex> IO.ANSI.format(["Hello, ", :red, :bright, "world!"], true)
- [[[[[[], "Hello, "] | "\e[31m"] | "\e[1m"], "world!"] | "\e[0m"]
-
- """
- def format(chardata, emit \\ enabled?()) when is_boolean(emit) do
- do_format(chardata, [], [], emit, :maybe)
- end
-
- @doc ~S"""
- Formats a chardata-like argument by converting named ANSI sequences into actual
- ANSI codes.
-
- The named sequences are represented by atoms.
-
- An optional boolean parameter can be passed to enable or disable
- emitting actual ANSI codes. When `false`, no ANSI codes will emitted.
- By default checks if ANSI is enabled using the `enabled?/0` function.
-
- ## Examples
-
- iex> IO.ANSI.format_fragment([:bright, 'Word'], true)
- [[[[[[] | "\e[1m"], 87], 111], 114], 100]
-
- """
- def format_fragment(chardata, emit \\ enabled?()) when is_boolean(emit) do
- do_format(chardata, [], [], emit, false)
- end
-
- defp do_format([term | rest], rem, acc, emit, append_reset) do
- do_format(term, [rest | rem], acc, emit, append_reset)
- end
-
- defp do_format(term, rem, acc, true, append_reset) when is_atom(term) do
- do_format([], rem, [acc | format_sequence(term)], true, !!append_reset)
- end
-
- defp do_format(term, rem, acc, false, append_reset) when is_atom(term) do
- do_format([], rem, acc, false, append_reset)
- end
-
- defp do_format(term, rem, acc, emit, append_reset) when not is_list(term) do
- do_format([], rem, [acc | [term]], emit, append_reset)
- end
-
- defp do_format([], [next | rest], acc, emit, append_reset) do
- do_format(next, rest, acc, emit, append_reset)
- end
-
- defp do_format([], [], acc, true, true) do
- [acc | IO.ANSI.reset()]
- end
-
- defp do_format([], [], acc, _emit, _append_reset) do
- acc
- end
-end
diff --git a/apps/plataforma_digital/deps/bunt/mix.exs b/apps/plataforma_digital/deps/bunt/mix.exs
deleted file mode 100644
index 7862f5de..00000000
--- a/apps/plataforma_digital/deps/bunt/mix.exs
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Bunt.Mixfile do
- use Mix.Project
-
- def project do
- [
- app: :bunt,
- version: "0.2.1",
- elixir: "~> 1.1",
- build_embedded: Mix.env() == :prod,
- start_permanent: Mix.env() == :prod,
- deps: deps(),
- name: "Bunt",
- description: "256 color ANSI coloring in the terminal",
- package: [
- maintainers: ["René Föhring"],
- licenses: ["MIT"],
- links: %{"GitHub" => "https://github.com/rrrene/bunt"}
- ]
- ]
- end
-
- # Configuration for the OTP application
- #
- # Type "mix help compile.app" for more information
- def application do
- [mod: {Bunt, []}, applications: [:logger]]
- end
-
- # Dependencies can be Hex packages:
- #
- # {:mydep, "~> 0.3.0"}
- #
- # Or git/path repositories:
- #
- # {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
- #
- # Type "mix help deps" for more examples and options
- defp deps do
- []
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/.credo.exs b/apps/plataforma_digital/deps/credo/.credo.exs
deleted file mode 100644
index 9e9f3c87..00000000
--- a/apps/plataforma_digital/deps/credo/.credo.exs
+++ /dev/null
@@ -1,216 +0,0 @@
-# This file contains the configuration for Credo and you are probably reading
-# this after creating it with `mix credo.gen.config`.
-#
-# If you find anything wrong or unclear in this file, please report an
-# issue on GitHub: https://github.com/rrrene/credo/issues
-#
-%{
- #
- # You can have as many configs as you like in the `configs:` field.
- configs: [
- %{
- #
- # Run any config using `mix credo -C `. If no config name is given
- # "default" is used.
- #
- name: "default",
- #
- # These are the files included in the analysis:
- files: %{
- #
- # You can give explicit globs or simply directories.
- # In the latter case `**/*.{ex,exs}` will be used.
- #
- included: [
- "lib/",
- "src/",
- "test/",
- "web/",
- "apps/*/lib/",
- "apps/*/src/",
- "apps/*/test/",
- "apps/*/web/"
- ],
- excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
- },
- #
- # Load and configure plugins here:
- #
- plugins: [],
- #
- # If you create your own checks, you must specify the source files for
- # them here, so they can be loaded by Credo before running the analysis.
- #
- requires: [],
- #
- # If you want to enforce a style guide and need a more traditional linting
- # experience, you can change `strict` to `true` below:
- #
- strict: false,
- #
- # To modify the timeout for parsing files, change this value:
- #
- parse_timeout: 5000,
- #
- # If you want to use uncolored output by default, you can change `color`
- # to `false` below:
- #
- color: true,
- #
- # You can customize the parameters of any check by adding a second element
- # to the tuple.
- #
- # To disable a check put `false` as second element:
- #
- # {Credo.Check.Design.DuplicatedCode, false}
- #
- checks: %{
- enabled: [
- #
- ## Consistency Checks
- #
- {Credo.Check.Consistency.ExceptionNames, []},
- {Credo.Check.Consistency.LineEndings, []},
- {Credo.Check.Consistency.ParameterPatternMatching, []},
- {Credo.Check.Consistency.SpaceAroundOperators, []},
- {Credo.Check.Consistency.SpaceInParentheses, []},
- {Credo.Check.Consistency.TabsOrSpaces, []},
-
- #
- ## Design Checks
- #
- # You can customize the priority of any check
- # Priority values are: `low, normal, high, higher`
- #
- {Credo.Check.Design.AliasUsage,
- [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
- # You can also customize the exit_status of each check.
- # If you don't want TODO comments to cause `mix credo` to fail, just
- # set this value to 0 (zero).
- #
- {Credo.Check.Design.TagTODO, [exit_status: 2]},
- {Credo.Check.Design.TagFIXME, []},
-
- #
- ## Readability Checks
- #
- {Credo.Check.Readability.AliasOrder, []},
- {Credo.Check.Readability.FunctionNames, []},
- {Credo.Check.Readability.LargeNumbers, []},
- {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
- {Credo.Check.Readability.ModuleAttributeNames, []},
- {Credo.Check.Readability.ModuleDoc, []},
- {Credo.Check.Readability.ModuleNames, []},
- {Credo.Check.Readability.ParenthesesInCondition, []},
- {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
- {Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
- {Credo.Check.Readability.PredicateFunctionNames, []},
- {Credo.Check.Readability.PreferImplicitTry, []},
- {Credo.Check.Readability.RedundantBlankLines, []},
- {Credo.Check.Readability.Semicolons, []},
- {Credo.Check.Readability.SpaceAfterCommas, []},
- {Credo.Check.Readability.StringSigils, []},
- {Credo.Check.Readability.TrailingBlankLine, []},
- {Credo.Check.Readability.TrailingWhiteSpace, []},
- {Credo.Check.Readability.UnnecessaryAliasExpansion, []},
- {Credo.Check.Readability.VariableNames, []},
- {Credo.Check.Readability.WithSingleClause, []},
-
- #
- ## Refactoring Opportunities
- #
- {Credo.Check.Refactor.Apply, []},
- {Credo.Check.Refactor.CondStatements, []},
- {Credo.Check.Refactor.CyclomaticComplexity, []},
- {Credo.Check.Refactor.FunctionArity, []},
- {Credo.Check.Refactor.LongQuoteBlocks, []},
- {Credo.Check.Refactor.MatchInCondition, []},
- {Credo.Check.Refactor.MapJoin, []},
- {Credo.Check.Refactor.NegatedConditionsInUnless, []},
- {Credo.Check.Refactor.NegatedConditionsWithElse, []},
- {Credo.Check.Refactor.Nesting, []},
- {Credo.Check.Refactor.UnlessWithElse, []},
- {Credo.Check.Refactor.WithClauses, []},
- {Credo.Check.Refactor.FilterCount, []},
- {Credo.Check.Refactor.FilterFilter, []},
- {Credo.Check.Refactor.RejectReject, []},
- {Credo.Check.Refactor.RedundantWithClauseResult, []},
-
- #
- ## Warnings
- #
- {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
- {Credo.Check.Warning.BoolOperationOnSameValues, []},
- {Credo.Check.Warning.Dbg, []},
- {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
- {Credo.Check.Warning.IExPry, []},
- {Credo.Check.Warning.IoInspect, []},
- {Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
- {Credo.Check.Warning.OperationOnSameValues, []},
- {Credo.Check.Warning.OperationWithConstantResult, []},
- {Credo.Check.Warning.RaiseInsideRescue, []},
- {Credo.Check.Warning.SpecWithStruct, []},
- {Credo.Check.Warning.WrongTestFileExtension, []},
- {Credo.Check.Warning.UnusedEnumOperation, []},
- {Credo.Check.Warning.UnusedFileOperation, []},
- {Credo.Check.Warning.UnusedKeywordOperation, []},
- {Credo.Check.Warning.UnusedListOperation, []},
- {Credo.Check.Warning.UnusedPathOperation, []},
- {Credo.Check.Warning.UnusedRegexOperation, []},
- {Credo.Check.Warning.UnusedStringOperation, []},
- {Credo.Check.Warning.UnusedTupleOperation, []},
- {Credo.Check.Warning.UnsafeExec, []}
- ],
- disabled: [
- #
- # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
-
- #
- # Controversial and experimental checks (opt-in, just move the check to `:enabled`
- # and be sure to use `mix credo --strict` to see low priority checks)
- #
- {Credo.Check.Consistency.MultiAliasImportRequireUse, []},
- {Credo.Check.Consistency.UnusedVariableNames, []},
- {Credo.Check.Design.DuplicatedCode, []},
- {Credo.Check.Design.SkipTestWithoutComment, []},
- {Credo.Check.Readability.AliasAs, []},
- {Credo.Check.Readability.BlockPipe, []},
- {Credo.Check.Readability.ImplTrue, []},
- {Credo.Check.Readability.MultiAlias, []},
- {Credo.Check.Readability.NestedFunctionCalls, []},
- {Credo.Check.Readability.OneArityFunctionInPipe, []},
- {Credo.Check.Readability.SeparateAliasRequire, []},
- {Credo.Check.Readability.SingleFunctionToBlockPipe, []},
- {Credo.Check.Readability.SinglePipe, []},
- {Credo.Check.Readability.Specs, []},
- {Credo.Check.Readability.StrictModuleLayout, []},
- {Credo.Check.Readability.WithCustomTaggedTuple, []},
- {Credo.Check.Readability.OnePipePerLine, []},
- {Credo.Check.Refactor.ABCSize, []},
- {Credo.Check.Refactor.AppendSingleItem, []},
- {Credo.Check.Refactor.DoubleBooleanNegation, []},
- {Credo.Check.Refactor.FilterReject, []},
- {Credo.Check.Refactor.IoPuts, []},
- {Credo.Check.Refactor.MapMap, []},
- {Credo.Check.Refactor.ModuleDependencies, []},
- {Credo.Check.Refactor.NegatedIsNil, []},
- {Credo.Check.Refactor.PassAsyncInTestCases, []},
- {Credo.Check.Refactor.PipeChainStart, []},
- {Credo.Check.Refactor.RejectFilter, []},
- {Credo.Check.Refactor.VariableRebinding, []},
- {Credo.Check.Warning.LazyLogging, []},
- {Credo.Check.Warning.LeakyEnvironment, []},
- {Credo.Check.Warning.MapGetUnsafePass, []},
- {Credo.Check.Warning.MixEnv, []},
- {Credo.Check.Warning.UnsafeToAtom, []}
-
- # {Credo.Check.Refactor.MapInto, []},
-
- #
- # Custom checks can be created using `mix credo.gen.check`.
- #
- ]
- }
- }
- ]
-}
diff --git a/apps/plataforma_digital/deps/credo/.fetch b/apps/plataforma_digital/deps/credo/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/credo/.hex b/apps/plataforma_digital/deps/credo/.hex
deleted file mode 100644
index ac349a2c..00000000
Binary files a/apps/plataforma_digital/deps/credo/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/credo/.template.check.ex b/apps/plataforma_digital/deps/credo/.template.check.ex
deleted file mode 100644
index 6ef2147e..00000000
--- a/apps/plataforma_digital/deps/credo/.template.check.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule <%= @check_name %> do
- @moduledoc """
- Checks all lines for a given Regex.
-
- This is fun!
- """
-
- @explanation [
- check: @moduledoc,
- params: [
- regex: "All lines matching this Regex will yield an issue.",
- ]
- ]
- @default_params [
- regex: ~r/Creeeedo/, # our check will find this line.
- ]
-
- # you can configure the basics of your check via the `use Credo.Check` call
- use Credo.Check, base_priority: :high, category: :custom, exit_status: 0
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- lines = SourceFile.lines(source_file)
-
- # IssueMeta helps us pass down both the source_file and params of a check
- # run to the lower levels where issues are created, formatted and returned
- issue_meta = IssueMeta.for(source_file, params)
-
- # we use the `params` parameter and the `Params` module to extract a
- # configuration parameter from `.credo.exs` while also providing a
- # default value
- line_regex = params |> Params.get(:regex, __MODULE__)
-
- # Finally, we can run our custom made analysis.
- # In this example, we look for lines in source code matching our regex:
- Enum.reduce(lines, [], &process_line(&1, &2, line_regex, issue_meta))
- end
-
- defp process_line({line_no, line}, issues, line_regex, issue_meta) do
- case Regex.run(line_regex, line) do
- nil -> issues
- matches ->
- trigger = matches |> List.last
- new_issue = issue_for(issue_meta, line_no, trigger)
- [new_issue] ++ issues
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- # format_issue/2 is a function provided by Credo.Check to help us format the
- # found issue
- format_issue issue_meta,
- message: "OMG! This line matches our Regexp in @default_params!",
- line_no: line_no,
- trigger: trigger
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/.template.debug.html b/apps/plataforma_digital/deps/credo/.template.debug.html
deleted file mode 100644
index 4a49d2fc..00000000
--- a/apps/plataforma_digital/deps/credo/.template.debug.html
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
- Credo Debug Log
-
-
-
-
-
-
-
-
-
Experimental Credo Debug Log
-
-
- Analysis in
-
- <%= File.cwd! %>
- took
- <%= @time_total %> ms (<%= @time_load %> ms to load, <%= @time_run %> ms running checks)
-
-
-
Timings
-
- Please note that these are cumulative timings across all cores, therefore an individual file or check can account for more time than the overall time spent.
-
-
-
-
-
-
Check
-
File
-
Time (ms)
-
-
-
Slowest Files
- <%= for {filename, time} <- Enum.take(@file_timings, 5) do %>
-
-
<%= filename %>
-
<%= floor(time / 1000) %>
-
-
- <% end %>
-
-
-
Slowest Checks
- <%= for {check, time} <- Enum.take(@check_timings, 5) do %>
-
-
-
-
-
diff --git a/apps/plataforma_digital/deps/credo/LICENSE b/apps/plataforma_digital/deps/credo/LICENSE
deleted file mode 100644
index 3dee2c23..00000000
--- a/apps/plataforma_digital/deps/credo/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2015-2020 René Föhring
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/apps/plataforma_digital/deps/credo/README.md b/apps/plataforma_digital/deps/credo/README.md
deleted file mode 100644
index d6d7a5c7..00000000
--- a/apps/plataforma_digital/deps/credo/README.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# Credo [![CI Tests](https://github.com/rrrene/credo/workflows/CI%20Tests/badge.svg)](https://github.com/rrrene/credo/actions?query=branch%3Amaster) [![Inline docs](https://inch-ci.org/github/rrrene/credo.svg?branch=master)](https://hexdocs.pm/credo)
-
-Credo is a static code analysis tool for the Elixir language with a focus on teaching and code consistency.
-
-It can show you refactoring opportunities in your code, complex code fragments, warn you about common mistakes, show inconsistencies in your naming scheme and - if needed - help you enforce a desired coding style.
-
-
-![Credo](https://raw.github.com/rrrene/credo/master/assets/screenshot.png)
-
-
-## Installation and Usage
-
-The easiest way to add Credo to your project is by [using Mix](http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html).
-
-Add `:credo` as a dependency to your project's `mix.exs`:
-
-```elixir
-defp deps do
- [
- {:credo, "~> 1.6", only: [:dev, :test], runtime: false}
- ]
-end
-```
-
-And run:
-
- $ mix deps.get
-
- $ mix credo
-
-## Documentation
-
-Documentation is [available on Hexdocs](https://hexdocs.pm/credo/)
-
-## Integrations
-
-### IDE/Editor
-
-Some IDEs and editors are able to run Credo in the background and mark issues inline.
-
-* [IntelliJ Elixir](https://github.com/KronicDeth/intellij-elixir#credo) - Elixir plugin for JetBrains IDEs (IntelliJ IDEA, Rubymine, PHPStorm, PyCharm, etc)
-* [linter-elixir-credo](https://atom.io/packages/linter-elixir-credo) - Package for Atom editor (by @smeevil)
-* [Elixir Linter (Credo)](https://marketplace.visualstudio.com/items?itemName=pantajoe.vscode-elixir-credo) - VSCode extension (by @pantajoe)
-* [flycheck](https://www.flycheck.org/en/latest/languages.html#elixir) - Emacs syntax checking extension
-* [kakoune](https://github.com/mawww/kakoune/wiki/Lint#elixir) - Config for linting support in Kakoune editor
-* [Neovim via null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/diagnostics/credo.lua) - diagnostics builtin
-
-### Automated Code Review
-
-* [Codacy](https://www.codacy.com/) - checks your code from style to security, duplication, complexity, and also integrates with coverage.
-* [SourceLevel](https://sourcelevel.io/) - tracks how your code changes over time and have this information accessible to your whole team.
-* [Stickler CI](https://stickler-ci.com/) - checks your code for style and best practices across your entire stack.
-
-## Contributing
-
-1. [Fork it!](http://github.com/rrrene/credo/fork)
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
-
-
-
-## Author
-
-René Föhring (@rrrene)
-
-
-
-## License
-
-Credo is released under the MIT License. See the LICENSE file for further
-details.
diff --git a/apps/plataforma_digital/deps/credo/hex_metadata.config b/apps/plataforma_digital/deps/credo/hex_metadata.config
deleted file mode 100644
index 89e5f435..00000000
--- a/apps/plataforma_digital/deps/credo/hex_metadata.config
+++ /dev/null
@@ -1,284 +0,0 @@
-{<<"app">>,<<"credo">>}.
-{<<"build_tools">>,[<<"mix">>]}.
-{<<"description">>,
- <<"A static code analysis tool with a focus on code consistency and teaching.">>}.
-{<<"elixir">>,<<">= 1.10.0">>}.
-{<<"files">>,
- [<<".credo.exs">>,<<".template.check.ex">>,<<".template.debug.html">>,
- <<"lib">>,<<"lib/mix">>,<<"lib/mix/tasks">>,
- <<"lib/mix/tasks/credo.gen.check.ex">>,
- <<"lib/mix/tasks/credo.gen.config.ex">>,<<"lib/mix/tasks/credo.ex">>,
- <<"lib/credo.ex">>,<<"lib/credo">>,<<"lib/credo/priority.ex">>,
- <<"lib/credo/build_info.ex">>,<<"lib/credo/cli.ex">>,
- <<"lib/credo/exs_loader.ex">>,<<"lib/credo/cli">>,
- <<"lib/credo/cli/command">>,<<"lib/credo/cli/command/help.ex">>,
- <<"lib/credo/cli/command/version.ex">>,<<"lib/credo/cli/command/explain">>,
- <<"lib/credo/cli/command/explain/output">>,
- <<"lib/credo/cli/command/explain/output/default.ex">>,
- <<"lib/credo/cli/command/explain/output/json.ex">>,
- <<"lib/credo/cli/command/explain/explain_output.ex">>,
- <<"lib/credo/cli/command/explain/explain_command.ex">>,
- <<"lib/credo/cli/command/gen.check.ex">>,<<"lib/credo/cli/command/list">>,
- <<"lib/credo/cli/command/list/list_command.ex">>,
- <<"lib/credo/cli/command/list/output">>,
- <<"lib/credo/cli/command/list/output/default.ex">>,
- <<"lib/credo/cli/command/list/output/flycheck.ex">>,
- <<"lib/credo/cli/command/list/output/sarif.ex">>,
- <<"lib/credo/cli/command/list/output/json.ex">>,
- <<"lib/credo/cli/command/list/output/oneline.ex">>,
- <<"lib/credo/cli/command/list/list_output.ex">>,
- <<"lib/credo/cli/command/info">>,<<"lib/credo/cli/command/info/output">>,
- <<"lib/credo/cli/command/info/output/default.ex">>,
- <<"lib/credo/cli/command/info/output/json.ex">>,
- <<"lib/credo/cli/command/info/info_command.ex">>,
- <<"lib/credo/cli/command/info/info_output.ex">>,
- <<"lib/credo/cli/command/categories">>,
- <<"lib/credo/cli/command/categories/categories_command.ex">>,
- <<"lib/credo/cli/command/categories/categories_output.ex">>,
- <<"lib/credo/cli/command/categories/output">>,
- <<"lib/credo/cli/command/categories/output/default.ex">>,
- <<"lib/credo/cli/command/categories/output/json.ex">>,
- <<"lib/credo/cli/command/suggest">>,
- <<"lib/credo/cli/command/suggest/suggest_command.ex">>,
- <<"lib/credo/cli/command/suggest/output">>,
- <<"lib/credo/cli/command/suggest/output/default.ex">>,
- <<"lib/credo/cli/command/suggest/output/flycheck.ex">>,
- <<"lib/credo/cli/command/suggest/output/sarif.ex">>,
- <<"lib/credo/cli/command/suggest/output/json.ex">>,
- <<"lib/credo/cli/command/suggest/output/oneline.ex">>,
- <<"lib/credo/cli/command/suggest/suggest_output.ex">>,
- <<"lib/credo/cli/command/diff">>,
- <<"lib/credo/cli/command/diff/diff_summary.ex">>,
- <<"lib/credo/cli/command/diff/output">>,
- <<"lib/credo/cli/command/diff/output/default.ex">>,
- <<"lib/credo/cli/command/diff/output/flycheck.ex">>,
- <<"lib/credo/cli/command/diff/output/json.ex">>,
- <<"lib/credo/cli/command/diff/output/oneline.ex">>,
- <<"lib/credo/cli/command/diff/diff_output.ex">>,
- <<"lib/credo/cli/command/diff/task">>,
- <<"lib/credo/cli/command/diff/task/get_git_diff.ex">>,
- <<"lib/credo/cli/command/diff/task/print_before_info.ex">>,
- <<"lib/credo/cli/command/diff/task/filter_issues.ex">>,
- <<"lib/credo/cli/command/diff/task/filter_issues_for_exit_status.ex">>,
- <<"lib/credo/cli/command/diff/task/print_results_and_summary.ex">>,
- <<"lib/credo/cli/command/diff/diff_command.ex">>,
- <<"lib/credo/cli/command/gen.config.ex">>,
- <<"lib/credo/cli/exit_status.ex">>,<<"lib/credo/cli/filename.ex">>,
- <<"lib/credo/cli/command.ex">>,<<"lib/credo/cli/output">>,
- <<"lib/credo/cli/output/ui.ex">>,<<"lib/credo/cli/output/summary.ex">>,
- <<"lib/credo/cli/output/formatter">>,
- <<"lib/credo/cli/output/formatter/flycheck.ex">>,
- <<"lib/credo/cli/output/formatter/sarif.ex">>,
- <<"lib/credo/cli/output/formatter/json.ex">>,
- <<"lib/credo/cli/output/formatter/oneline.ex">>,
- <<"lib/credo/cli/output/format_delegator.ex">>,
- <<"lib/credo/cli/output/first_run_hint.ex">>,
- <<"lib/credo/cli/output/shell.ex">>,<<"lib/credo/cli/filter.ex">>,
- <<"lib/credo/cli/options.ex">>,<<"lib/credo/cli/output.ex">>,
- <<"lib/credo/cli/switch.ex">>,<<"lib/credo/cli/task">>,
- <<"lib/credo/cli/task/run_checks.ex">>,
- <<"lib/credo/cli/task/load_and_validate_source_files.ex">>,
- <<"lib/credo/cli/task/set_relevant_issues.ex">>,
- <<"lib/credo/cli/task/prepare_checks_to_run.ex">>,
- <<"lib/credo/cli/sorter.ex">>,<<"lib/credo/test">>,
- <<"lib/credo/test/check_runner.ex">>,<<"lib/credo/test/assertions.ex">>,
- <<"lib/credo/test/source_files.ex">>,<<"lib/credo/test/case.ex">>,
- <<"lib/credo/code.ex">>,<<"lib/credo/plugin.ex">>,<<"lib/credo/check">>,
- <<"lib/credo/check/warning">>,
- <<"lib/credo/check/warning/expensive_empty_enum_check.ex">>,
- <<"lib/credo/check/warning/leaky_environment.ex">>,
- <<"lib/credo/check/warning/operation_on_same_values.ex">>,
- <<"lib/credo/check/warning/dbg.ex">>,
- <<"lib/credo/check/warning/raise_inside_rescue.ex">>,
- <<"lib/credo/check/warning/lazy_logging.ex">>,
- <<"lib/credo/check/warning/unused_path_operation.ex">>,
- <<"lib/credo/check/warning/unused_file_operation.ex">>,
- <<"lib/credo/check/warning/unused_string_operation.ex">>,
- <<"lib/credo/check/warning/application_config_in_module_attribute.ex">>,
- <<"lib/credo/check/warning/map_get_unsafe_pass.ex">>,
- <<"lib/credo/check/warning/unsafe_exec.ex">>,
- <<"lib/credo/check/warning/unused_list_operation.ex">>,
- <<"lib/credo/check/warning/mix_env.ex">>,
- <<"lib/credo/check/warning/bool_operation_on_same_values.ex">>,
- <<"lib/credo/check/warning/unused_operation.ex">>,
- <<"lib/credo/check/warning/unused_enum_operation.ex">>,
- <<"lib/credo/check/warning/spec_with_struct.ex">>,
- <<"lib/credo/check/warning/unused_regex_operation.ex">>,
- <<"lib/credo/check/warning/missed_metadata_key_in_logger_config.ex">>,
- <<"lib/credo/check/warning/unused_function_return_helper.ex">>,
- <<"lib/credo/check/warning/unused_keyword_operation.ex">>,
- <<"lib/credo/check/warning/io_inspect.ex">>,
- <<"lib/credo/check/warning/wrong_test_file_extension.ex">>,
- <<"lib/credo/check/warning/unused_tuple_operation.ex">>,
- <<"lib/credo/check/warning/forbidden_module.ex">>,
- <<"lib/credo/check/warning/iex_pry.ex">>,
- <<"lib/credo/check/warning/unsafe_to_atom.ex">>,
- <<"lib/credo/check/warning/operation_with_constant_result.ex">>,
- <<"lib/credo/check/params.ex">>,<<"lib/credo/check/runner.ex">>,
- <<"lib/credo/check/config_comment.ex">>,<<"lib/credo/check/readability">>,
- <<"lib/credo/check/readability/module_doc.ex">>,
- <<"lib/credo/check/readability/prefer_implicit_try.ex">>,
- <<"lib/credo/check/readability/single_pipe.ex">>,
- <<"lib/credo/check/readability/redundant_blank_lines.ex">>,
- <<"lib/credo/check/readability/max_line_length.ex">>,
- <<"lib/credo/check/readability/pipe_into_anonymous_functions.ex">>,
- <<"lib/credo/check/readability/one_pipe_per_line.ex">>,
- <<"lib/credo/check/readability/parentheses_on_zero_arity_defs.ex">>,
- <<"lib/credo/check/readability/single_function_to_block_pipe.ex">>,
- <<"lib/credo/check/readability/strict_module_layout.ex">>,
- <<"lib/credo/check/readability/with_custom_tagged_tuple.ex">>,
- <<"lib/credo/check/readability/trailing_white_space.ex">>,
- <<"lib/credo/check/readability/module_attribute_names.ex">>,
- <<"lib/credo/check/readability/parentheses_in_condition.ex">>,
- <<"lib/credo/check/readability/alias_order.ex">>,
- <<"lib/credo/check/readability/specs.ex">>,
- <<"lib/credo/check/readability/unnecessary_alias_expansion.ex">>,
- <<"lib/credo/check/readability/space_after_commas.ex">>,
- <<"lib/credo/check/readability/function_names.ex">>,
- <<"lib/credo/check/readability/large_numbers.ex">>,
- <<"lib/credo/check/readability/predicate_function_names.ex">>,
- <<"lib/credo/check/readability/variable_names.ex">>,
- <<"lib/credo/check/readability/string_sigils.ex">>,
- <<"lib/credo/check/readability/separate_alias_require.ex">>,
- <<"lib/credo/check/readability/one_arity_function_in_pipe.ex">>,
- <<"lib/credo/check/readability/with_single_clause.ex">>,
- <<"lib/credo/check/readability/block_pipe.ex">>,
- <<"lib/credo/check/readability/trailing_blank_line.ex">>,
- <<"lib/credo/check/readability/alias_as.ex">>,
- <<"lib/credo/check/readability/module_names.ex">>,
- <<"lib/credo/check/readability/semicolons.ex">>,
- <<"lib/credo/check/readability/impl_true.ex">>,
- <<"lib/credo/check/readability/multi_alias.ex">>,
- <<"lib/credo/check/readability/nested_function_calls.ex">>,
- <<"lib/credo/check/readability/prefer_unquoted_atoms.ex">>,
- <<"lib/credo/check/design">>,
- <<"lib/credo/check/design/skip_test_without_comment.ex">>,
- <<"lib/credo/check/design/tag_fixme.ex">>,
- <<"lib/credo/check/design/tag_helper.ex">>,
- <<"lib/credo/check/design/duplicated_code.ex">>,
- <<"lib/credo/check/design/alias_usage.ex">>,
- <<"lib/credo/check/design/tag_todo.ex">>,<<"lib/credo/check/worker.ex">>,
- <<"lib/credo/check/consistency">>,
- <<"lib/credo/check/consistency/space_around_operators.ex">>,
- <<"lib/credo/check/consistency/space_in_parentheses">>,
- <<"lib/credo/check/consistency/space_in_parentheses/collector.ex">>,
- <<"lib/credo/check/consistency/exception_names.ex">>,
- <<"lib/credo/check/consistency/space_in_parentheses.ex">>,
- <<"lib/credo/check/consistency/multi_alias_import_require_use.ex">>,
- <<"lib/credo/check/consistency/unused_variable_names.ex">>,
- <<"lib/credo/check/consistency/parameter_pattern_matching.ex">>,
- <<"lib/credo/check/consistency/multi_alias_import_require_use">>,
- <<"lib/credo/check/consistency/multi_alias_import_require_use/collector.ex">>,
- <<"lib/credo/check/consistency/unused_variable_names">>,
- <<"lib/credo/check/consistency/unused_variable_names/collector.ex">>,
- <<"lib/credo/check/consistency/exception_names">>,
- <<"lib/credo/check/consistency/exception_names/collector.ex">>,
- <<"lib/credo/check/consistency/tabs_or_spaces">>,
- <<"lib/credo/check/consistency/tabs_or_spaces/collector.ex">>,
- <<"lib/credo/check/consistency/tabs_or_spaces.ex">>,
- <<"lib/credo/check/consistency/collector.ex">>,
- <<"lib/credo/check/consistency/space_around_operators">>,
- <<"lib/credo/check/consistency/space_around_operators/space_helper.ex">>,
- <<"lib/credo/check/consistency/space_around_operators/collector.ex">>,
- <<"lib/credo/check/consistency/parameter_pattern_matching">>,
- <<"lib/credo/check/consistency/parameter_pattern_matching/collector.ex">>,
- <<"lib/credo/check/consistency/line_endings">>,
- <<"lib/credo/check/consistency/line_endings/collector.ex">>,
- <<"lib/credo/check/consistency/line_endings.ex">>,
- <<"lib/credo/check/config_comment_finder.ex">>,
- <<"lib/credo/check/refactor">>,
- <<"lib/credo/check/refactor/function_arity.ex">>,
- <<"lib/credo/check/refactor/negated_conditions_with_else.ex">>,
- <<"lib/credo/check/refactor/filter_filter.ex">>,
- <<"lib/credo/check/refactor/nesting.ex">>,
- <<"lib/credo/check/refactor/double_boolean_negation.ex">>,
- <<"lib/credo/check/refactor/long_quote_blocks.ex">>,
- <<"lib/credo/check/refactor/module_dependencies.ex">>,
- <<"lib/credo/check/refactor/reject_reject.ex">>,
- <<"lib/credo/check/refactor/append_single_item.ex">>,
- <<"lib/credo/check/refactor/filter_reject.ex">>,
- <<"lib/credo/check/refactor/io_puts.ex">>,
- <<"lib/credo/check/refactor/unless_with_else.ex">>,
- <<"lib/credo/check/refactor/map_map.ex">>,
- <<"lib/credo/check/refactor/filter_count.ex">>,
- <<"lib/credo/check/refactor/variable_rebinding.ex">>,
- <<"lib/credo/check/refactor/cyclomatic_complexity.ex">>,
- <<"lib/credo/check/refactor/negated_is_nil.ex">>,
- <<"lib/credo/check/refactor/match_in_condition.ex">>,
- <<"lib/credo/check/refactor/reject_filter.ex">>,
- <<"lib/credo/check/refactor/negated_conditions_in_unless.ex">>,
- <<"lib/credo/check/refactor/map_join.ex">>,
- <<"lib/credo/check/refactor/with_clauses.ex">>,
- <<"lib/credo/check/refactor/map_into.ex">>,
- <<"lib/credo/check/refactor/enum_helpers.ex">>,
- <<"lib/credo/check/refactor/perceived_complexity.ex">>,
- <<"lib/credo/check/refactor/abc_size.ex">>,
- <<"lib/credo/check/refactor/pass_async_in_test_cases.ex">>,
- <<"lib/credo/check/refactor/pipe_chain_start.ex">>,
- <<"lib/credo/check/refactor/redundant_with_clause_result.ex">>,
- <<"lib/credo/check/refactor/case_trivial_matches.ex">>,
- <<"lib/credo/check/refactor/apply.ex">>,
- <<"lib/credo/check/refactor/cond_statements.ex">>,<<"lib/credo/check.ex">>,
- <<"lib/credo/application.ex">>,<<"lib/credo/issue_meta.ex">>,
- <<"lib/credo/source_file.ex">>,<<"lib/credo/config_file.ex">>,
- <<"lib/credo/severity.ex">>,<<"lib/credo/watcher.ex">>,
- <<"lib/credo/config_builder.ex">>,<<"lib/credo/service">>,
- <<"lib/credo/service/source_file_scopes.ex">>,
- <<"lib/credo/service/source_file_source.ex">>,
- <<"lib/credo/service/config_files.ex">>,
- <<"lib/credo/service/source_file_lines.ex">>,
- <<"lib/credo/service/source_file_ast.ex">>,
- <<"lib/credo/service/ets_table_helper.ex">>,<<"lib/credo/execution.ex">>,
- <<"lib/credo/code">>,<<"lib/credo/code/name.ex">>,
- <<"lib/credo/code/block.ex">>,<<"lib/credo/code/token_ast_correlation.ex">>,
- <<"lib/credo/code/strings.ex">>,<<"lib/credo/code/scope.ex">>,
- <<"lib/credo/code/parameters.ex">>,<<"lib/credo/code/sigils.ex">>,
- <<"lib/credo/code/token.ex">>,<<"lib/credo/code/interpolation_helper.ex">>,
- <<"lib/credo/code/heredocs.ex">>,<<"lib/credo/code/module.ex">>,
- <<"lib/credo/code/charlists.ex">>,<<"lib/credo/sources.ex">>,
- <<"lib/credo/execution">>,
- <<"lib/credo/execution/execution_config_files.ex">>,
- <<"lib/credo/execution/execution_issues.ex">>,
- <<"lib/credo/execution/execution_timing.ex">>,
- <<"lib/credo/execution/execution_source_files.ex">>,
- <<"lib/credo/execution/task">>,
- <<"lib/credo/execution/task/parse_options.ex">>,
- <<"lib/credo/execution/task/write_debug_report.ex">>,
- <<"lib/credo/execution/task/assign_exit_status_for_issues.ex">>,
- <<"lib/credo/execution/task/set_default_command.ex">>,
- <<"lib/credo/execution/task/require_requires.ex">>,
- <<"lib/credo/execution/task/determine_command.ex">>,
- <<"lib/credo/execution/task/initialize_plugins.ex">>,
- <<"lib/credo/execution/task/initialize_command.ex">>,
- <<"lib/credo/execution/task/append_extra_config.ex">>,
- <<"lib/credo/execution/task/run_command.ex">>,
- <<"lib/credo/execution/task/append_default_config.ex">>,
- <<"lib/credo/execution/task/use_colors.ex">>,
- <<"lib/credo/execution/task/validate_config.ex">>,
- <<"lib/credo/execution/task/validate_options.ex">>,
- <<"lib/credo/execution/task/convert_cli_options_to_config.ex">>,
- <<"lib/credo/execution/task.ex">>,<<"lib/credo/issue.ex">>,<<"LICENSE">>,
- <<"mix.exs">>,<<"README.md">>]}.
-{<<"licenses">>,[<<"MIT">>]}.
-{<<"links">>,
- [{<<"Changelog">>,
- <<"https://github.com/rrrene/credo/blob/master/CHANGELOG.md">>},
- {<<"GitHub">>,<<"https://github.com/rrrene/credo">>}]}.
-{<<"name">>,<<"credo">>}.
-{<<"requirements">>,
- [[{<<"app">>,<<"file_system">>},
- {<<"name">>,<<"file_system">>},
- {<<"optional">>,false},
- {<<"repository">>,<<"hexpm">>},
- {<<"requirement">>,<<"~> 0.2.8">>}],
- [{<<"app">>,<<"bunt">>},
- {<<"name">>,<<"bunt">>},
- {<<"optional">>,false},
- {<<"repository">>,<<"hexpm">>},
- {<<"requirement">>,<<"~> 0.2.1">>}],
- [{<<"app">>,<<"jason">>},
- {<<"name">>,<<"jason">>},
- {<<"optional">>,false},
- {<<"repository">>,<<"hexpm">>},
- {<<"requirement">>,<<"~> 1.0">>}]]}.
-{<<"version">>,<<"1.7.0">>}.
diff --git a/apps/plataforma_digital/deps/credo/lib/credo.ex b/apps/plataforma_digital/deps/credo/lib/credo.ex
deleted file mode 100644
index 36e68d52..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo.ex
+++ /dev/null
@@ -1,42 +0,0 @@
-defmodule Credo do
- @moduledoc """
- Credo builds upon four building blocks:
-
- - `Credo.CLI` - everything related to the command line interface (CLI), which orchestrates the analysis
- - `Credo.Execution` - a struct which is handed down the pipeline during analysis
- - `Credo.Check` - the default Credo checks
- - `Credo.Code` - all analysis tools used by Credo during analysis
- """
-
- alias Credo.Execution
- alias Credo.Execution.Task.WriteDebugReport
-
- @version Mix.Project.config()[:version] |> Credo.BuildInfo.version()
-
- @doc """
- Runs Credo with the given `argv` and returns its final `Credo.Execution` struct.
-
- Example:
-
- iex> exec = Credo.run(["--only", "Readability"])
- iex> issues = Credo.Execution.get_issues(exec)
- iex> Enum.count(issues) > 0
- true
-
- """
- def run(argv_or_exec) do
- argv_or_exec
- |> Execution.build()
- |> Execution.run()
- |> WriteDebugReport.call([])
- end
-
- def run(argv_or_exec, files_that_changed) do
- argv_or_exec
- |> Execution.build(files_that_changed)
- |> Execution.run()
- |> WriteDebugReport.call([])
- end
-
- def version, do: @version
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/application.ex b/apps/plataforma_digital/deps/credo/lib/credo/application.ex
deleted file mode 100644
index eb12b9d5..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/application.ex
+++ /dev/null
@@ -1,29 +0,0 @@
-defmodule Credo.Application do
- @moduledoc false
-
- use Application
-
- @worker_modules [
- Credo.CLI.Output.Shell,
- Credo.Service.SourceFileAST,
- Credo.Service.SourceFileLines,
- Credo.Service.SourceFileScopes,
- Credo.Service.SourceFileSource
- ]
-
- if Version.match?(System.version(), ">= 1.10.0-rc") do
- def children do
- Enum.map(@worker_modules, &{&1, []})
- end
- else
- def children do
- import Supervisor.Spec, warn: false
- Enum.map(@worker_modules, &worker(&1, []))
- end
- end
-
- def start(_type, _args) do
- opts = [strategy: :one_for_one, name: Credo.Supervisor]
- Supervisor.start_link(children(), opts)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/build_info.ex b/apps/plataforma_digital/deps/credo/lib/credo/build_info.ex
deleted file mode 100644
index ae4987fb..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/build_info.ex
+++ /dev/null
@@ -1,109 +0,0 @@
-defmodule Credo.BuildInfo do
- @moduledoc false
-
- # This is called at compile-time and should not be used at runtime!
-
- @doc false
- def version(mix_version) do
- version(mix_version, git_info())
- end
-
- defp version(mix_version, nil) do
- mix_version
- end
-
- defp version(mix_version, git_info) do
- version =
- if git_info.tag == "v#{mix_version}" do
- mix_version
- else
- branch = git_info.branch || "nobranch"
- commit = git_info.commit || "nocommit"
-
- "#{mix_version}-ref.#{branch}.#{commit}"
- end
-
- if git_info.dirty? do
- "#{version}+uncommittedchanges"
- else
- version
- end
- end
-
- defp git_info do
- if in_git_work_tree?() do
- %{
- commit: git_commit(),
- branch: git_branch(),
- tag: git_tag(),
- dirty?: git_dirty?()
- }
- end
- end
-
- defp in_git_work_tree? do
- {_, exit_status} =
- System.cmd("git", ["rev-parse", "--is-inside-work-tree"], stderr_to_stdout: true)
-
- exit_status == 0
- rescue
- _ -> false
- end
-
- defp git_branch do
- case System.cmd("git", ["branch"]) do
- {output, 0} -> git_branch(output)
- {_, _} -> nil
- end
- end
-
- defp git_branch(output) do
- line_with_active_branch =
- output
- |> String.split("\n")
- |> Enum.find(fn
- "* " <> _ -> true
- _ -> false
- end)
-
- case line_with_active_branch do
- "* (HEAD detached at origin/" <> remote_branch_name ->
- String.replace(remote_branch_name, ~r/\)$/, "")
-
- "* (HEAD detached at " <> branch_name ->
- String.replace(branch_name, ~r/\)$/, "")
-
- "* " <> branch_name ->
- branch_name
-
- _ ->
- nil
- end
- end
-
- defp git_commit do
- case System.cmd("git", ["rev-parse", "--short", "HEAD"]) do
- {output, 0} -> String.trim(output)
- {_, _} -> nil
- end
- end
-
- defp git_tag do
- case System.cmd("git", ["tag", "--points-at", "HEAD"]) do
- {output, 0} -> String.trim(output)
- {_, _} -> nil
- end
- end
-
- defp git_dirty? do
- case System.cmd("git", ["status", "--short"]) do
- {output, 0} -> output |> String.trim() |> git_dirty?()
- {_, _} -> nil
- end
- end
-
- defp git_dirty?(""), do: false
- # Hex puts a `.fetch` file in the working dir when downloading deps via git
- defp git_dirty?("?? .fetch"), do: false
- defp git_dirty?(_), do: true
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check.ex b/apps/plataforma_digital/deps/credo/lib/credo/check.ex
deleted file mode 100644
index 4c72d131..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check.ex
+++ /dev/null
@@ -1,809 +0,0 @@
-defmodule Credo.Check do
- @moduledoc """
- `Check` modules represent the checks which are run during Credo's analysis.
-
- Example:
-
- defmodule MyCheck do
- use Credo.Check, category: :warning, base_priority: :high
-
- def run(%SourceFile{} = source_file, params) do
- #
- end
- end
-
- The check can be configured by passing the following
- options to `use Credo.Check`:
-
- - `:base_priority` Sets the checks's base priority (`:low`, `:normal`, `:high`, `:higher` or `:ignore`).
- - `:category` Sets the check's category (`:consistency`, `:design`, `:readability`, `:refactor` or `:warning`).
- - `:elixir_version` Sets the check's version requirement for Elixir (defaults to `>= 0.0.1`).
- - `:explanations` Sets explanations displayed for the check, e.g.
-
- ```elixir
- [
- check: "...",
- params: [
- param1: "Your favorite number",
- param2: "Online/Offline mode"
- ]
- ]
- ```
-
- - `:param_defaults` Sets the default values for the check's params (e.g. `[param1: 42, param2: "offline"]`)
- - `:tags` Sets the tags for this check (list of atoms, e.g. `[:tag1, :tag2]`)
-
- Please also note that these options to `use Credo.Check` are just a convenience to implement the `Credo.Check`
- behaviour. You can implement any of these by hand:
-
- defmodule MyCheck do
- use Credo.Check
-
- def category, do: :warning
-
- def base_priority, do: :high
-
- def explanations do
- [
- check: "...",
- params: [
- param1: "Your favorite number",
- param2: "Online/Offline mode"
- ]
- ]
- end
-
- def param_defaults, do: [param1: 42, param2: "offline"]
-
- def run(%SourceFile{} = source_file, params) do
- #
- end
- end
-
- The `run/2` function of a Check module takes two parameters: a source file and a list of parameters for the check.
- It has to return a list of found issues.
- """
-
- @doc """
- Runs the current check on all `source_files` by calling `run_on_source_file/3`.
-
- If you are developing a check that has to run on all source files, you can overwrite `run_on_all_source_files/3`:
-
- defmodule MyCheck do
- use Credo.Check
-
- def run_on_all_source_files(exec, source_files, params) do
- issues =
- source_files
- |> do_something_crazy()
- |> do_something_crazier()
-
- append_issues_and_timings(exec, issues)
-
- :ok
- end
- end
-
- Check out Credo's checks from the consistency category for examples of these kinds of checks.
- """
- @callback run_on_all_source_files(
- exec :: Credo.Execution.t(),
- source_files :: list(Credo.SourceFile.t()),
- params :: Keyword.t()
- ) :: :ok
-
- @doc """
- Runs the current check on a single `source_file` and appends the resulting issues to the current `exec`.
- """
- @callback run_on_source_file(
- exec :: Credo.Execution.t(),
- source_file :: Credo.SourceFile.t(),
- params :: Keyword.t()
- ) :: :ok
-
- @callback run(source_file :: Credo.SourceFile.t(), params :: Keyword.t()) ::
- list(Credo.Issue.t())
-
- @doc """
- Returns the base priority for the check.
-
- This can be one of `:higher`, `:high`, `:normal`, `:low` or `:ignore`
- (technically it can also be or an integer, but these are internal representations although that is not recommended).
- """
- @callback base_priority() :: :higher | :high | :normal | :low | :ignore | integer
-
- @doc """
- Returns the category for the check.
- """
- @callback category() :: atom
-
- @doc """
- Returns the required Elixir version for the check.
- """
- @callback elixir_version() :: String.t()
-
- @doc """
- Returns the exit status for the check.
- """
- @callback exit_status() :: integer
-
- @doc """
- Returns the explanations for the check and params as a keyword list.
- """
- @callback explanations() :: Keyword.t()
-
- @doc """
- Returns the default values for the check's params as a keyword list.
- """
- @callback param_defaults() :: Keyword.t()
-
- # @callback run(source_file :: Credo.SourceFile.t, params :: Keyword.t) :: list()
-
- @doc """
- Returns whether or not this check runs on all source files.
- """
- @callback run_on_all?() :: boolean
-
- @doc """
- Returns the tags for the check.
- """
- @callback tags() :: list(atom)
-
- @doc """
- Returns the docs URL for the check.
- """
- @callback docs_uri() :: binary()
-
- @doc """
- Returns an ID that can be used to identify the check.
- """
- @callback id() :: binary()
-
- @doc false
- @callback format_issue(issue_meta :: Credo.IssueMeta.t(), opts :: Keyword.t()) ::
- Credo.Issue.t()
-
- @base_category_exit_status_map %{
- consistency: 1,
- design: 2,
- readability: 4,
- refactor: 8,
- warning: 16
- }
-
- alias Credo.Check
- alias Credo.Check.Params
- alias Credo.Code.Scope
- alias Credo.Issue
- alias Credo.IssueMeta
- alias Credo.Priority
- alias Credo.Service.SourceFileScopes
- alias Credo.Severity
- alias Credo.SourceFile
-
- @valid_use_opts [
- :base_priority,
- :category,
- :docs_uri,
- :elixir_version,
- :exit_status,
- :explanations,
- :id,
- :param_defaults,
- :run_on_all,
- :tags
- ]
-
- @doc false
- defmacro __using__(opts) do
- Enum.each(opts, fn
- {key, _name} when key not in @valid_use_opts ->
- raise "Could not find key `#{key}` in #{inspect(@valid_use_opts)}"
-
- _ ->
- nil
- end)
-
- def_base_priority =
- if opts[:base_priority] do
- quote do
- @impl true
- def base_priority, do: unquote(opts[:base_priority])
- end
- else
- quote do
- @impl true
- def base_priority, do: 0
- end
- end
-
- def_category =
- if opts[:category] do
- quote do
- @impl true
- def category, do: unquote(category_body(opts[:category]))
- end
- else
- quote do
- @impl true
- def category, do: unquote(category_body(nil))
- end
- end
-
- def_elixir_version =
- if opts[:elixir_version] do
- quote do
- @impl true
- def elixir_version do
- unquote(opts[:elixir_version])
- end
- end
- else
- quote do
- @impl true
- def elixir_version, do: ">= 0.0.1"
- end
- end
-
- def_exit_status =
- if opts[:exit_status] do
- quote do
- @impl true
- def exit_status do
- unquote(opts[:exit_status])
- end
- end
- else
- quote do
- @impl true
- def exit_status, do: Credo.Check.to_exit_status(category())
- end
- end
-
- def_run_on_all? =
- if opts[:run_on_all] do
- quote do
- @impl true
- def run_on_all?, do: unquote(opts[:run_on_all] == true)
- end
- else
- quote do
- @impl true
- def run_on_all?, do: false
- end
- end
-
- def_param_defaults =
- if opts[:param_defaults] do
- quote do
- @impl true
- def param_defaults, do: unquote(opts[:param_defaults])
- end
- end
-
- def_explanations =
- if opts[:explanations] do
- quote do
- @impl true
- def explanations do
- unquote(opts[:explanations])
- end
- end
- end
-
- def_tags =
- quote do
- @impl true
- def tags do
- unquote(opts[:tags] || [])
- end
- end
-
- docs_uri =
- if opts[:docs_uri] do
- quote do
- @impl true
- def docs_uri do
- unquote(opts[:docs_uri])
- end
- end
- else
- quote do
- @impl true
- def docs_uri do
- "https://hexdocs.pm/credo/#{Credo.Code.Name.full(__MODULE__)}.html"
- end
- end
- end
-
- id =
- if opts[:id] do
- quote do
- @impl true
- def id do
- unquote(opts[:id])
- end
- end
- else
- quote do
- @impl true
- def id do
- Credo.Code.Name.full(__MODULE__)
- end
- end
- end
-
- quote do
- @moduledoc unquote(moduledoc(opts))
- @behaviour Credo.Check
- @before_compile Credo.Check
-
- @use_deprecated_run_on_all? false
-
- alias Credo.Check
- alias Credo.Check.Params
- alias Credo.CLI.ExitStatus
- alias Credo.CLI.Output.UI
- alias Credo.Execution
- alias Credo.Execution.ExecutionTiming
- alias Credo.Issue
- alias Credo.IssueMeta
- alias Credo.Priority
- alias Credo.Severity
- alias Credo.SourceFile
-
- unquote(def_base_priority)
- unquote(def_category)
- unquote(def_elixir_version)
- unquote(def_exit_status)
- unquote(def_run_on_all?)
- unquote(def_param_defaults)
- unquote(def_explanations)
- unquote(def_tags)
- unquote(docs_uri)
- unquote(id)
-
- @impl true
- def format_issue(issue_meta, issue_options) do
- Check.format_issue(
- issue_meta,
- issue_options,
- __MODULE__
- )
- end
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params \\ [])
-
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- if function_exported?(__MODULE__, :run, 3) do
- IO.warn(
- "Defining `run(source_files, exec, params)` for checks that run on all source files is deprecated. " <>
- "Define `run_on_all_source_files(exec, source_files, params)` instead."
- )
-
- apply(__MODULE__, :run, [source_files, exec, params])
- else
- do_run_on_all_source_files(exec, source_files, params)
- end
- end
-
- defp do_run_on_all_source_files(exec, source_files, params) do
- source_files
- |> Enum.map(&Task.async(fn -> run_on_source_file(exec, &1, params) end))
- |> Enum.each(&Task.await(&1, :infinity))
-
- :ok
- end
-
- @doc false
- @impl true
- def run_on_source_file(exec, source_file, params \\ [])
-
- def run_on_source_file(%Execution{debug: true} = exec, source_file, params) do
- ExecutionTiming.run(&do_run_on_source_file/3, [exec, source_file, params])
- |> ExecutionTiming.append(exec,
- task: exec.current_task,
- check: __MODULE__,
- filename: source_file.filename
- )
- end
-
- def run_on_source_file(exec, source_file, params) do
- do_run_on_source_file(exec, source_file, params)
- end
-
- defp do_run_on_source_file(exec, source_file, params) do
- issues =
- try do
- run(source_file, params)
- rescue
- error ->
- UI.warn("Error while running #{__MODULE__} on #{source_file.filename}")
-
- if exec.crash_on_error do
- reraise error, __STACKTRACE__
- else
- []
- end
- end
-
- append_issues_and_timings(issues, exec)
-
- :ok
- end
-
- @doc false
- @impl true
- def run(source_file, params)
-
- def run(%SourceFile{} = source_file, params) do
- throw("Implement me")
- end
-
- defoverridable Credo.Check
-
- defp append_issues_and_timings([] = _issues, exec) do
- exec
- end
-
- defp append_issues_and_timings([_ | _] = issues, exec) do
- Credo.Execution.ExecutionIssues.append(exec, issues)
- end
- end
- end
-
- @doc false
- defmacro __before_compile__(env) do
- quote do
- unquote(deprecated_def_default_params(env))
- unquote(deprecated_def_explanations(env))
-
- @doc false
- def param_names do
- Keyword.keys(param_defaults())
- end
-
- @deprecated "Use param_defaults/1 instead"
- @doc false
- def params_defaults do
- # deprecated - remove module attribute
- param_defaults()
- end
-
- @deprecated "Use param_names/1 instead"
- @doc false
- def params_names do
- param_names()
- end
-
- @deprecated "Use explanations()[:check] instead"
- @doc false
- def explanation do
- # deprecated - remove module attribute
- explanations()[:check]
- end
-
- @deprecated "Use explanations()[:params] instead"
- @doc false
- def explanation_for_params do
- # deprecated - remove module attribute
- explanations()[:params]
- end
- end
- end
-
- defp moduledoc(opts) do
- explanations = opts[:explanations]
-
- base_priority = opts_to_string(opts[:base_priority]) || 0
-
- # category = opts_to_string(opts[:category]) || to_string(__MODULE__)
-
- elixir_version_hint =
- if opts[:elixir_version] do
- elixir_version = opts_to_string(opts[:elixir_version])
-
- "requires Elixir `#{elixir_version}`"
- else
- "works with any version of Elixir"
- end
-
- check_doc = opts_to_string(explanations[:check])
- params = explanations[:params] |> opts_to_string() |> List.wrap()
- param_defaults = opts_to_string(opts[:param_defaults])
-
- params_doc =
- if params == [] do
- "*There are no specific parameters for this check.*"
- else
- param_explanation =
- Enum.map(params, fn {key, value} ->
- default_value = inspect(param_defaults[key], limit: :infinity)
-
- default_hint =
- if default_value do
- "*This parameter defaults to* `#{default_value}`."
- end
-
- value = value |> String.split("\n") |> Enum.map_join("\n", &" #{&1}")
-
- """
- ### `:#{key}`
-
- #{value}
-
- #{default_hint}
-
- """
- end)
-
- """
- Use the following parameters to configure this check:
-
- #{param_explanation}
-
- """
- end
-
- """
- This check has a base priority of `#{base_priority}` and #{elixir_version_hint}.
-
- ## Explanation
-
- #{check_doc}
-
- ## Check-Specific Parameters
-
- #{params_doc}
-
- ## General Parameters
-
- Like with all checks, [general params](check_params.html) can be applied.
-
- Parameters can be configured via the [`.credo.exs` config file](config_file.html).
- """
- end
-
- defp opts_to_string(value) do
- {result, _} =
- value
- |> Macro.to_string()
- |> Code.eval_string()
-
- result
- end
-
- defp deprecated_def_default_params(env) do
- default_params = Module.get_attribute(env.module, :default_params)
-
- if is_nil(default_params) do
- if not Module.defines?(env.module, {:param_defaults, 0}) do
- quote do
- @impl true
- def param_defaults, do: []
- end
- end
- else
- # deprecated - remove once we ditch @default_params
- quote do
- @impl true
- def param_defaults do
- @default_params
- end
- end
- end
- end
-
- defp deprecated_def_explanations(env) do
- defines_deprecated_explanation_module_attribute? =
- !is_nil(Module.get_attribute(env.module, :explanation))
-
- defines_deprecated_explanations_fun? = Module.defines?(env.module, {:explanations, 0})
-
- if defines_deprecated_explanation_module_attribute? do
- # deprecated - remove once we ditch @explanation
- quote do
- @impl true
- def explanations do
- @explanation
- end
- end
- else
- if !defines_deprecated_explanations_fun? do
- quote do
- @impl true
- def explanations, do: []
- end
- end
- end
- end
-
- def explanation_for(nil, _), do: nil
- def explanation_for(keywords, key), do: keywords[key]
-
- @doc """
- format_issue takes an issue_meta and returns an issue.
- The resulting issue can be made more explicit by passing the following
- options to `format_issue/2`:
-
- - `:priority` Sets the issue's priority.
- - `:trigger` Sets the issue's trigger.
- - `:line_no` Sets the issue's line number. Tries to find `column` if `:trigger` is supplied.
- - `:column` Sets the issue's column.
- - `:exit_status` Sets the issue's exit_status.
- - `:severity` Sets the issue's severity.
- """
- def format_issue(issue_meta, opts, check) do
- params = IssueMeta.params(issue_meta)
- issue_category = Params.category(params, check)
- issue_base_priority = Params.priority(params, check)
-
- format_issue(issue_meta, opts, issue_category, issue_base_priority, check)
- end
-
- @doc false
- def format_issue(issue_meta, opts, issue_category, issue_priority, check) do
- source_file = IssueMeta.source_file(issue_meta)
- params = IssueMeta.params(issue_meta)
-
- priority = Priority.to_integer(issue_priority)
-
- exit_status_or_category = Params.exit_status(params, check) || issue_category
- exit_status = Check.to_exit_status(exit_status_or_category)
-
- line_no = opts[:line_no]
- trigger = opts[:trigger]
- column = opts[:column]
- severity = opts[:severity] || Severity.default_value()
-
- %Issue{
- priority: priority,
- filename: source_file.filename,
- message: opts[:message],
- trigger: trigger,
- line_no: line_no,
- column: column,
- severity: severity,
- exit_status: exit_status
- }
- |> add_line_no_options(line_no, source_file)
- |> add_column_if_missing(trigger, line_no, column, source_file)
- |> add_check_and_category(check, issue_category)
- end
-
- defp add_check_and_category(issue, check, issue_category) do
- %Issue{
- issue
- | check: check,
- category: issue_category
- }
- end
-
- defp add_column_if_missing(issue, trigger, line_no, column, source_file) do
- if trigger && line_no && !column do
- %Issue{
- issue
- | column: SourceFile.column(source_file, line_no, trigger)
- }
- else
- issue
- end
- end
-
- defp add_line_no_options(issue, line_no, source_file) do
- if line_no do
- {_def, scope} = scope_for(source_file, line: line_no)
-
- %Issue{
- issue
- | priority: issue.priority + priority_for(source_file, scope),
- scope: scope
- }
- else
- issue
- end
- end
-
- # Returns the scope for the given line as a tuple consisting of the call to
- # define the scope (`:defmodule`, `:def`, `:defp` or `:defmacro`) and the
- # name of the scope.
- #
- # Examples:
- #
- # {:defmodule, "Foo.Bar"}
- # {:def, "Foo.Bar.baz"}
- #
- @doc false
- def scope_for(source_file, line: line_no) do
- source_file
- |> scope_list
- |> Enum.at(line_no - 1)
- end
-
- # Returns all scopes for the given source_file per line of source code as tuple
- # consisting of the call to define the scope
- # (`:defmodule`, `:def`, `:defp` or `:defmacro`) and the name of the scope.
- #
- # Examples:
- #
- # [
- # {:defmodule, "Foo.Bar"},
- # {:def, "Foo.Bar.baz"},
- # {:def, "Foo.Bar.baz"},
- # {:def, "Foo.Bar.baz"},
- # {:def, "Foo.Bar.baz"},
- # {:defmodule, "Foo.Bar"}
- # ]
- defp scope_list(%SourceFile{} = source_file) do
- case SourceFileScopes.get(source_file) do
- {:ok, value} ->
- value
-
- :notfound ->
- ast = SourceFile.ast(source_file)
- lines = SourceFile.lines(source_file)
- scope_info_list = Scope.scope_info_list(ast)
-
- result =
- Enum.map(lines, fn {line_no, _} ->
- Scope.name_from_scope_info_list(scope_info_list, line_no)
- end)
-
- SourceFileScopes.put(source_file, result)
-
- result
- end
- end
-
- defp priority_for(source_file, scope) do
- scope_prio_map = Priority.scope_priorities(source_file)
-
- scope_prio_map[scope] || 0
- end
-
- defp category_body(nil) do
- quote do
- name =
- __MODULE__
- |> Module.split()
- |> Enum.at(2)
-
- safe_name = name || :unknown
-
- safe_name
- |> to_string
- |> String.downcase()
- |> String.to_atom()
- end
- end
-
- defp category_body(value), do: value
-
- @doc "Converts a given category to an exit status"
- def to_exit_status(nil), do: 0
-
- def to_exit_status(atom) when is_atom(atom) do
- to_exit_status(@base_category_exit_status_map[atom])
- end
-
- def to_exit_status(value) when is_number(value), do: value
-
- @doc false
- def defined?(check)
-
- def defined?({atom, _params}), do: defined?(atom)
-
- def defined?(binary) when is_binary(binary) do
- binary |> String.to_atom() |> defined?()
- end
-
- def defined?(module) when is_atom(module) do
- case Code.ensure_compiled(module) do
- {:module, _} -> true
- {:error, _} -> false
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment.ex
deleted file mode 100644
index 3236f3f8..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment.ex
+++ /dev/null
@@ -1,146 +0,0 @@
-defmodule Credo.Check.ConfigComment do
- @moduledoc """
- `ConfigComment` structs represent comments which follow control Credo's behaviour.
-
- The following comments are supported:
-
- # credo:disable-for-this-file
- # credo:disable-for-next-line
- # credo:disable-for-previous-line
- # credo:disable-for-lines:
-
- """
-
- @instruction_disable_file "disable-for-this-file"
- @instruction_disable_next_line "disable-for-next-line"
- @instruction_disable_previous_line "disable-for-previous-line"
- @instruction_disable_lines "disable-for-lines"
-
- alias Credo.Issue
-
- defstruct line_no: nil,
- line_no_end: nil,
- instruction: nil,
- params: nil
-
- @doc "Returns a `ConfigComment` struct based on the given parameters."
- def new(instruction, param_string, line_no)
-
- def new("#{@instruction_disable_lines}:" <> line_count, param_string, line_no) do
- line_count = String.to_integer(line_count)
-
- params =
- param_string
- |> value_for()
- |> List.wrap()
-
- if line_count >= 0 do
- %__MODULE__{
- line_no: line_no,
- line_no_end: line_no + line_count,
- instruction: @instruction_disable_lines,
- params: params
- }
- else
- %__MODULE__{
- line_no: line_no + line_count,
- line_no_end: line_no,
- instruction: @instruction_disable_lines,
- params: params
- }
- end
- end
-
- def new(instruction, param_string, line_no) do
- %__MODULE__{
- line_no: line_no,
- instruction: instruction,
- params: param_string |> value_for() |> List.wrap()
- }
- end
-
- @doc "Returns `true` if the given `issue` should be ignored based on the given `config_comment`"
- def ignores_issue?(config_comment, issue)
-
- def ignores_issue?(
- %__MODULE__{instruction: @instruction_disable_file, params: params},
- %Issue{} = issue
- ) do
- params_ignore_issue?(params, issue)
- end
-
- def ignores_issue?(
- %__MODULE__{
- instruction: @instruction_disable_next_line,
- line_no: line_no,
- params: params
- },
- %Issue{line_no: line_no_issue} = issue
- )
- when line_no_issue == line_no + 1 do
- params_ignore_issue?(params, issue)
- end
-
- def ignores_issue?(
- %__MODULE__{
- instruction: @instruction_disable_previous_line,
- line_no: line_no,
- params: params
- },
- %Issue{line_no: line_no_issue} = issue
- )
- when line_no_issue == line_no - 1 do
- params_ignore_issue?(params, issue)
- end
-
- def ignores_issue?(
- %__MODULE__{
- instruction: @instruction_disable_lines,
- line_no: line_no_start,
- line_no_end: line_no_end,
- params: params
- },
- %Issue{line_no: line_no_issue} = issue
- )
- when line_no_issue >= line_no_start and line_no_issue <= line_no_end do
- params_ignore_issue?(params, issue)
- end
-
- def ignores_issue?(_, _) do
- false
- end
-
- #
-
- defp params_ignore_issue?([], _issue) do
- true
- end
-
- defp params_ignore_issue?(params, issue) when is_list(params) do
- Enum.any?(params, &check_tuple_ignores_issue?(&1, issue))
- end
-
- defp check_tuple_ignores_issue?(check_or_regex, issue) do
- if Regex.regex?(check_or_regex) do
- issue.check
- |> to_string
- |> String.match?(check_or_regex)
- else
- issue.check == check_or_regex
- end
- end
-
- defp value_for(""), do: nil
-
- defp value_for(param_string) do
- if regex_value?(param_string) do
- param_string
- |> String.slice(1..-2)
- |> Regex.compile!("i")
- else
- String.to_atom("Elixir.#{param_string}")
- end
- end
-
- defp regex_value?(param_string), do: param_string =~ ~r'^/.+/$'
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment_finder.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment_finder.ex
deleted file mode 100644
index b3072430..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/config_comment_finder.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule Credo.Check.ConfigCommentFinder do
- @moduledoc false
-
- # This check is used internally by Credo.
- #
- # It traverses the given codebase to find `Credo.Check.ConfigComment`
- # compatible comments, which control Credo's behaviour.
-
- @config_comment_format ~r/#\s*credo\:([\w-\:]+)\s*(.*)/im
-
- alias Credo.Check.ConfigComment
- alias Credo.SourceFile
-
- @doc false
- def run(source_files) when is_list(source_files) do
- source_files
- |> Enum.map(&find_and_set_in_source_file/1)
- |> Enum.reject(&is_nil/1)
- end
-
- def find_and_set_in_source_file(source_file) do
- case find_config_comments(source_file) do
- [] ->
- nil
-
- config_comments ->
- {source_file.filename, config_comments}
- end
- end
-
- defp find_config_comments(source_file) do
- source = SourceFile.source(source_file)
-
- if source =~ @config_comment_format do
- source
- |> Credo.Code.clean_charlists_strings_and_sigils()
- |> Credo.Code.to_lines()
- |> Enum.reduce([], &find_config_comment/2)
- else
- []
- end
- end
-
- defp find_config_comment({line_no, string}, memo) do
- case Regex.run(@config_comment_format, string) do
- nil ->
- memo
-
- [_, instruction, param_string] ->
- memo ++ [ConfigComment.new(instruction, param_string, line_no)]
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/collector.ex
deleted file mode 100644
index 8bd2e873..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/collector.ex
+++ /dev/null
@@ -1,219 +0,0 @@
-defmodule Credo.Check.Consistency.Collector do
- @moduledoc """
- A behavior for modules that walk through source files and
- identify consistency issues.
-
- When defining a consistency check, you would typically use
- this structure for the main module, responsible
- for formatting issue messages:
-
- defmodule Credo.Check.Consistency.SomeCheck do
- use Credo.Check, run_on_all: true
-
- @collector Credo.Check.Consistency.SomeCheck.Collector
-
- def run(source_files, exec, params) when is_list(source_files) do
- issue_formatter = &issues_for/3
-
- @collector.find_and_append_issues(source_files, exec, params, issue_formatter)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- issue_locations =
- @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(issue_locations, fn(location) ->
- format_issue issue_meta, message: ... # write an issue message
- end)
- end
-
- The actual analysis would be performed by another module
- implementing the `Credo.Check.Consistency.Collector` behavior:
-
- defmodule Credo.Check.Consistency.SomeCheck.Collector do
- use Credo.Check.Consistency.Collector
-
- def collect_matches(source_file, params) do
- # ...
- end
-
- def find_locations_not_matching(expected, source_file) do
- # ...
- end
- end
-
- Read further for more information on `collect_matches/2`,
- `find_locations_not_matching/2`, and `issue_formatter`.
- """
-
- alias Credo.Execution.ExecutionIssues
- alias Credo.Issue
- alias Credo.SourceFile
-
- @doc """
- When you call `@collector.find_and_append_issues/4` inside the check module,
- the collector first counts the occurrences of different matches
- (e.g. :with_space and :without_space for a space around operators check)
- per each source file.
-
- `collect_matches/2` produces a map of matches as keys and their frequencies
- as values (e.g. %{with_space: 50, without_space: 40}).
-
- The maps for individual source files are then merged, producing a map
- that reflects frequency trends for the whole codebase.
- """
- @callback collect_matches(
- source_file :: SourceFile.t(),
- params :: Keyword.t()
- ) :: %{
- term => non_neg_integer
- }
-
- # Once the most frequent match is identified, the `Collector` looks up
- # source files that have other matches (e.g. both :with_space
- # and :without_space or just :without_space when :with_space is the
- # most frequent) and calls the `issue_formatter` function on them.
- #
- # An issue formatter produces a list of `Credo.Issue` structs
- # from the most frequent (expected) match, a source file
- # containing other matches, and check params
- # (the latter two are required to build an IssueMeta).
- @type issue_formatter :: (term, SourceFile.t(), Keyword.t() -> [Issue.t()])
-
- @doc """
- `issue_formatter` may call the `@collector.find_locations_not_matching/2`
- function to obtain additional metadata for each occurrence of
- an unexpected match in a given file.
-
- An example implementation that returns a list of line numbers on
- which unexpected occurrences were found:
-
- def find_locations_not_matching(expected, source_file) do
- traverse(source_file, fn(match, line_no, acc) ->
- if match != expected do
- acc ++ [line_no]
- else
- acc
- end
- end)
- end
-
- defp traverse(source_file, fun), do: ...
- """
- @callback find_locations_not_matching(
- expected :: term,
- source_file :: SourceFile.t()
- ) :: list(term)
-
- @optional_callbacks find_locations_not_matching: 2
-
- defmacro __using__(_opts) do
- quote do
- @behaviour Credo.Check.Consistency.Collector
-
- alias Credo.Check.Consistency.Collector
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- @spec find_and_append_issues(
- [SourceFile.t()],
- Execution.t(),
- Keyword.t(),
- Collector.issue_formatter(),
- boolean()
- ) :: atom
- def find_and_append_issues(
- source_files,
- exec,
- params,
- issue_formatter,
- supress_issues_for_single_match? \\ false
- )
- when is_list(source_files) and is_function(issue_formatter) do
- source_files
- |> Collector.find_issues(
- __MODULE__,
- params,
- issue_formatter,
- supress_issues_for_single_match?
- )
- |> Enum.each(&Collector.append_issue_via_issue_service(&1, exec))
-
- :ok
- end
- end
- end
-
- def find_issues(
- source_files,
- collector,
- params,
- issue_formatter,
- supress_issues_for_single_match?
- ) do
- frequencies_per_source_file =
- source_files
- |> Enum.map(&Task.async(fn -> {&1, collector.collect_matches(&1, params)} end))
- |> Enum.map(&Task.await(&1, :infinity))
-
- frequencies = total_frequencies(frequencies_per_source_file)
-
- if map_size(frequencies) > 0 do
- most_frequent_match =
- most_frequent_match(frequencies, supress_issues_for_single_match?, params[:force])
-
- result =
- frequencies_per_source_file
- |> source_files_with_issues(most_frequent_match)
- |> Enum.map(&Task.async(fn -> issue_formatter.(most_frequent_match, &1, params) end))
- |> Enum.flat_map(&Task.await(&1, :infinity))
-
- result
- else
- []
- end
- end
-
- defp most_frequent_match(frequencies, supress_issues_for_single_match?, nil) do
- {value, frequency_of_match} = Enum.max_by(frequencies, &elem(&1, 1))
- single_match? = frequency_of_match == 1
-
- if single_match? && supress_issues_for_single_match? do
- :__only_single_match__
- else
- value
- end
- end
-
- defp most_frequent_match(_frequencies, _supress_issues_for_single_match, forced_value) do
- forced_value
- end
-
- def append_issue_via_issue_service(%Issue{} = issue, exec) do
- ExecutionIssues.append(exec, issue)
- end
-
- defp source_files_with_issues(_frequencies_per_file, :__only_single_match__) do
- []
- end
-
- defp source_files_with_issues(frequencies_per_file, most_frequent_match) do
- Enum.reduce(frequencies_per_file, [], fn {filename, stats}, acc ->
- unexpected_matches = Map.keys(stats) -- [most_frequent_match]
-
- if unexpected_matches != [] do
- [filename | acc]
- else
- acc
- end
- end)
- end
-
- defp total_frequencies(frequencies_per_file) do
- Enum.reduce(frequencies_per_file, %{}, fn {_, file_stats}, stats ->
- Map.merge(stats, file_stats, fn _k, f1, f2 -> f1 + f2 end)
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names.ex
deleted file mode 100644
index 8dff5795..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names.ex
+++ /dev/null
@@ -1,80 +0,0 @@
-defmodule Credo.Check.Consistency.ExceptionNames do
- use Credo.Check,
- id: "EX1001",
- run_on_all: true,
- base_priority: :high,
- explanations: [
- check: """
- Exception names should end with a common suffix like "Error".
-
- Try to name your exception modules consistently:
-
- defmodule BadCodeError do
- defexception [:message]
- end
-
- defmodule ParserError do
- defexception [:message]
- end
-
- Inconsistent use should be avoided:
-
- defmodule BadHTTPResponse do
- defexception [:message]
- end
-
- defmodule HTTPHeaderException do
- defexception [:message]
- end
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """
- ]
-
- @collector Credo.Check.Consistency.ExceptionNames.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3, true)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- issue_locations = @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(issue_locations, fn location ->
- format_issue(issue_meta, [
- {:message, message_for(expected, location[:trigger])} | location
- ])
- end)
- end
-
- defp message_for({:prefix, expected}, trigger) do
- message = """
- Exception modules should be named consistently.
- It seems your strategy is to prefix them with `#{expected}`,
- but `#{trigger}` does not follow that convention.
- """
-
- to_one_line(message)
- end
-
- defp message_for({:suffix, expected}, trigger) do
- message = """
- Exception modules should be named consistently.
- It seems your strategy is to have `#{expected}` as a suffix,
- but `#{trigger}` does not follow that convention.
- """
-
- to_one_line(message)
- end
-
- defp to_one_line(str) do
- str
- |> String.split()
- |> Enum.join(" ")
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names/collector.ex
deleted file mode 100644
index 014c1e92..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/exception_names/collector.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Credo.Check.Consistency.ExceptionNames.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- alias Credo.Code.Module
- alias Credo.Code.Name
-
- def collect_matches(source_file, _params) do
- exception_recorder = &record_exception/2
-
- Credo.Code.prewalk(source_file, &traverse(exception_recorder, &1, &2), %{})
- end
-
- def find_locations_not_matching(expected, source_file) do
- location_recorder = &record_not_matching(expected, &1, &2)
-
- source_file
- |> Credo.Code.prewalk(&traverse(location_recorder, &1, &2), [])
- |> Enum.reverse()
- end
-
- defp traverse(
- callback,
- {:defmodule, _meta, [{:__aliases__, _, _name_arr}, _arguments]} = ast,
- acc
- ) do
- if Module.exception?(ast) do
- {ast, callback.(ast, acc)}
- else
- {ast, acc}
- end
- end
-
- defp traverse(_callback, ast, acc), do: {ast, acc}
-
- defp record_exception(ast, acc) do
- {prefix, suffix} = ast |> Module.name() |> prefix_and_suffix
-
- acc
- |> Map.update({:prefix, prefix}, 1, &(&1 + 1))
- |> Map.update({:suffix, suffix}, 1, &(&1 + 1))
- end
-
- defp record_not_matching(expected, {_, meta, _} = ast, acc) do
- exception_name = Module.name(ast)
- {prefix, suffix} = prefix_and_suffix(exception_name)
-
- # TODO: how is this `case` necessary
- case expected do
- {:prefix, expected_prefix} ->
- if prefix != expected_prefix do
- [[line_no: meta[:line], trigger: exception_name] | acc]
- else
- acc
- end
-
- {:suffix, expected_suffix} ->
- if suffix != expected_suffix do
- [[line_no: meta[:line], trigger: exception_name] | acc]
- else
- acc
- end
- end
- end
-
- defp prefix_and_suffix(exception_name) do
- name_list = exception_name |> Name.last() |> Name.split_pascal_case()
- prefix = List.first(name_list)
- suffix = List.last(name_list)
-
- {prefix, suffix}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings.ex
deleted file mode 100644
index cd1aedca..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings.ex
+++ /dev/null
@@ -1,55 +0,0 @@
-defmodule Credo.Check.Consistency.LineEndings do
- use Credo.Check,
- id: "EX1002",
- run_on_all: true,
- base_priority: :high,
- tags: [:formatter],
- param_defaults: [
- force: nil
- ],
- explanations: [
- check: """
- Windows and Linux/macOS systems use different line-endings in files.
-
- It seems like a good idea not to mix these in the same codebase.
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """,
- params: [
- force: "Force a choice, values can be `:unix` or `:windows`."
- ]
- ]
-
- @collector Credo.Check.Consistency.LineEndings.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- first_line_with_issue = @collector.first_line_with_issue(expected, source_file)
-
- message =
- case expected do
- :unix ->
- "File is using windows line endings while most of the files use unix line endings."
-
- :windows ->
- "File is using unix line endings while most of the files use windows line endings."
- end
-
- trigger =
- case expected do
- :unix -> "\r\n"
- :windows -> "\n"
- end
-
- source_file
- |> IssueMeta.for(params)
- |> format_issue(message: message, line_no: first_line_with_issue, trigger: trigger)
- |> List.wrap()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings/collector.ex
deleted file mode 100644
index 19c53f35..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/line_endings/collector.ex
+++ /dev/null
@@ -1,33 +0,0 @@
-defmodule Credo.Check.Consistency.LineEndings.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- def collect_matches(source_file, _params) do
- source_file
- |> SourceFile.lines()
- # remove the last line since it behaves differently on windows and linux
- # and apparently does not help determining line endings (see #965)
- |> List.delete_at(-1)
- |> Enum.reduce(%{}, fn line, stats ->
- Map.update(stats, line_ending(line), 1, &(&1 + 1))
- end)
- end
-
- def first_line_with_issue(expected, source_file) do
- {line_no, _} =
- source_file
- |> SourceFile.lines()
- |> Enum.find(&(line_ending(&1) != expected))
-
- line_no
- end
-
- defp line_ending({_line_no, line}) do
- if String.ends_with?(line, "\r") do
- :windows
- else
- :unix
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use.ex
deleted file mode 100644
index 4dfa238e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Credo.Check.Consistency.MultiAliasImportRequireUse do
- use Credo.Check,
- id: "EX1003",
- run_on_all: true,
- base_priority: :high,
- tags: [:controversial],
- explanations: [
- check: """
- When using alias, import, require or use for multiple names from the same
- namespace, you have two options:
-
- Use single instructions per name:
-
- alias Ecto.Query
- alias Ecto.Schema
- alias Ecto.Multi
-
- or use one multi instruction per namespace:
-
- alias Ecto.{Query, Schema, Multi}
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """
- ]
-
- @collector Credo.Check.Consistency.MultiAliasImportRequireUse.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- issue_locations = @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(issue_locations, fn line_no ->
- format_issue(issue_meta, message: message_for(expected), line_no: line_no)
- end)
- end
-
- defp message_for(:multi = _expected) do
- "Most of the time you are using the multi-alias/require/import/use syntax, but here you are using multiple single directives"
- end
-
- defp message_for(:single = _expected) do
- "Most of the time you are using the multiple single line alias/require/import/use directives but here you are using the multi-alias/require/import/use syntax"
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use/collector.ex
deleted file mode 100644
index fcf1e1ef..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/multi_alias_import_require_use/collector.ex
+++ /dev/null
@@ -1,97 +0,0 @@
-defmodule Credo.Check.Consistency.MultiAliasImportRequireUse.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- @directives [:alias, :import, :require, :use]
-
- def collect_matches(source_file, _params) do
- source_file
- |> Credo.Code.prewalk(&traverse/2, [])
- |> group_usages
- |> count_occurrences
- end
-
- def find_locations_not_matching(expected, source_file) do
- source_file
- |> Credo.Code.prewalk(&traverse/2, [])
- |> group_usages
- |> drop_locations(expected)
- end
-
- defp traverse({directive, meta, arguments} = ast, acc)
- when directive in @directives do
- aliases =
- case arguments do
- [{:__aliases__, _, nested_modules}] when length(nested_modules) > 1 ->
- base_name = Enum.slice(nested_modules, 0..-2)
- {:single, base_name}
-
- [{{:., _, [{:__aliases__, _, _namespaces}, :{}]}, _, _nested_aliases}] ->
- :multi
-
- _ ->
- nil
- end
-
- if aliases do
- {ast, [{directive, aliases, meta[:line]} | acc]}
- else
- {ast, acc}
- end
- end
-
- defp traverse(ast, acc), do: {ast, acc}
-
- defp group_usages(usages) do
- split_with(usages, fn
- {_directive, :multi, _line_no} -> true
- _ -> false
- end)
- end
-
- defp count_occurrences({multi, single}) do
- stats = [
- multi: Enum.count(multi),
- single: single |> multiple_single_locations |> Enum.count()
- ]
-
- stats
- |> Enum.filter(fn {_, count} -> count > 0 end)
- |> Enum.into(%{})
- end
-
- defp drop_locations({_, single}, :multi), do: multiple_single_locations(single)
-
- defp drop_locations({multi, _}, :single), do: multi_locations(multi)
-
- defp multi_locations(multi_usages) do
- Enum.map(multi_usages, fn {_directive, :multi, line_no} -> line_no end)
- end
-
- defp multiple_single_locations(single_usages) do
- single_usages
- |> Enum.group_by(fn {directive, base_name, _line_no} ->
- {directive, base_name}
- end)
- |> Enum.filter(fn {_grouped_by, occurrences} ->
- Enum.count(occurrences) > 1
- end)
- |> Enum.map(fn {_grouped_by, [{_, _, line_no} | _]} -> line_no end)
- end
-
- # Enum.split_with/2 is not available on Elixir < 1.4
- # see https://github.com/elixir-lang/elixir/blob/v1.4.4/lib/elixir/lib/enum.ex#L1620
- defp split_with(enumerable, fun) when is_function(fun, 1) do
- {acc1, acc2} =
- Enum.reduce(enumerable, {[], []}, fn entry, {acc1, acc2} ->
- if fun.(entry) do
- {[entry | acc1], acc2}
- else
- {acc1, [entry | acc2]}
- end
- end)
-
- {:lists.reverse(acc1), :lists.reverse(acc2)}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching.ex
deleted file mode 100644
index 07e4668c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-defmodule Credo.Check.Consistency.ParameterPatternMatching do
- use Credo.Check,
- id: "EX1004",
- run_on_all: true,
- base_priority: :high,
- param_defaults: [
- force: nil
- ],
- explanations: [
- check: """
- When capturing a parameter using pattern matching you can either put the parameter name before or after the value
- i.e.
-
- def parse({:ok, values} = pair)
-
- or
-
- def parse(pair = {:ok, values})
-
- Neither of these is better than the other, but it seems a good idea not to mix the two patterns in the same codebase.
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """,
- params: [
- force: "Force a choice, values can be `:after` or `:before`."
- ]
- ]
-
- @collector Credo.Check.Consistency.ParameterPatternMatching.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- issue_locations = @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(issue_locations, fn location ->
- format_issue(issue_meta, [{:message, message_for(expected)} | location])
- end)
- end
-
- defp message_for(expected) do
- actual = @collector.actual_for(expected)
-
- "File has #{message_for_kind(actual)} while most of the files " <>
- "have #{message_for_kind(expected)} when naming parameter pattern matches"
- end
-
- defp message_for_kind(:after), do: "the variable name after the pattern"
- defp message_for_kind(:before), do: "the variable name before the pattern"
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching/collector.ex
deleted file mode 100644
index aa286d05..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/parameter_pattern_matching/collector.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-defmodule Credo.Check.Consistency.ParameterPatternMatching.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- def collect_matches(source_file, _params) do
- position_recorder = &record_position/4
-
- Credo.Code.prewalk(source_file, &traverse(position_recorder, &1, &2), %{})
- end
-
- def find_locations_not_matching(expected, source_file) do
- location_recorder = &record_not_matching(expected, &1, &2, &3, &4)
-
- source_file
- |> Credo.Code.prewalk(&traverse(location_recorder, &1, &2), [])
- |> Enum.reverse()
- end
-
- def actual_for(:before = _expected), do: :after
- def actual_for(:after = _expected), do: :before
-
- defp traverse(callback, {:def, _, [{_name, _, params}, _]} = ast, acc)
- when is_list(params) do
- {ast, traverse_params(callback, params, acc)}
- end
-
- defp traverse(callback, {:defp, _, [{_name, _, params}, _]} = ast, acc)
- when is_list(params) do
- {ast, traverse_params(callback, params, acc)}
- end
-
- defp traverse(_callback, ast, acc), do: {ast, acc}
-
- defp traverse_params(callback, params, acc) do
- Enum.reduce(params, acc, fn
- {:=, _, [{capture_name, meta, nil}, _rhs]}, param_acc ->
- callback.(:before, capture_name, meta, param_acc)
-
- {:=, _, [_lhs, {capture_name, meta, nil}]}, param_acc ->
- callback.(:after, capture_name, meta, param_acc)
-
- _, param_acc ->
- param_acc
- end)
- end
-
- defp record_position(kind, _capture_name, _meta, acc) do
- Map.update(acc, kind, 1, &(&1 + 1))
- end
-
- defp record_not_matching(expected, actual, capture_name, meta, acc) do
- if actual != expected do
- [[line_no: meta[:line], trigger: capture_name] | acc]
- else
- acc
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators.ex
deleted file mode 100644
index 5c925c5a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators.ex
+++ /dev/null
@@ -1,267 +0,0 @@
-defmodule Credo.Check.Consistency.SpaceAroundOperators do
- use Credo.Check,
- id: "EX1005",
- run_on_all: true,
- base_priority: :high,
- tags: [:formatter],
- param_defaults: [ignore: [:|]],
- explanations: [
- check: """
- Use spaces around operators like `+`, `-`, `*` and `/`. This is the
- **preferred** way, although other styles are possible, as long as it is
- applied consistently.
-
- # preferred
-
- 1 + 2 * 4
-
- # also okay
-
- 1+2*4
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """,
- params: [
- ignore: "List of operators to be ignored for this check."
- ]
- ]
-
- @collector Credo.Check.Consistency.SpaceAroundOperators.Collector
-
- # TODO: add *ignored* operators, so you can add "|" and still write
- # [head|tail] while enforcing 2 + 3 / 1 ...
- # FIXME: this seems to be already implemented, but there don't seem to be
- # any related test cases around.
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- tokens = Credo.Code.to_tokens(source_file)
- ast = SourceFile.ast(source_file)
- issue_meta = IssueMeta.for(source_file, params)
-
- issue_locations =
- expected
- |> @collector.find_locations_not_matching(source_file)
- |> Enum.reject(&ignored?(&1, params))
- |> Enum.filter(&create_issue?(&1, tokens, ast, issue_meta))
-
- Enum.map(issue_locations, fn location ->
- format_issue(
- issue_meta,
- message: message_for(expected),
- line_no: location[:line_no],
- column: location[:column],
- trigger: location[:trigger]
- )
- end)
- end
-
- defp message_for(:with_space = _expected) do
- "There are spaces around operators most of the time, but not here."
- end
-
- defp message_for(:without_space = _expected) do
- "There are no spaces around operators most of the time, but here there are."
- end
-
- defp ignored?(location, params) do
- ignored_triggers = Params.get(params, :ignore, __MODULE__)
-
- Enum.member?(ignored_triggers, location[:trigger])
- end
-
- defp create_issue?(location, tokens, ast, issue_meta) do
- line_no = location[:line_no]
- trigger = location[:trigger]
- column = location[:column]
-
- line =
- issue_meta
- |> IssueMeta.source_file()
- |> SourceFile.line_at(line_no)
-
- create_issue?(trigger, line_no, column, line, tokens, ast)
- end
-
- defp create_issue?(trigger, line_no, column, line, tokens, ast) when trigger in [:+, :-] do
- create_issue?(line, column, trigger) &&
- !parameter_in_function_call?({line_no, column, trigger}, tokens, ast)
- end
-
- defp create_issue?(trigger, _line_no, column, line, _tokens, _ast) do
- create_issue?(line, column, trigger)
- end
-
- # Don't create issues for `c = -1`
- # TODO: Consider moving these checks inside the Collector.
- defp create_issue?(line, column, trigger) when trigger in [:+, :-] do
- !number_with_sign?(line, column) && !number_in_range?(line, column) &&
- !(trigger == :- && minus_in_binary_size?(line, column))
- end
-
- defp create_issue?(line, column, trigger) when trigger == :-> do
- !arrow_in_typespec?(line, column)
- end
-
- defp create_issue?(line, column, trigger) when trigger == :/ do
- !number_in_function_capture?(line, column)
- end
-
- defp create_issue?(line, _column, trigger) when trigger == :* do
- # The Elixir formatter always removes spaces around the asterisk in
- # typespecs for binaries by default. Credo shouldn't conflict with the
- # default Elixir formatter settings.
- !typespec_binary_unit_operator_without_spaces?(line)
- end
-
- defp create_issue?(_, _, _), do: true
-
- defp typespec_binary_unit_operator_without_spaces?(line) do
- # In code this construct can only appear inside a binary typespec. It could
- # also appear verbatim in a string, but it's rather unlikely...
- line =~ "_::_*"
- end
-
- defp arrow_in_typespec?(line, column) do
- # -2 because we need to subtract the operator
- line
- |> String.slice(0..(column - 2))
- |> String.match?(~r/\(\s*$/)
- end
-
- defp number_with_sign?(line, column) do
- line
- # -2 because we need to subtract the operator
- |> String.slice(0..(column - 2))
- |> String.match?(~r/(\A\s+|\@[a-zA-Z0-9\_]+\.?|[\|\\\{\[\(\,\:\>\<\=\+\-\*\/])\s*$/)
- end
-
- defp number_in_range?(line, column) do
- line
- |> String.slice(column..-1)
- |> String.match?(~r/^\d+\.\./)
- end
-
- defp number_in_function_capture?(line, column) do
- line
- |> String.slice(0..(column - 2))
- |> String.match?(~r/[\.\&][a-z0-9_]+[\!\?]?$/)
- end
-
- # TODO: this implementation is a bit naive. improve it.
- defp minus_in_binary_size?(line, column) do
- # -2 because we need to subtract the operator
- binary_pattern_start_before? =
- line
- |> String.slice(0..(column - 2))
- |> String.match?(~r/\<\)
-
- # -2 because we need to subtract the operator
- double_colon_before? =
- line
- |> String.slice(0..(column - 2))
- |> String.match?(~r/\:\:/)
-
- # -1 because we need to subtract the operator
- binary_pattern_end_after? =
- line
- |> String.slice(column..-1)
- |> String.match?(~r/\>\>/)
-
- # -1 because we need to subtract the operator
- typed_after? =
- line
- |> String.slice(column..-1)
- |> String.match?(~r/^\s*(integer|native|signed|unsigned|binary|size|little|float)/)
-
- # -2 because we need to subtract the operator
- typed_before? =
- line
- |> String.slice(0..(column - 2))
- |> String.match?(~r/(integer|native|signed|unsigned|binary|size|little|float)\s*$/)
-
- heuristics_met_count =
- [
- binary_pattern_start_before?,
- binary_pattern_end_after?,
- double_colon_before?,
- typed_after?,
- typed_before?
- ]
- |> Enum.filter(& &1)
- |> Enum.count()
-
- heuristics_met_count >= 2
- end
-
- defp parameter_in_function_call?(location_tuple, tokens, ast) do
- case find_prev_current_next_token(tokens, location_tuple) do
- {prev, _current, _next} ->
- prev
- |> Credo.Code.TokenAstCorrelation.find_tokens_in_ast(ast)
- |> List.wrap()
- |> List.first()
- |> is_parameter_in_function_call()
-
- _ ->
- false
- end
- end
-
- defp is_parameter_in_function_call({atom, _, arguments})
- when is_atom(atom) and is_list(arguments) do
- true
- end
-
- defp is_parameter_in_function_call(
- {{:., _, [{:__aliases__, _, _mods}, fun_name]}, _, arguments}
- )
- when is_atom(fun_name) and is_list(arguments) do
- true
- end
-
- defp is_parameter_in_function_call(_) do
- false
- end
-
- # TOKENS
-
- defp find_prev_current_next_token(tokens, location_tuple) do
- tokens
- |> traverse_prev_current_next(&matching_location(location_tuple, &1, &2, &3, &4), [])
- |> List.first()
- end
-
- defp traverse_prev_current_next(tokens, callback, acc) do
- tokens
- |> case do
- [prev | [current | [next | rest]]] ->
- acc = callback.(prev, current, next, acc)
-
- traverse_prev_current_next([current | [next | rest]], callback, acc)
-
- _ ->
- acc
- end
- end
-
- defp matching_location(
- {line_no, column, trigger},
- prev,
- {_, {line_no, column, _}, trigger} = current,
- next,
- acc
- ) do
- acc ++ [{prev, current, next}]
- end
-
- defp matching_location(_, _prev, _current, _next, acc) do
- acc
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/collector.ex
deleted file mode 100644
index 92ee98ac..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/collector.ex
+++ /dev/null
@@ -1,183 +0,0 @@
-defmodule Credo.Check.Consistency.SpaceAroundOperators.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- import Credo.Check.Consistency.SpaceAroundOperators.SpaceHelper,
- only: [
- operator?: 1,
- space_between?: 2,
- no_space_between?: 2,
- usually_no_space_before?: 3,
- usually_no_space_after?: 3
- ]
-
- def collect_matches(source_file, _params) do
- source_file
- |> Credo.Code.to_tokens()
- |> traverse_tokens(&record_spaces(&1, &2, &3, &4), %{})
- end
-
- def find_locations_not_matching(expected, source_file) do
- source_file
- |> Credo.Code.to_tokens()
- |> traverse_tokens(&record_not_matching(expected, &1, &2, &3, &4), [])
- |> Enum.reverse()
- end
-
- defp traverse_tokens(tokens, callback, acc) do
- tokens
- |> skip_specs_types_captures_and_binary_patterns()
- |> case do
- [prev | [current | [next | rest]]] ->
- acc =
- if operator?(current) do
- callback.(prev, current, next, acc)
- else
- acc
- end
-
- traverse_tokens([current | [next | rest]], callback, acc)
-
- _ ->
- acc
- end
- end
-
- defp skip_specs_types_captures_and_binary_patterns([{:at_op, {line, _, _}, :@} | tokens]) do
- case tokens do
- # @spec - drop whole line
- [{:identifier, _, :spec} | tokens] ->
- drop_while_on_line(tokens, line)
-
- # @type - drop whole line
- [{:identifier, _, :type} | tokens] ->
- drop_while_on_line(tokens, line)
-
- tokens ->
- tokens
- end
- end
-
- defp skip_specs_types_captures_and_binary_patterns([{:capture_op, _, _} | tokens]) do
- drop_while_in_fun_capture(tokens)
- end
-
- # When quoting &//2 (which captures the / operator via &fun_name/2), the
- # {:capture_op, _, :&} token becomes an {:identifier, _, :&} token ...
- defp skip_specs_types_captures_and_binary_patterns([
- {:identifier, _, :&} | [{:identifier, _, :/} | tokens]
- ]) do
- drop_while_in_fun_capture(tokens)
- end
-
- defp skip_specs_types_captures_and_binary_patterns([{:"<<", _} | tokens]) do
- drop_while_in_binary_pattern(tokens)
- end
-
- defp skip_specs_types_captures_and_binary_patterns(tokens), do: tokens
-
- defp drop_while_on_line(tokens, line) do
- Enum.drop_while(tokens, fn
- {_, {^line, _, _}} -> true
- {_, {^line, _, _}, _} -> true
- _ -> false
- end)
- end
-
- defp drop_while_in_fun_capture(tokens) do
- Enum.drop_while(tokens, fn
- # :erlang_module
- {:atom, _, _} ->
- true
-
- # ElixirModule (Elixir >= 1.6.0)
- {:alias, _, _} ->
- true
-
- # ElixirModule
- {:aliases, _, _} ->
- true
-
- # function_name
- {:identifier, _, _} ->
- true
-
- # unquote
- {:paren_identifier, _, :unquote} ->
- true
-
- # @module_attribute
- {:at_op, _, _} ->
- true
-
- {:mult_op, _, :/} ->
- true
-
- {:., _} ->
- true
-
- {:"(", _} ->
- true
-
- {:")", _} ->
- true
-
- _ ->
- false
- end)
- end
-
- defp drop_while_in_binary_pattern(tokens) do
- Enum.drop_while(tokens, fn
- :">>" ->
- false
-
- _ ->
- true
- end)
- end
-
- defp record_spaces(prev, current, next, acc) do
- acc
- |> increment(:with_space, with_space?(prev, current, next))
- |> increment(:without_space, without_space?(prev, current, next))
- end
-
- defp increment(map, key, matches) do
- if matches do
- Map.update(map, key, 1, &(&1 + 1))
- else
- map
- end
- end
-
- defp record_not_matching(expected, prev, current, next, acc) do
- match_found =
- case expected do
- :with_space ->
- without_space?(prev, current, next)
-
- :without_space ->
- with_space?(prev, current, next)
- end
-
- if match_found do
- {_, {line_no, column, _}, trigger} = current
-
- [[line_no: line_no, column: column, trigger: trigger] | acc]
- else
- acc
- end
- end
-
- defp with_space?(prev, op, next) do
- space_between?(prev, op) || space_between?(op, next)
- end
-
- defp without_space?(prev, op, next) do
- (!usually_no_space_before?(prev, op, next) && no_space_between?(prev, op)) ||
- (!usually_no_space_after?(prev, op, next) && no_space_between?(op, next) &&
- !(elem(next, 0) == :eol))
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/space_helper.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/space_helper.ex
deleted file mode 100644
index 21cff079..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_around_operators/space_helper.ex
+++ /dev/null
@@ -1,84 +0,0 @@
-defmodule Credo.Check.Consistency.SpaceAroundOperators.SpaceHelper do
- @moduledoc false
-
- alias Credo.Code.Token
-
- @doc """
- Returns true if there is no space before the operator (usually).
-
- Examples:
- x..-1 # .. is the operator here and there is usually no space before that
- """
- def usually_no_space_before?({_, _, :^}, {_, _, :-}, _), do: true
- def usually_no_space_before?({:identifier, _, _}, {_, _, :-}, _), do: false
- def usually_no_space_before?({:number, _, _}, {_, _, :-}, _), do: false
- def usually_no_space_before?({:int, _, _}, {_, _, :-}, _), do: false
- def usually_no_space_before?({:float, _, _}, {_, _, :-}, _), do: false
- def usually_no_space_before?({:flt, _, _}, {_, _, :-}, _), do: false
- def usually_no_space_before?(_, {_, _, :-}, _), do: true
- def usually_no_space_before?(_, {_, _, :..}, _), do: true
- def usually_no_space_before?(_, {_, _, :"//"}, _), do: true
- def usually_no_space_before?(_, _, _), do: false
-
- @doc """
- Returns true if there is no space after the operator (usually).
-
- Examples:
- x..-1 # .. is the operator here and there is usually no space after that
- """
- def usually_no_space_after?({:"(", _}, {:dual_op, _, :-}, {:identifier, _, _}), do: true
- def usually_no_space_after?({:"(", _}, {:dual_op, _, :-}, {:number, _, _}), do: true
- def usually_no_space_after?({:"(", _}, {:dual_op, _, :-}, {:int, _, _}), do: true
- def usually_no_space_after?({:"(", _}, {:dual_op, _, :-}, {:float, _, _}), do: true
- def usually_no_space_after?({:"(", _}, {:dual_op, _, :-}, {:flt, _, _}), do: true
- def usually_no_space_after?({:"{", _}, {:dual_op, _, :-}, {:identifier, _, _}), do: true
- def usually_no_space_after?({:"{", _}, {:dual_op, _, :-}, {:number, _, _}), do: true
- def usually_no_space_after?({:"{", _}, {:dual_op, _, :-}, {:int, _, _}), do: true
- def usually_no_space_after?({:"{", _}, {:dual_op, _, :-}, {:float, _, _}), do: true
- def usually_no_space_after?({:"{", _}, {:dual_op, _, :-}, {:flt, _, _}), do: true
- def usually_no_space_after?({:",", _}, {:dual_op, _, :-}, {:identifier, _, _}), do: true
- def usually_no_space_after?({:",", _}, {:dual_op, _, :-}, {:number, _, _}), do: true
- def usually_no_space_after?({:",", _}, {:dual_op, _, :-}, {:int, _, _}), do: true
- def usually_no_space_after?({:",", _}, {:dual_op, _, :-}, {:float, _, _}), do: true
- def usually_no_space_after?({:",", _}, {:dual_op, _, :-}, {:flt, _, _}), do: true
- def usually_no_space_after?({_, _, :^}, {_, _, :-}, _), do: true
- def usually_no_space_after?({_, _, :=}, {_, _, :-}, _), do: true
- def usually_no_space_after?({_, _, :..}, {_, _, :-}, _), do: true
- def usually_no_space_after?(_, {_, _, :-}, _), do: false
- def usually_no_space_after?(_, {_, _, :..}, _), do: true
- def usually_no_space_after?(_, {_, _, :"//"}, _), do: true
- def usually_no_space_after?(_, _, _), do: false
-
- def operator?({:comp_op, _, _}), do: true
- def operator?({:comp_op2, _, _}), do: true
- def operator?({:dual_op, _, _}), do: true
- def operator?({:mult_op, _, _}), do: true
- def operator?({:two_op, _, _}), do: true
- def operator?({:concat_op, _, _}), do: true
- def operator?({:ternary_op, _, _}), do: true
- def operator?({:rel_op, _, _}), do: true
- def operator?({:rel_op2, _, _}), do: true
- def operator?({:and_op, _, _}), do: true
- def operator?({:or_op, _, _}), do: true
- def operator?({:match_op, _, _}), do: true
- def operator?({:in_match_op, _, _}), do: true
- def operator?({:stab_op, _, _}), do: true
- def operator?({:pipe_op, _, _}), do: true
- # Space around |> is ignored
- def operator?({:arrow_op, _, _}), do: false
- def operator?(_), do: false
-
- def no_space_between?(arg1, arg2) do
- {line_no, _col_start, _line_no_end, col_end} = Token.position(arg1)
- {line_no2, col_start2, _line_no_end, _col_end} = Token.position(arg2)
-
- line_no == line_no2 && col_end == col_start2
- end
-
- def space_between?(arg1, arg2) do
- {line_no, _col_start, _line_no_end, col_end} = Token.position(arg1)
- {line_no2, col_start2, _line_no_end, _col_end} = Token.position(arg2)
-
- line_no == line_no2 && col_end < col_start2
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses.ex
deleted file mode 100644
index 8655d05c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses.ex
+++ /dev/null
@@ -1,64 +0,0 @@
-defmodule Credo.Check.Consistency.SpaceInParentheses do
- use Credo.Check,
- id: "EX1006",
- run_on_all: true,
- base_priority: :high,
- tags: [:formatter],
- param_defaults: [allow_empty_enums: false],
- explanations: [
- check: """
- Don't use spaces after `(`, `[`, and `{` or before `}`, `]`, and `)`. This is
- the **preferred** way, although other styles are possible, as long as it is
- applied consistently.
-
- # preferred
-
- Helper.format({1, true, 2}, :my_atom)
-
- # also okay
-
- Helper.format( { 1, true, 2 }, :my_atom )
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """,
- params: [
- allow_empty_enums:
- "Allows [], %{} and similar empty enum values to be used regardless of spacing throughout the codebase."
- ]
- ]
-
- @collector Credo.Check.Consistency.SpaceInParentheses.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- allow_empty_enums = Params.get(params, :allow_empty_enums, __MODULE__)
-
- lines_with_issues =
- @collector.find_locations_not_matching(expected, source_file, allow_empty_enums)
-
- lines_with_issues
- |> Enum.filter(&create_issue?(expected, &1[:trigger]))
- |> Enum.map(fn location ->
- format_issue(issue_meta, [{:message, message_for(expected)} | location])
- end)
- end
-
- # Don't create issues for `&Mod.fun/4`
- defp create_issue?(:without_space, ", ]"), do: false
- defp create_issue?(_expected, _trigger), do: true
-
- defp message_for(:without_space = _expected) do
- "There is no whitespace around parentheses/brackets most of the time, but here there is."
- end
-
- defp message_for(:with_space = _expected) do
- "There is whitespace around parentheses/brackets most of the time, but here there is not."
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses/collector.ex
deleted file mode 100644
index 7850672f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/space_in_parentheses/collector.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Credo.Check.Consistency.SpaceInParentheses.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- @regex [
- with_space: ~r/[^\?]([\{\[\(]\s+\S|\S\s+[\)\]\}]])/,
- without_space: ~r/[^\?]([\{\[\(]\S|\S[\)\]\}])/,
- without_space_allow_empty_enums: ~r/[^\?](?!\{\}|\[\])([\{\[\(]\S|\S[\)\]\}])/
- ]
-
- def collect_matches(source_file, _params) do
- source_file
- |> Credo.Code.clean_charlists_strings_sigils_and_comments("")
- |> Credo.Code.to_lines()
- |> Enum.reduce(%{}, &spaces/2)
- end
-
- def find_locations_not_matching(expected, source_file, allow_empty_enums) do
- actual =
- case expected do
- :with_space when allow_empty_enums == true -> :without_space_allow_empty_enums
- :with_space -> :without_space
- :without_space -> :with_space
- end
-
- source_file
- |> Credo.Code.clean_charlists_strings_sigils_and_comments("")
- |> Credo.Code.to_lines()
- |> List.foldr([], &locate(actual, &1, &2))
- end
-
- defp spaces({_line_no, line}, acc) do
- Enum.reduce(@regex, acc, fn {kind_of_space, regex}, space_map ->
- if Regex.match?(regex, line) do
- Map.update(space_map, kind_of_space, 1, &(&1 + 1))
- else
- space_map
- end
- end)
- end
-
- defp locate(kind_of_space, {line_no, line}, locations) do
- case Regex.run(@regex[kind_of_space], line) do
- nil ->
- locations
-
- match ->
- [[trigger: Enum.at(match, 1), line_no: line_no] | locations]
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces.ex
deleted file mode 100644
index ece737cc..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule Credo.Check.Consistency.TabsOrSpaces do
- use Credo.Check,
- id: "EX1007",
- run_on_all: true,
- base_priority: :high,
- tags: [:formatter],
- param_defaults: [
- force: nil
- ],
- explanations: [
- check: """
- Tabs should be used consistently.
-
- NOTE: This check does not verify the indentation depth, but checks whether
- or not soft/hard tabs are used consistently across all source files.
-
- It is very common to use 2 spaces wide soft-tabs, but that is not a strict
- requirement and you can use hard-tabs if you like that better.
-
- While this is not necessarily a concern for the correctness of your code,
- you should use a consistent style throughout your codebase.
- """,
- params: [
- force: "Force a choice, values can be `:spaces` or `:tabs`."
- ]
- ]
-
- @collector Credo.Check.Consistency.TabsOrSpaces.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- lines_with_issues = @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(lines_with_issues, fn line_no ->
- format_issue(issue_meta, message: message_for(expected), line_no: line_no)
- end)
- end
-
- defp message_for(:spaces = _expected) do
- "File is using tabs while most of the files use spaces for indentation."
- end
-
- defp message_for(:tabs = _expected) do
- "File is using spaces while most of the files use tabs for indentation."
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces/collector.ex
deleted file mode 100644
index 8bed7113..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/tabs_or_spaces/collector.ex
+++ /dev/null
@@ -1,35 +0,0 @@
-defmodule Credo.Check.Consistency.TabsOrSpaces.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- def collect_matches(source_file, _params) do
- source_file
- |> SourceFile.lines()
- |> Enum.reduce(%{}, fn line, stats ->
- match = indentation(line)
-
- if match do
- Map.update(stats, match, 1, &(&1 + 1))
- else
- stats
- end
- end)
- end
-
- def find_locations_not_matching(expected, source_file) do
- source_file
- |> SourceFile.lines()
- |> List.foldr([], fn {line_no, _} = line, line_nos ->
- if indentation(line) && indentation(line) != expected do
- [line_no | line_nos]
- else
- line_nos
- end
- end)
- end
-
- defp indentation({_line_no, " " <> _line}), do: :spaces
- defp indentation({_line_no, "\t" <> _line}), do: :tabs
- defp indentation({_, _}), do: nil
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names.ex
deleted file mode 100644
index 45e42913..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names.ex
+++ /dev/null
@@ -1,66 +0,0 @@
-defmodule Credo.Check.Consistency.UnusedVariableNames do
- use Credo.Check,
- id: "EX1008",
- run_on_all: true,
- base_priority: :high,
- param_defaults: [
- force: nil
- ],
- explanations: [
- check: """
- Elixir allows us to use `_` as a name for variables that are not meant to be
- used. But it’s a common practice to give these variables meaningful names
- anyway (`_user` instead of `_`), but some people prefer to name them all anonymously (`_`).
-
- A single style should be present in the same codebase.
- """,
- params: [
- force: "Force a choice, values can be `:meaningful` or `:anonymous`."
- ]
- ]
-
- @collector Credo.Check.Consistency.UnusedVariableNames.Collector
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- @collector.find_and_append_issues(source_files, exec, params, &issues_for/3)
- end
-
- defp issues_for(expected, source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- issue_locations = @collector.find_locations_not_matching(expected, source_file)
-
- Enum.map(issue_locations, fn location ->
- format_issue(issue_meta, [
- {:message, message_for(expected, location[:trigger])} | location
- ])
- end)
- end
-
- defp message_for(:meaningful, trigger) do
- message = """
- Unused variables should be named consistently.
- It seems your strategy is to give them meaningful names (eg. `_foo`)
- but `#{trigger}` does not follow that convention.
- """
-
- to_one_line(message)
- end
-
- defp message_for(:anonymous, trigger) do
- message = """
- Unused variables should be named consistently.
- It seems your strategy is to name them anonymously (ie. `_`)
- but `#{trigger}` does not follow that convention.
- """
-
- to_one_line(message)
- end
-
- defp to_one_line(str) do
- str
- |> String.split()
- |> Enum.join(" ")
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names/collector.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names/collector.ex
deleted file mode 100644
index 02997ebc..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/consistency/unused_variable_names/collector.ex
+++ /dev/null
@@ -1,82 +0,0 @@
-defmodule Credo.Check.Consistency.UnusedVariableNames.Collector do
- @moduledoc false
-
- use Credo.Check.Consistency.Collector
-
- def collect_matches(source_file, _params) do
- unused_variable_recorder = &record_unused_variable/2
-
- Credo.Code.prewalk(source_file, &traverse(unused_variable_recorder, &1, &2), %{})
- end
-
- def find_locations_not_matching(expected, source_file) do
- location_recorder = &record_not_matching(expected, &1, &2)
-
- source_file
- |> Credo.Code.prewalk(&traverse(location_recorder, &1, &2), [])
- |> Enum.reverse()
- end
-
- defp traverse(callback, {:=, _, params} = ast, acc) do
- {ast, reduce_unused_variables(params, callback, acc)}
- end
-
- defp traverse(callback, {def, _, [{_, _, params} | _]} = ast, acc)
- when def in [:def, :defp] do
- {ast, reduce_unused_variables(params, callback, acc)}
- end
-
- defp traverse(callback, {:->, _, [params | _]} = ast, acc) do
- {ast, reduce_unused_variables(params, callback, acc)}
- end
-
- defp traverse(_callback, ast, acc), do: {ast, acc}
-
- defp reduce_unused_variables(nil, _callback, acc), do: acc
-
- defp reduce_unused_variables(ast, callback, acc) do
- Enum.reduce(ast, acc, fn
- {_, _, params}, param_acc when is_list(params) ->
- reduce_unused_variables(params, callback, param_acc)
-
- param_ast, param_acc ->
- if unused_variable_ast?(param_ast) do
- callback.(param_ast, param_acc)
- else
- param_acc
- end
- end)
- end
-
- defp unused_variable_ast?({:_, _, _}), do: true
-
- defp unused_variable_ast?({name, _, _}) when is_atom(name) do
- name
- |> Atom.to_string()
- |> unused_variable_name?()
- end
-
- defp unused_variable_ast?(_), do: false
-
- defp unused_variable_name?("__" <> _rest), do: false
-
- defp unused_variable_name?("_" <> _rest), do: true
-
- defp unused_variable_name?(_rest), do: false
-
- defp record_unused_variable({:_, _, _}, acc), do: Map.update(acc, :anonymous, 1, &(&1 + 1))
- defp record_unused_variable(_, acc), do: Map.update(acc, :meaningful, 1, &(&1 + 1))
-
- defp record_not_matching(expected, {name, meta, _}, acc) do
- case {expected, Atom.to_string(name)} do
- {:anonymous, "_" <> rest = trigger} when rest != "" ->
- [[line_no: meta[:line], trigger: trigger] | acc]
-
- {:meaningful, "_" = trigger} ->
- [[line_no: meta[:line], trigger: trigger] | acc]
-
- _ ->
- acc
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/alias_usage.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/alias_usage.ex
deleted file mode 100644
index e14b4969..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/alias_usage.ex
+++ /dev/null
@@ -1,360 +0,0 @@
-defmodule Credo.Check.Design.AliasUsage do
- use Credo.Check,
- id: "EX2001",
- base_priority: :normal,
- param_defaults: [
- excluded_namespaces: ~w[File IO Inspect Kernel Macro Supervisor Task Version],
- excluded_lastnames: ~w[Access Agent Application Atom Base Behaviour
- Bitwise Code Date DateTime Dict Enum Exception
- File Float GenEvent GenServer HashDict HashSet
- Integer IO Kernel Keyword List Macro Map MapSet
- Module NaiveDateTime Node OptionParser Path Port
- Process Protocol Range Record Regex Registry Set
- Stream String StringIO Supervisor System Task Time
- Tuple URI Version],
- if_called_more_often_than: 0,
- if_nested_deeper_than: 0,
- if_referenced: false,
- only: nil
- ],
- explanations: [
- check: """
- Functions from other modules should be used via an alias if the module's
- namespace is not top-level.
-
- While this is completely fine:
-
- defmodule MyApp.Web.Search do
- def twitter_mentions do
- MyApp.External.TwitterAPI.search(...)
- end
- end
-
- ... you might want to refactor it to look like this:
-
- defmodule MyApp.Web.Search do
- alias MyApp.External.TwitterAPI
-
- def twitter_mentions do
- TwitterAPI.search(...)
- end
- end
-
- The thinking behind this is that you can see the dependencies of your module
- at a glance. So if you are attempting to build a medium to large project,
- this can help you to get your boundaries/layers/contracts right.
-
- As always: This is just a suggestion. Check the configuration options for
- tweaking or disabling this check.
- """,
- params: [
- excluded_namespaces: "List of namespaces to be excluded for this check.",
- excluded_lastnames: "List of lastnames to be excluded for this check.",
- if_nested_deeper_than: "Only raise an issue if a module is nested deeper than this.",
- if_called_more_often_than:
- "Only raise an issue if a module is called more often than this.",
- if_referenced:
- "Raise an issue if a module is referenced by name, e.g. as an argument in a function call.",
- only: """
- Regex or a list of regexes that specifies which modules to include for this check.
-
- `excluded_namespaces` and `excluded_lastnames` take precedence over this parameter.
- """
- ]
- ]
-
- alias Credo.Code.Name
-
- @keywords [:alias]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- excluded_namespaces = Params.get(params, :excluded_namespaces, __MODULE__)
-
- excluded_lastnames = Params.get(params, :excluded_lastnames, __MODULE__)
-
- if_nested_deeper_than = Params.get(params, :if_nested_deeper_than, __MODULE__)
-
- if_called_more_often_than = Params.get(params, :if_called_more_often_than, __MODULE__)
-
- only = Params.get(params, :only, __MODULE__)
-
- if_referenced? = Params.get(params, :if_referenced, __MODULE__)
-
- source_file
- |> Credo.Code.prewalk(
- &traverse(&1, &2, issue_meta, excluded_namespaces, excluded_lastnames, only, if_referenced?)
- )
- |> filter_issues_if_called_more_often_than(if_called_more_often_than)
- |> filter_issues_if_nested_deeper_than(if_nested_deeper_than)
- end
-
- defp traverse(
- {:defmodule, _, _} = ast,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- if_referenced?
- ) do
- aliases = Credo.Code.Module.aliases(ast)
- mod_deps = Credo.Code.Module.modules(ast)
-
- new_issues =
- Credo.Code.prewalk(
- ast,
- &find_issues(
- &1,
- &2,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps,
- if_referenced?
- )
- )
-
- {ast, issues ++ new_issues}
- end
-
- defp traverse(
- ast,
- issues,
- _source_file,
- _excluded_namespaces,
- _excluded_lastnames,
- _only,
- _if_referenced?
- ) do
- {ast, issues}
- end
-
- # Ignore module attributes
- defp find_issues({:@, _, _}, issues, _, _, _, _, _, _, _) do
- {nil, issues}
- end
-
- # Ignore multi alias call
- defp find_issues(
- {:., _, [{:__aliases__, _, _}, :{}]} = ast,
- issues,
- _,
- _,
- _,
- _,
- _,
- _,
- _
- ) do
- {ast, issues}
- end
-
- # Ignore alias containing an `unquote` call
- defp find_issues(
- {:., _, [{:__aliases__, _, mod_list}, :unquote]} = ast,
- issues,
- _,
- _,
- _,
- _,
- _,
- _,
- _
- )
- when is_list(mod_list) do
- {ast, issues}
- end
-
- defp find_issues(
- {:., _, [{:__aliases__, meta, mod_list}, fun_atom]} = ast,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps,
- _if_referenced?
- )
- when is_list(mod_list) and is_atom(fun_atom) do
- do_find_issues(
- ast,
- mod_list,
- meta,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps
- )
- end
-
- defp find_issues(
- {fun_atom, _, [{:__aliases__, meta, mod_list}]} = ast,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps,
- true
- )
- when is_list(mod_list) and is_atom(fun_atom) and fun_atom not in @keywords do
- do_find_issues(
- ast,
- mod_list,
- meta,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps
- )
- end
-
- defp find_issues(ast, issues, _, _, _, _, _, _, _) do
- {ast, issues}
- end
-
- defp do_find_issues(
- ast,
- mod_list,
- meta,
- issues,
- issue_meta,
- excluded_namespaces,
- excluded_lastnames,
- only,
- aliases,
- mod_deps
- ) do
- cond do
- Enum.count(mod_list) <= 1 || Enum.any?(mod_list, &tuple?/1) ->
- {ast, issues}
-
- Enum.any?(mod_list, &unquote?/1) ->
- {ast, issues}
-
- excluded_lastname_or_namespace?(
- mod_list,
- excluded_namespaces,
- excluded_lastnames
- ) ->
- {ast, issues}
-
- excluded_with_only?(mod_list, only) ->
- {ast, issues}
-
- conflicting_with_aliases?(mod_list, aliases) ->
- {ast, issues}
-
- conflicting_with_other_modules?(mod_list, mod_deps) ->
- {ast, issues}
-
- true ->
- trigger = Credo.Code.Name.full(mod_list)
-
- {ast, issues ++ [issue_for(issue_meta, meta[:line], trigger)]}
- end
- end
-
- defp unquote?({:unquote, _, arguments}) when is_list(arguments), do: true
- defp unquote?(_), do: false
-
- defp excluded_lastname_or_namespace?(
- mod_list,
- excluded_namespaces,
- excluded_lastnames
- ) do
- first_name = Credo.Code.Name.first(mod_list)
- last_name = Credo.Code.Name.last(mod_list)
-
- Enum.member?(excluded_namespaces, first_name) || Enum.member?(excluded_lastnames, last_name)
- end
-
- defp excluded_with_only?(_mod_list, nil), do: false
-
- defp excluded_with_only?(mod_list, only) when is_list(only) do
- Enum.any?(only, &excluded_with_only?(mod_list, &1))
- end
-
- defp excluded_with_only?(mod_list, %Regex{} = only) do
- name = Credo.Code.Name.full(mod_list)
- !String.match?(name, only)
- end
-
- # Returns true if mod_list and alias_name would result in the same alias
- # since they share the same last name.
- defp conflicting_with_aliases?(mod_list, aliases) do
- last_name = Credo.Code.Name.last(mod_list)
-
- Enum.find(aliases, &conflicting_alias?(&1, mod_list, last_name))
- end
-
- defp conflicting_alias?(alias_name, mod_list, last_name) do
- full_name = Credo.Code.Name.full(mod_list)
- alias_last_name = Credo.Code.Name.last(alias_name)
-
- full_name != alias_name && alias_last_name == last_name
- end
-
- # Returns true if mod_list and any dependent module would result in the same alias
- # since they share the same last name.
- defp conflicting_with_other_modules?(mod_list, mod_deps) do
- full_name = Credo.Code.Name.full(mod_list)
- last_name = Credo.Code.Name.last(mod_list)
-
- (mod_deps -- [full_name])
- |> Enum.filter(&(Credo.Code.Name.parts_count(&1) > 1))
- |> Enum.map(&Credo.Code.Name.last/1)
- |> Enum.any?(&(&1 == last_name))
- end
-
- defp tuple?(t) when is_tuple(t), do: true
- defp tuple?(_), do: false
-
- defp filter_issues_if_called_more_often_than(issues, 0) do
- issues
- end
-
- defp filter_issues_if_called_more_often_than(issues, count) do
- issues
- |> Enum.reduce(%{}, fn issue, memo ->
- list = memo[issue.trigger] || []
-
- Map.put(memo, issue.trigger, [issue | list])
- end)
- |> Enum.filter(fn {_trigger, issues} ->
- length(issues) > count
- end)
- |> Enum.flat_map(fn {_trigger, issues} ->
- issues
- end)
- end
-
- defp filter_issues_if_nested_deeper_than(issues, count) do
- Enum.filter(issues, fn issue ->
- Name.parts_count(issue.trigger) > count
- end)
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Nested modules could be aliased at the top of the invoking module.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/duplicated_code.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/duplicated_code.ex
deleted file mode 100644
index fd75ebfa..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/duplicated_code.ex
+++ /dev/null
@@ -1,306 +0,0 @@
-defmodule Credo.Check.Design.DuplicatedCode do
- use Credo.Check,
- id: "EX2002",
- run_on_all: true,
- base_priority: :higher,
- tags: [:controversial],
- param_defaults: [
- mass_threshold: 40,
- nodes_threshold: 2,
- excluded_macros: []
- ],
- explanations: [
- check: """
- Code should not be copy-pasted in a codebase when there is room to abstract
- the copied functionality in a meaningful way.
-
- That said, you should by no means "ABSTRACT ALL THE THINGS!".
-
- Sometimes it can serve a purpose to have code be explicit in two places, even
- if it means the snippets are nearly identical. A good example for this are
- Database Adapters in a project like Ecto, where you might have nearly
- identical functions for things like `order_by` or `limit` in both the
- Postgres and MySQL adapters.
-
- In this case, introducing an `AbstractAdapter` just to avoid code duplication
- might cause more trouble down the line than having a bit of duplicated code.
-
- Like all `Software Design` issues, this is just advice and might not be
- applicable to your project/situation.
- """,
- params: [
- mass_threshold:
- "The minimum mass which a part of code has to have to qualify for this check.",
- nodes_threshold: "The number of nodes that need to be found to raise an issue.",
- excluded_macros: "List of macros to be excluded for this check."
- ]
- ]
-
- alias Credo.SourceFile
-
- @doc false
- @impl true
- def run_on_all_source_files(exec, source_files, params) do
- mass_threshold = Params.get(params, :mass_threshold, __MODULE__)
- nodes_threshold = Params.get(params, :nodes_threshold, __MODULE__)
-
- source_files
- |> duplicate_nodes(mass_threshold)
- |> append_issues_via_issue_service(source_files, nodes_threshold, params, exec)
-
- :ok
- end
-
- defp append_issues_via_issue_service(found_hashes, source_files, nodes_threshold, params, exec)
- when is_map(found_hashes) do
- found_hashes
- |> Enum.map(
- &Task.async(fn ->
- do_append_issues_via_issue_service(
- &1,
- source_files,
- nodes_threshold,
- params,
- exec
- )
- end)
- )
- |> Enum.map(&Task.await(&1, :infinity))
- end
-
- defp do_append_issues_via_issue_service(
- {_hash, nodes},
- source_files,
- nodes_threshold,
- params,
- exec
- ) do
- filename_map = nodes |> Enum.map(&{&1.filename, true}) |> Enum.into(%{})
-
- source_files
- |> Enum.filter(fn source_file -> filename_map[source_file.filename] end)
- |> Enum.each(&new_issue_for_members(&1, nodes_threshold, nodes, params, exec))
- end
-
- defp new_issue_for_members(source_file, nodes_threshold, nodes, params, exec) do
- this_node = Enum.find(nodes, &(&1.filename == source_file.filename))
- other_nodes = List.delete(nodes, this_node)
- issue_meta = IssueMeta.for(source_file, params)
- issue = issue_for(issue_meta, this_node, other_nodes, nodes_threshold, params)
-
- if issue do
- Credo.Execution.ExecutionIssues.append(exec, source_file, issue)
- end
- end
-
- defp duplicate_nodes(source_files, mass_threshold) do
- chunked_nodes =
- source_files
- |> Enum.chunk_every(30)
- |> Enum.map(&Task.async(fn -> calculate_hashes_for_chunk(&1, mass_threshold) end))
- |> Enum.map(&Task.await(&1, :infinity))
-
- nodes =
- Enum.reduce(chunked_nodes, %{}, fn current_hashes, existing_hashes ->
- Map.merge(existing_hashes, current_hashes, fn _hash, node_items1, node_items2 ->
- node_items1 ++ node_items2
- end)
- end)
-
- nodes
- |> prune_hashes
- |> add_masses
- end
-
- defp calculate_hashes_for_chunk(source_files, mass_threshold) do
- Enum.reduce(source_files, %{}, fn source_file, acc ->
- ast = SourceFile.ast(source_file)
-
- calculate_hashes(ast, acc, source_file.filename, mass_threshold)
- end)
- end
-
- def add_masses(found_hashes) do
- Enum.into(found_hashes, %{}, &add_mass_to_subnode/1)
- end
-
- defp add_mass_to_subnode({hash, node_items}) do
- node_items =
- Enum.map(node_items, fn node_item ->
- %{node_item | mass: mass(node_item.node)}
- end)
-
- {hash, node_items}
- end
-
- @doc """
- Takes a map of hashes to nodes and prunes those nodes that are just
- subnodes of others in the same set.
-
- Returns the resulting map.
- """
- def prune_hashes(
- given_hashes,
- mass_threshold \\ param_defaults()[:mass_threshold]
- ) do
- # remove entries containing a single node
- hashes_with_multiple_nodes =
- given_hashes
- |> Enum.filter(fn {_hash, node_items} -> Enum.count(node_items) > 1 end)
- |> Enum.into(%{})
-
- hashes_to_prune =
- Enum.flat_map(
- hashes_with_multiple_nodes,
- &collect_subhashes(&1, mass_threshold)
- )
-
- delete_keys(hashes_to_prune, hashes_with_multiple_nodes)
- end
-
- defp delete_keys([], acc), do: acc
-
- defp delete_keys([head | tail], acc) do
- delete_keys(tail, Map.delete(acc, head))
- end
-
- defp collect_subhashes({_hash, node_items}, mass_threshold) do
- %{node: first_node, filename: filename} = Enum.at(node_items, 0)
-
- my_hash = first_node |> Credo.Code.remove_metadata() |> to_hash
- # don't count self
- subhashes =
- first_node
- |> calculate_hashes(%{}, filename, mass_threshold)
- |> Map.keys()
- |> List.delete(my_hash)
-
- subhashes
- end
-
- @doc """
- Calculates hash values for all sub nodes in a given +ast+.
-
- Returns a map with the hashes as keys and the nodes as values.
- """
- def calculate_hashes(
- ast,
- existing_hashes \\ %{},
- filename \\ "foo.ex",
- mass_threshold \\ param_defaults()[:mass_threshold]
- )
- when is_map(existing_hashes) do
- Credo.Code.prewalk(
- ast,
- &collect_hashes(&1, &2, filename, mass_threshold),
- existing_hashes
- )
- end
-
- defp collect_hashes(ast, existing_hashes, filename, mass_threshold) do
- if mass(ast) < mass_threshold do
- {ast, existing_hashes}
- else
- hash = ast |> Credo.Code.remove_metadata() |> to_hash
- node_item = %{node: ast, filename: filename, mass: nil}
- node_items = Map.get(existing_hashes, hash, [])
-
- updated_hashes = Map.put(existing_hashes, hash, node_items ++ [node_item])
-
- {ast, updated_hashes}
- end
- end
-
- @doc """
- Returns a hash-value for a given +ast+.
- """
- def to_hash(ast) do
- string =
- ast
- |> Inspect.Algebra.to_doc(%Inspect.Opts{})
- |> Inspect.Algebra.format(80)
- |> Enum.join("")
-
- :sha256
- |> :crypto.hash(string)
- |> Base.encode16()
- end
-
- @doc """
- Returns the mass (count of instructions) for an AST.
- """
- def mass(ast) do
- Credo.Code.prewalk(ast, &calc_mass/2, 0)
- end
-
- defp calc_mass(ast, acc) when is_tuple(ast) do
- {ast, acc + 1}
- end
-
- defp calc_mass(ast, acc) do
- {ast, acc}
- end
-
- defp issue_for(issue_meta, this_node, other_nodes, nodes_threshold, params) do
- if Enum.count(other_nodes) >= nodes_threshold - 1 do
- filenames =
- Enum.map_join(other_nodes, ", ", fn other_node ->
- "#{other_node.filename}:#{line_no_for(other_node.node)}"
- end)
-
- node_mass = this_node.mass
- line_no = line_no_for(this_node.node)
- excluded_macros = params[:excluded_macros] || []
-
- if create_issue?(this_node.node, excluded_macros) do
- format_issue(
- issue_meta,
- message: "Duplicate code found in #{filenames} (mass: #{node_mass}).",
- line_no: line_no,
- severity: Severity.compute(1 + Enum.count(other_nodes), 1)
- )
- end
- end
- end
-
- # ignore similar module attributes, no matter how complex
- def create_issue?({:@, _, _}, _), do: false
-
- def create_issue?([do: {atom, _, arguments}], excluded_macros)
- when is_atom(atom) and is_list(arguments) do
- !Enum.member?(excluded_macros, atom)
- end
-
- def create_issue?({atom, _, arguments}, excluded_macros)
- when is_atom(atom) and is_list(arguments) do
- !Enum.member?(excluded_macros, atom)
- end
-
- def create_issue?(_ast, _), do: true
-
- # TODO: Put in AST helper
-
- def line_no_for({:__block__, _meta, arguments}) do
- line_no_for(arguments)
- end
-
- def line_no_for({:do, arguments}) do
- line_no_for(arguments)
- end
-
- def line_no_for({atom, meta, _}) when is_atom(atom) do
- meta[:line]
- end
-
- def line_no_for(list) when is_list(list) do
- Enum.find_value(list, &line_no_for/1)
- end
-
- def line_no_for(nil), do: nil
-
- def line_no_for(block) do
- block
- |> Credo.Code.Block.do_block_for!()
- |> line_no_for
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/skip_test_without_comment.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/skip_test_without_comment.ex
deleted file mode 100644
index aa9cc78f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/skip_test_without_comment.ex
+++ /dev/null
@@ -1,73 +0,0 @@
-defmodule Credo.Check.Design.SkipTestWithoutComment do
- use Credo.Check,
- id: "EX2003",
- base_priority: :normal,
- explanations: [
- check: """
- Skipped tests should have a comment documenting why the test is skipped.
-
- Tests are often skipped using `@tag :skip` when some issue arises that renders
- the test temporarily broken or unable to run. This temporary skip often becomes
- a permanent one because the reason for the test being skipped is not documented.
-
- A comment should exist on the line prior to the skip tag describing why the test is
- skipped.
-
- Example:
-
- # john: skipping this since our credentials expired, working on getting new ones
- @tag :skip
- test "vendor api returns data" do
- # ...
- end
-
- While the pure existence of a comment does not change anything per se, a thoughtful
- comment can improve the odds for future iteration on the issue.
- """
- ],
- param_defaults: [included: ["test/**/*_test.exs"]]
-
- @tag_skip_regex ~r/^\s*\@tag :skip\s*$/
- @comment_regex ~r/^\s*\#.*$/
-
- @doc false
- @impl true
- def run(source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- source_file
- |> Credo.Code.clean_charlists_strings_and_sigils()
- |> String.split("\n")
- |> Enum.with_index(1)
- |> Enum.map(&transform_line/1)
- |> check_lines([], issue_meta)
- end
-
- defp transform_line({line, line_number}) do
- cond do
- line =~ @tag_skip_regex -> {:tag_skip, line_number}
- line =~ @comment_regex -> {:comment, line_number}
- true -> {line, line_number}
- end
- end
-
- defp check_lines([{:tag_skip, line_number} | rest], issues, issue_meta) do
- check_lines(rest, [issue_for(issue_meta, line_number) | issues], issue_meta)
- end
-
- defp check_lines([{:comment, _}, {:tag_skip, _} | rest], issues, issue_meta) do
- check_lines(rest, issues, issue_meta)
- end
-
- defp check_lines([_hd | tl], issues, issue_meta), do: check_lines(tl, issues, issue_meta)
- defp check_lines([], issues, _issue_meta), do: issues
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Tests tagged to be skipped should have a comment preceding the `@tag :skip`",
- trigger: "@tag :skip",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_fixme.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_fixme.ex
deleted file mode 100644
index 5983df00..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_fixme.ex
+++ /dev/null
@@ -1,51 +0,0 @@
-defmodule Credo.Check.Design.TagFIXME do
- use Credo.Check,
- id: "EX2004",
- base_priority: :high,
- param_defaults: [include_doc: true],
- explanations: [
- check: """
- FIXME comments are used to indicate places where source code needs fixing.
-
- Example:
-
- # FIXME: this does no longer work, research new API url
- defp fun do
- # ...
- end
-
- The premise here is that FIXME should indeed be fixed as soon as possible and
- are therefore reported by Credo.
-
- Like all `Software Design` issues, this is just advice and might not be
- applicable to your project/situation.
- """,
- params: [
- include_doc: "Set to `true` to also include tags from @doc attributes."
- ]
- ]
-
- @tag_name "FIXME"
-
- alias Credo.Check.Design.TagHelper
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- include_doc? = Params.get(params, :include_doc, __MODULE__)
-
- source_file
- |> TagHelper.tags(@tag_name, include_doc?)
- |> Enum.map(&issue_for(issue_meta, &1))
- end
-
- defp issue_for(issue_meta, {line_no, _line, trigger}) do
- format_issue(
- issue_meta,
- message: "Found a #{@tag_name} tag in a comment: #{trigger}",
- line_no: line_no,
- trigger: trigger
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_helper.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_helper.ex
deleted file mode 100644
index 1e854db9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_helper.ex
+++ /dev/null
@@ -1,65 +0,0 @@
-defmodule Credo.Check.Design.TagHelper do
- @moduledoc false
-
- @doc_attribute_names [:doc, :moduledoc, :shortdoc]
-
- alias Credo.SourceFile
-
- def tags(source_file, tag_name, include_doc?) do
- tags_from_module_attributes(source_file, tag_name, include_doc?) ++
- tags_from_comments(source_file, tag_name)
- end
-
- defp tags_from_module_attributes(source_file, tag_name, true) do
- regex = Regex.compile!("\\A\\s*#{tag_name}:?\\s*.+", "i")
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, regex))
- end
-
- defp tags_from_module_attributes(_source_file, _tag_name, false) do
- []
- end
-
- defp tags_from_comments(source_file, tag_name) do
- regex = Regex.compile!("(\\A|[^\\?])#\\s*#{tag_name}:?\\s*.+", "i")
- source = SourceFile.source(source_file)
-
- if source =~ regex do
- source
- |> Credo.Code.clean_charlists_strings_and_sigils()
- |> String.split("\n")
- |> Enum.with_index()
- |> Enum.map(&find_tag_in_line(&1, regex))
- |> Enum.filter(&tags?/1)
- else
- []
- end
- end
-
- defp traverse({:@, _, [{name, meta, [string]} | _]} = ast, issues, regex)
- when name in @doc_attribute_names and is_binary(string) do
- if string =~ regex do
- trimmed = String.trim_trailing(string)
- {nil, issues ++ [{meta[:line], trimmed, trimmed}]}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _regex) do
- {ast, issues}
- end
-
- defp find_tag_in_line({line, index}, regex) do
- tag_list =
- regex
- |> Regex.run(line)
- |> List.wrap()
- |> Enum.map(&String.trim/1)
-
- {index + 1, line, List.first(tag_list)}
- end
-
- defp tags?({_line_no, _line, nil}), do: false
- defp tags?({_line_no, _line, _tag}), do: true
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_todo.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_todo.ex
deleted file mode 100644
index 8859b3fd..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/design/tag_todo.ex
+++ /dev/null
@@ -1,50 +0,0 @@
-defmodule Credo.Check.Design.TagTODO do
- use Credo.Check,
- id: "EX2005",
- param_defaults: [include_doc: true],
- explanations: [
- check: """
- TODO comments are used to remind yourself of source code related things.
-
- Example:
-
- # TODO: move this to a Helper module
- defp fun do
- # ...
- end
-
- The premise here is that TODO should be dealt with in the near future and
- are therefore reported by Credo.
-
- Like all `Software Design` issues, this is just advice and might not be
- applicable to your project/situation.
- """,
- params: [
- include_doc: "Set to `true` to also include tags from @doc attributes."
- ]
- ]
-
- alias Credo.Check.Design.TagHelper
-
- @tag_name "TODO"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- include_doc? = Params.get(params, :include_doc, __MODULE__)
-
- source_file
- |> TagHelper.tags(@tag_name, include_doc?)
- |> Enum.map(&issue_for(issue_meta, &1))
- end
-
- defp issue_for(issue_meta, {line_no, _line, trigger}) do
- format_issue(
- issue_meta,
- message: "Found a #{@tag_name} tag in a comment: #{trigger}",
- line_no: line_no,
- trigger: trigger
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/params.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/params.ex
deleted file mode 100644
index 39df819c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/params.ex
+++ /dev/null
@@ -1,105 +0,0 @@
-defmodule Credo.Check.Params do
- @moduledoc """
- This module provides functions for handling parameters ("params") given to
- checks through `.credo.exs` (i.e. the `Credo.ConfigFile`).
- """
-
- @doc """
- Returns the given `field`'s `params` value.
-
- Example:
-
- defmodule SamepleCheck do
- def param_defaults do
- [foo: "bar"]
- end
- end
-
- iex> Credo.Check.Params.get([], :foo, SamepleCheck)
- "bar"
- iex> Credo.Check.Params.get([foo: "baz"], :foo, SamepleCheck)
- "baz"
- """
- def get(params, field, check_mod)
-
- # this one is deprecated
- def get(params, field, keywords) when is_list(keywords) do
- case params[field] do
- nil ->
- keywords[field]
-
- val ->
- val
- end
- end
-
- def get(params, field, check_mod) do
- case params[field] do
- nil ->
- check_mod.param_defaults[field]
-
- val ->
- val
- end
- end
-
- @doc false
- def get_rerun_files_that_changed(params) do
- List.wrap(params[:__rerun_files_that_changed__])
- end
-
- @doc false
- def put_rerun_files_that_changed(params, files_that_changed) do
- Keyword.put(params, :__rerun_files_that_changed__, files_that_changed)
- end
-
- @doc false
- def builtin_param_names do
- [
- :category,
- :__category__,
- :exit_status,
- :__exit_status__,
- :files,
- :__files__,
- :priority,
- :__priority__,
- :tags,
- :__tags__
- ]
- end
-
- @doc false
- def category(params, check_mod) do
- params[:__category__] || params[:category] || check_mod.category
- end
-
- @doc false
- def exit_status(params, check_mod) do
- params[:__exit_status__] || params[:exit_status] || check_mod.exit_status
- end
-
- @doc false
- def files_excluded(params, check_mod) do
- files = get(params, :__files__, check_mod) || get(params, :files, check_mod)
-
- List.wrap(files[:excluded])
- end
-
- @doc false
- def files_included(params, check_mod) do
- files = get(params, :__files__, check_mod) || get(params, :files, check_mod)
-
- List.wrap(files[:included])
- end
-
- @doc false
- def priority(params, check_mod) do
- params[:__priority__] || params[:priority] || check_mod.base_priority
- end
-
- @doc false
- def tags(params, check_mod) do
- params[:__tags__] || params[:tags] || check_mod.tags
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_as.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_as.ex
deleted file mode 100644
index a072e938..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_as.ex
+++ /dev/null
@@ -1,66 +0,0 @@
-defmodule Credo.Check.Readability.AliasAs do
- use Credo.Check,
- id: "EX3001",
- base_priority: :low,
- tags: [:experimental],
- explanations: [
- check: """
- Aliases which are not completely renamed using the `:as` option are easier to follow.
-
- # preferred
-
- def MyModule do
- alias MyApp.Module1
-
- def my_function(foo) do
- Module1.run(foo)
- end
- end
-
- # NOT preferred
-
- def MyModule do
- alias MyApp.Module1, as: M1
-
- def my_function(foo) do
- # what the heck is `M1`?
- M1.run(foo)
- end
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- source_file
- |> Credo.Code.prewalk(&traverse(&1, &2, IssueMeta.for(source_file, params)))
- |> Enum.reverse()
- end
-
- defp traverse(ast, issues, issue_meta), do: {ast, add_issue(issues, issue(ast, issue_meta))}
-
- defp add_issue(issues, nil), do: issues
- defp add_issue(issues, issue), do: [issue | issues]
-
- defp issue({:alias, _, [{:__MODULE__, _, nil}, [as: {_, meta, _}]]}, issue_meta),
- do: issue_for(issue_meta, meta[:line], inspect(:__MODULE__))
-
- defp issue({:alias, _, [{_, _, original}, [as: {_, meta, _}]]}, issue_meta),
- do: issue_for(issue_meta, meta[:line], inspect(Module.concat(original)))
-
- defp issue(_ast, _issue_meta), do: nil
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Avoid using the :as option with alias.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_order.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_order.ex
deleted file mode 100644
index 6fbe64f1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/alias_order.ex
+++ /dev/null
@@ -1,230 +0,0 @@
-defmodule Credo.Check.Readability.AliasOrder do
- use Credo.Check,
- id: "EX3002",
- base_priority: :low,
- explanations: [
- check: """
- Alphabetically ordered lists are more easily scannable by the read.
-
- # preferred
-
- alias ModuleA
- alias ModuleB
- alias ModuleC
-
- # NOT preferred
-
- alias ModuleA
- alias ModuleC
- alias ModuleB
-
- Alias should be alphabetically ordered among their group:
-
- # preferred
-
- alias ModuleC
- alias ModuleD
-
- alias ModuleA
- alias ModuleB
-
- # NOT preferred
-
- alias ModuleC
- alias ModuleD
-
- alias ModuleB
- alias ModuleA
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:defmodule, _, _} = ast, issues, issue_meta) do
- new_issues =
- ast
- |> extract_alias_groups()
- |> Enum.reduce([], &traverse_groups(&1, &2, issue_meta))
-
- {ast, issues ++ new_issues}
- end
-
- defp traverse(ast, issues, _), do: {ast, issues}
-
- defp traverse_groups(group, acc, issue_meta) do
- group
- |> Enum.chunk_every(2, 1)
- |> Enum.reduce_while(nil, &process_group/2)
- |> case do
- nil ->
- acc
-
- line ->
- acc ++ [issue_for(issue_meta, line)]
- end
- end
-
- defp process_group([{line_no, mod_list_second, a}, {_line_no, _mod_list_second, b}], _)
- when a > b do
- module =
- case mod_list_second do
- {base, _} -> base
- value -> value
- end
-
- issue_opts = issue_opts(line_no, module, module)
-
- {:halt, issue_opts}
- end
-
- defp process_group([{line_no1, mod_list_first, _}, {line_no2, mod_list_second, _}], _) do
- issue_opts =
- cond do
- issue = inner_group_order_issue(line_no1, mod_list_first) ->
- issue
-
- issue = inner_group_order_issue(line_no2, mod_list_second) ->
- issue
-
- true ->
- nil
- end
-
- if issue_opts do
- {:halt, issue_opts}
- else
- {:cont, nil}
- end
- end
-
- defp process_group([{line_no1, mod_list_first, _}], _) do
- if issue_opts = inner_group_order_issue(line_no1, mod_list_first) do
- {:halt, issue_opts}
- else
- {:cont, nil}
- end
- end
-
- defp process_group(_, _), do: {:cont, nil}
-
- defp inner_group_order_issue(_line_no, {_base, []}), do: nil
-
- defp inner_group_order_issue(line_no, {base, mod_list}) do
- downcased_mod_list = Enum.map(mod_list, &String.downcase(to_string(&1)))
- sorted_downcased_mod_list = Enum.sort(downcased_mod_list)
-
- if downcased_mod_list != sorted_downcased_mod_list do
- issue_opts(line_no, base, mod_list, downcased_mod_list, sorted_downcased_mod_list)
- end
- end
-
- defp issue_opts(line_no, base, mod_list, downcased_mod_list, sorted_downcased_mod_list) do
- trigger =
- downcased_mod_list
- |> Enum.with_index()
- |> Enum.find_value(fn {downcased_mod_entry, index} ->
- if downcased_mod_entry != Enum.at(sorted_downcased_mod_list, index) do
- Enum.at(mod_list, index)
- end
- end)
-
- issue_opts(line_no, [base, trigger], trigger)
- end
-
- defp issue_opts(line_no, module, trigger) do
- %{
- line_no: line_no,
- trigger: trigger,
- module: module
- }
- end
-
- defp extract_alias_groups({:defmodule, _, _} = ast) do
- ast
- |> Credo.Code.postwalk(&find_alias_groups/2)
- |> Enum.reverse()
- |> Enum.reduce([[]], fn definition, acc ->
- case definition do
- nil ->
- [[]] ++ acc
-
- definition ->
- [group | groups] = acc
- [group ++ [definition]] ++ groups
- end
- end)
- |> Enum.reverse()
- end
-
- defp find_alias_groups(
- {:alias, _, [{:__aliases__, meta, mod_list} | _]} = ast,
- aliases
- ) do
- compare_name = compare_name(ast)
- modules = [{meta[:line], {Name.full(mod_list), []}, compare_name}]
-
- accumulate_alias_into_group(ast, modules, meta[:line], aliases)
- end
-
- defp find_alias_groups(
- {:alias, _,
- [
- {{:., _, [{:__aliases__, meta, mod_list}, :{}]}, _, multi_mod_list}
- ]} = ast,
- aliases
- ) do
- multi_mod_list =
- multi_mod_list
- |> Enum.map(fn {:__aliases__, _, mod_list} -> mod_name(mod_list) end)
-
- compare_name = compare_name(ast)
- modules = [{meta[:line], {Name.full(mod_list), multi_mod_list}, compare_name}]
-
- nested_mod_line = meta[:line] + 1
- accumulate_alias_into_group(ast, modules, nested_mod_line, aliases)
- end
-
- defp find_alias_groups(ast, aliases), do: {ast, aliases}
-
- defp mod_name(mod_list) do
- Enum.map_join(mod_list, ".", &to_string/1)
- end
-
- defp compare_name(value) do
- value
- |> Macro.to_string()
- |> String.downcase()
- |> String.replace(~r/[\{\}]/, "")
- |> String.replace(~r/,.+/, "")
- end
-
- defp accumulate_alias_into_group(ast, modules, line, [{line_no, _, _} | _] = aliases)
- when line_no != 0 and line_no != line - 1 do
- {ast, modules ++ [nil] ++ aliases}
- end
-
- defp accumulate_alias_into_group(ast, modules, _, aliases) do
- {ast, modules ++ aliases}
- end
-
- defp issue_for(issue_meta, %{line_no: line_no, trigger: trigger, module: module}) do
- format_issue(
- issue_meta,
- message: "The alias `#{Name.full(module)}` is not alphabetically ordered among its group.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/block_pipe.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/block_pipe.ex
deleted file mode 100644
index d889d12d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/block_pipe.ex
+++ /dev/null
@@ -1,91 +0,0 @@
-defmodule Credo.Check.Readability.BlockPipe do
- use Credo.Check,
- id: "EX3003",
- tags: [:controversial],
- param_defaults: [
- exclude: []
- ],
- explanations: [
- check: """
- Pipes (`|>`) should not be used with blocks.
-
- The code in this example ...
-
- list
- |> Enum.take(5)
- |> Enum.sort()
- |> case do
- [[_h | _t] | _] -> true
- _ -> false
- end
-
- ... should be refactored to look like this:
-
- maybe_nested_lists =
- list
- |> Enum.take(5)
- |> Enum.sort()
-
- case maybe_nested_lists do
- [[_h | _t] | _] -> true
- _ -> false
- end
-
- ... or create a new function:
-
- list
- |> Enum.take(5)
- |> Enum.sort()
- |> contains_nested_list?()
-
- Piping to blocks may be harder to read because it can be said that it obscures intentions
- and increases cognitive load on the reader. Instead, prefer introducing variables to your code or
- new functions when it may be a sign that your function is getting too complicated and/or has too many concerns.
-
- Like all `Readability` issues, this one is not a technical concern, but you can improve the odds of others reading
- and understanding the intent of your code by making it easier to follow.
- """,
- params: [
- exclude: "Do not raise an issue for these macros and functions."
- ]
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- excluded_functions = Params.get(params, :exclude, __MODULE__)
-
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, excluded_functions, issue_meta)
- )
- end
-
- defp traverse(
- {:|>, meta, [_, {function, _, [[{:do, _} | _]]}]} = ast,
- issues,
- excluded_functions,
- issue_meta
- ) do
- if Enum.member?(excluded_functions, function) do
- {ast, issues}
- else
- {nil, issues ++ [issue_for(issue_meta, meta[:line], "|>")]}
- end
- end
-
- defp traverse(ast, issues, _excluded_functions, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Use a variable or create a new function instead of piping to a block",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/function_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/function_names.ex
deleted file mode 100644
index b0c6fe31..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/function_names.ex
+++ /dev/null
@@ -1,167 +0,0 @@
-defmodule Credo.Check.Readability.FunctionNames do
- use Credo.Check,
- id: "EX3004",
- base_priority: :high,
- param_defaults: [
- allow_acronyms: false
- ],
- explanations: [
- check: """
- Function, macro, and guard names are always written in snake_case in Elixir.
-
- # snake_case
-
- def handle_incoming_message(message) do
- end
-
- # not snake_case
-
- def handleIncomingMessage(message) do
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- allow_acronyms: "Allows acronyms like HTTP or OTP in function names."
- ]
- ]
-
- alias Credo.Code.Name
-
- @def_ops [:def, :defp, :defmacro, :defmacrop, :defguard, :defguardp]
- @all_sigil_chars ~w(a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z)
- @all_sigil_atoms Enum.map(@all_sigil_chars, &:"sigil_#{&1}")
-
- # all non-special-form operators
- @all_nonspecial_operators ~W(! && ++ -- .. <> =~ @ |> || != !== * + - / < <= == === > >= ||| &&& <<< >>> <<~ ~>> <~ ~> <~> <|> ^^^ ~~~ +++ ---)a
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
- allow_acronyms? = Credo.Check.Params.get(params, :allow_acronyms, __MODULE__)
-
- source_file
- |> Credo.Code.prewalk(&traverse(&1, &2, issue_meta, allow_acronyms?), empty_issues())
- |> issues_list()
- end
-
- defp empty_issues, do: %{}
-
- defp add_issue(issues, name, arity, issue), do: Map.put_new(issues, {name, arity}, issue)
-
- defp issues_list(issues) do
- issues
- |> Map.values()
- |> Enum.sort_by(& &1.line_no)
- end
-
- # Ignore sigil definitions
- for sigil <- @all_sigil_atoms do
- defp traverse(
- {op, _meta, [{unquote(sigil), _sigil_meta, _args} | _tail]} = ast,
- issues,
- _issue_meta,
- _allow_acronyms?
- )
- when op in [:def, :defmacro] do
- {ast, issues}
- end
-
- defp traverse(
- {op, _op_meta,
- [{:when, _when_meta, [{unquote(sigil), _sigil_meta, _args} | _tail]}, _block]} = ast,
- issues,
- _issue_meta,
- _allow_acronyms?
- )
- when op in [:def, :defmacro] do
- {ast, issues}
- end
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see above for how we want to avoid `sigil_X` definitions
- for op <- @def_ops do
- # Ignore variables named e.g. `defp`
- defp traverse({unquote(op), _meta, nil} = ast, issues, _issue_meta, _allow_acronyms?) do
- {ast, issues}
- end
-
- # ignore non-special-form (overridable) operators
- defp traverse(
- {unquote(op), _meta, [{operator, _at_meta, _args} | _tail]} = ast,
- issues,
- _issue_meta,
- _allow_acronyms?
- )
- when operator in @all_nonspecial_operators do
- {ast, issues}
- end
-
- # ignore non-special-form (overridable) operators
- defp traverse(
- {unquote(op), _meta,
- [
- {:when, _,
- [
- {operator, _, _} | _
- ]}
- | _
- ]} = ast,
- issues,
- _issue_meta,
- _allow_acronyms?
- )
- when operator in @all_nonspecial_operators do
- {ast, issues}
- end
-
- defp traverse({unquote(op), _meta, arguments} = ast, issues, issue_meta, allow_acronyms?) do
- {ast, issues_for_definition(arguments, issues, issue_meta, allow_acronyms?)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _allow_acronyms?) do
- {ast, issues}
- end
-
- defp issues_for_definition(body, issues, issue_meta, allow_acronyms?) do
- case Enum.at(body, 0) do
- {:when, _when_meta, [{name, meta, args} | _guard]} ->
- issues_for_name(name, args, meta, issues, issue_meta, allow_acronyms?)
-
- {name, meta, args} when is_atom(name) ->
- issues_for_name(name, args, meta, issues, issue_meta, allow_acronyms?)
-
- _ ->
- issues
- end
- end
-
- defp issues_for_name({:unquote, _, _}, _args, _meta, issues, _issue_meta, _allow_acronyms?) do
- issues
- end
-
- defp issues_for_name(name, args, meta, issues, issue_meta, allow_acronyms?) do
- if name |> to_string |> Name.snake_case?(allow_acronyms?) do
- issues
- else
- issue = issue_for(issue_meta, meta[:line], name)
- arity = length(args || [])
-
- add_issue(issues, name, arity, issue)
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Function/macro/guard names should be written in snake_case.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/impl_true.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/impl_true.ex
deleted file mode 100644
index 2e44f004..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/impl_true.ex
+++ /dev/null
@@ -1,56 +0,0 @@
-defmodule Credo.Check.Readability.ImplTrue do
- use Credo.Check,
- id: "EX3004",
- base_priority: :normal,
- explanations: [
- check: """
- When implementing behaviour callbacks, `@impl true` indicates that a function implements a callback, but
- a better way is to note the actual behaviour being implemented, for example `@impl MyBehaviour`. This
- not only improves readability, but adds extra validation in cases where multiple behaviours are implemented
- in a single module.
-
- Instead of:
-
- @impl true
- def my_funcion() do
- ...
-
- use:
-
- @impl MyBehaviour
- def my_funcion() do
- ...
-
- """
- ]
-
- alias Credo.Code.Heredocs
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- source_file
- |> Heredocs.replace_with_spaces()
- |> String.split("\n")
- |> Enum.with_index(1)
- |> Enum.reduce([], &check_line(&1, &2, issue_meta))
- end
-
- defp check_line({line, line_number}, issues, issue_meta) do
- case String.trim(line) do
- "@impl true" -> [issue_for(issue_meta, line_number) | issues]
- _ -> issues
- end
- end
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "@impl true should be @impl MyBehaviour",
- trigger: "@impl true",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/large_numbers.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/large_numbers.ex
deleted file mode 100644
index 4fbabb01..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/large_numbers.ex
+++ /dev/null
@@ -1,248 +0,0 @@
-defmodule Credo.Check.Readability.LargeNumbers do
- use Credo.Check,
- id: "EX3006",
- base_priority: :high,
- tags: [:formatter],
- param_defaults: [
- only_greater_than: 9_999,
- trailing_digits: []
- ],
- explanations: [
- check: """
- Numbers can contain underscores for readability purposes.
- These do not affect the value of the number, but can help read large numbers
- more easily.
-
- 141592654 # how large is this number?
-
- 141_592_654 # ah, it's in the hundreds of millions!
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- only_greater_than: "The check only reports numbers greater than this.",
- trailing_digits:
- "The check allows for the given number of trailing digits (can be a number, range or list)"
- ]
- ]
-
- @doc false
- # TODO: consider for experimental check front-loader (tokens)
- def run(%SourceFile{} = source_file, params) do
- min_number = Params.get(params, :only_greater_than, __MODULE__)
- issue_meta = IssueMeta.for(source_file, Keyword.merge(params, only_greater_than: min_number))
-
- allowed_trailing_digits =
- case Params.get(params, :trailing_digits, __MODULE__) do
- %Range{} = value -> Enum.to_list(value)
- value -> List.wrap(value)
- end
-
- source_file
- |> Credo.Code.to_tokens()
- |> collect_number_tokens([], min_number)
- |> find_issues([], allowed_trailing_digits, issue_meta)
- end
-
- defp collect_number_tokens([], acc, _), do: acc
-
- defp collect_number_tokens([head | t], acc, min_number) do
- acc =
- case number_token(head, min_number) do
- nil -> acc
- token -> acc ++ [token]
- end
-
- collect_number_tokens(t, acc, min_number)
- end
-
- # tuple for Elixir >= 1.10.0
- defp number_token({:flt, {_, _, number}, _} = tuple, min_number) when min_number < number do
- tuple
- end
-
- # tuple for Elixir >= 1.6.0
- defp number_token({:int, {_, _, number}, _} = tuple, min_number) when min_number < number do
- tuple
- end
-
- defp number_token({:float, {_, _, number}, _} = tuple, min_number) when min_number < number do
- tuple
- end
-
- # tuple for Elixir <= 1.5.x
- defp number_token({:number, _, number} = tuple, min_number) when min_number < number do
- tuple
- end
-
- defp number_token(_, _), do: nil
-
- defp find_issues([], acc, _allowed_trailing_digits, _issue_meta) do
- acc
- end
-
- # tuple for Elixir >= 1.10.0
- defp find_issues(
- [{:flt, {line_no, column1, number} = location, _} | t],
- acc,
- allowed_trailing_digits,
- issue_meta
- ) do
- acc =
- acc ++ find_issue(line_no, column1, location, number, allowed_trailing_digits, issue_meta)
-
- find_issues(t, acc, allowed_trailing_digits, issue_meta)
- end
-
- # tuple for Elixir >= 1.6.0
- defp find_issues(
- [{:int, {line_no, column1, number} = location, _} | t],
- acc,
- allowed_trailing_digits,
- issue_meta
- ) do
- acc =
- acc ++ find_issue(line_no, column1, location, number, allowed_trailing_digits, issue_meta)
-
- find_issues(t, acc, allowed_trailing_digits, issue_meta)
- end
-
- defp find_issues(
- [{:float, {line_no, column1, number} = location, _} | t],
- acc,
- allowed_trailing_digits,
- issue_meta
- ) do
- acc =
- acc ++ find_issue(line_no, column1, location, number, allowed_trailing_digits, issue_meta)
-
- find_issues(t, acc, allowed_trailing_digits, issue_meta)
- end
-
- # tuple for Elixir <= 1.5.x
- defp find_issues(
- [{:number, {line_no, column1, _column2} = location, number} | t],
- acc,
- allowed_trailing_digits,
- issue_meta
- ) do
- acc =
- acc ++ find_issue(line_no, column1, location, number, allowed_trailing_digits, issue_meta)
-
- find_issues(t, acc, allowed_trailing_digits, issue_meta)
- end
-
- defp find_issue(line_no, column1, location, number, allowed_trailing_digits, issue_meta) do
- source = source_fragment(location, issue_meta)
- underscored_versions = number_with_underscores(number, allowed_trailing_digits, source)
-
- if decimal_in_source?(source) && not Enum.member?(underscored_versions, source) do
- [
- issue_for(
- issue_meta,
- line_no,
- column1,
- source,
- underscored_versions
- )
- ]
- else
- []
- end
- end
-
- defp number_with_underscores(number, allowed_trailing_digits, _) when is_integer(number) do
- number
- |> to_string
- |> add_underscores_to_number_string(allowed_trailing_digits)
- end
-
- defp number_with_underscores(number, allowed_trailing_digits, source_fragment)
- when is_number(number) do
- case String.split(source_fragment, ".", parts: 2) do
- [num, decimal] ->
- add_underscores_to_number_string(num, allowed_trailing_digits)
- |> Enum.map(fn base -> Enum.join([base, decimal], ".") end)
-
- [num] ->
- add_underscores_to_number_string(num, allowed_trailing_digits)
- end
- end
-
- defp add_underscores_to_number_string(string, allowed_trailing_digits) do
- without_trailing_digits =
- string
- |> String.reverse()
- |> String.replace(~r/(\d{3})(?=\d)/, "\\1_")
- |> String.reverse()
-
- all_trailing_digit_versions =
- Enum.map(allowed_trailing_digits, fn trailing_digits ->
- if String.length(string) > trailing_digits do
- base =
- String.slice(string, 0..(-1 * trailing_digits - 1))
- |> String.reverse()
- |> String.replace(~r/(\d{3})(?=\d)/, "\\1_")
- |> String.reverse()
-
- trailing = String.slice(string, (-1 * trailing_digits)..-1)
-
- "#{base}_#{trailing}"
- end
- end)
-
- ([without_trailing_digits] ++ all_trailing_digit_versions)
- |> Enum.reject(&is_nil/1)
- |> Enum.uniq()
- end
-
- defp issue_for(issue_meta, line_no, column, trigger, expected) do
- params = IssueMeta.params(issue_meta)
- only_greater_than = Params.get(params, :only_greater_than, __MODULE__)
-
- format_issue(
- issue_meta,
- message:
- "Numbers larger than #{only_greater_than} should be written with underscores: #{Enum.join(expected, " or ")}",
- line_no: line_no,
- column: column,
- trigger: trigger
- )
- end
-
- defp decimal_in_source?(source) do
- case String.slice(source, 0, 2) do
- "0b" -> false
- "0o" -> false
- "0x" -> false
- "" -> false
- _ -> true
- end
- end
-
- defp source_fragment({line_no, column1, _}, issue_meta) do
- line =
- issue_meta
- |> IssueMeta.source_file()
- |> SourceFile.line_at(line_no)
-
- beginning_of_number =
- ~r/[^0-9_oxb]*([0-9_oxb]+$)/
- |> Regex.run(String.slice(line, 1..column1))
- |> List.wrap()
- |> List.last()
- |> to_string()
-
- ending_of_number =
- ~r/^([0-9_\.]+)/
- |> Regex.run(String.slice(line, (column1 + 1)..-1))
- |> List.wrap()
- |> List.last()
- |> to_string()
- |> String.replace(~r/\.\..*/, "")
-
- beginning_of_number <> ending_of_number
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/max_line_length.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/max_line_length.ex
deleted file mode 100644
index 870f6aa2..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/max_line_length.ex
+++ /dev/null
@@ -1,154 +0,0 @@
-defmodule Credo.Check.Readability.MaxLineLength do
- use Credo.Check,
- id: "EX3007",
- base_priority: :low,
- tags: [:formatter],
- param_defaults: [
- max_length: 120,
- ignore_definitions: true,
- ignore_heredocs: true,
- ignore_specs: false,
- ignore_sigils: true,
- ignore_strings: true,
- ignore_urls: true
- ],
- explanations: [
- check: """
- Checks for the length of lines.
-
- Ignores function definitions and (multi-)line strings by default.
- """,
- params: [
- max_length: "The maximum number of characters a line may consist of.",
- ignore_definitions: "Set to `true` to ignore lines including function definitions.",
- ignore_specs: "Set to `true` to ignore lines including `@spec`s.",
- ignore_sigils: "Set to `true` to ignore lines that are sigils, e.g. regular expressions.",
- ignore_strings: "Set to `true` to ignore lines that are strings or in heredocs.",
- ignore_urls: "Set to `true` to ignore lines that contain urls."
- ]
- ]
-
- alias Credo.Code.Heredocs
- alias Credo.Code.Sigils
- alias Credo.Code.Strings
-
- @def_ops [:def, :defp, :defmacro]
- @url_regex ~r/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_length = Params.get(params, :max_length, __MODULE__)
-
- ignore_definitions = Params.get(params, :ignore_definitions, __MODULE__)
-
- ignore_specs = Params.get(params, :ignore_specs, __MODULE__)
- ignore_sigils = Params.get(params, :ignore_sigils, __MODULE__)
- ignore_strings = Params.get(params, :ignore_strings, __MODULE__)
- ignore_heredocs = Params.get(params, :ignore_heredocs, __MODULE__)
- ignore_urls = Params.get(params, :ignore_urls, __MODULE__)
-
- definitions = Credo.Code.prewalk(source_file, &find_definitions/2)
- specs = Credo.Code.prewalk(source_file, &find_specs/2)
-
- source =
- if ignore_heredocs do
- Heredocs.replace_with_spaces(source_file, "")
- else
- SourceFile.source(source_file)
- end
-
- source =
- if ignore_sigils do
- Sigils.replace_with_spaces(source, "")
- else
- source
- end
-
- lines = Credo.Code.to_lines(source)
-
- lines_for_comparison =
- if ignore_strings do
- source
- |> Strings.replace_with_spaces("", " ", source_file.filename)
- |> Credo.Code.to_lines()
- else
- lines
- end
-
- lines_for_comparison =
- if ignore_urls do
- Enum.reject(lines_for_comparison, fn {_, line} -> line =~ @url_regex end)
- else
- lines_for_comparison
- end
-
- Enum.reduce(lines_for_comparison, [], fn {line_no, line_for_comparison}, issues ->
- if String.length(line_for_comparison) > max_length do
- if refute_issue?(line_no, definitions, ignore_definitions, specs, ignore_specs) do
- issues
- else
- {_, line} = Enum.at(lines, line_no - 1)
-
- [issue_for(line_no, max_length, line, issue_meta) | issues]
- end
- else
- issues
- end
- end)
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- defp find_definitions({unquote(op), meta, arguments} = ast, definitions)
- when is_list(arguments) do
- {ast, [meta[:line] | definitions]}
- end
- end
-
- defp find_definitions(ast, definitions) do
- {ast, definitions}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp find_specs({:spec, meta, arguments} = ast, specs) when is_list(arguments) do
- {ast, [meta[:line] | specs]}
- end
-
- defp find_specs(ast, specs) do
- {ast, specs}
- end
-
- defp refute_issue?(line_no, definitions, ignore_definitions, specs, ignore_specs) do
- ignore_definitions? =
- if ignore_definitions do
- Enum.member?(definitions, line_no)
- else
- false
- end
-
- ignore_specs? =
- if ignore_specs do
- Enum.member?(specs, line_no)
- else
- false
- end
-
- ignore_definitions? || ignore_specs?
- end
-
- defp issue_for(line_no, max_length, line, issue_meta) do
- line_length = String.length(line)
- column = max_length + 1
- trigger = String.slice(line, max_length, line_length - max_length)
-
- format_issue(
- issue_meta,
- message: "Line is too long (max is #{max_length}, was #{line_length}).",
- line_no: line_no,
- column: column,
- trigger: trigger
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_attribute_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_attribute_names.ex
deleted file mode 100644
index 18ff57e9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_attribute_names.ex
+++ /dev/null
@@ -1,72 +0,0 @@
-defmodule Credo.Check.Readability.ModuleAttributeNames do
- use Credo.Check,
- id: "EX3008",
- base_priority: :high,
- explanations: [
- check: """
- Module attribute names are always written in snake_case in Elixir.
-
- # snake_case
-
- @inbox_name "incoming"
-
- # not snake_case
-
- @inboxName "incoming"
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # ignore non-alphanumeric @ ASTs, for when you're redefining the @ macro.
- defp traverse({:@, _meta, [{:{}, _, _}]} = ast, issues, _) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see above how we want to exclude certain front-loads
- defp traverse(
- {:@, _meta, [{name, meta, _arguments}]} = ast,
- issues,
- issue_meta
- ) do
- case issue_for_name(issue_meta, name, meta) do
- nil -> {ast, issues}
- val -> {ast, issues ++ [val]}
- end
- end
-
- defp traverse(ast, issues, _source_file) do
- {ast, issues}
- end
-
- defp issue_for_name(issue_meta, name, meta)
- when is_binary(name) or is_atom(name) do
- unless name |> to_string |> Name.snake_case?() do
- issue_for(issue_meta, meta[:line], "@#{name}")
- end
- end
-
- defp issue_for_name(_, _, _), do: nil
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Module attribute names should be written in snake_case.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_doc.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_doc.ex
deleted file mode 100644
index 882ee574..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_doc.ex
+++ /dev/null
@@ -1,145 +0,0 @@
-defmodule Credo.Check.Readability.ModuleDoc do
- use Credo.Check,
- id: "EX3009",
- param_defaults: [
- ignore_names: [
- ~r/(\.\w+Controller|\.Endpoint|\.\w+Live(\.\w+)?|\.Repo|\.Router|\.\w+Socket|\.\w+View|\.\w+HTML|\.\w+JSON)$/
- ]
- ],
- explanations: [
- check: """
- Every module should contain comprehensive documentation.
-
- # preferred
-
- defmodule MyApp.Web.Search do
- @moduledoc \"\"\"
- This module provides a public API for all search queries originating
- in the web layer.
- \"\"\"
- end
-
- # also okay: explicitly say there is no documentation
-
- defmodule MyApp.Web.Search do
- @moduledoc false
- end
-
- Many times a sentence or two in plain english, explaining why the module
- exists, will suffice. Documenting your train of thought this way will help
- both your co-workers and your future-self.
-
- Other times you will want to elaborate even further and show some
- examples of how the module's functions can and should be used.
-
- In some cases however, you might not want to document things about a module,
- e.g. it is part of a private API inside your project. Since Elixir prefers
- explicitness over implicit behaviour, you should "tag" these modules with
-
- @moduledoc false
-
- to make it clear that there is no intention in documenting it.
- """,
- params: [
- ignore_names: "All modules matching this regex (or list of regexes) will be ignored."
- ]
- ]
-
- alias Credo.Code.Module
-
- @doc false
- def run(%SourceFile{filename: filename} = source_file, params \\ []) do
- if Path.extname(filename) == ".exs" do
- []
- else
- issue_meta = IssueMeta.for(source_file, params)
- ignore_names = Params.get(params, :ignore_names, __MODULE__)
-
- {_continue, issues} =
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, ignore_names),
- {true, []}
- )
-
- issues
- end
- end
-
- defp traverse(
- {:defmodule, meta, _arguments} = ast,
- {true, issues},
- issue_meta,
- ignore_names
- ) do
- mod_name = Module.name(ast)
-
- if matches_any?(mod_name, ignore_names) do
- {ast, {false, issues}}
- else
- exception? = Module.exception?(ast)
-
- case Module.attribute(ast, :moduledoc) do
- {:error, _} when not exception? ->
- {
- ast,
- {true,
- [
- issue_for(
- "Modules should have a @moduledoc tag.",
- issue_meta,
- meta[:line],
- mod_name
- )
- ] ++ issues}
- }
-
- string when is_binary(string) ->
- if String.trim(string) == "" do
- {
- ast,
- {true,
- [
- issue_for(
- "Use `@moduledoc false` if a module will not be documented.",
- issue_meta,
- meta[:line],
- mod_name
- )
- ] ++ issues}
- }
- else
- {ast, {true, issues}}
- end
-
- _ ->
- {ast, {true, issues}}
- end
- end
- end
-
- defp traverse(ast, {continue, issues}, _issue_meta, _ignore_names) do
- {ast, {continue, issues}}
- end
-
- defp matches_any?(name, list) when is_list(list) do
- Enum.any?(list, &matches_any?(name, &1))
- end
-
- defp matches_any?(name, string) when is_binary(string) do
- String.contains?(name, string)
- end
-
- defp matches_any?(name, regex) do
- String.match?(name, regex)
- end
-
- defp issue_for(message, issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: message,
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_names.ex
deleted file mode 100644
index c00c521d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/module_names.ex
+++ /dev/null
@@ -1,104 +0,0 @@
-defmodule Credo.Check.Readability.ModuleNames do
- use Credo.Check,
- id: "EX3010",
- base_priority: :high,
- param_defaults: [
- ignore: []
- ],
- explanations: [
- check: """
- Module names are always written in PascalCase in Elixir.
-
- # PascalCase
-
- defmodule MyApp.WebSearchController do
- # ...
- end
-
- # not PascalCase
-
- defmodule MyApp.Web_searchController do
- # ...
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of other reading and liking your code by making
- it easier to follow.
- """,
- params: [
- ignore:
- "List of ignored module names and patterns e.g. `[~r/Sample_Module/, \"Credo.Sample_Module\"]`"
- ]
- ]
-
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- ignored_patterns = Credo.Check.Params.get(params, :ignore, __MODULE__)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta, ignored_patterns))
- end
-
- defp traverse({:defmodule, _meta, arguments} = ast, issues, issue_meta, ignored_patterns) do
- {ast, issues_for_def(arguments, issues, issue_meta, ignored_patterns)}
- end
-
- defp traverse(ast, issues, _issue_meta, _ignored_patterns) do
- {ast, issues}
- end
-
- defp issues_for_def(body, issues, issue_meta, ignored_patterns) do
- case Enum.at(body, 0) do
- {:__aliases__, meta, names} ->
- names
- |> Enum.filter(&String.Chars.impl_for/1)
- |> Enum.join(".")
- |> issues_for_name(meta, issues, issue_meta, ignored_patterns)
-
- _ ->
- issues
- end
- end
-
- defp issues_for_name(name, meta, issues, issue_meta, ignored_patterns) do
- module_name = Name.full(name)
-
- pascal_case? =
- module_name
- |> String.split(".")
- |> Enum.all?(&Name.pascal_case?/1)
-
- if pascal_case? or ignored_module?(ignored_patterns, module_name) do
- issues
- else
- [issue_for(issue_meta, meta[:line], name) | issues]
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Module names should be written in PascalCase.",
- trigger: trigger,
- line_no: line_no
- )
- end
-
- defp ignored_module?([], _module_name), do: false
-
- defp ignored_module?(ignored_patterns, module_name) do
- Enum.any?(ignored_patterns, fn
- %Regex{} = pattern ->
- String.match?(module_name, pattern)
-
- name when is_atom(name) ->
- module_name == Credo.Code.Name.full(name)
-
- name ->
- module_name == name
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/multi_alias.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/multi_alias.ex
deleted file mode 100644
index 3c8019f0..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/multi_alias.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-defmodule Credo.Check.Readability.MultiAlias do
- use Credo.Check,
- id: "EX3011",
- base_priority: :low,
- tags: [:controversial],
- explanations: [
- check: """
- Multi alias expansion makes module uses harder to search for in large code bases.
-
- # preferred
-
- alias Module.Foo
- alias Module.Bar
-
- # NOT preferred
-
- alias Module.{Foo, Bar}
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse(
- {:alias, _, [{{_, _, [{alias, opts, _base_alias}, :{}]}, _, [multi_alias | _]}]} = ast,
- issues,
- issue_meta
- )
- when alias in [:__aliases__, :__MODULE__] do
- {:__aliases__, _, module} = multi_alias
- module = Enum.join(module, ".")
-
- new_issue = issue_for(issue_meta, Keyword.get(opts, :line), module)
-
- {ast, [new_issue | issues]}
- end
-
- defp traverse(ast, issues, _issue_meta), do: {ast, issues}
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message:
- "Avoid grouping aliases in '{ ... }'; please specify one fully-qualified alias per line.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/nested_function_calls.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/nested_function_calls.ex
deleted file mode 100644
index b60dff1c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/nested_function_calls.ex
+++ /dev/null
@@ -1,357 +0,0 @@
-defmodule Credo.Check.Readability.NestedFunctionCalls do
- use Credo.Check,
- id: "EX3012",
- tags: [:controversial],
- param_defaults: [min_pipeline_length: 2],
- explanations: [
- check: """
- A function call should not be nested inside another function call.
-
- So while this is fine:
-
- Enum.shuffle([1,2,3])
-
- The code in this example ...
-
- Enum.shuffle(Enum.uniq([1,2,3,3]))
-
- ... should be refactored to look like this:
-
- [1,2,3,3]
- |> Enum.uniq()
- |> Enum.shuffle()
-
- Nested function calls make the code harder to read. Instead, break the
- function calls out into a pipeline.
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- min_pipeline_length: "Set a minimum pipeline length"
- ]
- ]
-
- alias Credo.Check.Readability.NestedFunctionCalls.PipeHelper
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- min_pipeline_length = Params.get(params, :min_pipeline_length, __MODULE__)
-
- {_min_pipeline_length, issues} =
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta),
- {min_pipeline_length, []}
- )
-
- issues
- end
-
- # A call in a pipeline
- defp traverse({:|>, _meta, [pipe_input, {{:., _meta2, _fun}, _meta3, args}]}, acc, _issue) do
- {[pipe_input, args], acc}
- end
-
- # A fully qualified call with no arguments
- defp traverse({{:., _meta, _call}, _meta2, []} = ast, accumulator, _issue) do
- {ast, accumulator}
- end
-
- # Any call
- defp traverse(
- {{_name, _loc, call}, meta, args} = ast,
- {min_pipeline_length, issues} = acc,
- issue_meta
- ) do
- if cannot_be_in_pipeline?(ast) do
- {ast, acc}
- else
- case length_as_pipeline(args) + 1 do
- potential_pipeline_length when potential_pipeline_length >= min_pipeline_length ->
- new_issues = issues ++ [issue_for(issue_meta, meta[:line], Name.full(call))]
- {ast, {min_pipeline_length, new_issues}}
-
- _ ->
- {nil, acc}
- end
- end
- end
-
- # Another expression, we must no longer be in a pipeline
- defp traverse(ast, {min_pipeline_length, issues}, _issue_meta) do
- {ast, {min_pipeline_length, issues}}
- end
-
- # Call with function call for first argument
- defp length_as_pipeline([{_name, _meta, args} = call_ast | _]) do
- if cannot_be_in_pipeline?(call_ast) do
- 0
- else
- 1 + length_as_pipeline(args)
- end
- end
-
- # Call where the first argument isn't another function call
- defp length_as_pipeline(_args) do
- 0
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Use a pipeline when there are nested function calls",
- trigger: trigger,
- line_no: line_no
- )
- end
-
- defp cannot_be_in_pipeline?(ast) do
- PipeHelper.cannot_be_in_pipeline?(ast, [], [])
- end
-
- defmodule PipeHelper do
- @moduledoc """
- This module exists to contain logic for the cannot_be_in_pipline?/3 helper
- function. This function was originally copied from the
- Credo.Check.Refactor.PipeChainStart module's valid_chain_start?/3 function.
- Both functions are identical.
- """
-
- @elixir_custom_operators [
- :<-,
- :|||,
- :&&&,
- :<<<,
- :>>>,
- :<<~,
- :~>>,
- :<~,
- :~>,
- :<~>,
- :"<|>",
- :"^^^",
- :"~~~",
- :"..//"
- ]
-
- def cannot_be_in_pipeline?(
- {:__block__, _, [single_ast_node]},
- excluded_functions,
- excluded_argument_types
- ) do
- cannot_be_in_pipeline?(
- single_ast_node,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- for atom <- [
- :%,
- :%{},
- :..,
- :<<>>,
- :@,
- :__aliases__,
- :unquote,
- :{},
- :&,
- :<>,
- :++,
- :--,
- :&&,
- :||,
- :+,
- :-,
- :*,
- :/,
- :>,
- :>=,
- :<,
- :<=,
- :==,
- :for,
- :with,
- :not,
- :and,
- :or
- ] do
- def cannot_be_in_pipeline?(
- {unquote(atom), _meta, _arguments},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
- end
-
- for operator <- @elixir_custom_operators do
- def cannot_be_in_pipeline?(
- {unquote(operator), _meta, _arguments},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
- end
-
- # anonymous function
- def cannot_be_in_pipeline?(
- {:fn, _, [{:->, _, [_args, _body]}]},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
-
- # function_call()
- def cannot_be_in_pipeline?(
- {atom, _, []},
- _excluded_functions,
- _excluded_argument_types
- )
- when is_atom(atom) do
- true
- end
-
- # function_call(with, args) and sigils
- def cannot_be_in_pipeline?(
- {atom, _, arguments} = ast,
- excluded_functions,
- excluded_argument_types
- )
- when is_atom(atom) and is_list(arguments) do
- sigil?(atom) ||
- valid_chain_start_function_call?(
- ast,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- # map[:access]
- def cannot_be_in_pipeline?(
- {{:., _, [Access, :get]}, _, _},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
-
- # Module.function_call()
- def cannot_be_in_pipeline?(
- {{:., _, _}, _, []},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Elixir <= 1.8.0
- # '__#{val}__' are compiled to String.to_charlist("__#{val}__")
- # we want to consider these charlists a valid pipe chain start
- def cannot_be_in_pipeline?(
- {{:., _, [String, :to_charlist]}, _, [{:<<>>, _, _}]},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Elixir >= 1.8.0
- # '__#{val}__' are compiled to String.to_charlist("__#{val}__")
- # we want to consider these charlists a valid pipe chain start
- def cannot_be_in_pipeline?(
- {{:., _, [List, :to_charlist]}, _, [[_ | _]]},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Module.function_call(with, parameters)
- def cannot_be_in_pipeline?(
- {{:., _, _}, _, _} = ast,
- excluded_functions,
- excluded_argument_types
- ) do
- valid_chain_start_function_call?(
- ast,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- def cannot_be_in_pipeline?(_, _excluded_functions, _excluded_argument_types), do: true
-
- def valid_chain_start_function_call?(
- {_atom, _, arguments} = ast,
- excluded_functions,
- excluded_argument_types
- ) do
- function_name = to_function_call_name(ast)
-
- found_argument_types =
- case arguments do
- [nil | _] -> [:atom]
- x -> x |> List.first() |> argument_type()
- end
-
- Enum.member?(excluded_functions, function_name) ||
- Enum.any?(
- found_argument_types,
- &Enum.member?(excluded_argument_types, &1)
- )
- end
-
- defp sigil?(atom) do
- atom
- |> to_string
- |> String.match?(~r/^sigil_[a-zA-Z]$/)
- end
-
- defp to_function_call_name({_, _, _} = ast) do
- {ast, [], []}
- |> Macro.to_string()
- |> String.replace(~r/\.?\(.*\)$/s, "")
- end
-
- @alphabet_wo_r ~w(a b c d e f g h i j k l m n o p q s t u v w x y z)
- @all_sigil_chars Enum.flat_map(@alphabet_wo_r, &[&1, String.upcase(&1)])
- @matchable_sigils Enum.map(@all_sigil_chars, &:"sigil_#{&1}")
-
- for sigil_atom <- @matchable_sigils do
- defp argument_type({unquote(sigil_atom), _, _}) do
- [unquote(sigil_atom)]
- end
- end
-
- defp argument_type({:sigil_r, _, _}), do: [:sigil_r, :regex]
- defp argument_type({:sigil_R, _, _}), do: [:sigil_R, :regex]
-
- defp argument_type({:fn, _, _}), do: [:fn]
- defp argument_type({:%{}, _, _}), do: [:map]
- defp argument_type({:{}, _, _}), do: [:tuple]
- defp argument_type(nil), do: []
-
- defp argument_type(v) when is_atom(v), do: [:atom]
- defp argument_type(v) when is_binary(v), do: [:binary]
- defp argument_type(v) when is_bitstring(v), do: [:bitstring]
- defp argument_type(v) when is_boolean(v), do: [:boolean]
-
- defp argument_type(v) when is_list(v) do
- if Keyword.keyword?(v) do
- [:keyword, :list]
- else
- [:list]
- end
- end
-
- defp argument_type(v) when is_number(v), do: [:number]
-
- defp argument_type(v), do: [:credo_type_error, v]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_arity_function_in_pipe.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_arity_function_in_pipe.ex
deleted file mode 100644
index ec7167f7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_arity_function_in_pipe.ex
+++ /dev/null
@@ -1,42 +0,0 @@
-defmodule Credo.Check.Readability.OneArityFunctionInPipe do
- use Credo.Check,
- id: "EX3034",
- base_priority: :low,
- explanations: [
- check: """
- Use parentheses for one-arity functions when using the pipe operator (|>).
-
- # not preferred
- some_string |> String.downcase |> String.trim
-
- # preferred
- some_string |> String.downcase() |> String.trim()
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- Credo.Code.prewalk(source_file, &traverse(&1, &2, IssueMeta.for(source_file, params)))
- end
-
- defp traverse({:|>, _, [_, {name, meta, nil}]} = ast, issues, issue_meta) when is_atom(name) do
- {ast, [issue(issue_meta, meta[:line]) | issues]}
- end
-
- defp traverse(ast, issues, _) do
- {ast, issues}
- end
-
- defp issue(meta, line) do
- format_issue(
- meta,
- message: "One arity functions should have parentheses in pipes",
- line_no: line
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_pipe_per_line.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_pipe_per_line.ex
deleted file mode 100644
index cc07ca42..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/one_pipe_per_line.ex
+++ /dev/null
@@ -1,61 +0,0 @@
-defmodule Credo.Check.Readability.OnePipePerLine do
- use Credo.Check,
- id: "EX3035",
- category: :readability,
- explanations: [
- check: """
- Don't use multiple pipes (|>) in the same line.
- Each function in the pipe should be in it's own line.
-
- # preferred
-
- foo
- |> bar()
- |> baz()
-
- # NOT preferred
-
- foo |> bar() |> baz()
-
- The code in this example ...
-
- 1 |> Integer.to_string() |> String.to_integer()
-
- ... should be refactored to look like this:
-
- 1
- |> Integer.to_string()
- |> String.to_integer()
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @impl Credo.Check
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.to_tokens(source_file)
- |> Enum.filter(&filter_pipes/1)
- |> Enum.group_by(fn {_, {line, _, _}, :|>} -> line end)
- |> Enum.filter(&filter_tokens/1)
- |> Enum.map(fn {_, [{_, {line_no, column_no, _}, _} | _]} ->
- format_issue(
- issue_meta,
- message: "Don't use multiple |> in the same line",
- line_no: line_no,
- column: column_no,
- trigger: "|>"
- )
- end)
- end
-
- defp filter_pipes({:arrow_op, _, :|>}), do: true
- defp filter_pipes(_), do: false
-
- defp filter_tokens({_, [_]}), do: false
- defp filter_tokens({_, [_ | _]}), do: true
- defp filter_tokens(_), do: false
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_in_condition.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_in_condition.ex
deleted file mode 100644
index 989702ca..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_in_condition.ex
+++ /dev/null
@@ -1,193 +0,0 @@
-defmodule Credo.Check.Readability.ParenthesesInCondition do
- use Credo.Check,
- id: "EX3013",
- base_priority: :high,
- tags: [:formatter],
- explanations: [
- check: """
- Because `if` and `unless` are macros, the preferred style is to not use
- parentheses around conditions.
-
- # preferred
-
- if valid?(username) do
- # ...
- end
-
- # NOT preferred
-
- if( valid?(username) ) do
- # ...
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- # TODO: consider for experimental check front-loader (tokens)
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- source_file
- |> Credo.Code.to_tokens()
- |> collect_parenthetical_tokens([], nil)
- |> find_issues([], issue_meta)
- end
-
- defp collect_parenthetical_tokens([], acc, _), do: acc
-
- defp collect_parenthetical_tokens([head | t], acc, prev_head) do
- acc =
- case check_for_opening_paren(head, t, prev_head) do
- false -> acc
- token -> acc ++ [token]
- end
-
- collect_parenthetical_tokens(t, acc, head)
- end
-
- defp check_for_opening_paren(
- {:identifier, _, if_or_unless} = start,
- [{:"(", _} = next_token | t],
- prev_head
- )
- when if_or_unless in [:if, :unless] do
- check_for_closing_paren(start, next_token, t, prev_head)
- end
-
- defp check_for_opening_paren(
- {:paren_identifier, _, if_or_unless},
- _,
- {:arrow_op, _, :|>}
- )
- when if_or_unless in [:if, :unless] do
- false
- end
-
- defp check_for_opening_paren(
- {:paren_identifier, _, if_or_unless} = token,
- [{:"(", _} | t],
- _
- )
- when if_or_unless in [:if, :unless] do
- if Enum.any?(collect_paren_children(t), &is_do/1) do
- false
- else
- token
- end
- end
-
- defp check_for_opening_paren(_, _, _), do: false
-
- # matches: if( something ) do
- # ^^^^
- defp check_for_closing_paren(start, {:do, _}, _tail, {:")", _}) do
- start
- end
-
- # matches: if( something ) == something_else do
- # ^^
- defp check_for_closing_paren(_start, {:")", _}, [{:comp_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( something ) or something_else do
- # ^^
- defp check_for_closing_paren(_start, {:")", _}, [{:or_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( something ) and something_else do
- # ^^^
- defp check_for_closing_paren(_start, {:")", _}, [{:and_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( something ) in something_else do
- # ^^
- defp check_for_closing_paren(_start, {:")", _}, [{:in_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( 1 + foo ) / bar > 0 do
- # ^
- defp check_for_closing_paren(_start, {:")", _}, [{:mult_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( 1 + foo ) + bar > 0 do
- # ^
- defp check_for_closing_paren(_start, {:")", _}, [{:dual_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( 1 &&& foo ) > bar do
- # ^
- defp check_for_closing_paren(_start, {:")", _}, [{:rel_op, _, _} | _tail], _prev_head) do
- false
- end
-
- # matches: if( something ), do:
- # ^^
- defp check_for_closing_paren(start, {:",", _}, _, {:")", _}) do
- start
- end
-
- defp check_for_closing_paren(_, {:or_op, _, _}, [{:"(", _} | _], _) do
- false
- end
-
- defp check_for_closing_paren(_, {:and_op, _, _}, [{:"(", _} | _], _) do
- false
- end
-
- defp check_for_closing_paren(_, {:comp_op, _, _}, [{:"(", _} | _], _) do
- false
- end
-
- defp check_for_closing_paren(start, token, [next_token | t], _prev_head) do
- check_for_closing_paren(start, next_token, t, token)
- end
-
- defp check_for_closing_paren(_, _, _, _), do: false
-
- defp is_do({_, _, :do}), do: true
- defp is_do(_), do: false
-
- defp collect_paren_children(x) do
- {_, children} = Enum.reduce(x, {0, []}, &collect_paren_child/2)
- children
- end
-
- defp collect_paren_child({:"(", _}, {nest_level, tokens}), do: {nest_level + 1, tokens}
-
- defp collect_paren_child({:")", _}, {nest_level, tokens}), do: {nest_level - 1, tokens}
-
- defp collect_paren_child(token, {0, tokens}), do: {0, tokens ++ [token]}
- defp collect_paren_child(_, {_, _} = state), do: state
-
- defp find_issues([], acc, _issue_meta) do
- acc
- end
-
- defp find_issues([{_, {line_no, _, _}, trigger} | t], acc, issue_meta) do
- new_issue = issue_for(issue_meta, line_no, trigger)
-
- acc = acc ++ [new_issue]
-
- find_issues(t, acc, issue_meta)
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "The condition of `#{trigger}` should not be wrapped in parentheses.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_on_zero_arity_defs.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_on_zero_arity_defs.ex
deleted file mode 100644
index 43894a09..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/parentheses_on_zero_arity_defs.ex
+++ /dev/null
@@ -1,108 +0,0 @@
-defmodule Credo.Check.Readability.ParenthesesOnZeroArityDefs do
- use Credo.Check,
- id: "EX3014",
- base_priority: :low,
- param_defaults: [parens: false],
- explanations: [
- check: """
- Either use parentheses or not when defining a function with no arguments.
-
- By default, this check enforces no parentheses, so zero-arity function
- and macro definitions should look like this:
-
- def summer? do
- # ...
- end
-
- If the `:parens` param is set to `true` for this check, then the check
- enforces zero-arity function and macro definitions to have parens:
-
- def summer?() do
- # ...
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Check.Params
-
- @def_ops [:def, :defp, :defmacro, :defmacrop]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- parens? = Params.get(params, :parens, __MODULE__)
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta, parens?))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- # catch variables named e.g. `defp`
- defp traverse({unquote(op), _, nil} = ast, issues, _issue_meta, _parens?) do
- {ast, issues}
- end
-
- defp traverse({unquote(op), _, body} = ast, issues, issue_meta, parens?) do
- function_head = Enum.at(body, 0)
-
- {ast, issues_for_definition(function_head, issues, issue_meta, parens?)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _parens?) do
- {ast, issues}
- end
-
- # skip the false positive for a metaprogrammed definition
- defp issues_for_definition({{:unquote, _, _}, _, _}, issues, _, _parens?) do
- issues
- end
-
- defp issues_for_definition({_, _, args}, issues, _, _parens?) when length(args) > 0 do
- issues
- end
-
- defp issues_for_definition({name, meta, _}, issues, issue_meta, enforce_parens?) do
- line_no = meta[:line]
- text = remaining_line_after(issue_meta, line_no, name)
- parens? = String.match?(text, ~r/^\((\w*)\)(.)*/)
-
- cond do
- parens? and not enforce_parens? ->
- issues ++ [issue_for(issue_meta, line_no, :present)]
-
- not parens? and enforce_parens? ->
- issues ++ [issue_for(issue_meta, line_no, :missing)]
-
- true ->
- issues
- end
- end
-
- defp remaining_line_after(issue_meta, line_no, text) do
- source_file = IssueMeta.source_file(issue_meta)
- line = SourceFile.line_at(source_file, line_no)
- name_size = text |> to_string |> String.length()
- skip = (SourceFile.column(source_file, line_no, text) || -1) + name_size - 1
-
- String.slice(line, skip..-1)
- end
-
- defp issue_for(issue_meta, line_no, kind) do
- message =
- case kind do
- :present ->
- "Do not use parentheses when defining a function which has no arguments."
-
- :missing ->
- "Use parentheses () when defining a function which has no arguments."
- end
-
- format_issue(issue_meta, message: message, line_no: line_no)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/pipe_into_anonymous_functions.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/pipe_into_anonymous_functions.ex
deleted file mode 100644
index fc92c981..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/pipe_into_anonymous_functions.ex
+++ /dev/null
@@ -1,60 +0,0 @@
-defmodule Credo.Check.Readability.PipeIntoAnonymousFunctions do
- use Credo.Check,
- id: "EX3015",
- base_priority: :low,
- explanations: [
- check: """
- Avoid piping into anonymous functions.
-
- The code in this example ...
-
- def my_fun(foo) do
- foo
- |> (fn i -> i * 2 end).()
- |> my_other_fun()
- end
-
- ... should be refactored to define a private function:
-
- def my_fun(foo) do
- foo
- |> times_2()
- |> my_other_fun()
- end
-
- defp timex_2(i), do: i * 2
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @impl true
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {:|>, meta, [_, {{:., _, [{:fn, _, _} | _]}, _, _}]} = ast,
- issues,
- issue_meta
- ) do
- {ast, [issue_for(issue_meta, meta[:line]) | issues]}
- end
-
- defp traverse(ast, issues, _) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Avoid piping into anonymous function calls",
- trigger: "|>",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/predicate_function_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/predicate_function_names.ex
deleted file mode 100644
index d83f0ca1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/predicate_function_names.ex
+++ /dev/null
@@ -1,116 +0,0 @@
-defmodule Credo.Check.Readability.PredicateFunctionNames do
- use Credo.Check,
- id: "EX3016",
- base_priority: :high,
- explanations: [
- check: """
- Predicate functions/macros should be named accordingly:
-
- * For functions, they should end in a question mark.
-
- # preferred
-
- defp user?(cookie) do
- end
-
- defp has_attachment?(mail) do
- end
-
- # NOT preferred
-
- defp is_user?(cookie) do
- end
-
- defp is_user(cookie) do
- end
-
- * For guard-safe macros they should have the prefix `is_` and not end in a question mark.
-
- # preferred
-
- defmacro is_user(cookie) do
- end
-
- # NOT preferred
-
- defmacro is_user?(cookie) do
- end
-
- defmacro user?(cookie) do
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see below for how we want to avoid `defp = "my_variable"` definitions
- for op <- @def_ops do
- # catch variables named e.g. `defp`
- defp traverse({unquote(op), _meta, nil} = ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp traverse(
- {unquote(op) = op, _meta, arguments} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_definition(op, arguments, issues, issue_meta)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_definition(op, body, issues, issue_meta) do
- case Enum.at(body, 0) do
- {name, meta, nil} ->
- issues_for_name(op, name, meta, issues, issue_meta)
-
- _ ->
- issues
- end
- end
-
- defp issues_for_name(_op, name, meta, issues, issue_meta) do
- name = to_string(name)
-
- cond do
- String.starts_with?(name, "is_") && String.ends_with?(name, "?") ->
- [
- issue_for(issue_meta, meta[:line], name, :predicate_and_question_mark)
- | issues
- ]
-
- String.starts_with?(name, "is_") ->
- [issue_for(issue_meta, meta[:line], name, :only_predicate) | issues]
-
- true ->
- issues
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger, _) do
- format_issue(
- issue_meta,
- message:
- "Predicate function names should not start with 'is', and should end in a question mark.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_implicit_try.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_implicit_try.ex
deleted file mode 100644
index af12d0af..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_implicit_try.ex
+++ /dev/null
@@ -1,68 +0,0 @@
-defmodule Credo.Check.Readability.PreferImplicitTry do
- use Credo.Check,
- id: "EX3017",
- base_priority: :low,
- explanations: [
- check: """
- Prefer using an implicit `try` rather than explicit `try` if you try to rescue
- anything the function does.
-
- For example, this:
-
- def failing_function(first) do
- try do
- to_string(first)
- rescue
- _ -> :rescued
- end
- end
-
- Can be rewritten without `try` as below:
-
- def failing_function(first) do
- to_string(first)
- rescue
- _ -> :rescued
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- The code will behave identical in both ways.
- """
- ]
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- defp traverse(
- {unquote(op), _, [{_, _, _}, [do: {:try, meta, _}]]} = ast,
- issues,
- issue_meta
- ) do
- line_no = meta[:line]
-
- {ast, issues ++ [issue_for(issue_meta, line_no)]}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Prefer using an implicit `try` rather than explicit `try`.",
- trigger: "try",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_unquoted_atoms.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_unquoted_atoms.ex
deleted file mode 100644
index 2cffaba2..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/prefer_unquoted_atoms.ex
+++ /dev/null
@@ -1,119 +0,0 @@
-defmodule Credo.Check.Readability.PreferUnquotedAtoms do
- use Credo.Check,
- id: "EX3018",
- run_on_all: true,
- base_priority: :high,
- elixir_version: "< 1.7.0-dev",
- explanations: [
- check: """
- Prefer unquoted atoms unless quotes are necessary.
- This is helpful because a quoted atom can be easily mistaken for a string.
-
- # preferred
-
- :x
- [x: 1]
- %{x: 1}
-
- # NOT preferred
-
- :"x"
- ["x": 1]
- %{"x": 1}
-
- The primary case where this can become an issue is when using atoms or
- strings for keys in a Map or Keyword list.
-
- For example, this:
-
- %{"x": 1}
-
- Can easily be mistaken for this:
-
- %{"x" => 1}
-
- Because a string key cannot be used to access a value with the equivalent
- atom key, this can lead to subtle bugs which are hard to discover.
-
- Like all `Readability` issues, this one is not a technical concern.
- The code will behave identical in both ways.
- """
- ]
-
- @token_types [:atom_unsafe, :kw_identifier_unsafe]
-
- @doc false
- @impl true
- # TODO: consider for experimental check front-loader (tokens)
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- source_file
- |> Credo.Code.to_tokens()
- |> Enum.reduce([], &find_issues(&1, &2, issue_meta))
- |> Enum.reverse()
- end
-
- for type <- @token_types do
- defp find_issues(
- {unquote(type), {line_no, column, _}, token},
- issues,
- issue_meta
- ) do
- case safe_atom_name(token) do
- nil ->
- issues
-
- atom ->
- [issue_for(issue_meta, atom, line_no, column) | issues]
- end
- end
- end
-
- defp find_issues(_token, issues, _issue_meta) do
- issues
- end
-
- # "safe atom" here refers to a quoted atom not containing an interpolation
- defp safe_atom_name(token) when is_list(token) do
- if Enum.all?(token, &is_binary/1) do
- token
- |> Enum.join()
- |> safe_atom_name()
- end
- end
-
- defp safe_atom_name(token) when is_binary(token) do
- ':#{token}'
- |> :elixir_tokenizer.tokenize(1, [])
- |> safe_atom_name(token)
- end
-
- defp safe_atom_name(_), do: nil
-
- # Elixir >= 1.6.0
- defp safe_atom_name({:ok, [{:atom, {_, _, _}, atom} | _]}, token) do
- if token == Atom.to_string(atom) do
- atom
- end
- end
-
- # Elixir <= 1.5.x
- defp safe_atom_name({:ok, _, _, [{:atom, _, atom} | _]}, token) do
- if token == Atom.to_string(atom) do
- atom
- end
- end
-
- defp issue_for(issue_meta, atom, line_no, column) do
- trigger = ~s[:"#{atom}"]
-
- format_issue(
- issue_meta,
- message: "Use unquoted atom `#{inspect(atom)}` rather than quoted atom `#{trigger}`.",
- trigger: trigger,
- line_no: line_no,
- column: column
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/redundant_blank_lines.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/redundant_blank_lines.ex
deleted file mode 100644
index 45d5a72c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/redundant_blank_lines.ex
+++ /dev/null
@@ -1,86 +0,0 @@
-defmodule Credo.Check.Readability.RedundantBlankLines do
- use Credo.Check,
- id: "EX3019",
- base_priority: :low,
- tags: [:formatter],
- param_defaults: [max_blank_lines: 1],
- explanations: [
- check: """
- Files should not have two or more consecutive blank lines.
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- max_blank_lines: "The maximum number of tolerated consecutive blank lines."
- ]
- ]
-
- alias Credo.Code.Charlists
- alias Credo.Code.Heredocs
- alias Credo.Code.Sigils
- alias Credo.Code.Strings
-
- @doc false
- # TODO: consider for experimental check front-loader (text)
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- max_blank_lines = Params.get(params, :max_blank_lines, __MODULE__)
-
- source_file
- |> Charlists.replace_with_spaces("=")
- |> Sigils.replace_with_spaces("=", "=", source_file.filename)
- |> Strings.replace_with_spaces("=", "=", source_file.filename)
- |> Heredocs.replace_with_spaces("=", "=", "=", source_file.filename)
- |> Credo.Code.to_lines()
- |> blank_lines()
- |> consecutive_lines(max_blank_lines)
- |> Enum.map(fn line -> issue_for(issue_meta, line, max_blank_lines) end)
- end
-
- defp issue_for(issue_meta, line, max_blank_lines) do
- format_issue(
- issue_meta,
- message: "There should be no more than #{max_blank_lines} consecutive blank lines.",
- line_no: line
- )
- end
-
- defp blank_lines(lines) do
- lines
- |> Enum.filter(fn {_, content} -> content == "" end)
- |> Enum.map(fn {pos, _} -> pos end)
- end
-
- defp consecutive_lines([], _), do: []
-
- defp consecutive_lines([first_line | other_lines], max_blank_lines) do
- reducer = consecutive_lines_reducer(max_blank_lines)
-
- other_lines
- |> Enum.reduce({first_line, 0, []}, reducer)
- |> elem(2)
- end
-
- defp consecutive_lines_reducer(max_blank_lines) do
- fn line, {last, consecutive, lines} ->
- consecutive =
- if last && line == last + 1 do
- consecutive + 1
- else
- 0
- end
-
- lines =
- if consecutive >= max_blank_lines do
- lines ++ [line]
- else
- lines
- end
-
- {line, consecutive, lines}
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/semicolons.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/semicolons.ex
deleted file mode 100644
index 23589b47..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/semicolons.ex
+++ /dev/null
@@ -1,55 +0,0 @@
-defmodule Credo.Check.Readability.Semicolons do
- use Credo.Check,
- id: "EX3020",
- base_priority: :high,
- tags: [:formatter],
- explanations: [
- check: """
- Don't use ; to separate statements and expressions.
- Statements and expressions should be separated by lines.
-
- # preferred
-
- a = 1
- b = 2
-
- # NOT preferred
-
- a = 1; b = 2
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- # TODO: consider for experimental check front-loader (tokens)
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- source_file
- |> Credo.Code.to_tokens()
- |> collect_issues([], issue_meta)
- end
-
- defp collect_issues([], acc, _issue_meta), do: acc
-
- defp collect_issues([{:";", {line_no, column1, _}} | rest], acc, issue_meta) do
- acc = [issue_for(issue_meta, line_no, column1) | acc]
- collect_issues(rest, acc, issue_meta)
- end
-
- defp collect_issues([_ | rest], acc, issue_meta), do: collect_issues(rest, acc, issue_meta)
-
- defp issue_for(issue_meta, line_no, column) do
- format_issue(
- issue_meta,
- message: "Don't use ; to separate statements and expressions",
- line_no: line_no,
- column: column,
- trigger: ";"
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/separate_alias_require.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/separate_alias_require.ex
deleted file mode 100644
index 10d0f50f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/separate_alias_require.ex
+++ /dev/null
@@ -1,85 +0,0 @@
-defmodule Credo.Check.Readability.SeparateAliasRequire do
- use Credo.Check,
- id: "EX3021",
- base_priority: :low,
- explanations: [
- check: """
- All instances of `alias` should be consecutive within a file.
- Likewise, all instances of `require` should be consecutive within a file.
-
- For example:
-
- defmodule Foo do
- require Logger
- alias Foo.Bar
-
- alias Foo.Baz
- require Integer
-
- # ...
- end
-
- should be changed to:
-
- defmodule Foo do
- require Integer
- require Logger
-
- alias Foo.Bar
- alias Foo.Baz
-
- # ...
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Code.Block
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:defmodule, _, _} = ast, issues, issue_meta) do
- {_previous_calls, issues} =
- ast
- |> Block.calls_in_do_block()
- |> Enum.reduce({[], issues}, fn
- {macro_name, meta, args}, {previous_calls, issues}
- when is_atom(macro_name) and is_list(args) ->
- cond do
- List.last(previous_calls) == macro_name ->
- {previous_calls, issues}
-
- macro_name in [:alias, :require] and Enum.member?(previous_calls, macro_name) ->
- {previous_calls, issues ++ [issue_for(issue_meta, meta[:line], macro_name)]}
-
- true ->
- {previous_calls ++ [macro_name], issues}
- end
-
- _, memo ->
- memo
- end)
-
- {ast, issues}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, type) do
- format_issue(issue_meta, message: message(type), line_no: line_no)
- end
-
- def message(:alias), do: "aliases should be consecutive within a file"
- def message(:require), do: "requires should be consecutive within a file"
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_function_to_block_pipe.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_function_to_block_pipe.ex
deleted file mode 100644
index cfbb7d96..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_function_to_block_pipe.ex
+++ /dev/null
@@ -1,80 +0,0 @@
-defmodule Credo.Check.Readability.SingleFunctionToBlockPipe do
- use Credo.Check,
- id: "EX3022",
- tags: [:controversial],
- explanations: [
- check: """
- A single pipe (`|>`) should not be used to pipe into blocks.
-
- The code in this example ...
-
- list
- |> length()
- |> case do
- 0 -> :none
- 1 -> :one
- _ -> :many
- end
-
- ... should be refactored to look like this:
-
- case length(list) do
- 0 -> :none
- 1 -> :one
- _ -> :many
- end
-
- If you want to disallow piping into blocks all together, use
- `Credo.Check.Readability.BlockPipe`.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- Credo.Code.prewalk(source_file, &traverse(&1, &2, IssueMeta.for(source_file, params)))
- end
-
- defp traverse(ast, {false, issues}, _issue_meta) do
- {ast, issues}
- end
-
- defp traverse(ast, issues, issue_meta) do
- case issue(ast, issue_meta) do
- nil -> {ast, issues}
- false -> {ast, {false, issues}}
- issue -> {ast, [issue | issues]}
- end
- end
-
- defp issue({:|>, _, [{:|>, _, [{:|>, _, _} | _]} | _]}, _), do: false
-
- defp issue({:|>, meta, [arg, {marker, _case_meta, _case_args}]}, issue_meta)
- when marker in [:case, :if] do
- if issue?(arg), do: issue_for(issue_meta, meta[:line]), else: nil
- end
-
- defp issue(_, _), do: nil
-
- defp issue?({_, _, nil}), do: true
-
- defp issue?({:%{}, _, _}), do: true
-
- defp issue?(arg) when is_list(arg), do: true
-
- defp issue?({:|>, _, [{_, _, nil}, {_, _, args}]}) when is_list(args), do: true
-
- defp issue?({:|>, _, [{:%{}, _, _}, {_, _, args}]}) when is_list(args), do: true
-
- defp issue?({:|>, _, [arg, {_, _, args}]}) when is_list(arg) and is_list(args), do: true
-
- defp issue?(_), do: false
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Avoid single pipes to a block",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_pipe.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_pipe.ex
deleted file mode 100644
index ac407575..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/single_pipe.ex
+++ /dev/null
@@ -1,94 +0,0 @@
-defmodule Credo.Check.Readability.SinglePipe do
- use Credo.Check,
- id: "EX3023",
- base_priority: :high,
- tags: [:controversial],
- param_defaults: [allow_0_arity_functions: false],
- explanations: [
- check: """
- Pipes (`|>`) should only be used when piping data through multiple calls.
-
- So while this is fine:
-
- list
- |> Enum.take(5)
- |> Enum.shuffle
- |> evaluate()
-
- The code in this example ...
-
- list
- |> evaluate()
-
- ... should be refactored to look like this:
-
- evaluate(list)
-
- Using a single |> to invoke functions makes the code harder to read. Instead,
- write a function call when a pipeline is only one function long.
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- allow_0_arity_functions: "Allow 0-arity functions"
- ]
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- allow_0_arity_functions = Params.get(params, :allow_0_arity_functions, __MODULE__)
-
- {_continue, issues} =
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, allow_0_arity_functions),
- {true, []}
- )
-
- issues
- end
-
- defp traverse({:|>, _, [{:|>, _, _} | _]} = ast, {_, issues}, _, _) do
- {ast, {false, issues}}
- end
-
- defp traverse({:|>, meta, _} = ast, {true, issues}, issue_meta, false) do
- {
- ast,
- {false, issues ++ [issue_for(issue_meta, meta[:line], "|>")]}
- }
- end
-
- defp traverse({:|>, _, [{{:., _, _}, _, []}, _]} = ast, {true, issues}, _, true) do
- {ast, {false, issues}}
- end
-
- defp traverse({:|>, _, [{fun, _, []}, _]} = ast, {true, issues}, _, true) when is_atom(fun) do
- {ast, {false, issues}}
- end
-
- defp traverse({:|>, meta, _} = ast, {true, issues}, issue_meta, true) do
- {
- ast,
- {false, issues ++ [issue_for(issue_meta, meta[:line], "|>")]}
- }
- end
-
- defp traverse(ast, {_, issues}, _issue_meta, _allow_functions) do
- {ast, {true, issues}}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Use a function call when a pipeline is only one function long",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/space_after_commas.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/space_after_commas.ex
deleted file mode 100644
index b0e6860b..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/space_after_commas.ex
+++ /dev/null
@@ -1,78 +0,0 @@
-defmodule Credo.Check.Readability.SpaceAfterCommas do
- use Credo.Check,
- id: "EX3024",
- tags: [:formatter],
- explanations: [
- check: """
- You can use white-space after commas to make items of lists,
- tuples and other enumerations easier to separate from one another.
-
- # preferred
-
- alias Project.{Alpha, Beta}
-
- def some_func(first, second, third) do
- list = [1, 2, 3, 4, 5]
- # ...
- end
-
- # NOT preferred - items are harder to separate
-
- alias Project.{Alpha,Beta}
-
- def some_func(first,second,third) do
- list = [1,2,3,4,5]
- # ...
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Code.Charlists
- alias Credo.Code.Heredocs
- alias Credo.Code.Sigils
- alias Credo.Code.Strings
-
- # Matches commas followed by non-whitespace unless preceded by
- # a question mark that is not part of a variable or function name
- @unspaced_commas ~r/(? Sigils.replace_with_spaces(" ", " ", source_file.filename)
- |> Strings.replace_with_spaces(" ", " ", source_file.filename)
- |> Heredocs.replace_with_spaces(" ", " ", "", source_file.filename)
- |> Charlists.replace_with_spaces(" ", " ", source_file.filename)
- |> String.replace(~r/(\A|[^\?])#.+/, "\\1")
- |> Credo.Code.to_lines()
- |> Enum.flat_map(&find_issues(issue_meta, &1))
- end
-
- defp issue_for(issue_meta, trigger, line_no, column) do
- format_issue(
- issue_meta,
- message: "Space missing after comma",
- trigger: trigger,
- line_no: line_no,
- column: column
- )
- end
-
- defp find_issues(issue_meta, {line_no, line}) do
- @unspaced_commas
- |> Regex.scan(line, capture: :all_but_first, return: :index)
- |> List.flatten()
- |> Enum.map(fn {idx, len} ->
- trigger = String.slice(line, idx, len)
- issue_for(issue_meta, trigger, line_no, idx + 1)
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/specs.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/specs.ex
deleted file mode 100644
index 5ec35823..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/specs.ex
+++ /dev/null
@@ -1,131 +0,0 @@
-defmodule Credo.Check.Readability.Specs do
- use Credo.Check,
- id: "EX3025",
- tags: [:controversial],
- param_defaults: [
- include_defp: false
- ],
- explanations: [
- check: """
- Functions, callbacks and macros need typespecs.
-
- Adding typespecs gives tools like Dialyzer more information when performing
- checks for type errors in function calls and definitions.
-
- @spec add(integer, integer) :: integer
- def add(a, b), do: a + b
-
- Functions with multiple arities need to have a spec defined for each arity:
-
- @spec foo(integer) :: boolean
- @spec foo(integer, integer) :: boolean
- def foo(a), do: a > 0
- def foo(a, b), do: a > b
-
- The check only considers whether the specification is present, it doesn't
- perform any actual type checking.
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- include_defp: "Include private functions."
- ]
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- specs = Credo.Code.prewalk(source_file, &find_specs(&1, &2))
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, specs, issue_meta))
- end
-
- defp find_specs(
- {:spec, _, [{:when, _, [{:"::", _, [{name, _, args}, _]}, _]} | _]} = ast,
- specs
- ) do
- {ast, [{name, length(args)} | specs]}
- end
-
- defp find_specs({:spec, _, [{_, _, [{name, _, args} | _]}]} = ast, specs)
- when is_list(args) or is_nil(args) do
- args = with nil <- args, do: []
- {ast, [{name, length(args)} | specs]}
- end
-
- defp find_specs({:impl, _, [impl]} = ast, specs) when impl != false do
- {ast, [:impl | specs]}
- end
-
- defp find_specs({keyword, meta, [{:when, _, def_ast} | _]}, [:impl | specs])
- when keyword in [:def, :defp] do
- find_specs({keyword, meta, def_ast}, [:impl | specs])
- end
-
- defp find_specs({keyword, _, [{name, _, nil}, _]} = ast, [:impl | specs])
- when keyword in [:def, :defp] do
- {ast, [{name, 0} | specs]}
- end
-
- defp find_specs({keyword, _, [{name, _, args}, _]} = ast, [:impl | specs])
- when keyword in [:def, :defp] do
- {ast, [{name, length(args)} | specs]}
- end
-
- defp find_specs(ast, issues) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse(
- {keyword, meta, [{:when, _, def_ast} | _]},
- issues,
- specs,
- issue_meta
- )
- when keyword in [:def, :defp] do
- traverse({keyword, meta, def_ast}, issues, specs, issue_meta)
- end
-
- defp traverse(
- {keyword, meta, [{name, _, args} | _]} = ast,
- issues,
- specs,
- issue_meta
- )
- when is_list(args) or is_nil(args) do
- args = with nil <- args, do: []
-
- if keyword not in enabled_keywords(issue_meta) or {name, length(args)} in specs do
- {ast, issues}
- else
- {ast, [issue_for(issue_meta, meta[:line], name) | issues]}
- end
- end
-
- defp traverse(ast, issues, _specs, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Functions should have a @spec type specification.",
- trigger: trigger,
- line_no: line_no
- )
- end
-
- defp enabled_keywords(issue_meta) do
- issue_meta
- |> IssueMeta.params()
- |> Params.get(:include_defp, __MODULE__)
- |> case do
- true -> [:def, :defp]
- _ -> [:def]
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/strict_module_layout.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/strict_module_layout.ex
deleted file mode 100644
index c99d0505..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/strict_module_layout.ex
+++ /dev/null
@@ -1,188 +0,0 @@
-defmodule Credo.Check.Readability.StrictModuleLayout do
- use Credo.Check,
- id: "EX3026",
- base_priority: :low,
- tags: [:controversial],
- explanations: [
- check: """
- Provide module parts in a required order.
-
- # preferred
-
- defmodule MyMod do
- @moduledoc "moduledoc"
- use Foo
- import Bar
- alias Baz
- require Qux
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- order: """
- List of atoms identifying the desired order of module parts.
-
- Supported values are:
-
- - `:moduledoc` - `@moduledoc` module attribute
- - `:shortdoc` - `@shortdoc` module attribute
- - `:behaviour` - `@behaviour` module attribute
- - `:use` - `use` expression
- - `:import` - `import` expression
- - `:alias` - `alias` expression
- - `:require` - `require` expression
- - `:defstruct` - `defstruct` expression
- - `:opaque` - `@opaque` module attribute
- - `:type` - `@type` module attribute
- - `:typep` - `@typep` module attribute
- - `:callback` - `@callback` module attribute
- - `:macrocallback` - `@macrocallback` module attribute
- - `:optional_callbacks` - `@optional_callbacks` module attribute
- - `:module_attribute` - other module attribute
- - `:public_fun` - public function
- - `:private_fun` - private function or a public function marked with `@doc false`
- - `:public_macro` - public macro
- - `:private_macro` - private macro or a public macro marked with `@doc false`
- - `:callback_impl` - public function or macro marked with `@impl`
- - `:public_guard` - public guard
- - `:private_guard` - private guard or a public guard marked with `@doc false`
- - `:module` - inner module definition (`defmodule` expression inside a module)
-
- Notice that the desired order always starts from the top.
-
- For example, if you provide the order `~w/public_fun private_fun/a`,
- it means that everything else (e.g. `@moduledoc`) must appear after
- function definitions.
- """,
- ignore: """
- List of atoms identifying the module parts which are not checked, and may
- therefore appear anywhere in the module. Supported values are the same as
- in the `:order` param.
- """
- ]
- ],
- param_defaults: [
- order: ~w/shortdoc moduledoc behaviour use import alias require/a,
- ignore: []
- ]
-
- alias Credo.CLI.Output.UI
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- params = normalize_params(params)
-
- source_file
- |> Credo.Code.ast()
- |> Credo.Code.Module.analyze()
- |> all_errors(params, IssueMeta.for(source_file, params))
- |> Enum.sort_by(&{&1.line_no, &1.column})
- end
-
- defp normalize_params(params) do
- order =
- params
- |> Params.get(:order, __MODULE__)
- |> Enum.map(fn element ->
- # TODO: This is done for backward compatibility and should be removed in some future version.
- with :callback_fun <- element do
- UI.warn([
- :red,
- "** (StrictModuleLayout) Check param `:callback_fun` has been deprecated. Use `:callback_impl` instead.\n\n",
- " Use `mix credo explain #{Credo.Code.Module.name(__MODULE__)}` to learn more. \n"
- ])
-
- :callback_impl
- end
- end)
-
- Keyword.put(params, :order, order)
- end
-
- defp all_errors(modules_and_parts, params, issue_meta) do
- expected_order = expected_order(params)
- ignored_parts = Keyword.get(params, :ignore, [])
-
- Enum.reduce(
- modules_and_parts,
- [],
- fn {module, parts}, errors ->
- parts =
- parts
- |> Stream.map(fn
- # Converting `callback_macro` and `callback_fun` into a common `callback_impl`,
- # because enforcing an internal order between these two kinds is counterproductive if
- # a module implements multiple behaviours. In such cases, we typically want to group
- # callbacks by the implementation, not by the kind (fun vs macro).
- {callback_impl, location} when callback_impl in ~w/callback_macro callback_fun/a ->
- {:callback_impl, location}
-
- other ->
- other
- end)
- |> Stream.reject(fn {part, _location} -> part in ignored_parts end)
-
- module_errors(module, parts, expected_order, issue_meta) ++ errors
- end
- )
- end
-
- defp expected_order(params) do
- params
- |> Keyword.fetch!(:order)
- |> Enum.with_index()
- |> Map.new()
- end
-
- defp module_errors(module, parts, expected_order, issue_meta) do
- Enum.reduce(
- parts,
- %{module: module, current_part: nil, errors: []},
- &check_part_location(&2, &1, expected_order, issue_meta)
- ).errors
- end
-
- defp check_part_location(state, {part, file_pos}, expected_order, issue_meta) do
- state
- |> validate_order(part, file_pos, expected_order, issue_meta)
- |> Map.put(:current_part, part)
- end
-
- defp validate_order(state, part, file_pos, expected_order, issue_meta) do
- if is_nil(state.current_part) or
- order(state.current_part, expected_order) <= order(part, expected_order),
- do: state,
- else: add_error(state, part, file_pos, issue_meta)
- end
-
- defp order(part, expected_order), do: Map.get(expected_order, part, map_size(expected_order))
-
- defp add_error(state, part, file_pos, issue_meta) do
- update_in(
- state.errors,
- &[error(issue_meta, part, state.current_part, state.module, file_pos) | &1]
- )
- end
-
- defp error(issue_meta, part, current_part, module, file_pos) do
- format_issue(
- issue_meta,
- message: "#{part_to_string(part)} must appear before #{part_to_string(current_part)}",
- trigger: inspect(module),
- line_no: Keyword.get(file_pos, :line),
- column: Keyword.get(file_pos, :column)
- )
- end
-
- defp part_to_string(:module_attribute), do: "module attribute"
- defp part_to_string(:public_guard), do: "public guard"
- defp part_to_string(:public_macro), do: "public macro"
- defp part_to_string(:public_fun), do: "public function"
- defp part_to_string(:private_fun), do: "private function"
- defp part_to_string(:callback_impl), do: "callback implementation"
- defp part_to_string(part), do: "#{part}"
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/string_sigils.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/string_sigils.ex
deleted file mode 100644
index 8c6bddb3..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/string_sigils.ex
+++ /dev/null
@@ -1,154 +0,0 @@
-defmodule Credo.Check.Readability.StringSigils do
- alias Credo.Code.Heredocs
- alias Credo.SourceFile
-
- use Credo.Check,
- id: "EX3027",
- base_priority: :low,
- param_defaults: [
- maximum_allowed_quotes: 3
- ],
- explanations: [
- check: ~S"""
- If you used quoted strings that contain quotes, you might want to consider
- switching to the use of sigils instead.
-
- # okay
-
- "#\{text}"
-
- # not okay, lots of escaped quotes
-
- "#\{text}"
-
- # refactor to
-
- ~S(#\{text})
-
- This allows us to remove the noise which results from the need to escape
- quotes within quotes.
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """,
- params: [
- maximum_allowed_quotes: "The maximum amount of escaped quotes you want to tolerate."
- ]
- ]
-
- @quote_codepoint 34
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- maximum_allowed_quotes = Params.get(params, :maximum_allowed_quotes, __MODULE__)
-
- case remove_heredocs_and_convert_to_ast(source_file) do
- {:ok, ast} ->
- Credo.Code.prewalk(ast, &traverse(&1, &2, issue_meta, maximum_allowed_quotes))
-
- {:error, errors} ->
- IO.warn("Unexpected error while parsing #{source_file.filename}: #{inspect(errors)}")
- []
- end
- end
-
- defp remove_heredocs_and_convert_to_ast(source_file) do
- source_file
- |> Heredocs.replace_with_spaces()
- |> Credo.Code.ast()
- end
-
- defp traverse(
- {maybe_sigil, meta, [str | rest_ast]} = ast,
- issues,
- issue_meta,
- maximum_allowed_quotes
- ) do
- line_no = meta[:line]
-
- cond do
- is_sigil(maybe_sigil) ->
- {rest_ast, issues}
-
- is_binary(str) ->
- {
- rest_ast,
- issues_for_string_literal(
- str,
- maximum_allowed_quotes,
- issues,
- issue_meta,
- line_no
- )
- }
-
- true ->
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _maximum_allowed_quotes) do
- {ast, issues}
- end
-
- defp is_sigil(maybe_sigil) when is_atom(maybe_sigil) do
- maybe_sigil
- |> Atom.to_string()
- |> String.starts_with?("sigil_")
- end
-
- defp is_sigil(_), do: false
-
- defp issues_for_string_literal(
- string,
- maximum_allowed_quotes,
- issues,
- issue_meta,
- line_no
- ) do
- if too_many_quotes?(string, maximum_allowed_quotes) do
- [issue_for(issue_meta, line_no, string, maximum_allowed_quotes) | issues]
- else
- issues
- end
- end
-
- defp too_many_quotes?(string, limit) do
- too_many_quotes?(string, 0, limit)
- end
-
- defp too_many_quotes?(_string, count, limit) when count > limit do
- true
- end
-
- defp too_many_quotes?(<<>>, _count, _limit) do
- false
- end
-
- defp too_many_quotes?(<>, count, limit)
- when c == @quote_codepoint do
- too_many_quotes?(rest, count + 1, limit)
- end
-
- defp too_many_quotes?(<<_::utf8, rest::binary>>, count, limit) do
- too_many_quotes?(rest, count, limit)
- end
-
- defp too_many_quotes?(<<_::binary>>, _count, _limit) do
- false
- end
-
- defp issue_for(issue_meta, line_no, trigger, maximum_allowed_quotes) do
- format_issue(
- issue_meta,
- message:
- "More than #{maximum_allowed_quotes} quotes found inside string literal, consider using a sigil instead.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_blank_line.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_blank_line.ex
deleted file mode 100644
index f5b2772d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_blank_line.ex
+++ /dev/null
@@ -1,43 +0,0 @@
-defmodule Credo.Check.Readability.TrailingBlankLine do
- use Credo.Check,
- id: "EX3028",
- base_priority: :low,
- tags: [:formatter],
- explanations: [
- check: """
- Files should end in a trailing blank line.
-
- This is mostly for historical reasons: every text file should end with a \\n,
- or newline since this acts as `eol` or the end of the line character.
-
- See also: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
-
- Most text editors ensure this "final newline" automatically.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- {line_no, last_line} =
- source_file
- |> SourceFile.lines()
- |> List.last()
-
- if String.trim(last_line) == "" do
- []
- else
- [issue_for(issue_meta, line_no)]
- end
- end
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "There should be a final \\n at the end of each file.",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_white_space.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_white_space.ex
deleted file mode 100644
index 1265f15a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/trailing_white_space.ex
+++ /dev/null
@@ -1,69 +0,0 @@
-defmodule Credo.Check.Readability.TrailingWhiteSpace do
- use Credo.Check,
- id: "EX3029",
- base_priority: :low,
- tags: [:formatter],
- param_defaults: [
- ignore_strings: true
- ],
- explanations: [
- check: """
- There should be no white-space (i.e. tabs, spaces) at the end of a line.
-
- Most text editors provide a way to remove them automatically.
- """,
- params: [
- ignore_strings: "Set to `false` to check lines that are strings or in heredocs"
- ]
- ]
-
- alias Credo.Code.Heredocs
- alias Credo.Code.Strings
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- ignore_strings = Params.get(params, :ignore_strings, __MODULE__)
-
- source_file
- |> to_lines(ignore_strings)
- |> traverse_line([], issue_meta)
- end
-
- defp to_lines(source_file, true) do
- source_file
- |> Strings.replace_with_spaces(".", ".")
- |> Heredocs.replace_with_spaces(".", ".", ".", source_file.filename)
- |> Credo.Code.to_lines()
- end
-
- defp to_lines(source_file, false) do
- SourceFile.lines(source_file)
- end
-
- defp traverse_line([{line_no, line} | tail], issues, issue_meta) do
- issues =
- case Regex.run(~r/\h+$/u, line, return: :index) do
- [{column, line_length}] ->
- [issue_for(issue_meta, line_no, column + 1, line_length) | issues]
-
- nil ->
- issues
- end
-
- traverse_line(tail, issues, issue_meta)
- end
-
- defp traverse_line([], issues, _issue_meta), do: issues
-
- defp issue_for(issue_meta, line_no, column, line_length) do
- format_issue(
- issue_meta,
- message: "There should be no trailing white-space at the end of a line.",
- line_no: line_no,
- column: column,
- trigger: String.duplicate(" ", line_length)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/unnecessary_alias_expansion.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/unnecessary_alias_expansion.ex
deleted file mode 100644
index 8ee090d5..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/unnecessary_alias_expansion.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Credo.Check.Readability.UnnecessaryAliasExpansion do
- use Credo.Check,
- id: "EX3030",
- base_priority: :low,
- explanations: [
- check: """
- Alias expansion is useful but when aliasing a single module,
- it can be harder to read with unnecessary braces.
-
- # preferred
-
- alias ModuleA.Foo
- alias ModuleA.{Foo, Bar}
-
- # NOT preferred
-
- alias ModuleA.{Foo}
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse(
- {:alias, _, [{{:., _, [_, :{}]}, _, [{:__aliases__, opts, [child]}]}]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues ++ [issue_for(issue_meta, Keyword.get(opts, :line), child)]}
- end
-
- defp traverse(ast, issues, _issue_meta), do: {ast, issues}
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Unnecessary alias expansion for #{trigger}, consider removing braces.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/variable_names.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/variable_names.ex
deleted file mode 100644
index b15464f3..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/variable_names.ex
+++ /dev/null
@@ -1,127 +0,0 @@
-defmodule Credo.Check.Readability.VariableNames do
- use Credo.Check,
- id: "EX3031",
- base_priority: :high,
- explanations: [
- check: """
- Variable names are always written in snake_case in Elixir.
-
- # snake_case:
-
- incoming_result = handle_incoming_message(message)
-
- # not snake_case
-
- incomingResult = handle_incoming_message(message)
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- alias Credo.Code.Name
-
- @special_var_names [:__CALLER__, :__DIR__, :__ENV__, :__MODULE__]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:=, _meta, [lhs, _rhs]} = ast, issues, issue_meta) do
- {ast, issues_for_lhs(lhs, issues, issue_meta)}
- end
-
- defp traverse({:->, _meta, [lhs, _rhs]} = ast, issues, issue_meta) do
- {ast, issues_for_lhs(lhs, issues, issue_meta)}
- end
-
- defp traverse(
- {:<-, _meta, [{:|, _comp_meta, [_lhs, rhs]}, _comp_rhs]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_lhs(rhs, issues, issue_meta)}
- end
-
- defp traverse({:<-, _meta, [lhs, _rhs]} = ast, issues, issue_meta) do
- {ast, issues_for_lhs(lhs, issues, issue_meta)}
- end
-
- defp traverse(
- {:def, _meta, [{_fun, _fun_meta, [lhs, _rhs]}, _fun_rhs]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_lhs(lhs, issues, issue_meta)}
- end
-
- defp traverse(
- {:defp, _meta, [{_fun, _fun_meta, [lhs, _rhs]}, _fun_rhs]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_lhs(lhs, issues, issue_meta)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- for op <- [:{}, :%{}, :^, :|, :<>] do
- defp issues_for_lhs({unquote(op), _meta, parameters}, issues, issue_meta) do
- issues_for_lhs(parameters, issues, issue_meta)
- end
- end
-
- defp issues_for_lhs({_name, _meta, nil} = value, issues, issue_meta) do
- case issue_for_name(value, issue_meta) do
- nil ->
- issues
-
- new_issue ->
- [new_issue | issues]
- end
- end
-
- defp issues_for_lhs(list, issues, issue_meta) when is_list(list) do
- Enum.reduce(list, issues, &issues_for_lhs(&1, &2, issue_meta))
- end
-
- defp issues_for_lhs(tuple, issues, issue_meta) when is_tuple(tuple) do
- Enum.reduce(
- Tuple.to_list(tuple),
- issues,
- &issues_for_lhs(&1, &2, issue_meta)
- )
- end
-
- defp issues_for_lhs(_, issues, _issue_meta) do
- issues
- end
-
- for name <- @special_var_names do
- defp issue_for_name({unquote(name), _, nil}, _), do: nil
- end
-
- defp issue_for_name({name, meta, nil}, issue_meta) do
- string_name = to_string(name)
-
- unless Name.snake_case?(string_name) or Name.no_case?(string_name) do
- issue_for(issue_meta, meta[:line], name)
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Variable names should be written in snake_case.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_custom_tagged_tuple.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_custom_tagged_tuple.ex
deleted file mode 100644
index 3db9d26c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_custom_tagged_tuple.ex
+++ /dev/null
@@ -1,82 +0,0 @@
-defmodule Credo.Check.Readability.WithCustomTaggedTuple do
- use Credo.Check,
- id: "EX3032",
- category: :warning,
- base_priority: :low,
- explanations: [
- check: """
- Avoid using custom tags for error reporting from `with` macros.
-
- This code injects placeholder tags such as `:resource` and `:authz` for the purpose of error
- reporting.
-
- with {:resource, {:ok, resource}} <- {:resource, Resource.fetch(user)},
- {:authz, :ok} <- {:authz, Resource.authorize(resource, user)} do
- do_something_with(resource)
- else
- {:resource, _} -> {:error, :not_found}
- {:authz, _} -> {:error, :unauthorized}
- end
-
- Instead, extract each validation into a separate helper function which returns error
- information immediately:
-
- defp find_resource(user) do
- with :error <- Resource.fetch(user), do: {:error, :not_found}
- end
-
- defp authorize(resource, user) do
- with :error <- Resource.authorize(resource, user), do: {:error, :unauthorized}
- end
-
- At this point, the validation chain in `with` becomes clearer and easier to understand:
-
- with {:ok, resource} <- find_resource(user),
- :ok <- authorize(resource, user),
- do: do_something(user)
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- source_file
- |> errors()
- |> Enum.map(&credo_error(&1, IssueMeta.for(source_file, params)))
- end
-
- defp errors(source_file) do
- {_ast, errors} = Macro.prewalk(Credo.Code.ast(source_file), MapSet.new(), &traverse/2)
- Enum.sort_by(errors, &{&1.line, &1.column})
- end
-
- defp traverse({:with, _meta, args}, errors) do
- errors =
- args
- |> Stream.map(&placeholder/1)
- |> Enum.reject(&is_nil/1)
- |> Enum.into(errors)
-
- {args, errors}
- end
-
- defp traverse(ast, state), do: {ast, state}
-
- defp placeholder({:<-, meta, [{placeholder, _}, {placeholder, _}]}) when is_atom(placeholder),
- do: %{placeholder: placeholder, line: meta[:line], column: meta[:column]}
-
- defp placeholder(_), do: nil
-
- defp credo_error(error, issue_meta) do
- format_issue(
- issue_meta,
- message: "Invalid usage of placeholder `#{inspect(error.placeholder)}` in with",
- line_no: error.line,
- column: error.column
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_single_clause.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_single_clause.ex
deleted file mode 100644
index 0d670ee9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/readability/with_single_clause.ex
+++ /dev/null
@@ -1,102 +0,0 @@
-defmodule Credo.Check.Readability.WithSingleClause do
- use Credo.Check,
- id: "EX3033",
- explanations: [
- check: ~S"""
- `with` statements are useful when you need to chain a sequence
- of pattern matches, stopping at the first one that fails.
-
- If the `with` has a single pattern matching clause and no `else`
- branch, it means that if the clause doesn't match than the whole
- `with` will return the value of that clause.
-
- However, if that `with` has also an `else` clause, then you're using `with` exactly
- like a `case` and a `case` should be used instead.
-
- Take this code:
-
- with {:ok, user} <- User.create(make_ref()) do
- user
- else
- {:error, :db_down} ->
- raise "DB is down!"
-
- {:error, reason} ->
- raise "error: #{inspect(reason)}"
- end
-
- It can be rewritten with a clearer use of `case`:
-
- case User.create(make_ref()) do
- {:ok, user} ->
- user
-
- {:error, :db_down} ->
- raise "DB is down!"
-
- {:error, reason} ->
- raise "error: #{inspect(reason)}"
- end
-
- Like all `Readability` issues, this one is not a technical concern.
- But you can improve the odds of others reading and liking your code by making
- it easier to follow.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:with, meta, [_, _ | _] = clauses_and_body} = ast, issues, issue_meta)
- when is_list(clauses_and_body) do
- # If clauses_and_body is a list with at least two elements in it, we think
- # this might be a call to the special form "with". To be sure of that,
- # we get the last element of clauses_and_body and check that it's a keyword
- # list with a :do key in it (the body).
-
- # We can hard-match on [maybe_body] here since we know that clauses_and_body
- # has at least two elements.
- {maybe_clauses, [maybe_body]} = Enum.split(clauses_and_body, -1)
-
- if Keyword.keyword?(maybe_body) and Keyword.has_key?(maybe_body, :do) do
- issue =
- issue_if_one_pattern_clause_with_else(maybe_clauses, maybe_body, meta[:line], issue_meta)
-
- {ast, issue ++ issues}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_if_one_pattern_clause_with_else(clauses, body, line, issue_meta) do
- contains_unquote_splicing? = Enum.any?(clauses, &match?({:unquote_splicing, _, _}, &1))
- pattern_clauses_count = Enum.count(clauses, &match?({:<-, _, _}, &1))
-
- cond do
- contains_unquote_splicing? ->
- []
-
- pattern_clauses_count <= 1 and Keyword.has_key?(body, :else) ->
- [
- format_issue(issue_meta,
- message:
- "`with` contains only one <- clause and an `else` branch, consider using `case` instead",
- line_no: line
- )
- ]
-
- true ->
- []
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/abc_size.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/abc_size.ex
deleted file mode 100644
index e56f8828..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/abc_size.ex
+++ /dev/null
@@ -1,279 +0,0 @@
-defmodule Credo.Check.Refactor.ABCSize do
- use Credo.Check,
- id: "EX4001",
- tags: [:controversial],
- param_defaults: [
- max_size: 30,
- excluded_functions: []
- ],
- explanations: [
- check: """
- The ABC size describes a metric based on assignments, branches and conditions.
-
- A high ABC size is a hint that a function might be doing "more" than it
- should.
-
- As always: Take any metric with a grain of salt. Since this one was originally
- introduced for C, C++ and Java, we still have to see whether or not this can
- be a useful metric in a declarative language like Elixir.
- """,
- params: [
- max_size: "The maximum ABC size a function should have.",
- excluded_functions: "All functions listed will be ignored."
- ]
- ]
-
- @ecto_functions ["where", "from", "select", "join"]
- @def_ops [:def, :defp, :defmacro]
- @branch_ops [:.]
- @condition_ops [:if, :unless, :for, :try, :case, :cond, :and, :or, :&&, :||]
- @non_calls [:==, :fn, :__aliases__, :__block__, :if, :or, :|>, :%{}]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- ignore_ecto? = imports_ecto_query?(source_file)
- issue_meta = IssueMeta.for(source_file, params)
- max_abc_size = Params.get(params, :max_size, __MODULE__)
- excluded_functions = Params.get(params, :excluded_functions, __MODULE__)
-
- excluded_functions =
- if ignore_ecto? do
- @ecto_functions ++ excluded_functions
- else
- excluded_functions
- end
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, max_abc_size, excluded_functions)
- )
- end
-
- defp imports_ecto_query?(source_file),
- do: Credo.Code.prewalk(source_file, &traverse_for_ecto/2, false)
-
- defp traverse_for_ecto(_, true), do: {nil, true}
-
- defp traverse_for_ecto({:import, _, [{:__aliases__, _, [:Ecto, :Query]} | _]}, false),
- do: {nil, true}
-
- defp traverse_for_ecto(ast, false), do: {ast, false}
-
- defp traverse(
- {:defmacro, _, [{:__using__, _, _}, _]} = ast,
- issues,
- _issue_meta,
- _max_abc_size,
- _excluded_functions
- ) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see above how we want to exclude certain front-loads
- for op <- @def_ops do
- defp traverse(
- {unquote(op), meta, arguments} = ast,
- issues,
- issue_meta,
- max_abc_size,
- excluded_functions
- )
- when is_list(arguments) do
- abc_size =
- ast
- |> abc_size_for(excluded_functions)
- |> round
-
- if abc_size > max_abc_size do
- fun_name = Credo.Code.Module.def_name(ast)
-
- {ast,
- [
- issue_for(issue_meta, meta[:line], fun_name, max_abc_size, abc_size)
- | issues
- ]}
- else
- {ast, issues}
- end
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _max_abc_size, _excluded_functions) do
- {ast, issues}
- end
-
- @doc """
- Returns the ABC size for the block inside the given AST, which is expected
- to represent a function or macro definition.
-
- iex> {:def, [line: 1],
- ...> [
- ...> {:first_fun, [line: 1], nil},
- ...> [do: {:=, [line: 2], [{:x, [line: 2], nil}, 1]}]
- ...> ]
- ...> } |> Credo.Check.Refactor.ABCSize.abc_size
- 1.0
- """
- def abc_size_for({_def_op, _meta, arguments}, excluded_functions) when is_list(arguments) do
- arguments
- |> Credo.Code.Block.do_block_for!()
- |> abc_size_for(arguments, excluded_functions)
- end
-
- @doc false
- def abc_size_for(nil, _arguments, _excluded_functions), do: 0
-
- def abc_size_for(ast, arguments, excluded_functions) do
- initial_acc = [a: 0, b: 0, c: 0, var_names: get_parameters(arguments)]
-
- [a: a, b: b, c: c, var_names: _] =
- Credo.Code.prewalk(ast, &traverse_abc(&1, &2, excluded_functions), initial_acc)
-
- :math.sqrt(a * a + b * b + c * c)
- end
-
- defp get_parameters(arguments) do
- case Enum.at(arguments, 0) do
- {_name, _meta, nil} ->
- []
-
- {_name, _meta, parameters} ->
- Enum.map(parameters, &var_name/1)
- end
- end
-
- for op <- @def_ops do
- defp traverse_abc({unquote(op), _, arguments} = ast, abc, _excluded_functions)
- when is_list(arguments) do
- {ast, abc}
- end
- end
-
- # Ignore string interpolation
- defp traverse_abc({:<<>>, _, _}, acc, _excluded_functions) do
- {nil, acc}
- end
-
- # A - assignments
- defp traverse_abc(
- {:=, _meta, [lhs | rhs]},
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- ) do
- var_names =
- case var_name(lhs) do
- nil ->
- var_names
-
- false ->
- var_names
-
- name ->
- var_names ++ [name]
- end
-
- {rhs, [a: a + 1, b: b, c: c, var_names: var_names]}
- end
-
- # B - branch
- defp traverse_abc(
- {:->, _meta, arguments} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- ) do
- var_names = var_names ++ fn_parameters(arguments)
- {ast, [a: a, b: b + 1, c: c, var_names: var_names]}
- end
-
- for op <- @branch_ops do
- defp traverse_abc(
- {unquote(op), _meta, [{_, _, nil}, _] = arguments} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- )
- when is_list(arguments) do
- {ast, [a: a, b: b, c: c, var_names: var_names]}
- end
-
- defp traverse_abc(
- {unquote(op), _meta, arguments} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- )
- when is_list(arguments) do
- {ast, [a: a, b: b + 1, c: c, var_names: var_names]}
- end
- end
-
- defp traverse_abc(
- {fun_name, _meta, arguments} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- excluded_functions
- )
- when is_atom(fun_name) and fun_name not in @non_calls and is_list(arguments) do
- if Enum.member?(excluded_functions, to_string(fun_name)) do
- {nil, [a: a, b: b, c: c, var_names: var_names]}
- else
- {ast, [a: a, b: b + 1, c: c, var_names: var_names]}
- end
- end
-
- defp traverse_abc(
- {fun_or_var_name, _meta, nil} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- ) do
- is_variable = Enum.member?(var_names, fun_or_var_name)
-
- if is_variable do
- {ast, [a: a, b: b, c: c, var_names: var_names]}
- else
- {ast, [a: a, b: b + 1, c: c, var_names: var_names]}
- end
- end
-
- # C - conditions
- for op <- @condition_ops do
- defp traverse_abc(
- {unquote(op), _meta, arguments} = ast,
- [a: a, b: b, c: c, var_names: var_names],
- _excluded_functions
- )
- when is_list(arguments) do
- {ast, [a: a, b: b, c: c + 1, var_names: var_names]}
- end
- end
-
- defp traverse_abc(ast, abc, _excluded_functions) do
- {ast, abc}
- end
-
- defp var_name({name, _, nil}) when is_atom(name), do: name
- defp var_name(_), do: nil
-
- defp fn_parameters([params, tuple]) when is_list(params) and is_tuple(tuple) do
- fn_parameters(params)
- end
-
- defp fn_parameters([[{:when, _, params}], _]) when is_list(params) do
- fn_parameters(params)
- end
-
- defp fn_parameters(params) when is_list(params) do
- params
- |> Enum.map(&var_name/1)
- |> Enum.reject(&is_nil/1)
- end
-
- defp issue_for(issue_meta, line_no, trigger, max_value, actual_value) do
- format_issue(
- issue_meta,
- message: "Function is too complex (ABC size is #{actual_value}, max is #{max_value}).",
- trigger: trigger,
- line_no: line_no,
- severity: Severity.compute(actual_value, max_value)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/append_single_item.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/append_single_item.ex
deleted file mode 100644
index 19d8d83b..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/append_single_item.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule Credo.Check.Refactor.AppendSingleItem do
- use Credo.Check,
- id: "EX4002",
- base_priority: :low,
- tags: [:controversial],
- explanations: [
- check: """
- When building up large lists, it is faster to prepend than
- append. Therefore: It is sometimes best to prepend to the list
- during iteration and call Enum.reverse/1 at the end, as it is quite
- fast.
-
- Example:
-
- list = list_so_far ++ [new_item]
-
- # refactoring it like this can make the code faster:
-
- list = [new_item] ++ list_so_far
- # ...
- Enum.reverse(list)
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # [a] ++ b is OK
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:++, _, [[_], _]} = ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- # a ++ [b] is not
- defp traverse({:++, meta, [_, [_]]} = ast, issues, issue_meta) do
- {ast, [issue_for(issue_meta, meta[:line], :++) | issues]}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Appending a single item to a list is inefficient, use [head | tail]
- notation (and Enum.reverse/1 when order matters)",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/apply.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/apply.ex
deleted file mode 100644
index 672bf8ba..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/apply.ex
+++ /dev/null
@@ -1,88 +0,0 @@
-defmodule Credo.Check.Refactor.Apply do
- use Credo.Check,
- id: "EX4003",
- base_priority: :low,
- explanations: [
- check: """
- Prefer calling functions directly if the number of arguments is known
- at compile time instead of using `apply/2` and `apply/3`.
-
- Example:
-
- # preferred
-
- fun.(arg_1, arg_2, ..., arg_n)
-
- module.function(arg_1, arg_2, ..., arg_n)
-
- # NOT preferred
-
- apply(fun, [arg_1, arg_2, ..., arg_n])
-
- apply(module, :function, [arg_1, arg_2, ..., arg_n])
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- Credo.Code.prewalk(source_file, &traverse(&1, &2, IssueMeta.for(source_file, params)))
- end
-
- defp traverse(ast, issues, issue_meta) do
- case issue(ast, issue_meta) do
- :stop ->
- {[], issues}
-
- nil ->
- {ast, issues}
-
- issue ->
- {ast, [issue | issues]}
- end
- end
-
- defp issue(
- {:|>, meta,
- [
- {_, _, _} = arg0,
- {:apply, _, apply_args}
- ]},
- issue_meta
- ),
- do: issue({:apply, meta, [arg0 | apply_args]}, issue_meta) || :stop
-
- defp issue({:apply, _meta, [{:__MODULE__, _, _}, _fun, _args]}, _issue_meta), do: nil
-
- defp issue({:apply, meta, [fun, args]}, issue_meta) do
- do_issue(:apply2, fun, args, meta, issue_meta)
- end
-
- defp issue({:apply, meta, [_module, fun, args]}, issue_meta) do
- do_issue(:apply3, fun, args, meta, issue_meta)
- end
-
- defp issue(_ast, _issue_meta), do: nil
-
- defp do_issue(_apply, _fun, [{:|, _, _}], _meta, _issue_meta), do: nil
-
- defp do_issue(:apply2, {name, _meta, nil}, args, meta, issue_meta)
- when is_atom(name) and is_list(args) do
- issue_for(meta, issue_meta)
- end
-
- defp do_issue(:apply3, fun, args, meta, issue_meta)
- when is_atom(fun) and is_list(args) do
- issue_for(meta, issue_meta)
- end
-
- defp do_issue(_apply, _fun, _args, _meta, _issue_meta), do: nil
-
- defp issue_for(meta, issue_meta) do
- format_issue(
- issue_meta,
- message: "Avoid `apply/2` and `apply/3` when the number of arguments is known",
- line_no: meta[:line]
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/case_trivial_matches.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/case_trivial_matches.ex
deleted file mode 100644
index 9d57064e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/case_trivial_matches.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Credo.Check.Refactor.CaseTrivialMatches do
- use Credo.Check,
- id: "EX4004",
- explanations: [
- check: """
- PLEASE NOTE: This check is deprecated as it might do more harm than good.
-
- Related discussion: https://github.com/rrrene/credo/issues/65
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:case, meta, arguments} = ast, issues, issue_meta) do
- cases =
- arguments
- |> Credo.Code.Block.do_block_for!()
- |> List.wrap()
- |> Enum.map(&case_statement_for/1)
- |> Enum.sort()
-
- if cases == [false, true] do
- {ast, issues ++ [issue_for(issue_meta, meta[:line], :cond)]}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp case_statement_for({:->, _, [[true], _]}), do: true
- defp case_statement_for({:->, _, [[false], _]}), do: false
- defp case_statement_for(_), do: nil
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Case statements should not only contain `true` and `false`.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cond_statements.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cond_statements.ex
deleted file mode 100644
index a4d49784..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cond_statements.ex
+++ /dev/null
@@ -1,84 +0,0 @@
-defmodule Credo.Check.Refactor.CondStatements do
- use Credo.Check,
- id: "EX4005",
- explanations: [
- check: """
- Each cond statement should have 3 or more statements including the
- "always true" statement.
-
- Consider an `if`/`else` construct if there is only one condition and the
- "always true" statement, since it will more accessible to programmers
- new to the codebase (and possibly new to Elixir).
-
- Example:
-
- cond do
- x == y -> 0
- true -> 1
- end
-
- # should be written as
-
- if x == y do
- 0
- else
- 1
- end
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:cond, meta, arguments} = ast, issues, issue_meta) do
- conditions =
- arguments
- |> Credo.Code.Block.do_block_for!()
- |> List.wrap()
-
- count = Enum.count(conditions)
-
- should_be_written_as_if_else_block? =
- count <= 2 && contains_always_matching_condition?(conditions)
-
- if should_be_written_as_if_else_block? do
- {ast, issues ++ [issue_for(issue_meta, meta[:line], :cond)]}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp contains_always_matching_condition?(conditions) do
- Enum.any?(conditions, fn
- {:->, _meta, [[{name, _meta2, nil}], _args]} when is_atom(name) ->
- name |> to_string |> String.starts_with?("_")
-
- {:->, _meta, [[true], _args]} ->
- true
-
- _ ->
- false
- end)
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message:
- "Cond statements should contain at least two conditions besides `true`, consider using `if` instead.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cyclomatic_complexity.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cyclomatic_complexity.ex
deleted file mode 100644
index 3282eb10..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/cyclomatic_complexity.ex
+++ /dev/null
@@ -1,179 +0,0 @@
-defmodule Credo.Check.Refactor.CyclomaticComplexity do
- use Credo.Check,
- id: "EX4006",
- param_defaults: [max_complexity: 9],
- explanations: [
- check: """
- Cyclomatic complexity (CC) is a software complexity metric closely
- correlated with coding errors.
-
- If a function feels like it's gotten too complex, it more often than not also
- has a high CC value. So, if anything, this is useful to convince team members
- and bosses of a need to refactor parts of the code based on "objective"
- metrics.
- """,
- params: [
- max_complexity: "The maximum cyclomatic complexity a function should have."
- ]
- ]
-
- @def_ops [:def, :defp, :defmacro]
- # these have two outcomes: it succeeds 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
- @multiple_condition_ops [:case, :cond]
- @op_complexity_map [
- def: 1,
- defp: 1,
- defmacro: 1,
- if: 1,
- unless: 1,
- for: 1,
- try: 1,
- and: 1,
- or: 1,
- &&: 1,
- ||: 1,
- case: 1,
- cond: 1
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_complexity = Params.get(params, :max_complexity, __MODULE__)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, max_complexity)
- )
- end
-
- # exception for `__using__` macros
- defp traverse({:defmacro, _, [{:__using__, _, _}, _]} = ast, issues, _, _) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see above how we want to exclude certain front-loads
- for op <- @def_ops do
- defp traverse(
- {unquote(op), meta, arguments} = ast,
- issues,
- issue_meta,
- max_complexity
- )
- when is_list(arguments) do
- complexity =
- ast
- |> complexity_for
- |> round
-
- if complexity > max_complexity do
- fun_name = Credo.Code.Module.def_name(ast)
-
- {
- ast,
- issues ++
- [
- issue_for(
- issue_meta,
- meta[:line],
- fun_name,
- max_complexity,
- complexity
- )
- ]
- }
- else
- {ast, issues}
- end
- end
- end
-
- defp traverse(ast, issues, _source_file, _max_complexity) do
- {ast, issues}
- end
-
- @doc """
- Returns the Cyclomatic Complexity score for the block inside the given AST,
- which is expected to represent a function or macro definition.
-
- iex> {:def, [line: 1],
- ...> [
- ...> {:first_fun, [line: 1], nil},
- ...> [do: {:=, [line: 2], [{:x, [line: 2], nil}, 1]}]
- ...> ]
- ...> } |> Credo.Check.Refactor.CyclomaticComplexity.complexity_for
- 1.0
- """
- def complexity_for({_def_op, _meta, _arguments} = ast) do
- Credo.Code.prewalk(ast, &traverse_complexity/2, 0)
- end
-
- for op <- @def_ops do
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- {ast, complexity + @op_complexity_map[op]}
- end
- end
-
- for op <- @double_condition_ops do
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- {ast, complexity + @op_complexity_map[op]}
- end
- end
-
- for op <- @multiple_condition_ops do
- defp traverse_complexity({unquote(op), _meta, nil} = ast, complexity) do
- {ast, complexity}
- end
-
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- block_cc =
- arguments
- |> Credo.Code.Block.do_block_for!()
- |> do_block_complexity(op)
-
- {ast, complexity + block_cc}
- end
- end
-
- defp traverse_complexity(ast, complexity) do
- {ast, complexity}
- end
-
- defp do_block_complexity(nil, _), do: 0
-
- defp do_block_complexity(block, op) do
- count =
- block
- |> List.wrap()
- |> Enum.count()
-
- count * @op_complexity_map[op]
- end
-
- defp issue_for(issue_meta, line_no, trigger, max_value, actual_value) do
- format_issue(
- issue_meta,
- message:
- "Function is too complex (cyclomatic complexity is #{actual_value}, max is #{max_value}).",
- trigger: trigger,
- line_no: line_no,
- severity: Severity.compute(actual_value, max_value)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/double_boolean_negation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/double_boolean_negation.ex
deleted file mode 100644
index bce47d10..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/double_boolean_negation.ex
+++ /dev/null
@@ -1,77 +0,0 @@
-defmodule Credo.Check.Refactor.DoubleBooleanNegation do
- use Credo.Check,
- id: "EX4007",
- base_priority: :low,
- tags: [:controversial],
- explanations: [
- check: """
- Having double negations in your code can obscure the parameter's original value.
-
- # NOT preferred
-
- !!var
-
- This will return `false` for `false` and `nil`, and `true` for anything else.
-
- At first this seems like an extra clever shorthand to cast anything truthy to
- `true` and anything non-truthy to `false`. But in most scenarios you want to
- be explicit about your input parameters (because it is easier to reason about
- edge-cases, code-paths and tests).
- Also: `nil` and `false` do mean two different things.
-
- A scenario where you want this kind of flexibility, however, is parsing
- external data, e.g. a third party JSON-API where a value is sometimes `null`
- and sometimes `false` and you want to normalize that before handing it down
- in your program.
-
- In these case, you would be better off making the cast explicit by introducing
- a helper function:
-
- # preferred
-
- defp present?(nil), do: false
- defp present?(false), do: false
- defp present?(_), do: true
-
- This makes your code more explicit than relying on the implications of `!!`.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # Checking for `!!`
- defp traverse({:!, meta, [{:!, _, ast}]}, issues, issue_meta) do
- issue =
- format_issue(
- issue_meta,
- message: "Double boolean negation found.",
- trigger: "!!",
- line_no: meta[:line]
- )
-
- {ast, [issue | issues]}
- end
-
- # Checking for `not not`
- defp traverse({:not, meta, [{:not, _, ast}]}, issues, issue_meta) do
- issue =
- format_issue(
- issue_meta,
- message: "Double boolean negation found.",
- trigger: "not not",
- line_no: meta[:line]
- )
-
- {ast, [issue | issues]}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/enum_helpers.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/enum_helpers.ex
deleted file mode 100644
index 413e10fb..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/enum_helpers.ex
+++ /dev/null
@@ -1,87 +0,0 @@
-defmodule Credo.Check.Refactor.EnumHelpers do
- def traverse(
- {{:., _, [{:__aliases__, meta, [:Enum]}, second]}, _,
- [{{:., _, [{:__aliases__, _, [:Enum]}, first]}, _, _}, _]} = ast,
- issues,
- issue_meta,
- message,
- trigger,
- first,
- second,
- module
- ) do
- new_issue = issue_for(issue_meta, meta[:line], message, trigger, module)
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- def traverse(
- {:|>, meta,
- [
- {{:., _, [{:__aliases__, _, [:Enum]}, first]}, _, _},
- {{:., _, [{:__aliases__, _, [:Enum]}, second]}, _, _}
- ]} = ast,
- issues,
- issue_meta,
- message,
- trigger,
- first,
- second,
- module
- ) do
- new_issue = issue_for(issue_meta, meta[:line], message, trigger, module)
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- def traverse(
- {{:., meta, [{:__aliases__, _, [:Enum]}, second]}, _,
- [
- {:|>, _, [_, {{:., _, [{:__aliases__, _, [:Enum]}, first]}, _, _}]},
- _
- ]} = ast,
- issues,
- issue_meta,
- message,
- trigger,
- first,
- second,
- module
- ) do
- new_issue = issue_for(issue_meta, meta[:line], message, trigger, module)
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- def traverse(
- {:|>, meta,
- [
- {:|>, _,
- [
- _,
- {{:., _, [{:__aliases__, _, [:Enum]}, first]}, _, _}
- ]},
- {{:., _, [{:__aliases__, _, [:Enum]}, second]}, _, _}
- ]} = ast,
- issues,
- issue_meta,
- message,
- trigger,
- first,
- second,
- module
- ) do
- new_issue = issue_for(issue_meta, meta[:line], message, trigger, module)
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- def traverse(ast, issues, _issue_meta, _message, _trigger, _first, _second, _module) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, message, trigger, module) do
- module.format_issue(
- issue_meta,
- message: message,
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_count.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_count.ex
deleted file mode 100644
index 42627c4d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_count.ex
+++ /dev/null
@@ -1,98 +0,0 @@
-defmodule Credo.Check.Refactor.FilterCount do
- use Credo.Check,
- id: "EX4030",
- base_priority: :high,
- explanations: [
- check: """
- `Enum.count/2` is more efficient than `Enum.filter/2 |> Enum.count/1`.
-
- This should be refactored:
-
- [1, 2, 3, 4, 5]
- |> Enum.filter(fn x -> rem(x, 3) == 0 end)
- |> Enum.count()
-
- to look like this:
-
- Enum.count([1, 2, 3, 4, 5], fn x -> rem(x, 3) == 0 end)
-
- The reason for this is performance, because the two separate calls
- to `Enum.filter/2` and `Enum.count/1` require two iterations whereas
- `Enum.count/2` performs the same work in one pass.
- """
- ]
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {:|>, _,
- [
- {:|>, _,
- [
- _,
- {{:., meta, [{:__aliases__, _, [:Enum]}, :filter]}, _, _}
- ]},
- {{:., _, [{:__aliases__, _, [:Enum]}, :count]}, _, []}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "filter_count")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {{:., meta, [{:__aliases__, _, [:Enum]}, :count]}, _,
- [
- {{:., _, [{:__aliases__, _, [:Enum]}, :filter]}, _, _}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "filter_count")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {:|>, _,
- [
- {{:., meta, [{:__aliases__, _, [:Enum]}, :filter]}, _, _},
- {{:., _, [{:__aliases__, _, [:Enum]}, :count]}, _, []}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "filter_count")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {{:., meta, [{:__aliases__, _, [:Enum]}, :count]}, _,
- [
- {:|>, _, [_, {{:., _, [{:__aliases__, _, [:Enum]}, :filter]}, _, _}]}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "filter_count")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "`Enum.count/2` is more efficient than `Enum.filter/2 |> Enum.count/1`",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_filter.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_filter.ex
deleted file mode 100644
index 0a8eac69..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_filter.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Credo.Check.Refactor.FilterFilter do
- use Credo.Check,
- id: "EX4008",
- explanations: [
- check: """
- One `Enum.filter/2` is more efficient than `Enum.filter/2 |> Enum.filter/2`.
-
- This should be refactored:
-
- ["a", "b", "c"]
- |> Enum.filter(&String.contains?(&1, "x"))
- |> Enum.filter(&String.contains?(&1, "a"))
-
- to look like this:
-
- Enum.filter(["a", "b", "c"], fn letter ->
- String.contains?(letter, "x") && String.contains?(letter, "a")
- end)
-
- The reason for this is performance, because the two separate calls
- to `Enum.filter/2` require two iterations whereas doing the
- functions in the single `Enum.filter/2` only requires one.
- """
- ]
-
- alias Credo.Check.Refactor.EnumHelpers
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- message = "One `Enum.filter/2` is more efficient than `Enum.filter/2 |> Enum.filter/2`"
- trigger = "|>"
-
- Credo.Code.prewalk(
- source_file,
- &EnumHelpers.traverse(&1, &2, issue_meta, message, trigger, :filter, :filter, __MODULE__)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_reject.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_reject.ex
deleted file mode 100644
index acbbc422..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/filter_reject.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Credo.Check.Refactor.FilterReject do
- use Credo.Check,
- id: "EX4009",
- tags: [:controversial],
- explanations: [
- check: """
- One `Enum.filter/2` is more efficient than `Enum.filter/2 |> Enum.reject/2`.
-
- This should be refactored:
-
- ["a", "b", "c"]
- |> Enum.filter(&String.contains?(&1, "x"))
- |> Enum.reject(&String.contains?(&1, "a"))
-
- to look like this:
-
- Enum.filter(["a", "b", "c"], fn letter ->
- String.contains?(letter, "x") && !String.contains?(letter, "a")
- end)
-
- The reason for this is performance, because the two calls to
- `Enum.reject/2` and `Enum.filter/2` require two iterations whereas
- doing the functions in the single `Enum.filter/2` only requires one.
- """
- ]
-
- alias Credo.Check.Refactor.EnumHelpers
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- message = "One `Enum.filter/2` is more efficient than `Enum.filter/2 |> Enum.reject/2`"
- trigger = "|>"
-
- Credo.Code.prewalk(
- source_file,
- &EnumHelpers.traverse(&1, &2, issue_meta, message, trigger, :filter, :reject, __MODULE__)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/function_arity.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/function_arity.ex
deleted file mode 100644
index e1179243..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/function_arity.ex
+++ /dev/null
@@ -1,78 +0,0 @@
-defmodule Credo.Check.Refactor.FunctionArity do
- use Credo.Check,
- id: "EX4010",
- param_defaults: [max_arity: 8, ignore_defp: false],
- explanations: [
- check: """
- A function can take as many parameters as needed, but even in a functional
- language there can be too many parameters.
-
- Can optionally ignore private functions (check configuration options).
- """,
- params: [
- max_arity: "The maximum number of parameters which a function should take.",
- ignore_defp: "Set to `true` to ignore private functions."
- ]
- ]
-
- alias Credo.Code.Parameters
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_arity = Params.get(params, :max_arity, __MODULE__)
- ignore_defp = Params.get(params, :ignore_defp, __MODULE__)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, max_arity, ignore_defp)
- )
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- defp traverse(
- {unquote(op) = op, meta, arguments} = ast,
- issues,
- issue_meta,
- max_arity,
- ignore_defp
- )
- when is_list(arguments) do
- arity = Parameters.count(ast)
-
- if issue?(op, ignore_defp, arity, max_arity) do
- fun_name = Credo.Code.Module.def_name(ast)
-
- {
- ast,
- issues ++ [issue_for(issue_meta, meta[:line], fun_name, max_arity, arity)]
- }
- else
- {ast, issues}
- end
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _max_arity, _ignore_defp) do
- {ast, issues}
- end
-
- defp issue?(:defp, true, _, _), do: false
- defp issue?(_, _, arity, max_arity) when arity > max_arity, do: true
- defp issue?(_, _, _, _), do: false
-
- defp issue_for(issue_meta, line_no, trigger, max_value, actual_value) do
- format_issue(
- issue_meta,
- message:
- "Function takes too many parameters (arity is #{actual_value}, max is #{max_value}).",
- trigger: trigger,
- line_no: line_no,
- severity: Severity.compute(actual_value, max_value)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/io_puts.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/io_puts.ex
deleted file mode 100644
index fdd0dba1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/io_puts.ex
+++ /dev/null
@@ -1,50 +0,0 @@
-defmodule Credo.Check.Refactor.IoPuts do
- use Credo.Check,
- id: "EX4011",
- tags: [:controversial],
- explanations: [
- check: """
- Prefer using Logger statements over using `IO.puts/1`.
-
- This is a situational check.
-
- As such, it might be a great help for e.g. Phoenix projects, but
- a clear mismatch for CLI projects.
- """
- ]
-
- @call_string "IO.puts"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:IO]}, :puts]}, meta, _arguments} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta) do
- [issue_for(issue_meta, meta[:line], @call_string) | issues]
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "There should be no calls to IO.puts/1.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/long_quote_blocks.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/long_quote_blocks.ex
deleted file mode 100644
index 684ccadc..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/long_quote_blocks.ex
+++ /dev/null
@@ -1,153 +0,0 @@
-defmodule Credo.Check.Refactor.LongQuoteBlocks do
- use Credo.Check,
- id: "EX4012",
- base_priority: :high,
- param_defaults: [max_line_count: 150, ignore_comments: false],
- explanations: [
- check: """
- Long `quote` blocks are generally an indication that too much is done inside
- them.
-
- Let's look at why this is problematic:
-
- defmodule MetaCommand do
- def __using__(opts \\\\ []) do
- modes = opts[:modes]
- command_name = opts[:command_name]
-
- quote do
- def run(filename) do
- contents =
- if File.exists?(filename) do
- {:ok, file} = File.open(filename, unquote(modes))
- {:ok, contents} = IO.read(file, :line)
- File.close(file)
- contents
- else
- ""
- end
-
- case contents do
- "" ->
- # ...
- unquote(command_name) <> rest ->
- # ...
- end
- end
-
- # ...
- end
- end
- end
-
- A cleaner solution would be to call "regular" functions outside the
- `quote` block to perform the actual work.
-
- defmodule MyMetaCommand do
- def __using__(opts \\\\ []) do
- modes = opts[:modes]
- command_name = opts[:command_name]
-
- quote do
- def run(filename) do
- MyMetaCommand.run_on_file(filename, unquote(modes), unquote(command_name))
- end
-
- # ...
- end
- end
-
- def run_on_file(filename, modes, command_name) do
- contents =
- # actual implementation
- end
- end
-
- This way it is easier to reason about what is actually happening. And to debug
- it.
- """,
- params: [
- max_line_count: "The maximum number of lines a quote block should be allowed to have.",
- ignore_comments: "Ignores comments when counting the lines of a `quote` block."
- ]
- ]
-
- alias Credo.IssueMeta
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_line_count = Params.get(params, :max_line_count, __MODULE__)
- ignore_comments = Params.get(params, :ignore_comments, __MODULE__)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, max_line_count, ignore_comments)
- )
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse(
- {:quote, meta, arguments} = ast,
- issues,
- issue_meta,
- max_line_count,
- ignore_comments
- ) do
- max_line_no = Credo.Code.prewalk(arguments, &find_max_line_no(&1, &2), 0)
- line_count = max_line_no - meta[:line]
-
- issue =
- if line_count > max_line_count do
- source_file = IssueMeta.source_file(issue_meta)
-
- lines =
- source_file
- |> Credo.Code.to_lines()
- |> Enum.slice(meta[:line] - 1, line_count)
-
- lines =
- if ignore_comments do
- Enum.reject(lines, fn {_line_no, line} ->
- Regex.run(~r/^\s*#/, line)
- end)
- else
- lines
- end
-
- if Enum.count(lines) > max_line_count do
- issue_for(issue_meta, meta[:line])
- end
- end
-
- {ast, issues ++ List.wrap(issue)}
- end
-
- defp traverse(ast, issues, _issue_meta, _max_line_count, _ignore_comments) do
- {ast, issues}
- end
-
- defp find_max_line_no({_, meta, _} = ast, max_line_no) do
- line_no = meta[:line] || 0
-
- if line_no > max_line_no do
- {ast, line_no}
- else
- {ast, max_line_no}
- end
- end
-
- defp find_max_line_no(ast, max_line_no) do
- {ast, max_line_no}
- end
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Avoid long quote blocks.",
- trigger: "quote",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_into.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_into.ex
deleted file mode 100644
index 2f65b568..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_into.ex
+++ /dev/null
@@ -1,108 +0,0 @@
-defmodule Credo.Check.Refactor.MapInto do
- # only available in Elixir < 1.8 since performance improvements have since made this check obsolete
- use Credo.Check,
- id: "EX4013",
- base_priority: :high,
- elixir_version: "< 1.8.0",
- explanations: [
- check: """
- `Enum.into/3` is more efficient than `Enum.map/2 |> Enum.into/2`.
-
- This should be refactored:
-
- [:apple, :banana, :carrot]
- |> Enum.map(&({&1, to_string(&1)}))
- |> Enum.into(%{})
-
- to look like this:
-
- Enum.into([:apple, :banana, :carrot], %{}, &({&1, to_string(&1)}))
-
- The reason for this is performance, because the separate calls to
- `Enum.map/2` and `Enum.into/2` require two iterations whereas
- `Enum.into/3` only requires one.
-
- **NOTE**: This check is only available in Elixir < 1.8 since performance
- improvements have since made this check obsolete.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, meta, [:Enum]}, :into]}, _,
- [{{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}, _]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_into")
-
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {:|>, meta,
- [
- {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _},
- {{:., _, [{:__aliases__, _, [:Enum]}, :into]}, _, _}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_into")
-
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {{:., meta, [{:__aliases__, _, [:Enum]}, :into]}, _,
- [
- {:|>, _, [_, {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}]},
- _
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_into")
-
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {:|>, meta,
- [
- {:|>, _,
- [
- _,
- {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}
- ]},
- {{:., _, [{:__aliases__, _, [:Enum]}, :into]}, _, into_args}
- ]} = ast,
- issues,
- issue_meta
- )
- when length(into_args) == 1 do
- new_issue = issue_for(issue_meta, meta[:line], "map_into")
-
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "`Enum.into/3` is more efficient than `Enum.map/2 |> Enum.into/2`",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_join.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_join.ex
deleted file mode 100644
index 682bfe2c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_join.ex
+++ /dev/null
@@ -1,97 +0,0 @@
-defmodule Credo.Check.Refactor.MapJoin do
- use Credo.Check,
- id: "EX4014",
- base_priority: :high,
- explanations: [
- check: """
- `Enum.map_join/3` is more efficient than `Enum.map/2 |> Enum.join/2`.
-
- This should be refactored:
-
- ["a", "b", "c"]
- |> Enum.map(&String.upcase/1)
- |> Enum.join(", ")
-
- to look like this:
-
- Enum.map_join(["a", "b", "c"], ", ", &String.upcase/1)
-
- The reason for this is performance, because the two separate calls
- to `Enum.map/2` and `Enum.join/2` require two iterations whereas
- `Enum.map_join/3` performs the same work in one pass.
- """
- ]
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, meta, [:Enum]}, :join]}, _,
- [{{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}, _]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_join")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {:|>, meta,
- [
- {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _},
- {{:., _, [{:__aliases__, _, [:Enum]}, :join]}, _, _}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_join")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {{:., meta, [{:__aliases__, _, [:Enum]}, :join]}, _,
- [
- {:|>, _, [_, {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}]},
- _
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_join")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(
- {:|>, meta,
- [
- {:|>, _,
- [
- _,
- {{:., _, [{:__aliases__, _, [:Enum]}, :map]}, _, _}
- ]},
- {{:., _, [{:__aliases__, _, [:Enum]}, :join]}, _, _}
- ]} = ast,
- issues,
- issue_meta
- ) do
- new_issue = issue_for(issue_meta, meta[:line], "map_join")
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "`Enum.map_join/3` is more efficient than `Enum.map/2 |> Enum.join/2`",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_map.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_map.ex
deleted file mode 100644
index a5d07268..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/map_map.ex
+++ /dev/null
@@ -1,42 +0,0 @@
-defmodule Credo.Check.Refactor.MapMap do
- use Credo.Check,
- id: "EX4015",
- explanations: [
- check: """
- One `Enum.map/2` is more efficient than `Enum.map/2 |> Enum.map/2`.
-
- This should be refactored:
-
- [:a, :b, :c]
- |> Enum.map(&inspect/1)
- |> Enum.map(&String.upcase/1)
-
- to look like this:
-
- Enum.map([:a, :b, :c], fn letter ->
- letter
- |> inspect()
- |> String.upcase()
- end)
-
- The reason for this is performance, because the two separate calls
- to `Enum.map/2` require two iterations whereas doing the functions
- in the single `Enum.map/2` only requires one.
- """
- ]
-
- alias Credo.Check.Refactor.EnumHelpers
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- message = "One `Enum.map/2` is more efficient than `Enum.map/2 |> Enum.map/2`"
- trigger = "|>"
-
- Credo.Code.prewalk(
- source_file,
- &EnumHelpers.traverse(&1, &2, issue_meta, message, trigger, :map, :map, __MODULE__)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/match_in_condition.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/match_in_condition.ex
deleted file mode 100644
index f1ce4d7e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/match_in_condition.ex
+++ /dev/null
@@ -1,144 +0,0 @@
-defmodule Credo.Check.Refactor.MatchInCondition do
- use Credo.Check,
- id: "EX4016",
- param_defaults: [
- allow_tagged_tuples: false
- ],
- explanations: [
- check: """
- Pattern matching should only ever be used for simple assignments
- inside `if` and `unless` clauses.
-
- While this fine:
-
- # okay, simple wildcard assignment:
-
- if contents = File.read!("foo.txt") do
- do_something(contents)
- end
-
- the following should be avoided, since it mixes a pattern match with a
- condition and do/else blocks.
-
- # considered too "complex":
-
- if {:ok, contents} = File.read("foo.txt") do
- do_something(contents)
- end
-
- # also considered "complex":
-
- if allowed? && ( contents = File.read!("foo.txt") ) do
- do_something(contents)
- end
-
- If you want to match for something and execute another block otherwise,
- consider using a `case` statement:
-
- case File.read("foo.txt") do
- {:ok, contents} ->
- do_something()
- _ ->
- do_something_else()
- end
-
- """,
- params: [
- allow_tagged_tuples:
- "Allow tagged tuples in conditions, e.g. `if {:ok, contents} = File.read( \"foo.txt\") do`"
- ]
- ]
-
- @condition_ops [:if, :unless]
- @trigger "="
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- allow_tagged_tuples = Params.get(params, :allow_tagged_tuples, __MODULE__)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, allow_tagged_tuples, issue_meta))
- end
-
- # Skip if arguments is not enumerable
- defp traverse({_op, _meta, nil} = ast, issues, _allow_tagged_tuples, _source_file) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: we have to exclude the cases matching the above
- for op <- @condition_ops do
- defp traverse({unquote(op), _meta, arguments} = ast, issues, allow_tagged_tuples, issue_meta) do
- # remove do/else blocks
- condition_arguments = Enum.reject(arguments, &Keyword.keyword?/1)
-
- new_issues =
- Credo.Code.prewalk(
- condition_arguments,
- &traverse_condition(
- &1,
- &2,
- unquote(op),
- condition_arguments,
- allow_tagged_tuples,
- issue_meta
- )
- )
-
- {ast, issues ++ new_issues}
- end
- end
-
- defp traverse(ast, issues, _allow_tagged_tuples, _source_file) do
- {ast, issues}
- end
-
- defp traverse_condition(
- {:=, meta, arguments} = ast,
- issues,
- op,
- op_arguments,
- allow_tagged_tuples?,
- issue_meta
- ) do
- assignment_in_body? = Enum.member?(op_arguments, ast)
-
- case arguments do
- [{atom, _, nil}, _right] when is_atom(atom) ->
- if assignment_in_body? do
- {ast, issues}
- else
- new_issue = issue_for(op, meta[:line], issue_meta)
-
- {ast, issues ++ [new_issue]}
- end
-
- [{tag_atom, {atom, _, nil}}, _right] when is_atom(atom) and is_atom(tag_atom) ->
- if allow_tagged_tuples? do
- {ast, issues}
- else
- new_issue = issue_for(op, meta[:line], issue_meta)
-
- {ast, issues ++ [new_issue]}
- end
-
- _ ->
- new_issue = issue_for(op, meta[:line], issue_meta)
- {ast, issues ++ [new_issue]}
- end
- end
-
- defp traverse_condition(ast, issues, _op, _op_arguments, _allow_tagged_tuples, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(op, line_no, issue_meta) do
- format_issue(
- issue_meta,
- message: "There should be no matches in `#{op}` conditions.",
- trigger: @trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/module_dependencies.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/module_dependencies.ex
deleted file mode 100644
index 4700cb61..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/module_dependencies.ex
+++ /dev/null
@@ -1,148 +0,0 @@
-defmodule Credo.Check.Refactor.ModuleDependencies do
- use Credo.Check,
- id: "EX4017",
- base_priority: :normal,
- tags: [:controversial],
- param_defaults: [
- max_deps: 10,
- dependency_namespaces: [],
- excluded_namespaces: [],
- excluded_paths: [~r"/test/", ~r"^test/"]
- ],
- explanations: [
- check: """
- This module might be doing too much. Consider limiting the number of
- module dependencies.
-
- As always: This is just a suggestion. Check the configuration options for
- tweaking or disabling this check.
- """,
- params: [
- max_deps: "Maximum number of module dependencies.",
- dependency_namespaces: "List of dependency namespaces to include in this check",
- excluded_namespaces: "List of namespaces to exclude from this check",
- excluded_paths: "List of paths or regex to exclude from this check"
- ]
- ]
-
- alias Credo.Code.Module
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- max_deps = Params.get(params, :max_deps, __MODULE__)
- dependency_namespaces = Params.get(params, :dependency_namespaces, __MODULE__)
- excluded_namespaces = Params.get(params, :excluded_namespaces, __MODULE__)
- excluded_paths = Params.get(params, :excluded_paths, __MODULE__)
-
- case ignore_path?(source_file.filename, excluded_paths) do
- true ->
- []
-
- false ->
- Credo.Code.prewalk(
- source_file,
- &traverse(
- &1,
- &2,
- issue_meta,
- dependency_namespaces,
- excluded_namespaces,
- max_deps
- )
- )
- end
- end
-
- # Check if analyzed module path is within ignored paths
- defp ignore_path?(filename, excluded_paths) do
- directory = Path.dirname(filename)
-
- Enum.any?(excluded_paths, &matches?(directory, &1))
- end
-
- defp matches?(directory, %Regex{} = regex), do: Regex.match?(regex, directory)
- defp matches?(directory, path) when is_binary(path), do: String.starts_with?(directory, path)
-
- defp traverse(
- {:defmodule, meta, [mod | _]} = ast,
- issues,
- issue_meta,
- dependency_namespaces,
- excluded_namespaces,
- max
- ) do
- module_name = Name.full(mod)
-
- new_issues =
- if has_namespace?(module_name, excluded_namespaces) do
- []
- else
- module_dependencies = get_dependencies(ast, dependency_namespaces)
-
- issues_for_module(module_dependencies, max, issue_meta, meta)
- end
-
- {ast, issues ++ new_issues}
- end
-
- defp traverse(ast, issues, _issues_meta, _dependency_namespaces, _excluded_namespaces, _max) do
- {ast, issues}
- end
-
- defp get_dependencies(ast, dependency_namespaces) do
- aliases = Module.aliases(ast)
-
- ast
- |> Module.modules()
- |> with_fullnames(aliases)
- |> filter_namespaces(dependency_namespaces)
- end
-
- defp issues_for_module(deps, max_deps, issue_meta, meta) when length(deps) > max_deps do
- [
- format_issue(
- issue_meta,
- message: "Module has too many dependencies: #{length(deps)} (max is #{max_deps})",
- trigger: deps,
- line_no: meta[:line],
- column_no: meta[:column]
- )
- ]
- end
-
- defp issues_for_module(_, _, _, _), do: []
-
- # Resolve dependencies to full module names
- defp with_fullnames(dependencies, aliases) do
- dependencies
- |> Enum.map(&full_name(&1, aliases))
- |> Enum.uniq()
- end
-
- # Keep only dependencies which are within specified namespaces
- defp filter_namespaces(dependencies, namespaces) do
- Enum.filter(dependencies, &keep?(&1, namespaces))
- end
-
- defp keep?(_module_name, []), do: true
-
- defp keep?(module_name, namespaces), do: has_namespace?(module_name, namespaces)
-
- defp has_namespace?(module_name, namespaces) do
- Enum.any?(namespaces, &String.starts_with?(module_name, &1))
- end
-
- # Get full module name from list of aliases (if present)
- defp full_name(dep, aliases) do
- aliases
- |> Enum.find(&String.ends_with?(&1, dep))
- |> case do
- nil -> dep
- full_name -> full_name
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_in_unless.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_in_unless.ex
deleted file mode 100644
index 925db756..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_in_unless.ex
+++ /dev/null
@@ -1,66 +0,0 @@
-defmodule Credo.Check.Refactor.NegatedConditionsInUnless do
- use Credo.Check,
- id: "EX4018",
- base_priority: :high,
- explanations: [
- check: """
- Unless blocks should avoid having a negated condition.
-
- The code in this example ...
-
- unless !allowed? do
- proceed_as_planned()
- end
-
- ... should be refactored to look like this:
-
- if allowed? do
- proceed_as_planned()
- end
-
- The reason for this is not a technical but a human one. It is pretty difficult
- to wrap your head around a block of code that is executed if a negated
- condition is NOT met. See what I mean?
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:@, _, [{:unless, _, _}]}, issues, _issue_meta) do
- {nil, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: we have to exclude the cases matching the above clause!
- defp traverse({:unless, _meta, arguments} = ast, issues, issue_meta)
- when is_list(arguments) do
- issue = issue_for_first_condition(List.first(arguments), issue_meta)
-
- {ast, issues ++ List.wrap(issue)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for_first_condition({:!, meta, _arguments}, issue_meta) do
- issue_for(issue_meta, meta[:line], "!")
- end
-
- defp issue_for_first_condition(_, _), do: nil
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Avoid negated conditions in unless blocks.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_with_else.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_with_else.ex
deleted file mode 100644
index 21601e81..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_conditions_with_else.ex
+++ /dev/null
@@ -1,95 +0,0 @@
-defmodule Credo.Check.Refactor.NegatedConditionsWithElse do
- use Credo.Check,
- id: "EX4019",
- base_priority: :high,
- explanations: [
- check: """
- An `if` block with a negated condition should not contain an else block.
-
- So while this is fine:
-
- if not allowed? do
- raise "Not allowed!"
- end
-
- The code in this example ...
-
- if not allowed? do
- raise "Not allowed!"
- else
- proceed_as_planned()
- end
-
- ... should be refactored to look like this:
-
- if allowed? do
- proceed_as_planned()
- else
- raise "Not allowed!"
- end
-
- The same goes for negation through `!` instead of `not`.
-
- The reason for this is not a technical but a human one. It is easier to wrap
- your head around a positive condition and then thinking "and else we do ...".
-
- In the above example raising the error in case something is not allowed
- might seem so important to put it first. But when you revisit this code a
- while later or have to introduce a colleague to it, you might be surprised
- how much clearer things get when the "happy path" comes first.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:if, meta, arguments} = ast, issues, issue_meta) do
- if negated_condition?(arguments) && Credo.Code.Block.else_block?(ast) do
- new_issue = issue_for(issue_meta, meta[:line], "!")
-
- {ast, issues ++ [new_issue]}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp negated_condition?(arguments) when is_list(arguments) do
- arguments |> List.first() |> negated_condition?()
- end
-
- defp negated_condition?({:!, _meta, _arguments}) do
- true
- end
-
- defp negated_condition?({:not, _meta, _arguments}) do
- true
- end
-
- # parentheses around the condition wrap it in a __block__
- defp negated_condition?({:__block__, _meta, arguments}) do
- negated_condition?(arguments)
- end
-
- defp negated_condition?(_) do
- false
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Avoid negated conditions in if-else blocks.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_is_nil.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_is_nil.ex
deleted file mode 100644
index 1038bc18..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/negated_is_nil.ex
+++ /dev/null
@@ -1,75 +0,0 @@
-defmodule Credo.Check.Refactor.NegatedIsNil do
- use Credo.Check,
- id: "EX4020",
- base_priority: :low,
- tags: [:controversial],
- explanations: [
- check: """
- We should avoid negating the `is_nil` predicate function.
-
- For example, the code here ...
-
- def fun(%{external_id: external_id, id: id}) when not is_nil(external_id) do
- # ...
- end
-
- ... can be refactored to look like this:
-
- def fun(%{external_id: nil, id: id}) do
- # ...
- end
-
- def fun(%{external_id: external_id, id: id}) do
- # ...
- end
-
- ... or even better, can match on what you were expecting on the first place:
-
- def fun(%{external_id: external_id, id: id}) when is_binary(external_id) do
- # ...
- end
-
- def fun(%{external_id: nil, id: id}) do
- # ...
- end
-
- def fun(%{external_id: external_id, id: id}) do
- # ...
- end
-
- Similar to negating `unless` blocks, the reason for this check is not
- technical, but a human one. If we can use the positive, more direct and human
- friendly case, we should.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:when, meta, [_, {negation, _, [{:is_nil, _, _}]}]} = ast, issues, issue_meta)
- when negation in [:!, :not] do
- issue =
- format_issue(
- issue_meta,
- message: "Negated is_nil in guard clause found",
- trigger: "when !/not is_nil",
- line_no: meta[:line]
- )
-
- {ast, [issue | issues]}
- end
-
- defp traverse({:when, meta, [fun, {_, _, [first_op | second_op]}]} = ast, issues, issue_meta) do
- {_, first_op_issues} = traverse({:when, meta, [fun, first_op]}, issues, issue_meta)
- {_, second_op_issues} = traverse({:when, meta, [fun, second_op]}, issues, issue_meta)
-
- {ast, first_op_issues ++ second_op_issues ++ issues}
- end
-
- defp traverse(ast, issues, _), do: {ast, issues}
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/nesting.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/nesting.ex
deleted file mode 100644
index d0d0192a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/nesting.ex
+++ /dev/null
@@ -1,136 +0,0 @@
-defmodule Credo.Check.Refactor.Nesting do
- use Credo.Check,
- id: "EX4021",
- param_defaults: [max_nesting: 2],
- explanations: [
- check: """
- Code should not be nested more than once inside a function.
-
- defmodule CredoSampleModule do
- def some_function(parameter1, parameter2) do
- Enum.reduce(var1, list, fn({_hash, nodes}, list) ->
- filenames = nodes |> Enum.map(&(&1.filename))
-
- Enum.reduce(list, [], fn(item, acc) ->
- if item.filename do
- item # <-- this is nested 3 levels deep
- end
- acc ++ [item]
- end)
- end)
- end
- end
-
- At this point it might be a good idea to refactor the code to separate the
- different loops and conditions.
- """,
- params: [
- max_nesting: "The maximum number of levels code should be nested."
- ]
- ]
-
- @def_ops [:def, :defp, :defmacro]
- @nest_ops [:if, :unless, :case, :cond, :fn]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_nesting = Params.get(params, :max_nesting, __MODULE__)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta, max_nesting))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- defp traverse(
- {unquote(op) = op, meta, arguments} = ast,
- issues,
- issue_meta,
- max_nesting
- )
- when is_list(arguments) do
- arguments
- |> find_depth([], meta[:line], op)
- |> handle_depth(ast, issue_meta, issues, max_nesting)
- end
- end
-
- defp traverse(ast, issues, _issue_meta, _max_nesting) do
- {ast, issues}
- end
-
- defp handle_depth(nil, ast, _issue_meta, issues, _max_nesting) do
- {ast, issues}
- end
-
- defp handle_depth(
- {depth, line_no, trigger},
- ast,
- issue_meta,
- issues,
- max_nesting
- ) do
- if depth > max_nesting do
- {
- ast,
- issues ++ [issue_for(issue_meta, line_no, trigger, max_nesting, depth)]
- }
- else
- {ast, issues}
- end
- end
-
- # Searches for the depth level and returns a tuple `{depth, line_no, trigger}`
- # where the greatest depth was reached.
- defp find_depth(arguments, nest_list, line_no, trigger)
- when is_list(arguments) do
- arguments
- |> Credo.Code.Block.all_blocks_for!()
- |> Enum.flat_map(fn block ->
- block
- |> List.wrap()
- |> Enum.map(&find_depth(&1, nest_list, line_no, trigger))
- end)
- |> Enum.sort()
- |> List.last()
- end
-
- for op <- @nest_ops do
- defp find_depth(
- {unquote(op) = op, meta, arguments},
- nest_list,
- _line_no,
- _trigger
- )
- when is_list(arguments) do
- arguments
- |> Enum.map(&find_depth(&1, nest_list ++ [op], meta[:line], op))
- |> Enum.sort()
- |> List.last()
- end
- end
-
- defp find_depth({atom, _meta, arguments}, nest_list, line_no, trigger)
- when (is_atom(atom) or is_tuple(atom)) and is_list(arguments) do
- arguments
- |> Enum.map(&find_depth(&1, nest_list, line_no, trigger))
- |> Enum.sort()
- |> List.last()
- end
-
- defp find_depth(_, nest_list, line_no, trigger) do
- {Enum.count(nest_list), line_no, trigger}
- end
-
- defp issue_for(issue_meta, line_no, trigger, max_value, actual_value) do
- format_issue(
- issue_meta,
- message:
- "Function body is nested too deep (max depth is #{max_value}, was #{actual_value}).",
- line_no: line_no,
- trigger: trigger,
- severity: Severity.compute(actual_value, max_value)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pass_async_in_test_cases.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pass_async_in_test_cases.ex
deleted file mode 100644
index 05bd7e83..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pass_async_in_test_cases.ex
+++ /dev/null
@@ -1,69 +0,0 @@
-defmodule Credo.Check.Refactor.PassAsyncInTestCases do
- use Credo.Check,
- id: "EX4031",
- base_priority: :normal,
- param_defaults: [
- files: %{included: ["**/*_test.exs"]}
- ],
- explanations: [
- check: """
- Test modules marked `async: true` are run concurrently, speeding up the
- test suite and improving productivity. This should always be done when
- possible.
-
- Leaving off the `async:` option silently defaults to `false`, which may make
- a test suite slower for no real reason.
-
- Test modules which cannot be run concurrently should be explicitly marked
- `async: false`, ideally with a comment explaining why.
- """
- ]
-
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # `use` with options
- defp traverse({:use, _, [{_, meta, module_namespace}, options]} = ast, issues, issue_meta) do
- module_name = module_name_from(module_namespace)
-
- if String.ends_with?(module_name, "Case") and !Keyword.has_key?(options, :async) do
- {ast, issues ++ [issue_for(ast, meta[:line], issue_meta)]}
- else
- {ast, issues}
- end
- end
-
- # `use` without options
- defp traverse({:use, _, [{_, meta, module_namespace}]} = ast, issues, issue_meta) do
- module_name = module_name_from(module_namespace)
-
- if String.ends_with?(module_name, "Case") do
- {ast, issues ++ [issue_for(module_name, meta[:line], issue_meta)]}
- else
- {ast, issues}
- end
- end
-
- # Ignore all other AST nodes
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(module_name, line_no, issue_meta) do
- format_issue(
- issue_meta,
- message: "Pass an `:async` boolean option to `use` a test case module",
- trigger: module_name,
- line_no: line_no
- )
- end
-
- defp module_name_from(module_namespace) do
- module_namespace
- |> List.last()
- |> to_string()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/perceived_complexity.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/perceived_complexity.ex
deleted file mode 100644
index 2ae51c40..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/perceived_complexity.ex
+++ /dev/null
@@ -1,178 +0,0 @@
-defmodule Credo.Check.Refactor.PerceivedComplexity do
- use Credo.Check,
- id: "EX4022",
- param_defaults: [max_complexity: 9],
- explanations: [
- check: """
- Cyclomatic complexity is a software complexity metric closely correlated with
- coding errors.
-
- If a function feels like it's gotten too complex, it more often than not also
- has a high CC value. So, if anything, this is useful to convince team members
- and bosses of a need to refactor parts of the code based on "objective"
- metrics.
- """,
- params: [
- max_complexity: "The maximum cyclomatic complexity a function should have."
- ]
- ]
-
- @def_ops [:def, :defp, :defmacro]
- # these have two outcomes: it succeeds 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
- @multiple_condition_ops [:case, :cond]
- @op_complexity_map [
- def: 1,
- defp: 1,
- defmacro: 1,
- if: 1,
- unless: 1,
- for: 1,
- try: 1,
- and: 1,
- or: 1,
- &&: 1,
- ||: 1,
- case: 0.3,
- cond: 1
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- max_complexity = Params.get(params, :max_complexity, __MODULE__)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, max_complexity)
- )
- end
-
- # exception for `__using__` macros
- defp traverse({:defmacro, _, [{:__using__, _, _}, _]} = ast, issues, _, _) do
- {ast, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: see above for how we want to exclude `__using__` macros
- for op <- @def_ops do
- defp traverse(
- {unquote(op), meta, arguments} = ast,
- issues,
- issue_meta,
- max_complexity
- )
- when is_list(arguments) do
- complexity =
- ast
- |> complexity_for
- |> round
-
- if complexity > max_complexity do
- fun_name = Credo.Code.Module.def_name(ast)
-
- {
- ast,
- issues ++
- [
- issue_for(
- issue_meta,
- meta[:line],
- fun_name,
- max_complexity,
- complexity
- )
- ]
- }
- else
- {ast, issues}
- end
- end
- end
-
- defp traverse(ast, issues, _source_file, _max_complexity) do
- {ast, issues}
- end
-
- @doc """
- Returns the Cyclomatic Complexity score for the block inside the given AST,
- which is expected to represent a function or macro definition.
-
- iex> {:def, [line: 1],
- ...> [
- ...> {:first_fun, [line: 1], nil},
- ...> [do: {:=, [line: 2], [{:x, [line: 2], nil}, 1]}]
- ...> ]
- ...> } |> Credo.Check.Refactor.CyclomaticComplexity.complexity_for
- 1.0
- """
- def complexity_for({_def_op, _meta, _arguments} = ast) do
- Credo.Code.prewalk(ast, &traverse_complexity/2, 0)
- end
-
- for op <- @def_ops do
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- {ast, complexity + @op_complexity_map[op]}
- end
- end
-
- for op <- @double_condition_ops do
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- {ast, complexity + @op_complexity_map[op]}
- end
- end
-
- for op <- @multiple_condition_ops do
- defp traverse_complexity({unquote(op), _meta, nil} = ast, complexity) do
- {ast, complexity}
- end
-
- defp traverse_complexity(
- {unquote(op) = op, _meta, arguments} = ast,
- complexity
- )
- when is_list(arguments) do
- block_cc =
- arguments
- |> Credo.Code.Block.do_block_for!()
- |> do_block_complexity(op)
-
- {ast, complexity + block_cc}
- end
- end
-
- defp traverse_complexity(ast, complexity) do
- {ast, complexity}
- end
-
- defp do_block_complexity(nil, _), do: 0
-
- defp do_block_complexity(block, op) do
- count =
- block
- |> List.wrap()
- |> Enum.count()
-
- count * @op_complexity_map[op]
- end
-
- defp issue_for(issue_meta, line_no, trigger, max_value, actual_value) do
- format_issue(
- issue_meta,
- message: "Function is too complex (CC is #{actual_value}, max is #{max_value}).",
- trigger: trigger,
- line_no: line_no,
- severity: Severity.compute(actual_value, max_value)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pipe_chain_start.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pipe_chain_start.ex
deleted file mode 100644
index 6a0e6503..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/pipe_chain_start.ex
+++ /dev/null
@@ -1,324 +0,0 @@
-defmodule Credo.Check.Refactor.PipeChainStart do
- use Credo.Check,
- id: "EX4023",
- tags: [:controversial],
- param_defaults: [
- excluded_argument_types: [],
- excluded_functions: []
- ],
- explanations: [
- check: """
- Pipes (`|>`) can become more readable by starting with a "raw" value.
-
- So while this is easily comprehendable:
-
- list
- |> Enum.take(5)
- |> Enum.shuffle
- |> pick_winner()
-
- This might be harder to read:
-
- Enum.take(list, 5)
- |> Enum.shuffle
- |> pick_winner()
-
- As always: This is just a suggestion. Check the configuration options for
- tweaking or disabling this check.
- """,
- params: [
- excluded_functions: "All functions listed will be ignored.",
- excluded_argument_types: "All pipes with argument types listed will be ignored."
- ]
- ]
-
- @elixir_custom_operators [
- :<-,
- :|||,
- :&&&,
- :<<<,
- :>>>,
- :<<~,
- :~>>,
- :<~,
- :~>,
- :<~>,
- :"<|>",
- :"^^^",
- :"~~~",
- :"..//"
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- excluded_functions = Params.get(params, :excluded_functions, __MODULE__)
-
- excluded_argument_types = Params.get(params, :excluded_argument_types, __MODULE__)
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, issue_meta, excluded_functions, excluded_argument_types)
- )
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse(
- {:|>, _, [{:|>, _, _} | _]} = ast,
- issues,
- _issue_meta,
- _excluded_functions,
- _excluded_argument_types
- ) do
- {ast, issues}
- end
-
- defp traverse(
- {:|>, meta, [lhs | _rhs]} = ast,
- issues,
- issue_meta,
- excluded_functions,
- excluded_argument_types
- ) do
- if valid_chain_start?(lhs, excluded_functions, excluded_argument_types) do
- {ast, issues}
- else
- {ast, issues ++ [issue_for(issue_meta, meta[:line], "TODO")]}
- end
- end
-
- defp traverse(
- ast,
- issues,
- _issue_meta,
- _excluded_functions,
- _excluded_argument_types
- ) do
- {ast, issues}
- end
-
- defp valid_chain_start?(
- {:__block__, _, [single_ast_node]},
- excluded_functions,
- excluded_argument_types
- ) do
- valid_chain_start?(
- single_ast_node,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- for atom <- [
- :%,
- :%{},
- :..,
- :<<>>,
- :@,
- :__aliases__,
- :unquote,
- :{},
- :&,
- :<>,
- :++,
- :--,
- :&&,
- :||,
- :+,
- :-,
- :*,
- :/,
- :>,
- :>=,
- :<,
- :<=,
- :==,
- :for,
- :with,
- :not,
- :and,
- :or
- ] do
- defp valid_chain_start?(
- {unquote(atom), _meta, _arguments},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
- end
-
- for operator <- @elixir_custom_operators do
- defp valid_chain_start?(
- {unquote(operator), _meta, _arguments},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
- end
-
- # anonymous function
- defp valid_chain_start?(
- {:fn, _, [{:->, _, [_args, _body]}]},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
-
- # function_call()
- defp valid_chain_start?(
- {atom, _, []},
- _excluded_functions,
- _excluded_argument_types
- )
- when is_atom(atom) do
- true
- end
-
- # function_call(with, args) and sigils
- defp valid_chain_start?(
- {atom, _, arguments} = ast,
- excluded_functions,
- excluded_argument_types
- )
- when is_atom(atom) and is_list(arguments) do
- sigil?(atom) ||
- valid_chain_start_function_call?(
- ast,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- # map[:access]
- defp valid_chain_start?(
- {{:., _, [Access, :get]}, _, _},
- _excluded_functions,
- _excluded_argument_types
- ) do
- true
- end
-
- # Module.function_call()
- defp valid_chain_start?(
- {{:., _, _}, _, []},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Elixir <= 1.8.0
- # '__#{val}__' are compiled to String.to_charlist("__#{val}__")
- # we want to consider these charlists a valid pipe chain start
- defp valid_chain_start?(
- {{:., _, [String, :to_charlist]}, _, [{:<<>>, _, _}]},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Elixir >= 1.8.0
- # '__#{val}__' are compiled to String.to_charlist("__#{val}__")
- # we want to consider these charlists a valid pipe chain start
- defp valid_chain_start?(
- {{:., _, [List, :to_charlist]}, _, [[_ | _]]},
- _excluded_functions,
- _excluded_argument_types
- ),
- do: true
-
- # Module.function_call(with, parameters)
- defp valid_chain_start?(
- {{:., _, _}, _, _} = ast,
- excluded_functions,
- excluded_argument_types
- ) do
- valid_chain_start_function_call?(
- ast,
- excluded_functions,
- excluded_argument_types
- )
- end
-
- defp valid_chain_start?(_, _excluded_functions, _excluded_argument_types), do: true
-
- defp valid_chain_start_function_call?(
- {_atom, _, arguments} = ast,
- excluded_functions,
- excluded_argument_types
- ) do
- function_name = to_function_call_name(ast)
-
- found_argument_types =
- case arguments do
- [nil | _] -> [:atom]
- x -> x |> List.first() |> argument_type()
- end
-
- Enum.member?(excluded_functions, function_name) ||
- Enum.any?(
- found_argument_types,
- &Enum.member?(excluded_argument_types, &1)
- )
- end
-
- defp sigil?(atom) do
- atom
- |> to_string
- |> String.match?(~r/^sigil_[a-zA-Z]$/)
- end
-
- defp to_function_call_name({_, _, _} = ast) do
- {ast, [], []}
- |> Macro.to_string()
- |> String.replace(~r/\.?\(.*\)$/s, "")
- end
-
- @alphabet_wo_r ~w(a b c d e f g h i j k l m n o p q s t u v w x y z)
- @all_sigil_chars Enum.flat_map(@alphabet_wo_r, &[&1, String.upcase(&1)])
- @matchable_sigils Enum.map(@all_sigil_chars, &:"sigil_#{&1}")
-
- for sigil_atom <- @matchable_sigils do
- defp argument_type({unquote(sigil_atom), _, _}) do
- [unquote(sigil_atom)]
- end
- end
-
- defp argument_type({:sigil_r, _, _}), do: [:sigil_r, :regex]
- defp argument_type({:sigil_R, _, _}), do: [:sigil_R, :regex]
-
- defp argument_type({:fn, _, _}), do: [:fn]
- defp argument_type({:%{}, _, _}), do: [:map]
- defp argument_type({:{}, _, _}), do: [:tuple]
- defp argument_type(nil), do: []
-
- defp argument_type(v) when is_atom(v), do: [:atom]
- defp argument_type(v) when is_binary(v), do: [:binary]
- defp argument_type(v) when is_bitstring(v), do: [:bitstring]
- defp argument_type(v) when is_boolean(v), do: [:boolean]
-
- defp argument_type(v) when is_list(v) do
- if Keyword.keyword?(v) do
- [:keyword, :list]
- else
- [:list]
- end
- end
-
- defp argument_type(v) when is_number(v), do: [:number]
-
- defp argument_type(v), do: [:credo_type_error, v]
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Pipe chain should start with a raw value.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/redundant_with_clause_result.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/redundant_with_clause_result.ex
deleted file mode 100644
index c1520c24..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/redundant_with_clause_result.ex
+++ /dev/null
@@ -1,90 +0,0 @@
-defmodule Credo.Check.Refactor.RedundantWithClauseResult do
- use Credo.Check,
- id: "EX4024",
- base_priority: :high,
- explanations: [
- check: ~S"""
- `with` statements are useful when you need to chain a sequence
- of pattern matches, stopping at the first one that fails.
-
- If the match of the last clause in a `with` statement is identical to the expression in the
- in its body, the code should be refactored to remove the redundant expression.
-
- This should be refactored:
-
- with {:ok, map} <- check(input),
- {:ok, result} <- something(map) do
- {:ok, result}
- end
-
- to look like this:
-
- with {:ok, map} <- check(input) do
- something(map)
- end
- """
- ]
-
- alias Credo.Code.Block
-
- require Logger
-
- @redundant_with "the `with` statement is redundant"
- @redundant_clause "the last clause in `with` is redundant"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:with, meta, clauses_and_body} = ast, issues, issue_meta) do
- case split(clauses_and_body) do
- {:ok, clauses, body} ->
- case issue_for({clauses, body}, meta, issue_meta) do
- nil -> {ast, issues}
- issue -> {ast, [issue | issues]}
- end
-
- :error ->
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp split(clauses_and_body) do
- case Block.do_block?(clauses_and_body) and not Block.else_block?(clauses_and_body) do
- false ->
- :error
-
- true ->
- {clauses, [body]} = Enum.split(clauses_and_body, -1)
- {:ok, clauses, Keyword.get(body, :do)}
- end
- end
-
- defp issue_for({clauses, body}, meta, issue_meta) do
- case {redundant?(List.last(clauses), body), length(clauses)} do
- {true, 1} ->
- format_issue(issue_meta, message: @redundant_with, line_no: meta[:line])
-
- {true, _length} ->
- format_issue(issue_meta, message: @redundant_clause, line_no: meta[:line])
-
- _else ->
- nil
- end
- end
-
- defp redundant?({:<-, _meta, [body, _expr]}, body), do: true
-
- defp redundant?({:<-, _meta, [match, _expr]}, body) do
- Credo.Code.remove_metadata(match) == Credo.Code.remove_metadata(body)
- end
-
- defp redundant?(_last_clause, _body), do: false
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_filter.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_filter.ex
deleted file mode 100644
index 3d9954e8..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_filter.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Credo.Check.Refactor.RejectFilter do
- use Credo.Check,
- id: "EX4025",
- tags: [:controversial],
- explanations: [
- check: """
- One `Enum.filter/2` is more efficient than `Enum.reject/2 |> Enum.filter/2`.
-
- This should be refactored:
-
- ["a", "b", "c"]
- |> Enum.reject(&String.contains?(&1, "x"))
- |> Enum.filter(&String.contains?(&1, "a"))
-
- to look like this:
-
- Enum.filter(["a", "b", "c"], fn letter ->
- !String.contains?(letter, "x") && String.contains?(letter, "a")
- end)
-
- The reason for this is performance, because the two calls to
- `Enum.reject/2` and `Enum.filter/2` require two iterations whereas
- doing the functions in the single `Enum.filter/2` only requires one.
- """
- ]
-
- alias Credo.Check.Refactor.EnumHelpers
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- message = "One `Enum.filter/2` is more efficient than `Enum.reject/2 |> Enum.filter/2`"
- trigger = "|>"
-
- Credo.Code.prewalk(
- source_file,
- &EnumHelpers.traverse(&1, &2, issue_meta, message, trigger, :reject, :filter, __MODULE__)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_reject.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_reject.ex
deleted file mode 100644
index 48f549db..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/reject_reject.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Credo.Check.Refactor.RejectReject do
- use Credo.Check,
- id: "EX4026",
- explanations: [
- check: """
- One `Enum.reject/2` is more efficient than `Enum.reject/2 |> Enum.reject/2`.
-
- This should be refactored:
-
- ["a", "b", "c"]
- |> Enum.reject(&String.contains?(&1, "x"))
- |> Enum.reject(&String.contains?(&1, "a"))
-
- to look like this:
-
- Enum.reject(["a", "b", "c"], fn letter ->
- String.contains?(letter, "x") || String.contains?(letter, "a")
- end)
-
- The reason for this is performance, because the two separate calls
- to `Enum.reject/2` require two iterations whereas doing the
- functions in the single `Enum.reject/2` only requires one.
- """
- ]
-
- alias Credo.Check.Refactor.EnumHelpers
-
- @doc false
- def run(source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- message = "One `Enum.reject/2` is more efficient than `Enum.reject/2 |> Enum.reject/2`"
- trigger = "|>"
-
- Credo.Code.prewalk(
- source_file,
- &EnumHelpers.traverse(&1, &2, issue_meta, message, trigger, :reject, :reject, __MODULE__)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/unless_with_else.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/unless_with_else.ex
deleted file mode 100644
index e0b0c7bf..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/unless_with_else.ex
+++ /dev/null
@@ -1,75 +0,0 @@
-defmodule Credo.Check.Refactor.UnlessWithElse do
- use Credo.Check,
- id: "EX4027",
- base_priority: :high,
- explanations: [
- check: """
- An `unless` block should not contain an else block.
-
- So while this is fine:
-
- unless allowed? do
- raise "Not allowed!"
- end
-
- This should be refactored:
-
- unless allowed? do
- raise "Not allowed!"
- else
- proceed_as_planned()
- end
-
- to look like this:
-
- if allowed? do
- proceed_as_planned()
- else
- raise "Not allowed!"
- end
-
- The reason for this is not a technical but a human one. The `else` in this
- case will be executed when the condition is met, which is the opposite of
- what the wording seems to imply.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:@, _, [{:unless, _, _}]}, issues, _issue_meta) do
- {nil, issues}
- end
-
- # TODO: consider for experimental check front-loader (ast)
- # NOTE: we have to exclude the cases matching the above clause!
- defp traverse({:unless, meta, _arguments} = ast, issues, issue_meta) do
- new_issue = issue_for_else_block(Credo.Code.Block.else_block_for!(ast), meta, issue_meta)
-
- {ast, issues ++ List.wrap(new_issue)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for_else_block(nil, _meta, _issue_meta), do: nil
-
- defp issue_for_else_block(_else_block, meta, issue_meta) do
- issue_for(issue_meta, meta[:line], "unless")
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Unless conditions should avoid having an `else` block.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/variable_rebinding.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/variable_rebinding.ex
deleted file mode 100644
index c821afff..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/variable_rebinding.ex
+++ /dev/null
@@ -1,167 +0,0 @@
-defmodule Credo.Check.Refactor.VariableRebinding do
- use Credo.Check,
- id: "EX4028",
- tags: [:controversial],
- param_defaults: [allow_bang: false],
- explanations: [
- check: """
- You might want to refrain from rebinding variables.
-
- Although technically fine, rebinding to the same name can lead to less
- precise naming.
-
- Consider this example:
-
- def find_a_good_time do
- time = MyApp.DateTime.now
- time = MyApp.DateTime.later(time, 5, :days)
- {:ok, time} = verify_available_time(time)
-
- time
- end
-
- While there is nothing wrong with this, many would consider the following
- implementation to be easier to comprehend:
-
- def find_a_good_time do
- today = DateTime.now
- proposed_time = DateTime.later(today, 5, :days)
- {:ok, verified_time} = verify_available_time(proposed_time)
-
- verified_time
- end
-
- In some rare cases you might really want to rebind a variable. This can be
- enabled "opt-in" on a per-variable basis by setting the :allow_bang option
- to true and adding a bang suffix sigil to your variable.
-
- def uses_mutating_parameters(params!) do
- params! = do_a_thing(params!)
- params! = do_another_thing(params!)
- params! = do_yet_another_thing(params!)
- end
- """,
- params: [
- allow_bang: "Variables with a bang suffix will be ignored."
- ]
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse([do: {:__block__, _, ast}], issues, {_, _, opt} = issue_meta) do
- variables =
- ast
- |> Enum.map(&find_assignments/1)
- |> List.flatten()
- |> Enum.filter(&only_variables(&1))
- |> Enum.reject(&bang_sigil(&1, opt[:allow_bang]))
-
- duplicates =
- variables
- |> Enum.filter(fn {key, _} ->
- Enum.count(variables, fn {other, _} -> key == other end) >= 2
- end)
- |> Enum.reverse()
- |> Enum.uniq_by(&get_variable_name/1)
-
- new_issues =
- Enum.map(duplicates, fn {variable_name, line} ->
- issue_for(issue_meta, Atom.to_string(variable_name), line)
- end)
-
- if length(new_issues) > 0 do
- {ast, issues ++ new_issues}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp find_assignments({:=, _, [lhs, _rhs]}) do
- find_variables(lhs)
- end
-
- defp find_assignments(_), do: nil
-
- defp find_variables({:=, _, args}) do
- Enum.map(args, &find_variables/1)
- end
-
- # ignore pinned variables
- defp find_variables({:"::", _, [{:^, _, _} | _]}) do
- []
- end
-
- defp find_variables({:"::", _, [lhs | _rhs]}) do
- find_variables(lhs)
- end
-
- # ignore pinned variables
- defp find_variables({:^, _, _}) do
- []
- end
-
- defp find_variables({variable_name, meta, nil}) when is_list(meta) do
- {variable_name, meta[:line]}
- end
-
- defp find_variables(tuple) when is_tuple(tuple) do
- tuple
- |> Tuple.to_list()
- |> find_variables
- end
-
- defp find_variables(list) when is_list(list) do
- list
- |> Enum.map(&find_variables/1)
- |> List.flatten()
- |> Enum.uniq_by(&get_variable_name/1)
- end
-
- defp find_variables(map) when is_map(map) do
- map
- |> Enum.into([])
- |> Enum.map(fn {_, value} -> find_variables(value) end)
- |> List.flatten()
- |> Enum.uniq_by(&get_variable_name/1)
- end
-
- defp find_variables(_), do: nil
-
- defp issue_for(issue_meta, trigger, line) do
- format_issue(
- issue_meta,
- message: "Variable \"#{trigger}\" was declared more than once.",
- trigger: trigger,
- line_no: line
- )
- end
-
- defp get_variable_name({name, _line}), do: name
- defp get_variable_name(nil), do: nil
-
- defp only_variables(nil), do: false
-
- defp only_variables({name, _}) do
- name
- |> Atom.to_string()
- |> String.starts_with?("_")
- |> Kernel.not()
- end
-
- defp bang_sigil({name, _}, allowed) do
- allowed &&
- name
- |> Atom.to_string()
- |> String.ends_with?("!")
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/with_clauses.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/with_clauses.ex
deleted file mode 100644
index 5a90e9db..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/refactor/with_clauses.ex
+++ /dev/null
@@ -1,97 +0,0 @@
-defmodule Credo.Check.Refactor.WithClauses do
- use Credo.Check,
- id: "EX4029",
- base_priority: :high,
- explanations: [
- check: ~S"""
- `with` statements are useful when you need to chain a sequence
- of pattern matches, stopping at the first one that fails.
-
- But sometimes, we go a little overboard with them (pun intended).
-
- If the first or last clause in a `with` statement is not a `<-` clause,
- it still compiles and works, but is not really utilizing what the `with`
- macro provides and can be misleading.
-
- with ref = make_ref(),
- {:ok, user} <- User.create(ref),
- :ok <- send_email(user),
- Logger.debug("Created user: #{inspect(user)}") do
- user
- end
-
- Here, both the first and last clause are actually not matching anything.
-
- If we move them outside of the `with` (the first ones) or inside the body
- of the `with` (the last ones), the code becomes more focused and .
-
- This `with` should be refactored like this:
-
- ref = make_ref()
-
- with {:ok, user} <- User.create(ref),
- :ok <- send_email(user) do
- Logger.debug("Created user: #{inspect(user)}")
- user
- end
- """
- ]
-
- @message_first_clause_not_pattern "`with` doesn't start with a <- clause, move the non-pattern <- clauses outside of the `with`"
- @message_last_clause_not_pattern "`with` doesn't end with a <- clause, move the non-pattern <- clauses inside the body of the `with`"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:with, meta, [_, _ | _] = clauses_and_body} = ast, issues, issue_meta)
- when is_list(clauses_and_body) do
- # If clauses_and_body is a list with at least two elements in it, we think
- # this might be a call to the special form "with". To be sure of that,
- # we get the last element of clauses_and_body and check that it's a keyword
- # list with a :do key in it (the body).
-
- # We can hard-match on [maybe_body] here since we know that clauses_and_body
- # has at least two elements.
- {maybe_clauses, [maybe_body]} = Enum.split(clauses_and_body, -1)
-
- if Keyword.keyword?(maybe_body) and Keyword.has_key?(maybe_body, :do) do
- {ast, issues_for_with(maybe_clauses, meta[:line], issue_meta) ++ issues}
- else
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_with(clauses, line, issue_meta) do
- issue_if_not_starting_with_pattern_clause(clauses, line, issue_meta) ++
- issue_if_not_ending_with_pattern_clause(clauses, line, issue_meta)
- end
-
- defp issue_if_not_starting_with_pattern_clause(
- [{:<-, _meta, _args} | _rest],
- _line,
- _issue_meta
- ) do
- []
- end
-
- defp issue_if_not_starting_with_pattern_clause(_clauses, line, issue_meta) do
- [format_issue(issue_meta, message: @message_first_clause_not_pattern, line_no: line)]
- end
-
- defp issue_if_not_ending_with_pattern_clause(clauses, line, issue_meta) do
- if length(clauses) > 1 and not match?({:<-, _, _}, Enum.at(clauses, -1)) do
- [format_issue(issue_meta, message: @message_last_clause_not_pattern, line_no: line)]
- else
- []
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/runner.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/runner.ex
deleted file mode 100644
index 49763f62..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/runner.ex
+++ /dev/null
@@ -1,114 +0,0 @@
-defmodule Credo.Check.Runner do
- @moduledoc false
-
- # This module is responsible for running checks based on the context represented
- # by the current `Credo.Execution`.
-
- alias Credo.Check.Params
- alias Credo.CLI.Output.UI
- alias Credo.Execution
- alias Credo.Execution.ExecutionTiming
-
- @doc """
- Runs all checks on all source files (according to the config).
- """
- def run(source_files, exec) when is_list(source_files) do
- check_tuples =
- exec
- |> Execution.checks()
- |> warn_about_ineffective_patterns(exec)
- |> fix_deprecated_notation_for_checks_without_params()
-
- Credo.Check.Worker.run(check_tuples, exec.max_concurrent_check_runs, fn check_tuple ->
- run_check(exec, check_tuple)
- end)
-
- :ok
- end
-
- defp run_check(%Execution{debug: true} = exec, {check, params}) do
- ExecutionTiming.run(&do_run_check/2, [exec, {check, params}])
- |> ExecutionTiming.append(exec, task: exec.current_task, check: check)
- end
-
- defp run_check(exec, {check, params}) do
- do_run_check(exec, {check, params})
- end
-
- defp do_run_check(exec, {check, params}) do
- rerun_files_that_changed = Params.get_rerun_files_that_changed(params)
-
- files_included = Params.files_included(params, check)
- files_excluded = Params.files_excluded(params, check)
-
- found_relevant_files =
- if files_included == [] and files_excluded == [] do
- []
- else
- exec
- |> Execution.working_dir()
- |> Credo.Sources.find_in_dir(files_included, files_excluded)
- end
-
- source_files =
- exec
- |> Execution.get_source_files()
- |> filter_source_files(rerun_files_that_changed)
- |> filter_source_files(found_relevant_files)
-
- try do
- check.run_on_all_source_files(exec, source_files, params)
- rescue
- error ->
- warn_about_failed_run(check, source_files)
-
- if exec.crash_on_error do
- reraise error, __STACKTRACE__
- else
- []
- end
- end
- end
-
- defp filter_source_files(source_files, []) do
- source_files
- end
-
- defp filter_source_files(source_files, files_included) do
- Enum.filter(source_files, fn source_file ->
- Enum.member?(files_included, Path.expand(source_file.filename))
- end)
- end
-
- defp warn_about_failed_run(check, %Credo.SourceFile{} = source_file) do
- UI.warn("Error while running #{check} on #{source_file.filename}")
- end
-
- defp warn_about_failed_run(check, _) do
- UI.warn("Error while running #{check}")
- end
-
- defp fix_deprecated_notation_for_checks_without_params(checks) do
- Enum.map(checks, fn
- {check} -> {check, []}
- {check, params} -> {check, params}
- end)
- end
-
- defp warn_about_ineffective_patterns(
- {checks, _included_checks, []},
- %Execution{ignore_checks: [_ | _] = ignore_checks}
- ) do
- UI.warn([
- :red,
- "A pattern was given to ignore checks, but it did not match any: ",
- inspect(ignore_checks)
- ])
-
- checks
- end
-
- defp warn_about_ineffective_patterns({checks, _, _}, _) do
- checks
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/application_config_in_module_attribute.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/application_config_in_module_attribute.ex
deleted file mode 100644
index 1a16ce18..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/application_config_in_module_attribute.ex
+++ /dev/null
@@ -1,109 +0,0 @@
-defmodule Credo.Check.Warning.ApplicationConfigInModuleAttribute do
- use Credo.Check,
- id: "EX5001",
- base_priority: :high,
- tags: [:controversial],
- category: :warning,
- explanations: [
- check: """
- Module attributes are evaluated at compile time and not at run time. As
- a result, certain configuration read calls made in your module attributes
- may work as expected during local development, but may break once in a
- deployed context.
-
- This check analyzes all of the module attributes present within a module,
- and validates that there are no unsafe calls.
-
- These unsafe calls include:
-
- - `Application.fetch_env/2`
- - `Application.fetch_env!/2`
- - `Application.get_all_env/1`
- - `Application.get_env/3`
- - `Application.get_env/2`
-
- As of Elixir 1.10 you can leverage `Application.compile_env/3` and
- `Application.compile_env!/2` if you wish to set configuration at
- compile time using module attributes.
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:@, meta, [attribute_definition]} = ast, issues, issue_meta) do
- case traverse_attribute(attribute_definition) do
- nil ->
- {ast, issues}
-
- {attribute, call} ->
- {ast, issues_for_call(attribute, call, meta, issue_meta, issues)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp traverse_attribute({attribute, _, _} = ast) do
- case Macro.prewalk(ast, nil, &get_forbidden_call/2) do
- {_ast, nil} ->
- nil
-
- {_ast, call} ->
- {attribute, call}
- end
- end
-
- defp traverse_attribute(_ast) do
- nil
- end
-
- defp get_forbidden_call(
- {{:., _, [{:__aliases__, _, [:Application]}, :fetch_env]}, _meta, _args} = ast,
- _acc
- ) do
- {ast, "Application.fetch_env/2"}
- end
-
- defp get_forbidden_call(
- {{:., _, [{:__aliases__, _, [:Application]}, :fetch_env!]}, _meta, _args} = ast,
- _acc
- ) do
- {ast, "Application.fetch_env!/2"}
- end
-
- defp get_forbidden_call(
- {{:., _, [{:__aliases__, _, [:Application]}, :get_all_env]}, _meta, _args} = ast,
- _acc
- ) do
- {ast, "Application.get_all_env/1"}
- end
-
- defp get_forbidden_call(
- {{:., _, [{:__aliases__, _, [:Application]}, :get_env]}, _meta, args} = ast,
- _acc
- ) do
- {ast, "Application.get_env/#{length(args)}"}
- end
-
- defp get_forbidden_call(ast, acc) do
- {ast, acc}
- end
-
- defp issues_for_call(attribute, call, meta, issue_meta, issues) do
- options = [
- message:
- "Module attribute @#{Atom.to_string(attribute)} makes use of unsafe Application configuration call #{call}",
- trigger: call,
- line_no: meta[:line]
- ]
-
- [format_issue(issue_meta, options) | issues]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/bool_operation_on_same_values.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/bool_operation_on_same_values.ex
deleted file mode 100644
index 341f866c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/bool_operation_on_same_values.ex
+++ /dev/null
@@ -1,98 +0,0 @@
-defmodule Credo.Check.Warning.BoolOperationOnSameValues do
- use Credo.Check,
- id: "EX5002",
- base_priority: :high,
- explanations: [
- check: """
- Boolean operations with identical values on the left and right side are
- most probably a logical fallacy or a copy-and-paste error.
-
- Examples:
-
- x && x
- x || x
- x and x
- x or x
-
- Each of these cases behaves the same as if you were just writing `x`.
- """
- ]
-
- @ops [:and, :or, :&&, :||]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:defmodule, _meta, _} = ast, issues, issue_meta) do
- redefined_ops = Credo.Code.prewalk(ast, &traverse_for_operator_redef(&1, &2))
-
- {ast, Credo.Code.prewalk(ast, &traverse_module(&1, &2, redefined_ops, issue_meta), issues)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- for op <- @ops do
- defp traverse_module({unquote(op), meta, [lhs, rhs]} = ast, issues, redefined_ops, issue_meta) do
- op_not_redefined? = unquote(op) not in redefined_ops
-
- if op_not_redefined? && Credo.Code.remove_metadata(lhs) === Credo.Code.remove_metadata(rhs) do
- new_issue = issue_for(issue_meta, meta[:line], unquote(op))
- {ast, issues ++ [new_issue]}
- else
- {ast, issues}
- end
- end
- end
-
- defp traverse_module(ast, issues, _redefined_ops, _issue_meta) do
- {ast, issues}
- end
-
- for op <- @ops do
- defp traverse_for_operator_redef(
- {:def, _,
- [
- {unquote(op), _, [_ | _]},
- [_ | _]
- ]} = ast,
- acc
- ) do
- {ast, acc ++ [unquote(op)]}
- end
-
- defp traverse_for_operator_redef(
- {:def, _,
- [
- {:when, _,
- [
- {unquote(op), _, _} | _
- ]}
- | _
- ]} = ast,
- acc
- ) do
- {ast, acc ++ [unquote(op)]}
- end
- end
-
- defp traverse_for_operator_redef(ast, acc) do
- {ast, acc}
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message:
- "There are identical sub-expressions to the left and to the right of the '#{trigger}' operator.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/dbg.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/dbg.ex
deleted file mode 100644
index ddefe7b7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/dbg.ex
+++ /dev/null
@@ -1,80 +0,0 @@
-defmodule Credo.Check.Warning.Dbg do
- use Credo.Check,
- id: "EX5026",
- base_priority: :high,
- elixir_version: ">= 1.14.0-dev",
- explanations: [
- check: """
- Calls to dbg/0 and dbg/2 should mostly be used during debugging sessions.
-
- This check warns about those calls, because they probably have been committed
- in error.
- """
- ]
-
- @call_string "dbg"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {:dbg, meta, []} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(
- {:dbg, meta, [_single_param]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(
- {:dbg, meta, [_first_param, _second_param]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:"Elixir", :Kernel]}, :dbg]}, meta, _args} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:Kernel]}, :dbg]}, meta, _args} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta) do
- [issue_for(issue_meta, meta[:line], @call_string) | issues]
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "There should be no calls to dbg.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/expensive_empty_enum_check.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/expensive_empty_enum_check.ex
deleted file mode 100644
index a79b1edf..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/expensive_empty_enum_check.ex
+++ /dev/null
@@ -1,83 +0,0 @@
-defmodule Credo.Check.Warning.ExpensiveEmptyEnumCheck do
- use Credo.Check,
- id: "EX5003",
- base_priority: :high,
- explanations: [
- # TODO: improve checkdoc
- check: """
- Checking if the size of the enum is `0` can be very expensive, since you are
- determining the exact count of elements.
-
- Checking if an enum is empty should be done by using
-
- Enum.empty?(enum)
-
- or
-
- list == []
-
-
- For Enum.count/2: Checking if an enum doesn't contain specific elements should
- be done by using
-
- not Enum.any?(enum, condition)
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- @enum_count_pattern quote do: {
- {:., _, [{:__aliases__, _, [:Enum]}, :count]},
- _,
- _
- }
- @length_pattern quote do: {:length, _, [_]}
- @comparisons [
- {@enum_count_pattern, 0},
- {0, @enum_count_pattern},
- {@length_pattern, 0},
- {0, @length_pattern}
- ]
- @operators [:==, :===]
-
- for {lhs, rhs} <- @comparisons,
- operator <- @operators do
- defp traverse(
- {unquote(operator), meta, [unquote(lhs), unquote(rhs)]} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta, ast)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta, ast) do
- [issue_for(issue_meta, meta[:line], Macro.to_string(ast), suggest(ast)) | issues]
- end
-
- defp suggest({_op, _, [0, {_pattern, _, args}]}), do: suggest_for_arity(Enum.count(args))
- defp suggest({_op, _, [{_pattern, _, args}, 0]}), do: suggest_for_arity(Enum.count(args))
-
- defp suggest_for_arity(2), do: "`not Enum.any?/2`"
- defp suggest_for_arity(1), do: "Enum.empty?/1 or list == []"
-
- defp issue_for(issue_meta, line_no, trigger, suggestion) do
- format_issue(
- issue_meta,
- message: "#{trigger} is expensive. Prefer #{suggestion}",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/forbidden_module.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/forbidden_module.ex
deleted file mode 100644
index ebedd116..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/forbidden_module.ex
+++ /dev/null
@@ -1,104 +0,0 @@
-defmodule Credo.Check.Warning.ForbiddenModule do
- use Credo.Check,
- id: "EX5004",
- base_priority: :high,
- category: :warning,
- param_defaults: [modules: []],
- explanations: [
- check: """
- Some modules that are included by a package may be hazardous
- if used by your application. Use this check to allow these modules in
- your dependencies but forbid them to be used in your application.
-
- Examples:
-
- The `:ecto_sql` package includes the `Ecto.Adapters.SQL` module,
- but direct usage of the `Ecto.Adapters.SQL.query/4` function, and related functions, may
- cause issues when using Ecto's dynamic repositories.
- """,
- params: [
- modules: "List of modules or `{Module, \"Error message\"}` tuples that must not be used."
- ]
- ]
-
- alias Credo.Code.Name
-
- @impl Credo.Check
- def run(%SourceFile{} = source_file, params) do
- modules = Params.get(params, :modules, __MODULE__)
-
- modules =
- if Keyword.keyword?(modules) do
- Enum.map(modules, fn {key, value} -> {Name.full(key), value} end)
- else
- Enum.map(modules, fn key -> {Name.full(key), nil} end)
- end
-
- Credo.Code.prewalk(
- source_file,
- &traverse(&1, &2, modules, IssueMeta.for(source_file, params))
- )
- end
-
- defp traverse({:__aliases__, meta, modules} = ast, issues, forbidden_modules, issue_meta) do
- module = Name.full(modules)
-
- issues = put_issue_if_forbidden(issues, issue_meta, meta[:line], module, forbidden_modules)
-
- {ast, issues}
- end
-
- defp traverse(
- {:alias, _meta, [{{_, _, [{:__aliases__, _opts, base_alias}, :{}]}, _, aliases}]} = ast,
- issues,
- forbidden_modules,
- issue_meta
- ) do
- modules =
- Enum.map(aliases, fn {:__aliases__, meta, module} ->
- {Name.full([base_alias, module]), meta[:line]}
- end)
-
- issues =
- Enum.reduce(modules, issues, fn {module, line}, issues ->
- put_issue_if_forbidden(issues, issue_meta, line, module, forbidden_modules)
- end)
-
- {ast, issues}
- end
-
- defp traverse(ast, issues, _, _), do: {ast, issues}
-
- defp put_issue_if_forbidden(issues, issue_meta, line_no, module, forbidden_modules) do
- forbidden_module_names = Enum.map(forbidden_modules, &elem(&1, 0))
-
- if found_module?(forbidden_module_names, module) do
- [issue_for(issue_meta, line_no, module, forbidden_modules) | issues]
- else
- issues
- end
- end
-
- defp found_module?(forbidden_module_names, module) do
- Enum.member?(forbidden_module_names, module)
- end
-
- defp issue_for(issue_meta, line_no, module, forbidden_modules) do
- trigger = Name.full(module)
- message = message(forbidden_modules, module) || "The `#{trigger}` module is not allowed."
-
- format_issue(
- issue_meta,
- message: message,
- trigger: trigger,
- line_no: line_no
- )
- end
-
- defp message(forbidden_modules, module) do
- Enum.find_value(forbidden_modules, fn
- {^module, message} -> message
- _ -> nil
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/iex_pry.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/iex_pry.ex
deleted file mode 100644
index 20544707..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/iex_pry.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Credo.Check.Warning.IExPry do
- use Credo.Check,
- id: "EX5005",
- base_priority: :high,
- explanations: [
- check: """
- While calls to IEx.pry might appear in some parts of production code,
- most calls to this function are added during debugging sessions.
-
- This check warns about those calls, because they might have been committed
- in error.
- """
- ]
-
- @call_string "IEx.pry"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {
- {:., _, [{:__aliases__, _, [:IEx]}, :pry]},
- meta,
- _arguments
- } = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta) do
- new_issue =
- format_issue(
- issue_meta,
- message: "There should be no calls to IEx.pry/0.",
- trigger: @call_string,
- line_no: meta[:line]
- )
-
- [new_issue | issues]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/io_inspect.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/io_inspect.ex
deleted file mode 100644
index 438f01ae..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/io_inspect.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-defmodule Credo.Check.Warning.IoInspect do
- use Credo.Check,
- id: "EX5006",
- base_priority: :high,
- explanations: [
- check: """
- While calls to IO.inspect might appear in some parts of production code,
- most calls to this function are added during debugging sessions.
-
- This check warns about those calls, because they might have been committed
- in error.
- """
- ]
-
- @call_string "IO.inspect"
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:"Elixir", :IO]}, :inspect]}, meta, _arguments} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:IO]}, :inspect]}, meta, _arguments} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta) do
- [issue_for(issue_meta, meta[:line], @call_string) | issues]
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "There should be no calls to IO.inspect/1.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/lazy_logging.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/lazy_logging.ex
deleted file mode 100644
index 9b24209d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/lazy_logging.ex
+++ /dev/null
@@ -1,119 +0,0 @@
-defmodule Credo.Check.Warning.LazyLogging do
- use Credo.Check,
- id: "EX5007",
- base_priority: :high,
- elixir_version: "< 1.7.0",
- param_defaults: [
- ignore: [:error, :warn, :info]
- ],
- explanations: [
- check: """
- Ensures laziness of Logger calls.
-
- You will want to wrap expensive logger calls into a zero argument
- function (`fn -> "string that gets logged" end`).
-
- Example:
-
- # preferred
-
- Logger.debug fn ->
- "This happened: \#{expensive_calculation(arg1, arg2)}"
- end
-
- # NOT preferred
- # the interpolation is executed whether or not the info is logged
-
- Logger.debug "This happened: \#{expensive_calculation(arg1, arg2)}"
- """,
- params: [
- ignore: "Do not raise an issue for these Logger calls."
- ]
- ]
-
- @logger_functions [:debug, :info, :warn, :error]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- # {, }
- state = {false, []}
-
- {_, issues} = Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta), state)
-
- issues
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:Logger]}, fun_name]}, meta, arguments} = ast,
- state,
- issue_meta
- )
- when fun_name in @logger_functions do
- issue = find_issue(fun_name, arguments, meta, issue_meta)
-
- {ast, add_issue_to_state(state, issue)}
- end
-
- defp traverse(
- {fun_name, meta, arguments} = ast,
- {true, _issues} = state,
- issue_meta
- )
- when fun_name in @logger_functions do
- issue = find_issue(fun_name, arguments, meta, issue_meta)
-
- {ast, add_issue_to_state(state, issue)}
- end
-
- defp traverse(
- {:import, _meta, arguments} = ast,
- {_module_contains_import?, issues} = state,
- _issue_meta
- ) do
- if logger_import?(arguments) do
- {ast, {true, issues}}
- else
- {ast, state}
- end
- end
-
- defp traverse(ast, state, _issue_meta) do
- {ast, state}
- end
-
- defp add_issue_to_state(state, nil), do: state
-
- defp add_issue_to_state({module_contains_import?, issues}, issue) do
- {module_contains_import?, [issue | issues]}
- end
-
- defp find_issue(fun_name, arguments, meta, issue_meta) do
- params = IssueMeta.params(issue_meta)
- ignored_functions = Params.get(params, :ignore, __MODULE__)
-
- unless Enum.member?(ignored_functions, fun_name) do
- issue_for_call(arguments, meta, issue_meta)
- end
- end
-
- defp issue_for_call([{:<<>>, _, [_ | _]} | _] = _args, meta, issue_meta) do
- issue_for(issue_meta, meta[:line])
- end
-
- defp issue_for_call(_args, _meta, _issue_meta) do
- nil
- end
-
- defp logger_import?([{:__aliases__, _meta, [:Logger]}]), do: true
- defp logger_import?(_), do: false
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Prefer lazy Logger calls.",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/leaky_environment.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/leaky_environment.ex
deleted file mode 100644
index cd327552..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/leaky_environment.ex
+++ /dev/null
@@ -1,79 +0,0 @@
-defmodule Credo.Check.Warning.LeakyEnvironment do
- use Credo.Check,
- id: "EX5008",
- base_priority: :high,
- tags: [:controversial],
- category: :warning,
- explanations: [
- check: """
- OS child processes inherit the environment of their parent process. This
- includes sensitive configuration parameters, such as credentials. To
- minimize the risk of such values leaking, clear or overwrite them when
- spawning executables.
-
- The functions `System.cmd/2` and `System.cmd/3` allow environment variables be cleared by
- setting their value to `nil`:
-
- System.cmd("env", [], env: %{"DB_PASSWORD" => nil})
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({{:., _loc, call}, meta, args} = ast, issues, issue_meta) do
- case get_forbidden_call(call, args) do
- nil ->
- {ast, issues}
-
- bad ->
- {ast, issues_for_call(bad, meta, issue_meta, issues)}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:System]}, :cmd], [_, _]) do
- "System.cmd/2"
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:System]}, :cmd], [_, _, opts])
- when is_list(opts) do
- if Keyword.has_key?(opts, :env) do
- nil
- else
- "System.cmd/3"
- end
- end
-
- defp get_forbidden_call([:erlang, :open_port], [_, opts])
- when is_list(opts) do
- if Keyword.has_key?(opts, :env) do
- nil
- else
- ":erlang.open_port/2"
- end
- end
-
- defp get_forbidden_call(_, _) do
- nil
- end
-
- defp issues_for_call(call, meta, issue_meta, issues) do
- options = [
- message: "When using #{call}, clear or overwrite sensitive environment variables",
- trigger: call,
- line_no: meta[:line]
- ]
-
- [format_issue(issue_meta, options) | issues]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/map_get_unsafe_pass.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/map_get_unsafe_pass.ex
deleted file mode 100644
index f8dd6375..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/map_get_unsafe_pass.ex
+++ /dev/null
@@ -1,92 +0,0 @@
-defmodule Credo.Check.Warning.MapGetUnsafePass do
- use Credo.Check,
- id: "EX5009",
- base_priority: :normal,
- tags: [:controversial],
- explanations: [
- check: """
- `Map.get/2` can lead into runtime errors if the result is passed into a pipe
- without a proper default value. This happens when the next function in the
- pipe cannot handle `nil` values correctly.
-
- Example:
-
- %{foo: [1, 2 ,3], bar: [4, 5, 6]}
- |> Map.get(:missing_key)
- |> Enum.each(&IO.puts/1)
-
- This will cause a `Protocol.UndefinedError`, since `nil` isn't `Enumerable`.
- Often times while iterating over enumerables zero iterations is preferable
- to being forced to deal with an exception. Had there been a `[]` default
- parameter this could have been averted.
-
- If you are sure the value exists and can't be nil, please use `Map.fetch!/2`.
- If you are not sure, `Map.get/3` can help you provide a safe default value.
- """
- ]
-
- @call_string "Map.get"
- @unsafe_modules [:Enum]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:|>, _meta, _args} = ast, issues, issue_meta) do
- pipe_issues =
- ast
- |> Macro.unpipe()
- |> Enum.with_index()
- |> find_pipe_issues(issue_meta)
-
- {ast, issues ++ pipe_issues}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp find_pipe_issues(pipe, issue_meta) do
- pipe
- |> Enum.reduce([], fn {expr, idx}, acc ->
- required_length = required_argument_length(idx)
- {next_expr, _} = Enum.at(pipe, idx + 1, {nil, nil})
-
- case {expr, nil_safe?(next_expr)} do
- {{{{:., meta, [{_, _, [:Map]}, :get]}, _, args}, _}, false}
- when length(args) != required_length ->
- acc ++ [issue_for(issue_meta, meta[:line], @call_string)]
-
- _ ->
- acc
- end
- end)
- end
-
- defp required_argument_length(idx) when idx == 0, do: 3
- defp required_argument_length(_), do: 2
-
- defp nil_safe?(expr) do
- case expr do
- {{{:., _, [{_, _, [module]}, _]}, _, _}, _} ->
- !(module in @unsafe_modules)
-
- _ ->
- true
- end
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "Map.get with no default return value is potentially unsafe
- in pipes, use Map.get/3 instead",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/missed_metadata_key_in_logger_config.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/missed_metadata_key_in_logger_config.ex
deleted file mode 100644
index e892011f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/missed_metadata_key_in_logger_config.ex
+++ /dev/null
@@ -1,154 +0,0 @@
-defmodule Credo.Check.Warning.MissedMetadataKeyInLoggerConfig do
- use Credo.Check,
- id: "EX5027",
- base_priority: :high,
- category: :warning,
- param_defaults: [
- metadata_keys: []
- ],
- explanations: [
- check: """
- Ensures custom metadata keys are included in logger config
-
- Note that all metadata is optional and may not always be available.
-
- For example, you might wish to include a custom `:error_code` metadata in your logs:
-
- Logger.error("We have a problem", [error_code: :pc_load_letter])
-
- In your app's logger configuration, you would need to include the `:error_code` key:
-
- config :logger, :console,
- format: "[$level] $message $metadata\n",
- metadata: [:error_code, :file]
-
- That way your logs might then receive lines like this:
-
- [error] We have a problem error_code=pc_load_letter file=lib/app.ex
- """,
- params: [
- ignore_logger_functions: "Do not raise an issue for these Logger functions.",
- metadata_keys: """
- Do not raise an issue for these Logger metadata keys.
-
- By default, we assume the metadata keys listed under your `console`
- backend.
- """
- ]
- ]
-
- @logger_functions ~w(alert critical debug emergency error info notice warn warning metadata log)a
-
- @doc false
- @impl Credo.Check
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- state = {false, []}
-
- {_, issues} = Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta), state)
-
- issues
- end
-
- defp traverse(
- {{:., _, [{:__aliases__, _, [:Logger]}, fun_name]}, meta, arguments} = ast,
- state,
- issue_meta
- )
- when fun_name in @logger_functions do
- issue = find_issue(fun_name, arguments, meta, issue_meta)
-
- {ast, add_issue_to_state(state, issue)}
- end
-
- defp traverse(
- {fun_name, meta, arguments} = ast,
- {true, _issues} = state,
- issue_meta
- )
- when fun_name in @logger_functions do
- issue = find_issue(fun_name, arguments, meta, issue_meta)
-
- {ast, add_issue_to_state(state, issue)}
- end
-
- defp traverse(
- {:import, _meta, arguments} = ast,
- {_module_contains_import?, issues} = state,
- _issue_meta
- ) do
- if logger_import?(arguments) do
- {ast, {true, issues}}
- else
- {ast, state}
- end
- end
-
- defp traverse(ast, state, _issue_meta) do
- {ast, state}
- end
-
- defp add_issue_to_state(state, nil), do: state
-
- defp add_issue_to_state({module_contains_import?, issues}, issue) do
- {module_contains_import?, [issue | issues]}
- end
-
- defp find_issue(fun_name, arguments, meta, issue_meta) do
- params = IssueMeta.params(issue_meta)
- metadata_keys = find_metadata_keys(params)
-
- issue_for_call(fun_name, arguments, meta, issue_meta, metadata_keys)
- end
-
- defp issue_for_call(:metadata, [logger_metadata], meta, issue_meta, metadata_keys) do
- issue_for_call(logger_metadata, meta, issue_meta, metadata_keys)
- end
-
- defp issue_for_call(:log, [_, _, logger_metadata], meta, issue_meta, metadata_keys) do
- issue_for_call(logger_metadata, meta, issue_meta, metadata_keys)
- end
-
- defp issue_for_call(:log, _args, _meta, _issue_meta, _metadata_keys) do
- nil
- end
-
- defp issue_for_call(_fun_name, [_, logger_metadata] = _args, meta, issue_meta, metadata_keys) do
- issue_for_call(logger_metadata, meta, issue_meta, metadata_keys)
- end
-
- defp issue_for_call(_fun_name, _args, _meta, _issue_meta, _metadata_keys) do
- nil
- end
-
- defp issue_for_call(logger_metadata, meta, issue_meta, metadata_keys) do
- if Keyword.keyword?(logger_metadata) do
- case Keyword.drop(logger_metadata, metadata_keys) do
- [] ->
- nil
-
- missed ->
- issue_for(issue_meta, meta[:line], Keyword.keys(missed))
- end
- end
- end
-
- defp logger_import?([{:__aliases__, _meta, [:Logger]}]), do: true
- defp logger_import?(_), do: false
-
- defp issue_for(issue_meta, line_no, missed_keys) do
- message = "Logger metadata key #{Enum.join(missed_keys, ", ")} will be ignored in production"
-
- format_issue(issue_meta, message: message, line_no: line_no)
- end
-
- defp find_metadata_keys(params) do
- metadata_keys = Params.get(params, :metadata_keys, __MODULE__)
-
- if metadata_keys == [] do
- :logger |> Application.get_env(:console, []) |> Keyword.get(:metadata, [])
- else
- metadata_keys
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/mix_env.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/mix_env.ex
deleted file mode 100644
index 325b848c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/mix_env.ex
+++ /dev/null
@@ -1,93 +0,0 @@
-defmodule Credo.Check.Warning.MixEnv do
- use Credo.Check,
- id: "EX5010",
- base_priority: :high,
- param_defaults: [excluded_paths: []],
- explanations: [
- check: """
- Mix is a build tool and, as such, it is not expected to be available in production.
- Therefore, it is recommended to access Mix.env only in configuration files and inside
- mix.exs, never in your application code (lib).
-
- (from the Elixir docs)
- """,
- params: [
- excluded_paths: "List of paths or regex to exclude from this check"
- ]
- ]
-
- alias Credo.SourceFile
-
- @call_string "Mix.env"
- @def_ops [:def, :defp, :defmacro]
-
- @doc false
- def run(%SourceFile{filename: filename} = source_file, params \\ []) do
- excluded_paths = Params.get(params, :excluded_paths, __MODULE__)
-
- case ignore_path?(source_file.filename, excluded_paths) do
- true ->
- []
-
- false ->
- issue_meta = IssueMeta.for(source_file, params)
-
- filename
- |> Path.extname()
- |> case do
- ".exs" -> []
- _ -> Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
- end
- end
-
- # Check if analyzed module path is within ignored paths
- defp ignore_path?(filename, excluded_paths) do
- directory = Path.dirname(filename)
-
- Enum.any?(excluded_paths, &matches?(directory, &1))
- end
-
- defp matches?(directory, %Regex{} = regex), do: Regex.match?(regex, directory)
- defp matches?(directory, path) when is_binary(path), do: String.starts_with?(directory, path)
-
- for op <- @def_ops do
- # catch variables named e.g. `defp`
- defp traverse({unquote(op), _, nil} = ast, issues, _issue_meta, _parens?) do
- {ast, issues}
- end
-
- defp traverse({unquote(op), _, _body} = ast, issues, issue_meta) do
- {ast, issues ++ Credo.Code.prewalk(ast, &traverse_defs(&1, &2, issue_meta))}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp traverse_defs(
- {{:., _, [{:__aliases__, _, [:Mix]}, :env]}, meta, _arguments} = ast,
- issues,
- issue_meta
- ) do
- {ast, issues_for_call(meta, issues, issue_meta)}
- end
-
- defp traverse_defs(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issues_for_call(meta, issues, issue_meta) do
- [issue_for(issue_meta, meta[:line], @call_string) | issues]
- end
-
- defp issue_for(issue_meta, line_no, trigger) do
- format_issue(
- issue_meta,
- message: "There should be no calls to Mix.env in application code.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_on_same_values.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_on_same_values.ex
deleted file mode 100644
index 6d2d98f3..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_on_same_values.ex
+++ /dev/null
@@ -1,100 +0,0 @@
-defmodule Credo.Check.Warning.OperationOnSameValues do
- use Credo.Check,
- id: "EX5011",
- base_priority: :high,
- explanations: [
- check: """
- Operations on the same values always yield the same result and therefore make
- little sense in production code.
-
- Examples:
-
- x == x # always returns true
- x <= x # always returns true
- x >= x # always returns true
- x != x # always returns false
- x > x # always returns false
- y / y # always returns 1
- y - y # always returns 0
-
- In practice they are likely the result of a debugging session or were made by
- mistake.
- """
- ]
-
- @def_ops [:def, :defp, :defmacro]
- @ops ~w(== >= <= != > < / -)a
- @ops_and_constant_results [
- {:==, "Comparison", true},
- {:>=, "Comparison", true},
- {:<=, "Comparison", true},
- {:!=, "Comparison", false},
- {:>, "Comparison", false},
- {:<, "Comparison", false},
- {:/, "Operation", 1},
- {:-, "Operation", 0}
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- for op <- @def_ops do
- # exclude def arguments for operators
- defp traverse(
- {unquote(op), _meta, [{op, _, _} | rest]},
- issues,
- _issue_meta
- )
- when op in @ops do
- {rest, issues}
- end
- end
-
- for {op, operation_name, constant_result} <- @ops_and_constant_results do
- defp traverse({unquote(op), meta, [lhs, rhs]} = ast, issues, issue_meta) do
- if variable_or_mod_attribute?(lhs) &&
- Credo.Code.remove_metadata(lhs) == Credo.Code.remove_metadata(rhs) do
- new_issue =
- issue_for(
- issue_meta,
- meta[:line],
- unquote(op),
- unquote(operation_name),
- unquote(constant_result)
- )
-
- {ast, issues ++ [new_issue]}
- else
- {ast, issues}
- end
- end
- end
-
- defp variable_or_mod_attribute?({atom, _meta, nil}) when is_atom(atom), do: true
- defp variable_or_mod_attribute?({:@, _meta, list}) when is_list(list), do: true
- defp variable_or_mod_attribute?(_), do: false
-
- # exclude @spec definitions
- defp traverse({:@, _meta, [{:spec, _, _} | _]}, issues, _issue_meta) do
- {nil, issues}
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger, operation, constant_result) do
- format_issue(
- issue_meta,
- message: "#{operation} will always return #{constant_result}.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_with_constant_result.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_with_constant_result.ex
deleted file mode 100644
index 898688eb..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/operation_with_constant_result.ex
+++ /dev/null
@@ -1,68 +0,0 @@
-defmodule Credo.Check.Warning.OperationWithConstantResult do
- use Credo.Check,
- id: "EX5012",
- base_priority: :high,
- explanations: [
- check: """
- Some numerical operations always yield the same result and therefore make
- little sense in production code.
-
- Examples:
-
- x * 1 # always returns x
- x * 0 # always returns 0
-
- In practice they are likely the result of a debugging session or were made by
- mistake.
- """
- ]
-
- @ops_and_constant_results [
- {:*, "zero", 0},
- {:*, "the left side of the expression", 1}
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # skip references to functions
- defp traverse({:&, _, _}, issues, _) do
- {nil, issues}
- end
-
- for {op, constant_result, operand} <- @ops_and_constant_results do
- defp traverse(
- {unquote(op), meta, [_lhs, unquote(operand)]} = ast,
- issues,
- issue_meta
- ) do
- new_issue =
- issue_for(
- issue_meta,
- meta[:line],
- unquote(op),
- unquote(constant_result)
- )
-
- {ast, issues ++ [new_issue]}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp issue_for(issue_meta, line_no, trigger, constant_result) do
- format_issue(
- issue_meta,
- message: "Operation will always return #{constant_result}.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/raise_inside_rescue.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/raise_inside_rescue.ex
deleted file mode 100644
index e74f7a50..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/raise_inside_rescue.ex
+++ /dev/null
@@ -1,90 +0,0 @@
-defmodule Credo.Check.Warning.RaiseInsideRescue do
- use Credo.Check,
- id: "EX5013",
- explanations: [
- check: """
- Using `Kernel.raise` inside of a `rescue` block creates a new stacktrace.
-
- Most of the time, this is not what you want to do since it obscures the cause of the original error.
-
- Example:
-
- # preferred
-
- try do
- raise "oops"
- rescue
- error ->
- Logger.warn("An exception has occurred")
-
- reraise error, System.stacktrace
- end
-
- # NOT preferred
-
- try do
- raise "oops"
- rescue
- error ->
- Logger.warn("An exception has occurred")
-
- raise error
- end
- """
- ]
-
- alias Credo.Code.Block
-
- @def_ops [:def, :defp, :defmacro, :defmacrop]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- # TODO: consider for experimental check front-loader (ast)
- defp traverse({:try, _meta, _arguments} = ast, issues, issue_meta) do
- case Block.rescue_block_for(ast) do
- {:ok, ast} ->
- issues_found = Credo.Code.prewalk(ast, &find_issues(&1, &2, issue_meta))
-
- {ast, issues ++ issues_found}
-
- _ ->
- {ast, issues}
- end
- end
-
- defp traverse(
- {op, _meta, [_def, [do: _do, rescue: rescue_block]]},
- issues,
- issue_meta
- )
- when op in @def_ops do
- issues_found = Credo.Code.prewalk(rescue_block, &find_issues(&1, &2, issue_meta))
-
- {rescue_block, issues ++ issues_found}
- end
-
- defp traverse(ast, issues, _issue_meta), do: {ast, issues}
-
- defp find_issues({:raise, meta, _arguments} = ast, issues, issue_meta) do
- issue = issue_for(issue_meta, meta[:line])
-
- {ast, issues ++ [issue]}
- end
-
- defp find_issues(ast, issues, _), do: {ast, issues}
-
- defp issue_for(issue_meta, line_no) do
- format_issue(
- issue_meta,
- message: "Use `reraise` inside a rescue block to preserve the original stacktrace.",
- trigger: "raise",
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/spec_with_struct.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/spec_with_struct.ex
deleted file mode 100644
index 322f80e9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/spec_with_struct.ex
+++ /dev/null
@@ -1,64 +0,0 @@
-defmodule Credo.Check.Warning.SpecWithStruct do
- use Credo.Check,
- id: "EX5014",
- base_priority: :normal,
- category: :warning,
- explanations: [
- check: """
- Structs create compile-time dependencies between modules. Using a struct in a spec
- will cause the module to be recompiled whenever the struct's module changes.
-
- It is preferable to define and use `MyModule.t()` instead of `%MyModule{}` in specs.
-
- Example:
-
- # preferred
- @spec a_function(MyModule.t()) :: any
-
- # NOT preferred
- @spec a_function(%MyModule{}) :: any
- """
- ]
-
- alias Credo.Code.Name
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:@, meta, [{:spec, _, args}]}, issues, issue_meta) do
- case Macro.prewalk(args, [], &find_structs/2) do
- {ast, []} ->
- {ast, issues}
-
- {ast, structs} ->
- issues =
- Enum.reduce(structs, issues, fn curr, acc ->
- options = [
- message: "Struct %#{curr}{} found in @spec",
- trigger: "%#{curr}{}",
- line_no: meta[:line]
- ]
-
- [format_issue(issue_meta, options) | acc]
- end)
-
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp find_structs({:%, _, [{:__aliases__, _, _} = aliases | _]} = ast, acc) do
- {ast, [Name.full(aliases) | acc]}
- end
-
- defp find_structs(ast, acc) do
- {ast, acc}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_exec.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_exec.ex
deleted file mode 100644
index 5dddac61..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_exec.ex
+++ /dev/null
@@ -1,76 +0,0 @@
-defmodule Credo.Check.Warning.UnsafeExec do
- use Credo.Check,
- id: "EX5015",
- base_priority: :high,
- category: :warning,
- explanations: [
- check: """
- Spawning external commands can lead to command injection vulnerabilities.
-
- Use a safe API where arguments are passed as an explicit list, rather
- than unsafe APIs that run a shell to parse the arguments from a single
- string.
-
- Safe APIs include:
-
- * `System.cmd/2,3`
- * `:erlang.open_port/2`, passing `{:spawn_executable, file_name}` as the
- first parameter, and any arguments using the `:args` option
-
- Unsafe APIs include:
-
- * `:os.cmd/1,2`
- * `:erlang.open_port/2`, passing `{:spawn, command}` as the first
- parameter
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({{:., _loc, call}, meta, args} = ast, issues, issue_meta) do
- case get_forbidden_call(call, args) do
- {bad, suggestion} ->
- {ast, issues_for_call(bad, suggestion, meta, issue_meta, issues)}
-
- nil ->
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp get_forbidden_call([:os, :cmd], [_]) do
- {":os.cmd/1", "System.cmd/2,3"}
- end
-
- defp get_forbidden_call([:os, :cmd], [_, _]) do
- {":os.cmd/2", "System.cmd/2,3"}
- end
-
- defp get_forbidden_call([:erlang, :open_port], [{:spawn, _}, _]) do
- {":erlang.open_port/2 with `:spawn`", ":erlang.open_port/2 with `:spawn_executable`"}
- end
-
- defp get_forbidden_call(_, _) do
- nil
- end
-
- defp issues_for_call(call, suggestion, meta, issue_meta, issues) do
- options = [
- message: "Prefer #{suggestion} over #{call} to prevent command injection",
- trigger: call,
- line_no: meta[:line]
- ]
-
- [format_issue(issue_meta, options) | issues]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_to_atom.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_to_atom.ex
deleted file mode 100644
index 2f7c0dc7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unsafe_to_atom.ex
+++ /dev/null
@@ -1,151 +0,0 @@
-defmodule Credo.Check.Warning.UnsafeToAtom do
- use Credo.Check,
- id: "EX5016",
- base_priority: :high,
- category: :warning,
- tags: [:controversial],
- explanations: [
- check: """
- Creating atoms from unknown or external sources dynamically is a potentially
- unsafe operation because atoms are not garbage-collected by the runtime.
-
- Creating an atom from a string or charlist should be done by using
-
- String.to_existing_atom(string)
-
- or
-
- List.to_existing_atom(charlist)
-
- Module aliases should be constructed using
-
- Module.safe_concat(prefix, suffix)
-
- or
-
- Module.safe_concat([prefix, infix, suffix])
-
- Jason.decode/Jason.decode! should be called using `keys: :atoms!` (*not* `keys: :atoms`):
-
- Jason.decode(str, keys: :atoms!)
-
- or `:keys` should be omitted (which defaults to `:strings`):
-
- Jason.decode(str)
-
- """
- ]
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- issue_meta = IssueMeta.for(source_file, params)
-
- Credo.Code.prewalk(source_file, &traverse(&1, &2, issue_meta))
- end
-
- defp traverse({:@, _, _}, issues, _) do
- {nil, issues}
- end
-
- defp traverse(
- {:|>, _meta1, [_lhs, {{:., _meta2, call}, meta, args}]} = ast,
- issues,
- issue_meta
- ) do
- case get_forbidden_pipe(call, args) do
- {bad, suggestion} ->
- {ast, issues_for_call(bad, suggestion, meta, issue_meta, issues)}
-
- nil ->
- {ast, issues}
- end
- end
-
- defp traverse({{:., _loc, call}, meta, args} = ast, issues, issue_meta) do
- case get_forbidden_call(call, args) do
- {bad, suggestion} ->
- {ast, issues_for_call(bad, suggestion, meta, issue_meta, issues)}
-
- nil ->
- {ast, issues}
- end
- end
-
- defp traverse(ast, issues, _issue_meta) do
- {ast, issues}
- end
-
- defp get_forbidden_call([:erlang, :list_to_atom], [_]) do
- {":erlang.list_to_atom/1", ":erlang.list_to_existing_atom/1"}
- end
-
- defp get_forbidden_call([:erlang, :binary_to_atom], [_, _]) do
- {":erlang.binary_to_atom/2", ":erlang.binary_to_existing_atom/2"}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:String]}, :to_atom], [_]) do
- {"String.to_atom/1", "String.to_existing_atom/1"}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:List]}, :to_atom], [_]) do
- {"List.to_atom/1", "List.to_existing_atom/1"}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:Module]}, :concat], [_]) do
- {"Module.concat/1", "Module.safe_concat/1"}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:Module]}, :concat], [_, _]) do
- {"Module.concat/2", "Module.safe_concat/2"}
- end
-
- defp get_forbidden_call([{:__aliases__, _, [:Jason]}, decode], args)
- when decode in [:decode, :decode!] do
- args
- |> Enum.any?(fn arg -> Keyword.keyword?(arg) and Keyword.get(arg, :keys) == :atoms end)
- |> if do
- {"Jason.#{decode}(..., keys: :atoms)", "Jason.#{decode}(..., keys: :atoms!)"}
- else
- nil
- end
- end
-
- defp get_forbidden_call(_, _) do
- nil
- end
-
- defp get_forbidden_pipe([:erlang, :list_to_atom], []) do
- {":erlang.list_to_atom/1", ":erlang.list_to_existing_atom/1"}
- end
-
- defp get_forbidden_pipe([:erlang, :binary_to_atom], [_]) do
- {":erlang.binary_to_atom/2", ":erlang.binary_to_existing_atom/2"}
- end
-
- defp get_forbidden_pipe([{:__aliases__, _, [:String]}, :to_atom], []) do
- {"String.to_atom/1", "String.to_existing_atom/1"}
- end
-
- defp get_forbidden_pipe([{:__aliases__, _, [:List]}, :to_atom], []) do
- {"List.to_atom/1", "List.to_existing_atom/1"}
- end
-
- defp get_forbidden_pipe([{:__aliases__, _, [:Module]}, :concat], []) do
- {"Module.concat/1", "Module.safe_concat/1"}
- end
-
- defp get_forbidden_pipe(_, _) do
- nil
- end
-
- defp issues_for_call(call, suggestion, meta, issue_meta, issues) do
- options = [
- message: "Prefer #{suggestion} over #{call} to avoid creating atoms at runtime",
- trigger: call,
- line_no: meta[:line]
- ]
-
- [format_issue(issue_meta, options) | issues]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_enum_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_enum_operation.ex
deleted file mode 100644
index 85a2a613..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_enum_operation.ex
+++ /dev/null
@@ -1,60 +0,0 @@
-defmodule Credo.Check.Warning.UnusedEnumOperation do
- use Credo.Check,
- id: "EX5017",
- base_priority: :high,
- explanations: [
- check: """
- With the exception of `Enum.each/2`, the result of a call to the
- Enum module's functions has to be used.
-
- While this is correct ...
-
- def prepend_my_username(my_username, usernames) do
- valid_usernames = Enum.reject(usernames, &is_nil/1)
-
- [my_username] ++ valid_usernames
- end
-
- ... we forgot to save the downcased username in this example:
-
- # This is bad because it does not modify the usernames variable!
-
- def prepend_my_username(my_username, usernames) do
- Enum.reject(usernames, &is_nil/1)
-
- [my_username] ++ valid_usernames
- end
-
- Since Elixir variables are immutable, Enum operations never work on the
- variable you pass in, but return a new variable which has to be used somehow
- (the exception being `Enum.each/2` which iterates a list and returns `:ok`).
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :Enum
- @funs_with_return_value ~w(
- all? any? at chunk chunk chunk_by concat concat count count dedup
- dedup_by drop drop_while empty? fetch fetch! filter filter_map
- find find_index find_value flat_map flat_map_reduce group_by
- intersperse into into join map map_join map_reduce max max_by
- member min min_by min_max min_max_by partition random reduce
- reduce_while reject reverse reverse reverse_slice scan
- scan shuffle slice slice sort sort sort_by split split_while
- sum take take_every take_random take_while to_list uniq uniq_by
- unzip with_index zip
- )a
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_file_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_file_operation.ex
deleted file mode 100644
index cf0ea917..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_file_operation.ex
+++ /dev/null
@@ -1,47 +0,0 @@
-defmodule Credo.Check.Warning.UnusedFileOperation do
- use Credo.Check,
- id: "EX5018",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the File module's functions has to be used.
-
- While this is correct ...
-
- def read_from_cwd(filename) do
- # TODO: use Path.join/2
- filename = File.cwd!() <> "/" <> filename
-
- File.read(filename)
- end
-
- ... we forgot to save the result in this example:
-
- def read_from_cwd(filename) do
- File.cwd!() <> "/" <> filename
-
- File.read(filename)
- end
-
- Since Elixir variables are immutable, many File operations don't work on the
- variable you pass in, but return a new variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :File
- @funs_with_return_value ~w(cwd cwd! dir? exists? read read! regular? stat stat!)a
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_function_return_helper.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_function_return_helper.ex
deleted file mode 100644
index 6b4cd1d8..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_function_return_helper.ex
+++ /dev/null
@@ -1,330 +0,0 @@
-defmodule Credo.Check.Warning.UnusedFunctionReturnHelper do
- @moduledoc false
-
- # Finds candidates and then postwalks the AST to either VERIFY or FALSIFY
- # the candidates (the acc is used to keep state).
-
- @def_ops [:def, :defp, :defmacro]
- @block_ops_with_head_expr [:if, :unless, :case, :for, :quote]
-
- alias Credo.Code.Block
- alias Credo.SourceFile
-
- def find_unused_calls(%SourceFile{} = source_file, _params, required_mod_list, fun_names) do
- Credo.Code.prewalk(source_file, &traverse_defs(&1, &2, required_mod_list, fun_names))
- end
-
- for op <- @def_ops do
- defp traverse_defs({unquote(op), _meta, arguments} = ast, acc, mod_list, fun_names)
- when is_list(arguments) do
- candidates = Credo.Code.prewalk(ast, &find_candidates(&1, &2, mod_list, fun_names))
-
- if Enum.any?(candidates) do
- {nil, acc ++ filter_unused_calls(ast, candidates)}
- else
- {ast, acc}
- end
- end
- end
-
- defp traverse_defs(ast, acc, _, _) do
- {ast, acc}
- end
-
- #
-
- defp find_candidates(
- {{:., _, [{:__aliases__, _, mods}, _fun_name]}, _, _} = ast,
- acc,
- required_mod_list,
- nil
- ) do
- if mods == required_mod_list do
- {ast, acc ++ [ast]}
- else
- {ast, acc}
- end
- end
-
- defp find_candidates(
- {{:., _, [{:__aliases__, _, mods}, fun_name]}, _, _} = ast,
- acc,
- required_mod_list,
- restrict_fun_names
- ) do
- if mods == required_mod_list and fun_name in restrict_fun_names do
- {ast, acc ++ [ast]}
- else
- {ast, acc}
- end
- end
-
- defp find_candidates(ast, acc, _, _) do
- {ast, acc}
- end
-
- #
-
- defp filter_unused_calls(ast, candidates) do
- candidates
- |> Enum.map(&detect_unused_call(&1, ast))
- |> Enum.reject(&is_nil/1)
- end
-
- defp detect_unused_call(candidate, ast) do
- ast
- |> Credo.Code.postwalk(&traverse_verify_candidate(&1, &2, candidate), :not_verified)
- |> verified_or_unused_call(candidate)
- end
-
- defp verified_or_unused_call(:VERIFIED, _), do: nil
- defp verified_or_unused_call(_, candidate), do: candidate
-
- #
-
- defp traverse_verify_candidate(ast, acc, candidate) do
- if Credo.Code.contains_child?(ast, candidate) do
- verify_candidate(ast, acc, candidate)
- else
- {ast, acc}
- end
- end
-
- # we know that `candidate` is part of `ast`
-
- for op <- @def_ops do
- defp verify_candidate({unquote(op), _, arguments} = ast, :not_verified = _acc, candidate)
- when is_list(arguments) do
- # IO.inspect(ast, label: "#{unquote(op)} (#{Macro.to_string(candidate)} #{acc})")
-
- if last_call_in_do_block?(ast, candidate) || last_call_in_rescue_block?(ast, candidate) ||
- last_call_in_catch_block?(ast, candidate) do
- {nil, :VERIFIED}
- else
- {nil, :FALSIFIED}
- end
- end
- end
-
- defp last_call_in_do_block?(ast, candidate) do
- ast
- |> Block.calls_in_do_block()
- |> List.last()
- |> Credo.Code.contains_child?(candidate)
- end
-
- defp last_call_in_rescue_block?(ast, candidate) do
- ast
- |> Block.calls_in_rescue_block()
- |> List.last()
- |> Credo.Code.contains_child?(candidate)
- end
-
- defp last_call_in_catch_block?(ast, candidate) do
- ast
- |> Block.calls_in_catch_block()
- |> List.last()
- |> Credo.Code.contains_child?(candidate)
- end
-
- for op <- @block_ops_with_head_expr do
- defp verify_candidate({unquote(op), _, arguments} = ast, :not_verified = acc, candidate)
- when is_list(arguments) do
- # IO.inspect(ast, label: "#{unquote(op)} (#{Macro.to_string(candidate)} #{acc})")
-
- head_expression = Enum.slice(arguments, 0..-2)
-
- if Credo.Code.contains_child?(head_expression, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
- end
-
- defp verify_candidate({:=, _, _} = ast, :not_verified = acc, candidate) do
- # IO.inspect(ast, label: ":= (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(ast, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- defp verify_candidate(
- {:__block__, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_list(arguments) do
- # IO.inspect(ast, label: ":__block__ /1 (#{Macro.to_string(candidate)} #{acc})")
-
- last_call = List.last(arguments)
-
- if Credo.Code.contains_child?(last_call, candidate) do
- {ast, acc}
- else
- {nil, :FALSIFIED}
- end
- end
-
- defp verify_candidate(
- {:|>, _, arguments} = ast,
- :not_verified = acc,
- candidate
- ) do
- # IO.inspect(ast, label: ":__block__ /2 (#{Macro.to_string(candidate)} #{acc})")
-
- last_call = List.last(arguments)
-
- if Credo.Code.contains_child?(last_call, candidate) do
- {ast, acc}
- else
- {nil, :VERIFIED}
- end
- end
-
- defp verify_candidate({:->, _, arguments} = ast, :not_verified = acc, _candidate)
- when is_list(arguments) do
- # IO.inspect(ast, label: ":-> (#{Macro.to_string(ast)} #{acc})")
-
- {ast, acc}
- end
-
- defp verify_candidate({:fn, _, arguments} = ast, :not_verified = acc, _candidate)
- when is_list(arguments) do
- {ast, acc}
- end
-
- defp verify_candidate(
- {:try, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_list(arguments) do
- # IO.inspect(ast, label: "try (#{Macro.to_string(candidate)} #{acc})")
-
- after_block = Block.after_block_for!(ast)
-
- if after_block && Credo.Code.contains_child?(after_block, candidate) do
- {nil, :FALSIFIED}
- else
- {ast, acc}
- end
- end
-
- # my_fun()
- defp verify_candidate(
- {fun_name, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_list(arguments) do
- # IO.inspect(ast, label: "my_fun() (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- # module.my_fun()
- defp verify_candidate(
- {{:., _, [{module, _, []}, fun_name]}, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_atom(module) and is_list(arguments) do
- # IO.inspect(ast, label: "Mod.fun() /1 (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- # :erlang_module.my_fun()
- defp verify_candidate(
- {{:., _, [module, fun_name]}, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_atom(module) and is_list(arguments) do
- # IO.inspect(ast, label: "Mod.fun() /2 (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- # MyModule.my_fun()
- defp verify_candidate(
- {{:., _, [{:__aliases__, _, mods}, fun_name]}, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_list(mods) and is_list(arguments) do
- # IO.inspect(ast, label: "Mod.fun() /3 (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- {:., [line: 3, column: 31],
- [
- {{:., [line: 3, column: 22],
- [{:__aliases__, [line: 3, column: 5], [:CredoSampleModule]}, :runner]},
- [line: 3, column: 23], []},
- :do_some_function
- ]}
-
- # module.my_fun()
- defp verify_candidate(
- {{:., _, [{module_variable, _, nil}, fun_name]}, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_atom(module_variable) and is_list(arguments) do
- # IO.inspect(ast, label: "Mod.fun() /4 (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- # get_module().my_fun()
- defp verify_candidate(
- {{:., _,
- [
- {{:., _, [{:__aliases__, _, [_ | _]}, _]}, _, []},
- fun_name
- ]}, _, arguments} = ast,
- :not_verified = acc,
- candidate
- )
- when is_atom(fun_name) and is_list(arguments) do
- # IO.inspect(ast, label: "Mod.fun() /5 (#{Macro.to_string(candidate)} #{acc})")
-
- if Credo.Code.contains_child?(arguments, candidate) do
- {nil, :VERIFIED}
- else
- {ast, acc}
- end
- end
-
- defp verify_candidate(ast, acc, _candidate) do
- # IO.inspect(ast, label: "_ (#{Macro.to_string(candidate)} #{acc})")
-
- {ast, acc}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_keyword_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_keyword_operation.ex
deleted file mode 100644
index ae6d3017..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_keyword_operation.ex
+++ /dev/null
@@ -1,50 +0,0 @@
-defmodule Credo.Check.Warning.UnusedKeywordOperation do
- use Credo.Check,
- id: "EX5019",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the Keyword module's functions has to be used.
-
- While this is correct ...
-
- def clean_and_verify_options!(keywords) do
- keywords = Keyword.delete(keywords, :debug)
-
- if Enum.length(keywords) == 0, do: raise "OMG!!!1"
-
- keywords
- end
-
- ... we forgot to save the result in this example:
-
- def clean_and_verify_options!(keywords) do
- Keyword.delete(keywords, :debug)
-
- if Enum.length(keywords) == 0, do: raise "OMG!!!1"
-
- keywords
- end
-
- Keyword operations never work on the variable you pass in, but return a new
- variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :Keyword
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_list_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_list_operation.ex
deleted file mode 100644
index 3fe15fe5..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_list_operation.ex
+++ /dev/null
@@ -1,46 +0,0 @@
-defmodule Credo.Check.Warning.UnusedListOperation do
- use Credo.Check,
- id: "EX5020",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the List module's functions has to be used.
-
- While this is correct ...
-
- def sort_usernames(usernames) do
- usernames = List.flatten(usernames)
-
- List.sort(usernames)
- end
-
- ... we forgot to save the result in this example:
-
- def sort_usernames(usernames) do
- List.flatten(usernames)
-
- List.sort(usernames)
- end
-
- List operations never work on the variable you pass in, but return a new
- variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :List
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_operation.ex
deleted file mode 100644
index b82a466f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_operation.ex
+++ /dev/null
@@ -1,49 +0,0 @@
-defmodule Credo.Check.Warning.UnusedOperation do
- # The result of a call to the provided module's functions has to be used.
-
- alias Credo.Check.Warning.UnusedFunctionReturnHelper
- alias Credo.IssueMeta
-
- @doc false
- def run(source_file, params \\ [], checked_module, funs_with_return_value, format_issue_fun) do
- issue_meta = IssueMeta.for(source_file, params)
-
- relevant_funs =
- if params[:ignore] do
- ignored_funs = List.wrap(params[:ignore])
-
- funs_with_return_value -- ignored_funs
- else
- funs_with_return_value
- end
-
- all_unused_calls =
- UnusedFunctionReturnHelper.find_unused_calls(
- source_file,
- params,
- [checked_module],
- relevant_funs
- )
-
- Enum.reduce(all_unused_calls, [], fn invalid_call, issues ->
- {_, meta, _} = invalid_call
-
- trigger =
- invalid_call
- |> Macro.to_string()
- |> String.split("(")
- |> List.first()
-
- issues ++ [issue_for(format_issue_fun, issue_meta, meta[:line], trigger, checked_module)]
- end)
- end
-
- defp issue_for(format_issue_fun, issue_meta, line_no, trigger, checked_module) do
- format_issue_fun.(
- issue_meta,
- message: "There should be no unused return values for #{checked_module} functions.",
- trigger: trigger,
- line_no: line_no
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_path_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_path_operation.ex
deleted file mode 100644
index 5795e134..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_path_operation.ex
+++ /dev/null
@@ -1,46 +0,0 @@
-defmodule Credo.Check.Warning.UnusedPathOperation do
- use Credo.Check,
- id: "EX5021",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the Path module's functions has to be used.
-
- While this is correct ...
-
- def read_from_cwd(filename) do
- filename = Path.join(cwd, filename)
-
- File.read(filename)
- end
-
- ... we forgot to save the result in this example:
-
- def read_from_cwd(filename) do
- Path.join(cwd, filename)
-
- File.read(filename)
- end
-
- Path operations never work on the variable you pass in, but return a new
- variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :Path
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_regex_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_regex_operation.ex
deleted file mode 100644
index d0f998fc..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_regex_operation.ex
+++ /dev/null
@@ -1,46 +0,0 @@
-defmodule Credo.Check.Warning.UnusedRegexOperation do
- use Credo.Check,
- id: "EX5022",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the Regex module's functions has to be used.
-
- While this is correct ...
-
- def extract_username_and_salute(regex, string) do
- [string] = Regex.run(regex, string)
-
- "Hi #\{string}"
- end
-
- ... we forgot to save the downcased username in this example:
-
- def extract_username_and_salute(regex, string) do
- Regex.run(regex, string)
-
- "Hi #\{string}"
- end
-
- Regex operations never work on the variable you pass in, but return a new
- variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :Regex
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_string_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_string_operation.ex
deleted file mode 100644
index 9d03f4c4..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_string_operation.ex
+++ /dev/null
@@ -1,48 +0,0 @@
-defmodule Credo.Check.Warning.UnusedStringOperation do
- use Credo.Check,
- id: "EX5023",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the String module's functions has to be used.
-
- While this is correct ...
-
- def salutation(username) do
- username = String.downcase(username)
-
- "Hi #\{username}"
- end
-
- ... we forgot to save the downcased username in this example:
-
- # This is bad because it does not modify the username variable!
-
- def salutation(username) do
- String.downcase(username)
-
- "Hi #\{username}"
- end
-
- Since Elixir variables are immutable, String operations never work on the
- variable you pass in, but return a new variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :String
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_tuple_operation.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_tuple_operation.ex
deleted file mode 100644
index abd188c1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/unused_tuple_operation.ex
+++ /dev/null
@@ -1,50 +0,0 @@
-defmodule Credo.Check.Warning.UnusedTupleOperation do
- use Credo.Check,
- id: "EX5024",
- base_priority: :high,
- explanations: [
- check: """
- The result of a call to the Tuple module's functions has to be used.
-
- While this is correct ...
-
- def remove_magic_item!(tuple) do
- tuple = Tuple.delete_at(tuple, 0)
-
- if Enum.length(tuple) == 0, do: raise "OMG!!!1"
-
- tuple
- end
-
- ... we forgot to save the result in this example:
-
- def remove_magic_item!(tuple) do
- Tuple.delete_at(tuple, 0)
-
- if Enum.length(tuple) == 0, do: raise "OMG!!!1"
-
- tuple
- end
-
- Tuple operations never work on the variable you pass in, but return a new
- variable which has to be used somehow.
- """
- ]
-
- alias Credo.Check.Warning.UnusedOperation
-
- @checked_module :Tuple
- @funs_with_return_value nil
-
- @doc false
- @impl true
- def run(%SourceFile{} = source_file, params) do
- UnusedOperation.run(
- source_file,
- params,
- @checked_module,
- @funs_with_return_value,
- &format_issue/2
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/wrong_test_file_extension.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/warning/wrong_test_file_extension.ex
deleted file mode 100644
index 9fa2abae..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/warning/wrong_test_file_extension.ex
+++ /dev/null
@@ -1,43 +0,0 @@
-defmodule Credo.Check.Warning.WrongTestFileExtension do
- use Credo.Check,
- id: "EX5025",
- base_priority: :high,
- param_defaults: [included: ["test/**/*_test.ex"]],
- explanations: [
- check: """
- Invoking mix test from the command line will run the tests in each file
- matching the pattern `*_test.exs` found in the test directory of your project.
-
- (from the `ex_unit` docs)
-
- This check ensures that test files are not ending with `.ex` (which would cause them to be skipped).
- """
- ]
-
- @test_files_with_ex_ending_regex ~r/test\/.*\/.*_test.ex$/
-
- alias Credo.SourceFile
-
- @doc false
- def run(%SourceFile{filename: filename} = source_file, params \\ []) do
- issue_meta = IssueMeta.for(source_file, params)
-
- if matches?(filename, @test_files_with_ex_ending_regex) do
- issue_meta
- |> issue_for()
- |> List.wrap()
- else
- []
- end
- end
-
- defp issue_for(issue_meta) do
- format_issue(
- issue_meta,
- message: "Test files should end with .exs"
- )
- end
-
- defp matches?(directory, path) when is_binary(path), do: String.starts_with?(directory, path)
- defp matches?(directory, %Regex{} = regex), do: Regex.match?(regex, directory)
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/check/worker.ex b/apps/plataforma_digital/deps/credo/lib/credo/check/worker.ex
deleted file mode 100644
index 1652e85e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/check/worker.ex
+++ /dev/null
@@ -1,126 +0,0 @@
-defmodule Credo.Check.Worker do
- @moduledoc false
-
- @doc """
- Runs all members of `workloads` using ``.
- """
- def run(workloads, max_concurrency, work_fn) do
- {:ok, server_pid} = GenServer.start_link(__MODULE__.Server, workloads)
-
- worker_context = %{
- runner_pid: self(),
- server_pid: server_pid,
- max_concurrency: max_concurrency,
- work_fn: work_fn,
- results: []
- }
-
- outer_loop(worker_context, 0)
- end
-
- @doc """
- Called when a workload has finished.
- """
- def send_workload_finished_to_runner(worker_context, _workload, result) do
- send(worker_context.runner_pid, {self(), {:workload_finished, result}})
- end
-
- defp outer_loop(worker_context, taken) do
- available = worker_context.max_concurrency - taken
-
- cond do
- available <= 0 ->
- wait_for_workload_finished(worker_context, taken)
-
- taken_workloads = __MODULE__.Server.take_workloads(worker_context.server_pid, available) ->
- inner_loop(worker_context, taken_workloads, taken)
-
- # we fall thru here if there are no checks left
- # there are two options: we are done ...
- taken == 0 ->
- {:ok, worker_context.results}
-
- # ... or we need for the very last batch to finish up
- true ->
- wait_for_workload_finished(worker_context, taken)
- end
- end
-
- defp wait_for_workload_finished(worker_context, taken) do
- receive do
- {_spawned_pid, {:workload_finished, result}} ->
- # IO.puts("Finished #{workload}")
- new_worker_context = %{worker_context | results: [result | worker_context.results]}
-
- outer_loop(new_worker_context, taken - 1)
- end
- end
-
- defp inner_loop(worker_context, [], taken) do
- outer_loop(worker_context, taken)
- end
-
- defp inner_loop(worker_context, [workload | rest], taken) do
- spawn_fn = fn ->
- result = worker_context.work_fn.(workload)
-
- send_workload_finished_to_runner(worker_context, workload, result)
- end
-
- spawn_link(spawn_fn)
-
- inner_loop(worker_context, rest, taken + 1)
- end
-
- defmodule Server do
- @moduledoc false
- @timeout :infinity
-
- use GenServer
-
- def take_workloads(pid, count) do
- GenServer.call(pid, {:take_workloads, count}, @timeout)
- end
-
- #
- # Server
- #
-
- @impl true
- def init(workloads) do
- state = %{
- waiting: nil,
- workloads: workloads
- }
-
- {:ok, state}
- end
-
- @impl true
- def handle_call({:take_workloads, count}, from, %{waiting: nil} = state) do
- {:noreply, take_workloads(%{state | waiting: {from, count}})}
- end
-
- defp take_workloads(%{waiting: nil} = state) do
- state
- end
-
- defp take_workloads(%{waiting: {from, _count}, workloads: []} = state) do
- GenServer.reply(from, nil)
-
- %{state | waiting: nil}
- end
-
- defp take_workloads(%{workloads: []} = state) do
- state
- end
-
- defp take_workloads(%{waiting: {from, count}, workloads: workloads} = state) do
- {reply, workloads} = Enum.split(workloads, count)
-
- GenServer.reply(from, reply)
-
- %{state | workloads: workloads, waiting: nil}
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli.ex
deleted file mode 100644
index f5c5b506..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-defmodule Credo.CLI do
- @moduledoc """
- `Credo.CLI` is the entrypoint for both the Mix task and the escript.
- """
-
- alias Credo.Execution
-
- @doc """
- Runs Credo with the given `argv` and exits the process.
-
- See `Credo.run/1` if you want to run Credo programmatically.
- """
- def main(argv \\ []) do
- Credo.Application.start(nil, nil)
-
- {options, _argv_rest, _errors} = OptionParser.parse(argv, strict: [watch: :boolean])
-
- if options[:watch] do
- run_to_watch(argv)
- else
- run_to_halt(argv)
- end
- end
-
- @doc false
- @deprecated "Use Credo.run/1 instead"
- def run(argv) do
- Credo.run(argv)
- end
-
- defp run_to_watch(argv) do
- Credo.Watcher.run(argv)
-
- receive do
- _ -> nil
- end
- end
-
- defp run_to_halt(argv) do
- argv
- |> Credo.run()
- |> halt_if_exit_status_assigned()
- end
-
- defp halt_if_exit_status_assigned(%Execution{mute_exit_status: true}) do
- # Skip if exit status is muted
- end
-
- defp halt_if_exit_status_assigned(exec) do
- exec
- |> Execution.get_exit_status()
- |> halt_if_failed()
- end
-
- defp halt_if_failed(0), do: nil
- defp halt_if_failed(exit_status), do: exit({:shutdown, exit_status})
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command.ex
deleted file mode 100644
index 95d73670..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command.ex
+++ /dev/null
@@ -1,171 +0,0 @@
-defmodule Credo.CLI.Command do
- @moduledoc """
- `Command` is used to describe commands which can be executed from the command line.
-
- The default command is `Credo.CLI.Command.Suggest.SuggestCommand`.
-
- A basic command that writes "Hello World" can be implemented like this:
-
- defmodule HelloWorldCommand do
- use Credo.CLI.Command
-
- alias Credo.CLI.Output.UI
-
- def call(_exec, _opts) do
- UI.puts([:yellow, "Hello ", :orange, "World"])
- end
- end
-
- """
-
- @typedoc false
- @type t :: module
-
- @doc """
- Is called when a Command is invoked.
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def call(exec) do
- IO.inspect(exec)
- end
- end
-
- The `call/1` functions receives an `exec` struct and must return a (modified) `Credo.Execution`.
- """
- @callback call(exec :: Credo.Execution.t()) :: Credo.Execution.t()
-
- @doc """
- Is called when a Command is initialized.
-
- The `init/1` functions receives an `exec` struct and must return a (modified) `Credo.Execution`.
-
- This can be used to initialize Execution pipelines for the current Command:
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def init(exec) do
- Execution.put_pipeline(exec, __MODULE__,
- run_my_thing: [
- {RunMySpecialThing, []}
- ],
- filter_results: [
- {FilterResults, []}
- ],
- print_results: [
- {PrintResultsAndSummary, []}
- ]
- )
- end
- end
- """
- @callback init(exec :: Credo.Execution.t()) :: Credo.Execution.t()
-
- @valid_use_opts [
- :short_description,
- :treat_unknown_args_as_files,
- :cli_switches
- ]
-
- @doc false
- defmacro __using__(opts \\ []) do
- Enum.each(opts, fn
- {key, _name} when key not in @valid_use_opts ->
- raise "Could not find key `#{key}` in #{inspect(@valid_use_opts)}"
-
- _ ->
- nil
- end)
-
- def_short_description =
- if opts[:short_description] do
- quote do
- @impl true
- def short_description, do: unquote(opts[:short_description])
- end
- end
-
- def_cli_switches =
- quote do
- @impl true
- def cli_switches do
- unquote(opts[:cli_switches])
- |> List.wrap()
- |> Enum.map(&Credo.CLI.Switch.ensure/1)
- end
- end
-
- def_treat_unknown_args_as_files =
- quote do
- @impl true
- def treat_unknown_args_as_files? do
- !!unquote(opts[:treat_unknown_args_as_files])
- end
- end
-
- quote do
- @before_compile Credo.CLI.Command
- @behaviour Credo.CLI.Command
-
- unquote(def_short_description)
- unquote(def_treat_unknown_args_as_files)
- unquote(def_cli_switches)
-
- @deprecated "Use Credo.Execution.Task.run/2 instead"
- defp run_task(exec, task), do: Credo.Execution.Task.run(task, exec)
-
- @doc false
- @impl true
- def init(exec), do: exec
-
- @doc false
- @impl true
- def call(exec), do: exec
-
- defoverridable init: 1
- defoverridable call: 1
- end
- end
-
- @doc false
- defmacro __before_compile__(env) do
- quote do
- unquote(deprecated_def_short_description(env))
- end
- end
-
- defp deprecated_def_short_description(env) do
- shortdoc = Module.get_attribute(env.module, :shortdoc)
-
- if is_nil(shortdoc) do
- if not Module.defines?(env.module, {:short_description, 0}) do
- quote do
- @impl true
- def short_description, do: nil
- end
- end
- else
- # deprecated - remove once we ditch @shortdoc
- if not Module.defines?(env.module, {:short_description, 0}) do
- quote do
- @impl true
- def short_description do
- @shortdoc
- end
- end
- end
- end
- end
-
- @doc "Runs the Command"
- @callback call(exec :: Credo.Execution.t(), opts :: list()) :: Credo.Execution.t()
-
- @doc "Returns a short, one-line description of what the command does"
- @callback short_description() :: String.t()
-
- @callback treat_unknown_args_as_files?() :: boolean()
-
- @callback cli_switches() :: [Map.t()]
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_command.ex
deleted file mode 100644
index 7e2e5e58..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_command.ex
+++ /dev/null
@@ -1,76 +0,0 @@
-defmodule Credo.CLI.Command.Categories.CategoriesCommand do
- @moduledoc false
-
- alias Credo.CLI.Command.Categories.CategoriesOutput
- alias Credo.CLI.Switch
-
- use Credo.CLI.Command,
- short_description: "Show and explain all issue categories",
- cli_switches: [
- Switch.string("format"),
- Switch.boolean("help", alias: :h)
- ]
-
- @categories [
- %{
- id: :readability,
- name: "readability",
- color: :blue,
- title: "Code Readability",
- description: """
- Readability checks do not concern themselves with the technical correctness
- of your code, but how easy it is to digest.
- """
- },
- %{
- id: :design,
- name: "design",
- color: :olive,
- title: "Software Design",
- description: """
- While refactor checks show you possible problems, these checks try to
- highlight possibilities, like - potentially intended - duplicated code or
- TODO and FIXME comments.
- """
- },
- %{
- id: :refactor,
- name: "refactor",
- color: :yellow,
- title: "Refactoring opportunities",
- description: """
- The Refactor checks show you opportunities to avoid future problems and
- technical debt.
- """
- },
- %{
- id: :warning,
- name: "warning",
- color: :red,
- title: "Warnings - please take a look",
- description: """
- These checks warn you about things that are potentially dangerous, like a
- missed call to `IEx.pry` you put in during a debugging session or a call
- to String.downcase without using the result.
- """
- },
- %{
- id: :consistency,
- name: "consistency",
- color: :cyan,
- title: "Consistency",
- description: """
- These checks take a look at your code and ensure a consistent coding style.
- Using tabs or spaces? Both is fine, just don't mix them or Credo will tell
- you.
- """
- }
- ]
-
- @doc false
- def call(exec, _opts) do
- CategoriesOutput.print_categories(exec, @categories)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_output.ex
deleted file mode 100644
index d00fff4e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/categories_output.ex
+++ /dev/null
@@ -1,13 +0,0 @@
-defmodule Credo.CLI.Command.Categories.CategoriesOutput do
- @moduledoc false
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Categories.Output.Default,
- json: Credo.CLI.Command.Categories.Output.Json
-
- def print_categories(exec, categories) do
- format_mod = format_mod(exec)
-
- format_mod.print(exec, categories)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/default.ex
deleted file mode 100644
index af515903..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/default.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Credo.CLI.Command.Categories.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
-
- def print(_exec, categories) do
- Enum.each(categories, &print_category/1)
- end
-
- defp print_category(%{color: color, title: title, description: text}) do
- term_width = Output.term_columns()
-
- UI.puts()
-
- [
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " #{title}" |> String.pad_trailing(term_width - 1)
- ]
- |> UI.puts()
-
- color
- |> UI.edge()
- |> UI.puts()
-
- text
- |> String.split("\n")
- |> Enum.each(&print_line(&1, color))
- end
-
- defp print_line(line, color) do
- [UI.edge(color), " ", :reset, line]
- |> UI.puts()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/json.ex
deleted file mode 100644
index 52eaaee9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/categories/output/json.ex
+++ /dev/null
@@ -1,9 +0,0 @@
-defmodule Credo.CLI.Command.Categories.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
-
- def print(_exec, categories) do
- JSON.print_map(%{categories: categories})
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_command.ex
deleted file mode 100644
index b8b3997a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_command.ex
+++ /dev/null
@@ -1,146 +0,0 @@
-defmodule Credo.CLI.Command.Diff.DiffCommand do
- @moduledoc false
-
- alias Credo.CLI.Command.Diff.DiffOutput
- alias Credo.CLI.Switch
- alias Credo.CLI.Task
- alias Credo.Execution
-
- alias Credo.CLI.Command.Diff.Task.FilterIssues
- alias Credo.CLI.Command.Diff.Task.FilterIssuesForExitStatus
- alias Credo.CLI.Command.Diff.Task.GetGitDiff
- alias Credo.CLI.Command.Diff.Task.PrintBeforeInfo
- alias Credo.CLI.Command.Diff.Task.PrintResultsAndSummary
-
- use Credo.CLI.Command,
- short_description: "Suggest code objects to look at next (based on git-diff)",
- treat_unknown_args_as_files: true,
- cli_switches:
- Credo.CLI.Command.Suggest.SuggestCommand.cli_switches() ++
- [
- Switch.string("from_dir"),
- Switch.string("from_git_ref"),
- Switch.string("from_git_merge_base"),
- Switch.boolean("show_fixed"),
- Switch.boolean("show_kept"),
- Switch.string("since")
- ]
-
- def init(exec) do
- Execution.put_pipeline(exec, "diff",
- load_and_validate_source_files: [
- {Task.LoadAndValidateSourceFiles, []}
- ],
- prepare_analysis: [
- {Task.PrepareChecksToRun, []}
- ],
- print_previous_analysis: [
- {GetGitDiff, []},
- {PrintBeforeInfo, []}
- ],
- run_analysis: [
- {Task.RunChecks, []}
- ],
- filter_issues: [
- {Task.SetRelevantIssues, []},
- {FilterIssues, []}
- ],
- print_after_analysis: [
- {PrintResultsAndSummary, []}
- ],
- filter_issues_for_exit_status: [
- {FilterIssuesForExitStatus, []}
- ]
- )
- end
-
- def call(%Execution{help: true} = exec, _opts), do: DiffOutput.print_help(exec)
- def call(exec, _opts), do: Execution.run_pipeline(exec, __MODULE__)
-
- def previous_ref(exec) do
- case exec.cli_options.switches do
- %{since: given_datetime} ->
- previous_ref_as_datetime(given_datetime) ||
- {:error, "given value is not a valid commit date: #{given_datetime}"}
-
- %{from_dir: given_dir} ->
- previous_ref_as_path(given_dir) ||
- {:error, "given value is not a local directory: #{given_dir}"}
-
- %{from_git_ref: given_git_ref} ->
- previous_ref_as_git_ref(given_git_ref) ||
- {:error, "given value is not a Git ref: #{given_git_ref}"}
-
- %{from_git_merge_base: given_git_merge_base} ->
- previous_ref_as_git_merge_base(given_git_merge_base) ||
- {:error, "given value is not a Git ref: #{given_git_merge_base}"}
-
- _ ->
- given_first_arg = List.first(exec.cli_options.args)
-
- previous_ref_from_first_arg(given_first_arg) ||
- {:error, "given ref is not a Git ref or local path: #{given_first_arg}"}
- end
- end
-
- defp previous_ref_from_first_arg(nil) do
- previous_ref_as_git_ref("HEAD")
- end
-
- defp previous_ref_from_first_arg(given_first_arg) do
- previous_ref_as_git_ref(given_first_arg) ||
- previous_ref_as_path(given_first_arg)
- end
-
- def previous_ref_as_datetime(potential_datetime) do
- if git_present?() do
- {:git_datetime, potential_datetime}
- else
- {:error, "could not run `git`"}
- end
- end
-
- def previous_ref_as_git_ref(potential_git_ref) do
- if git_present?() do
- if git_ref_exists?(potential_git_ref) do
- {:git, potential_git_ref}
- end
- else
- {:error, "could not run `git`"}
- end
- end
-
- def previous_ref_as_git_merge_base(potential_git_ref) do
- if git_present?() do
- if git_ref_exists?(potential_git_ref) do
- {:git_merge_base, potential_git_ref}
- end
- else
- {:error, "could not run `git`"}
- end
- end
-
- def previous_ref_as_path(potential_path) do
- if File.exists?(potential_path) do
- {:path, potential_path}
- else
- {:error, "could not find given path: #{potential_path}"}
- end
- end
-
- defp git_present? do
- case System.cmd("git", ["--help"], stderr_to_stdout: true) do
- {_output, 0} -> true
- {_output, _} -> false
- end
- rescue
- _ -> false
- end
-
- defp git_ref_exists?(git_ref) do
- case System.cmd("git", ["show", git_ref], stderr_to_stdout: true) do
- {_output, 0} -> true
- {_output, _} -> false
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_output.ex
deleted file mode 100644
index 814aa5cf..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_output.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Credo.CLI.Command.Diff.DiffOutput do
- @moduledoc false
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Diff.Output.Default,
- flycheck: Credo.CLI.Command.Diff.Output.FlyCheck,
- oneline: Credo.CLI.Command.Diff.Output.Oneline,
- json: Credo.CLI.Command.Diff.Output.Json
-
- alias Credo.CLI.Output.UI
-
- def print_help(exec) do
- usage = ["Usage: ", :olive, "mix credo diff [options]"]
-
- description = """
-
- Diffs objects against a point in Git's history.
- """
-
- example = [
- "Examples:\n",
- :olive,
- " $ mix credo diff v1.4.0\n",
- " $ mix credo diff main\n",
- " $ mix credo diff --from-git-ref HEAD --files-included \"lib/**/*.ex\""
- ]
-
- options =
- """
-
- Arrows (↑ ↗ → ↘ ↓) hint at the importance of an issue.
-
- Diff options:
- -a, --all Show all new issues
- -A, --all-priorities Show all new issues including low priority ones
- -c, --checks Only include checks that match the given strings
- --checks-with-tag Only include checks that match the given tag (can be used multiple times)
- --checks-without-tag Ignore checks that match the given tag (can be used multiple times)
- --config-file Use the given config file
- -C, --config-name Use the given config instead of "default"
- --enable-disabled-checks Re-enable disabled checks that match the given strings
- --files-included Only include these files (accepts globs, can be used multiple times)
- --files-excluded Exclude these files (accepts globs, can be used multiple times)
- --format Display the list in a specific format (json,flycheck,oneline)
- --from-dir Diff from the given directory
- --from-git-ref Diff from the given Git ref
- --from-git-merge-base Diff from where the current HEAD branched off from the given merge base
- -i, --ignore-checks Ignore checks that match the given strings
- --ignore Alias for --ignore-checks
- --min-priority Minimum priority to show issues (high,medium,normal,low,lower or number)
- --mute-exit-status Exit with status zero even if there are issues
- --only Alias for --checks
- --since Diff from the given point in time (using Git)
- --strict Alias for --all-priorities
-
- General options:
- --[no-]color Toggle colored output
- -v, --version Show version
- -h, --help Show this help
-
- Feedback:
- Open an issue here: https://github.com/rrrene/credo/issues
- """
- |> String.trim_trailing()
-
- UI.puts()
- UI.puts(usage)
- UI.puts(description)
- UI.puts(example)
- UI.puts(options)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_summary.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_summary.ex
deleted file mode 100644
index 644e1526..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/diff_summary.ex
+++ /dev/null
@@ -1,237 +0,0 @@
-defmodule Credo.CLI.Command.Diff.DiffSummary do
- @moduledoc false
-
- # This module is responsible for printing the summary at the end of the analysis.
-
- @category_wording [
- {:consistency, "consistency issue", "consistency issues"},
- {:warning, "warning", "warnings"},
- {:refactor, "refactoring opportunity", "refactoring opportunities"},
- {:readability, "code readability issue", "code readability issues"},
- {:design, "software design suggestion", "software design suggestions"}
- ]
- @cry_for_help "Please report incorrect results: https://github.com/rrrene/credo/issues"
-
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- def print(
- _source_files,
- %Execution{format: "flycheck"},
- _time_load,
- _time_run
- ) do
- nil
- end
-
- def print(_source_files, %Execution{format: "oneline"}, _time_load, _time_run) do
- nil
- end
-
- def print(source_files, exec, time_load, time_run) do
- issues = Execution.get_issues(exec)
- source_file_count = exec |> Execution.get_source_files() |> Enum.count()
- checks_count = count_checks(exec)
-
- git_ref = Execution.get_assign(exec, "credo.diff.previous_git_ref")
-
- UI.puts()
- UI.puts([:faint, @cry_for_help])
- UI.puts()
-
- UI.puts(format_time_spent(checks_count, source_file_count, time_load, time_run))
- UI.puts()
-
- new_issues = Enum.filter(issues, &(&1.diff_marker == :new))
- fixed_issues = Enum.filter(issues, &(&1.diff_marker == :fixed))
- old_issues = Enum.filter(issues, &(&1.diff_marker == :old))
-
- UI.puts([
- "Changes between ",
- :faint,
- :cyan,
- git_ref,
- :reset,
- " and working dir:"
- ])
-
- UI.puts()
- UI.puts(summary_parts_new(source_files, new_issues))
- UI.puts(summary_parts_fixed(source_files, fixed_issues))
- UI.puts(summary_parts_old(source_files, old_issues))
- UI.puts()
-
- print_priority_hint(exec)
- end
-
- defp count_checks(exec) do
- {result, _only_matching, _ignore_matching} = Execution.checks(exec)
-
- Enum.count(result)
- end
-
- defp print_priority_hint(%Execution{min_priority: min_priority})
- when min_priority >= 0 do
- UI.puts([
- :faint,
- "Showing priority issues: ↑ ↗ → (use `mix credo explain` to explain issues, `mix credo diff --help` for options)."
- ])
- end
-
- defp print_priority_hint(_) do
- UI.puts([
- :faint,
- "Use `mix credo explain` to explain issues, `mix credo diff --help` for options."
- ])
- end
-
- defp format_time_spent(check_count, source_file_count, time_load, time_run) do
- time_run = time_run |> div(10_000)
- time_load = time_load |> div(10_000)
-
- formatted_total = format_in_seconds(time_run + time_load)
-
- time_to_load = format_in_seconds(time_load)
- time_to_run = format_in_seconds(time_run)
-
- total_in_seconds =
- case formatted_total do
- "1.0" -> "1 second"
- value -> "#{value} seconds"
- end
-
- checks =
- if check_count == 1 do
- "1 check"
- else
- "#{check_count} checks"
- end
-
- source_files =
- if source_file_count == 1 do
- "1 file"
- else
- "#{source_file_count} files"
- end
-
- [
- :faint,
- "Analysis took #{total_in_seconds} ",
- "(#{time_to_load}s to load, #{time_to_run}s running #{checks} on #{source_files})"
- ]
- end
-
- defp format_in_seconds(t) do
- if t < 10 do
- "0.0#{t}"
- else
- t = div(t, 10)
- "#{div(t, 10)}.#{rem(t, 10)}"
- end
- end
-
- defp category_count(issues, category) do
- issues
- |> Enum.filter(&(&1.category == category))
- |> Enum.count()
- end
-
- defp summary_parts_new(_source_files, issues) do
- parts =
- @category_wording
- |> Enum.flat_map(&summary_part(&1, issues, "new "))
-
- parts =
- parts
- |> List.update_at(Enum.count(parts) - 1, fn last_part ->
- String.replace(last_part, ", ", "")
- end)
-
- parts =
- if Enum.empty?(parts) do
- "no issues"
- else
- parts
- end
-
- [
- :green,
- :bright,
- "+ ",
- :reset,
- :green,
- " added ",
- :reset,
- parts,
- ","
- ]
- end
-
- defp summary_parts_fixed(_source_files, issues) do
- parts =
- @category_wording
- |> Enum.flat_map(&summary_part(&1, issues))
-
- parts =
- parts
- |> List.update_at(Enum.count(parts) - 1, fn last_part ->
- String.replace(last_part, ", ", "")
- end)
-
- parts =
- if Enum.empty?(parts) do
- "no issues"
- else
- parts
- end
-
- [
- :faint,
- "✔ ",
- :reset,
- " fixed ",
- :faint,
- parts,
- ", and"
- ]
- end
-
- defp summary_parts_old(_source_files, issues) do
- parts =
- @category_wording
- |> Enum.flat_map(&summary_part(&1, issues))
- |> Enum.reject(&is_atom(&1))
-
- parts =
- parts
- |> List.update_at(Enum.count(parts) - 1, fn last_part ->
- String.replace(last_part, ", ", "")
- end)
-
- parts =
- if Enum.empty?(parts) do
- "no issues"
- else
- parts
- end
-
- [
- :faint,
- "~ ",
- " kept ",
- parts,
- "."
- ]
- end
-
- defp summary_part({category, singular, plural}, issues, qualifier \\ "") do
- color = Output.check_color(category)
-
- case category_count(issues, category) do
- 0 -> []
- 1 -> [color, "1 #{qualifier}#{singular}, "]
- x -> [color, "#{x} #{qualifier}#{plural}, "]
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/default.ex
deleted file mode 100644
index 154a23f6..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/default.ex
+++ /dev/null
@@ -1,473 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Command.Diff.DiffCommand
- alias Credo.CLI.Command.Diff.DiffSummary
- alias Credo.CLI.Filename
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.CLI.Sorter
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- @category_starting_order [:design, :readability, :refactor]
- @category_ending_order [:warning, :consistency, :custom, :unknown]
- @category_colors [
- design: :olive,
- readability: :blue,
- refactor: :yellow,
- warning: :red,
- consistency: :cyan
- ]
- @category_titles [
- design: "Software Design",
- readability: "Code Readability",
- refactor: "Refactoring opportunities",
- warning: "Warnings - please take a look",
- consistency: "Consistency"
- ]
- @many_source_files 60
- @per_category 5
- @indent 8
-
- @doc "Called before the analysis is run."
- def print_before_info(source_files, exec) do
- {_, git_ref_or_range} = DiffCommand.previous_ref(exec)
-
- case Enum.count(source_files) do
- 0 ->
- UI.puts("No files found!")
-
- 1 ->
- UI.puts([
- :faint,
- "Diffing 1 source file in working dir with ",
- :cyan,
- git_ref_or_range,
- :reset,
- :faint,
- " ..."
- ])
-
- count ->
- UI.puts([
- :faint,
- "Diffing #{count} source files in working dir with ",
- :cyan,
- git_ref_or_range,
- :reset,
- :faint,
- "#{checking_suffix(count)} ..."
- ])
- end
-
- Output.print_skipped_checks(exec)
- end
-
- defp checking_suffix(count) when count > @many_source_files do
- " (this might take a while)"
- end
-
- defp checking_suffix(_), do: ""
-
- @doc "Called after the analysis has run."
- def print_after_info(source_files, exec, time_load, time_run) do
- term_width = Output.term_columns()
- filtered_diff_markers = filtered_diff_markers(exec)
-
- issues_to_display =
- exec
- |> Execution.get_issues()
- |> Enum.filter(&Enum.member?(filtered_diff_markers, &1.diff_marker))
-
- categories =
- issues_to_display
- |> Enum.map(& &1.category)
- |> Enum.uniq()
-
- issue_map =
- Enum.into(categories, %{}, fn category ->
- {category, Enum.filter(issues_to_display, &(&1.category == category))}
- end)
-
- source_file_map = Enum.into(source_files, %{}, &{&1.filename, &1})
-
- categories
- |> Sorter.ensure(@category_starting_order, @category_ending_order)
- |> Enum.each(fn category ->
- print_issues_for_category(
- category,
- issue_map[category],
- source_file_map,
- exec,
- term_width
- )
- end)
-
- DiffSummary.print(source_files, exec, time_load, time_run)
- end
-
- defp print_issues_for_category(
- _category,
- nil,
- _source_file_map,
- _exec,
- _term_width
- ) do
- nil
- end
-
- defp print_issues_for_category(
- category,
- issues,
- source_file_map,
- exec,
- term_width
- ) do
- color = @category_colors[category] || :magenta
- title = @category_titles[category] || "Category: #{category}"
-
- UI.puts()
-
- [
- diff_marker(1, color),
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " #{title}" |> String.pad_trailing(term_width - 3)
- ]
- |> UI.puts()
-
- UI.puts([
- diff_marker(2, color),
- UI.edge(color)
- ])
-
- print_issues(issues, source_file_map, exec, term_width)
-
- if Enum.count(issues) > per_category(exec) do
- not_shown = Enum.count(issues) - per_category(exec)
-
- [
- diff_marker(),
- UI.edge(color),
- :faint,
- " ... (#{not_shown} other new issues, use `--all` to show them)"
- ]
- |> UI.puts()
- end
- end
-
- defp print_issues(issues, source_file_map, exec, term_width) do
- count = per_category(exec)
- sort_weight = %{fixed: 0, old: 1, new: 2}
-
- issues
- |> Enum.sort_by(fn issue ->
- {sort_weight[issue.diff_marker], issue.priority, issue.severity, issue.filename,
- issue.line_no}
- end)
- |> Enum.reverse()
- |> Enum.take(count)
- |> do_print_issues(source_file_map, exec, term_width)
- end
-
- defp per_category(%Execution{all: true}), do: 1_000_000
- defp per_category(%Execution{all: false}), do: @per_category
-
- defp do_print_issues(
- issues,
- source_file_map,
- %Execution{format: _} = exec,
- term_width
- ) do
- Enum.each(issues, fn %Issue{filename: filename} = issue ->
- source_file = source_file_map[filename]
-
- do_print_issue(issue, source_file, exec, term_width)
- end)
- end
-
- defp do_print_issue(
- %Issue{
- check: check,
- message: message,
- filename: filename,
- priority: priority
- } = issue,
- source_file,
- %Execution{format: _, verbose: verbose} = exec,
- term_width
- ) do
- new_issue? = issue.diff_marker == :new
- fixed_issue? = issue.diff_marker == :fixed
-
- outer_color =
- if new_issue? do
- Output.check_color(issue)
- else
- [Output.check_color(issue), :faint]
- end
-
- inner_color =
- if new_issue? do
- Output.issue_color(issue)
- else
- [Output.issue_color(issue), :faint]
- end
-
- message_color = outer_color
- filename_color = :default_color
-
- tag_style =
- if outer_color == inner_color do
- :faint
- else
- :bright
- end
-
- message =
- if verbose do
- message <> " (" <> inspect(check) <> ")"
- else
- message
- end
-
- message
- |> UI.wrap_at(term_width - @indent)
- |> print_issue_message(
- issue,
- check,
- outer_color,
- message_color,
- tag_style,
- priority
- )
-
- location =
- if fixed_issue? do
- given_ref = Execution.get_assign(exec, "credo.diff.given_ref")
- previous_dirname = Execution.get_assign(exec, "credo.diff.previous_dirname")
-
- case given_ref do
- {:path, path} ->
- relative_filename = String.replace(filename, previous_dirname, "")
-
- "(dir:#{path}) #{relative_filename}"
-
- _ ->
- git_ref = Execution.get_assign(exec, "credo.diff.previous_git_ref")
-
- relative_filename =
- filename |> String.replace(previous_dirname, "") |> String.replace(~r/^[\/\\]/, "")
-
- "(git:#{git_ref}) #{relative_filename}"
- end
- else
- to_string(filename)
- end
-
- [
- diff_marker(issue.diff_marker),
- UI.edge(outer_color, @indent),
- filename_color,
- :faint,
- location,
- :default_color,
- :faint,
- Filename.pos_suffix(issue.line_no, issue.column),
- :conceal,
- " #",
- :reset,
- :faint,
- "(#{issue.scope})"
- ]
- |> UI.puts()
-
- if exec.verbose && issue.diff_marker == :new do
- print_issue_line(issue, source_file, inner_color, outer_color, term_width)
-
- [
- diff_marker(issue.diff_marker),
- UI.edge([
- outer_color,
- :faint
- ])
- ]
- |> UI.puts()
- end
- end
-
- defp print_issue_message(
- [first_line | other_lines],
- issue,
- check,
- outer_color,
- message_color,
- tag_style,
- priority
- ) do
- [
- diff_marker(issue.diff_marker),
- UI.edge(outer_color),
- outer_color,
- tag_style,
- Output.check_tag(check.category),
- " ",
- priority |> Output.priority_arrow(),
- :normal,
- message_color,
- " ",
- first_line
- ]
- |> UI.puts()
-
- other_lines
- |> Enum.each(&print_issue_message(&1, issue, outer_color, message_color))
- end
-
- defp print_issue_message(
- "",
- _issue,
- _outer_color,
- _message_color
- ) do
- end
-
- defp print_issue_message(
- message,
- issue,
- outer_color,
- message_color
- ) do
- [
- diff_marker(issue.diff_marker),
- UI.edge(outer_color),
- outer_color,
- String.duplicate(" ", @indent - 3),
- :normal,
- message_color,
- " ",
- message
- ]
- |> UI.puts()
- end
-
- defp print_issue_line(
- %Issue{line_no: nil},
- _source_file,
- _inner_color,
- _outer_color,
- _term_width
- ) do
- nil
- end
-
- defp print_issue_line(
- %Issue{} = issue,
- source_file,
- inner_color,
- outer_color,
- term_width
- ) do
- raw_line = SourceFile.line_at(source_file, issue.line_no)
- line = String.trim(raw_line)
-
- [diff_marker(issue.diff_marker), UI.edge([outer_color, :faint])]
- |> UI.puts()
-
- [
- diff_marker(issue.diff_marker),
- UI.edge([outer_color, :faint]),
- :cyan,
- :faint,
- String.duplicate(" ", @indent - 2),
- UI.truncate(line, term_width - @indent)
- ]
- |> UI.puts()
-
- print_issue_trigger_marker(issue, raw_line, inner_color, outer_color)
- end
-
- defp print_issue_trigger_marker(
- %Issue{column: nil},
- _line,
- _inner_color,
- _outer_color
- ) do
- nil
- end
-
- defp print_issue_trigger_marker(
- %Issue{} = issue,
- line,
- inner_color,
- outer_color
- ) do
- offset = String.length(line) - String.length(String.trim(line))
-
- # column is one-based
- x = max(issue.column - offset - 1, 0)
-
- w =
- case issue.trigger do
- nil -> 1
- atom -> atom |> to_string |> String.length()
- end
-
- [
- diff_marker(issue.diff_marker),
- UI.edge([outer_color, :faint], @indent),
- inner_color,
- String.duplicate(" ", x),
- :faint,
- String.duplicate("^", w)
- ]
- |> UI.puts()
- end
-
- defp filtered_diff_markers(exec) do
- filtered_diff_markers = [:new]
-
- filtered_diff_markers =
- if exec.cli_options.switches[:show_kept] do
- filtered_diff_markers ++ [:old]
- else
- filtered_diff_markers
- end
-
- if exec.cli_options.switches[:show_fixed] do
- filtered_diff_markers ++ [:fixed]
- else
- filtered_diff_markers
- end
- end
-
- defp diff_marker do
- [:faint, " ", :reset, ""]
- end
-
- defp diff_marker(1, color) do
- [color, :faint, " ", :reset, ""]
- end
-
- defp diff_marker(2, color) do
- [color, :faint, " ", :reset, ""]
- end
-
- defp diff_marker(:new) do
- [:green, :bright, "+ ", :reset, ""]
- end
-
- defp diff_marker(:old) do
- [:faint, "~ ", :reset, ""]
- end
-
- defp diff_marker(:fixed) do
- [:faint, "✔ ", :reset, ""]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/flycheck.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/flycheck.ex
deleted file mode 100644
index 34f0db52..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/flycheck.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Output.FlyCheck do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Flycheck
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Flycheck.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/json.ex
deleted file mode 100644
index edeee97f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/json.ex
+++ /dev/null
@@ -1,24 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- issues = Execution.get_issues(exec)
- new_issues = Enum.filter(issues, &(&1.diff_marker == :new))
- fixed_issues = Enum.filter(issues, &(&1.diff_marker == :fixed))
- old_issues = Enum.filter(issues, &(&1.diff_marker == :old))
-
- %{
- "diff" => %{
- "new" => Enum.map(new_issues, &JSON.issue_to_json/1),
- "fixed" => Enum.map(fixed_issues, &JSON.issue_to_json/1),
- "old" => Enum.map(old_issues, &JSON.issue_to_json/1)
- }
- }
- |> JSON.print_map()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/oneline.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/oneline.ex
deleted file mode 100644
index 00b72d91..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/output/oneline.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Output.Oneline do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Oneline
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Oneline.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues.ex
deleted file mode 100644
index 45bbb7b9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues.ex
+++ /dev/null
@@ -1,63 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Task.FilterIssues do
- use Credo.Execution.Task
-
- alias Credo.Issue
-
- def call(exec, _opts) do
- issues = get_old_new_and_fixed_issues(exec)
-
- Execution.put_issues(exec, issues)
- end
-
- defp get_old_new_and_fixed_issues(exec) do
- current_issues = Execution.get_issues(exec)
-
- previous_issues =
- exec
- |> Execution.get_assign("credo.diff.previous_exec")
- |> Execution.get_issues()
-
- previous_dirname = Execution.get_assign(exec, "credo.diff.previous_dirname")
-
- # in previous_issues, in current_issues
- old_issues = Enum.filter(current_issues, &old_issue?(&1, previous_issues, previous_dirname))
-
- # in previous_issues, not in current_issues
- fixed_issues = previous_issues -- old_issues
-
- # not in previous_issues, in current_issues
- new_issues = Enum.filter(current_issues, &new_issue?(&1, previous_issues, previous_dirname))
-
- old_issues = Enum.map(old_issues, fn issue -> %Issue{issue | diff_marker: :old} end)
-
- # TODO: we have to rewrite the filename to make it look like the file is in the current dir
- # instead of the generated tmp dir
- fixed_issues = Enum.map(fixed_issues, fn issue -> %Issue{issue | diff_marker: :fixed} end)
- new_issues = Enum.map(new_issues, fn issue -> %Issue{issue | diff_marker: :new} end)
-
- List.flatten([new_issues, fixed_issues, old_issues])
- end
-
- defp new_issue?(current_issue, previous_issues, previous_dirname)
- when is_list(previous_issues) do
- !Enum.any?(previous_issues, &same_issue?(current_issue, &1, previous_dirname))
- end
-
- defp old_issue?(previous_issue, current_issues, previous_dirname)
- when is_list(current_issues) do
- Enum.any?(current_issues, &same_issue?(previous_issue, &1, previous_dirname))
- end
-
- defp same_issue?(current_issue, %Issue{} = previous_issue, previous_dirname) do
- same_file_or_same_line? =
- current_issue.filename == Path.relative_to(previous_issue.filename, previous_dirname) ||
- current_issue.line_no == previous_issue.line_no
-
- same_file_or_same_line? &&
- current_issue.column == previous_issue.column &&
- current_issue.category == previous_issue.category &&
- current_issue.message == previous_issue.message &&
- current_issue.trigger == previous_issue.trigger &&
- current_issue.scope == previous_issue.scope
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues_for_exit_status.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues_for_exit_status.ex
deleted file mode 100644
index e91ca01b..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/filter_issues_for_exit_status.ex
+++ /dev/null
@@ -1,17 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Task.FilterIssuesForExitStatus do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec, _opts) do
- issues =
- exec
- |> Execution.get_issues()
- |> Enum.filter(fn
- %Credo.Issue{diff_marker: :new} -> true
- _ -> false
- end)
-
- Execution.put_issues(exec, issues)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/get_git_diff.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/get_git_diff.ex
deleted file mode 100644
index 7a395f4d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/get_git_diff.ex
+++ /dev/null
@@ -1,258 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Task.GetGitDiff do
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Diff.DiffCommand
- alias Credo.CLI.Output.Shell
- alias Credo.CLI.Output.UI
-
- def call(exec, _opts) do
- case Execution.get_assign(exec, "credo.diff.previous_exec") do
- %Execution{} -> exec
- _ -> run_credo_and_store_resulting_execution(exec)
- end
- end
-
- def error(exec, _opts) do
- exec
- |> Execution.get_halt_message()
- |> puts_error_message()
-
- exec
- end
-
- defp puts_error_message(halt_message) do
- UI.warn([:red, "** (diff) ", halt_message])
- UI.warn("")
- end
-
- defp run_credo_and_store_resulting_execution(exec) do
- case DiffCommand.previous_ref(exec) do
- {:git, git_ref} ->
- run_credo_on_git_ref(exec, git_ref, {:git, git_ref})
-
- {:git_merge_base, git_merge_base} ->
- run_credo_on_git_merge_base(exec, git_merge_base, {:git_merge_base, git_merge_base})
-
- {:git_datetime, datetime} ->
- run_credo_on_datetime(exec, datetime, {:git_datetime, datetime})
-
- {:path, path} ->
- run_credo_on_path_ref(exec, path, {:path, path})
-
- {:error, error} ->
- Execution.halt(exec, error)
- end
- end
-
- defp run_credo_on_git_ref(exec, git_ref, given_ref) do
- working_dir = Execution.working_dir(exec)
- previous_dirname = run_git_clone_and_checkout(working_dir, git_ref)
-
- run_credo_on_dir(exec, previous_dirname, git_ref, given_ref)
- end
-
- defp run_credo_on_git_merge_base(exec, git_merge_base, given_ref) do
- # git merge-base master HEAD
- case System.cmd("git", ["merge-base", git_merge_base, "HEAD"], stderr_to_stdout: true) do
- {output, 0} ->
- git_ref = String.trim(output)
- working_dir = Execution.working_dir(exec)
- previous_dirname = run_git_clone_and_checkout(working_dir, git_ref)
-
- run_credo_on_dir(exec, previous_dirname, git_ref, given_ref)
-
- {output, _} ->
- Execution.halt(
- exec,
- "Could not determine merge base for `#{git_merge_base}`: #{inspect(output)}"
- )
- end
- end
-
- defp run_credo_on_datetime(exec, datetime, given_ref) do
- git_ref =
- case get_git_ref_for_datetime(datetime) do
- nil -> "HEAD"
- git_ref -> git_ref
- end
-
- working_dir = Execution.working_dir(exec)
- previous_dirname = run_git_clone_and_checkout(working_dir, git_ref)
-
- run_credo_on_dir(exec, previous_dirname, git_ref, given_ref)
- end
-
- defp get_git_ref_for_datetime(datetime) do
- case System.cmd("git", ["rev-list", "--reverse", "--after", datetime, "HEAD"]) do
- {"", 0} ->
- nil
-
- {output, 0} ->
- output
- |> String.split(~r/\n/)
- |> List.first()
-
- _ ->
- nil
- end
- end
-
- defp run_credo_on_path_ref(exec, path, given_ref) do
- run_credo_on_dir(exec, path, path, given_ref)
- end
-
- defp run_credo_on_dir(exec, dirname, previous_git_ref, given_ref) do
- {previous_argv, _last_arg} =
- exec.argv
- |> Enum.slice(1..-1)
- |> Enum.reduce({[], nil}, fn
- _, {argv, "--working-dir"} -> {Enum.slice(argv, 1..-2), nil}
- _, {argv, "--from-git-merge-base"} -> {Enum.slice(argv, 1..-2), nil}
- _, {argv, "--from-git-ref"} -> {Enum.slice(argv, 1..-2), nil}
- _, {argv, "--from-dir"} -> {Enum.slice(argv, 1..-2), nil}
- _, {argv, "--since"} -> {Enum.slice(argv, 1..-2), nil}
- "--show-fixed", {argv, _last_arg} -> {argv, nil}
- "--show-kept", {argv, _last_arg} -> {argv, nil}
- ^previous_git_ref, {argv, _last_arg} -> {argv, nil}
- arg, {argv, _last_arg} -> {argv ++ [arg], arg}
- end)
-
- run_credo(exec, previous_git_ref, dirname, previous_argv, given_ref)
- end
-
- defp run_credo(exec, previous_git_ref, previous_dirname, previous_argv, given_ref) do
- parent_pid = self()
-
- spawn(fn ->
- Shell.suppress_output(fn ->
- argv = previous_argv ++ ["--working-dir", previous_dirname]
-
- previous_exec = Credo.run(argv)
-
- send(parent_pid, {:previous_exec, previous_exec})
- end)
- end)
-
- receive do
- {:previous_exec, previous_exec} ->
- store_resulting_execution(
- exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- )
- end
- end
-
- def store_resulting_execution(
- %Execution{debug: true} = exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- ) do
- exec =
- perform_store_resulting_execution(
- exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- )
-
- previous_dirname = Execution.get_assign(exec, "credo.diff.previous_dirname")
- require Logger
- Logger.debug("Git ref checked out to: #{previous_dirname}")
-
- exec
- end
-
- def store_resulting_execution(
- exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- ) do
- perform_store_resulting_execution(
- exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- )
- end
-
- defp perform_store_resulting_execution(
- exec,
- previous_git_ref,
- previous_dirname,
- previous_exec,
- given_ref
- ) do
- if previous_exec.halted do
- halt_execution(exec, previous_git_ref, previous_dirname, previous_exec)
- else
- exec
- |> Execution.put_assign("credo.diff.given_ref", given_ref)
- |> Execution.put_assign("credo.diff.previous_git_ref", previous_git_ref)
- |> Execution.put_assign("credo.diff.previous_dirname", previous_dirname)
- |> Execution.put_assign("credo.diff.previous_exec", previous_exec)
- end
- end
-
- defp halt_execution(exec, previous_git_ref, previous_dirname, previous_exec) do
- message =
- case Execution.get_halt_message(previous_exec) do
- {:config_name_not_found, message} -> message
- halt_message -> inspect(halt_message)
- end
-
- Execution.halt(
- exec,
- [
- :bright,
- "Running Credo on `#{previous_git_ref}` (checked out to #{previous_dirname}) resulted in the following error:\n\n",
- :faint,
- message
- ]
- )
- end
-
- defp run_git_clone_and_checkout(working_dir, git_ref) do
- now = DateTime.utc_now() |> to_string |> String.replace(~r/\D/, "")
- tmp_clone_dir = Path.join(System.tmp_dir!(), "credo-diff-#{now}")
- git_root_path = git_root_path(working_dir)
- current_dir = working_dir
- tmp_working_dir = tmp_working_dir(tmp_clone_dir, git_root_path, current_dir)
-
- {_output, 0} =
- System.cmd("git", ["clone", git_root_path, tmp_clone_dir],
- cd: working_dir,
- stderr_to_stdout: true
- )
-
- {_output, 0} =
- System.cmd("git", ["checkout", git_ref], cd: tmp_clone_dir, stderr_to_stdout: true)
-
- tmp_working_dir
- end
-
- defp git_root_path(path) do
- {output, 0} =
- System.cmd("git", ["rev-parse", "--show-toplevel"], cd: path, stderr_to_stdout: true)
-
- String.trim(output)
- end
-
- defp tmp_working_dir(tmp_clone_dir, git_root_is_current_dir, git_root_is_current_dir) do
- tmp_clone_dir
- end
-
- defp tmp_working_dir(tmp_clone_dir, git_root_path, current_dir) do
- subdir_to_run_credo_in = Path.relative_to(current_dir, git_root_path)
-
- Path.join(tmp_clone_dir, subdir_to_run_credo_in)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_before_info.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_before_info.ex
deleted file mode 100644
index 60ee0727..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_before_info.ex
+++ /dev/null
@@ -1,15 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Task.PrintBeforeInfo do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Diff.DiffOutput
-
- def call(exec, _opts) do
- source_files = Execution.get_source_files(exec)
-
- DiffOutput.print_before_info(source_files, exec)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_results_and_summary.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_results_and_summary.ex
deleted file mode 100644
index 1e1dde1f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/diff/task/print_results_and_summary.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule Credo.CLI.Command.Diff.Task.PrintResultsAndSummary do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Diff.DiffOutput
-
- def call(exec, _opts) do
- source_files = Execution.get_source_files(exec)
-
- time_load = Execution.get_assign(exec, "credo.time.source_files")
- time_run = Execution.get_assign(exec, "credo.time.run_checks")
-
- DiffOutput.print_after_info(source_files, exec, time_load, time_run)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_command.ex
deleted file mode 100644
index b5816714..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_command.ex
+++ /dev/null
@@ -1,234 +0,0 @@
-defmodule Credo.CLI.Command.Explain.ExplainCommand do
- @moduledoc false
-
- use Credo.CLI.Command,
- short_description: "Show code object and explain why it is/might be an issue",
- cli_switches: Credo.CLI.Command.Suggest.SuggestCommand.cli_switches()
-
- alias Credo.Check
- alias Credo.CLI.Command.Explain.ExplainOutput, as: Output
- alias Credo.CLI.Filename
- alias Credo.CLI.Task
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- def init(exec) do
- exec
- |> Execution.put_pipeline(__MODULE__.ExplainIssue,
- validate_given_location: [
- {__MODULE__.ExplainIssuePreCheck, []}
- ],
- load_and_validate_source_files: [
- {Task.LoadAndValidateSourceFiles, []}
- ],
- prepare_analysis: [
- {Task.PrepareChecksToRun, []}
- ],
- run_analysis: [
- {Task.RunChecks, []}
- ],
- filter_issues: [
- {Task.SetRelevantIssues, []}
- ],
- print_explanation: [
- {__MODULE__.ExplainIssue, []}
- ]
- )
- |> Execution.put_pipeline(__MODULE__.ExplainCheck,
- print_explanation: [
- {__MODULE__.ExplainCheck, []}
- ]
- )
- end
-
- @doc false
- def call(%Execution{help: true} = exec, _opts), do: Output.print_help(exec)
-
- def call(exec, _opts) do
- filename = get_filename_from_args(exec)
-
- cond do
- Filename.contains_line_no?(filename) ->
- Execution.run_pipeline(exec, __MODULE__.ExplainIssue)
-
- Check.defined?("Elixir.#{filename}") ->
- Execution.run_pipeline(exec, __MODULE__.ExplainCheck)
-
- true ->
- Output.print_help(exec)
- end
- end
-
- @doc false
- def get_filename_from_args(exec) do
- exec.cli_options.args
- |> List.wrap()
- |> List.first()
- end
-
- defmodule ExplainCheck do
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Explain.ExplainCommand
-
- def call(exec, _opts) do
- check_name = ExplainCommand.get_filename_from_args(exec)
- check = :"Elixir.#{check_name}"
- explanations = [cast_to_explanation(check)]
-
- Output.print_after_info(explanations, exec, nil, nil)
-
- exec
- end
-
- defp cast_to_explanation(check) do
- %{
- category: check.category,
- check: check,
- explanation_for_issue: check.explanation,
- priority: check.base_priority
- }
- end
- end
-
- defmodule ExplainIssuePreCheck do
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Explain.ExplainCommand
-
- def call(exec, _opts) do
- filename_with_location = ExplainCommand.get_filename_from_args(exec)
- working_dir = Execution.working_dir(exec)
-
- filename =
- filename_with_location
- |> String.split(":")
- |> List.first()
- |> Path.expand()
-
- if path_contains_file?(working_dir, filename) do
- exec
- else
- Execution.halt(exec, """
- Given location is not part of the working dir.
-
- Location: #{filename_with_location}
- Working dir: #{working_dir}
- """)
- end
- end
-
- # def error(exec, _opts) do
- # halt_message = Execution.get_halt_message(exec)
-
- # UI.warn([:red, "** (explain) ", halt_message])
-
- # exec
- # end
-
- defp path_contains_file?(path, filename) do
- case Path.relative_to(filename, path) do
- ^filename -> false
- _ -> true
- end
- end
- end
-
- defmodule ExplainIssue do
- use Credo.Execution.Task
-
- alias Credo.CLI.Command.Explain.ExplainCommand
-
- def call(exec, _opts) do
- filename = ExplainCommand.get_filename_from_args(exec)
-
- source_files = Execution.get_source_files(exec)
-
- filename
- |> String.split(":")
- |> print_result(source_files, exec)
- end
-
- def print_result([filename], source_files, exec) do
- print_result([filename, nil, nil], source_files, exec)
- end
-
- def print_result([filename, line_no], source_files, exec) do
- print_result([filename, line_no, nil], source_files, exec)
- end
-
- def print_result([filename, line_no, column], source_files, exec) do
- source_file = Enum.find(source_files, &(&1.filename == filename))
-
- if source_file do
- explanations =
- exec
- |> Execution.get_issues(source_file.filename)
- |> filter_issues(line_no, column)
- |> Enum.map(&cast_to_explanation(&1, source_file))
-
- Output.print_after_info(explanations, exec, line_no, column)
-
- exec
- else
- Execution.halt(exec, "Could not find source file: #{filename}")
- end
- end
-
- defp cast_to_explanation(issue, source_file) do
- %{
- category: issue.category,
- check: issue.check,
- column: issue.column,
- explanation_for_issue: issue.check.explanation,
- filename: issue.filename,
- line_no: issue.line_no,
- message: issue.message,
- priority: issue.priority,
- related_code: find_related_code(source_file, issue.line_no),
- scope: issue.scope,
- trigger: issue.trigger
- }
- end
-
- defp find_related_code(source_file, line_no) do
- [
- get_source_line(source_file, line_no - 2),
- get_source_line(source_file, line_no - 1),
- get_source_line(source_file, line_no),
- get_source_line(source_file, line_no + 1),
- get_source_line(source_file, line_no + 2)
- ]
- |> Enum.reject(&is_nil/1)
- end
-
- defp get_source_line(_, line_no) when line_no < 1 do
- nil
- end
-
- defp get_source_line(source_file, line_no) do
- line = SourceFile.line_at(source_file, line_no)
-
- if line do
- {line_no, line}
- end
- end
-
- defp filter_issues(issues, line_no, nil) do
- line_no = line_no |> String.to_integer()
- issues |> Enum.filter(&filter_issue(&1, line_no, nil))
- end
-
- defp filter_issues(issues, line_no, column) do
- line_no = line_no |> String.to_integer()
- column = column |> String.to_integer()
-
- issues |> Enum.filter(&filter_issue(&1, line_no, column))
- end
-
- defp filter_issue(%Issue{line_no: a, column: b}, a, b), do: true
- defp filter_issue(%Issue{line_no: a}, a, _), do: true
- defp filter_issue(_, _, _), do: false
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_output.ex
deleted file mode 100644
index 0d4790d2..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/explain_output.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-defmodule Credo.CLI.Command.Explain.ExplainOutput do
- @moduledoc false
-
- alias Credo.CLI.Output.UI
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Explain.Output.Default,
- json: Credo.CLI.Command.Explain.Output.Json
-
- def print_help(exec) do
- usage = [
- "Usage: ",
- :olive,
- "mix credo explain [options]"
- ]
-
- description = """
-
- Explain the given check or issue.
- """
-
- example = [
- "Examples:\n",
- :olive,
- " $ mix credo explain lib/foo/bar.ex:13:6\n",
- " $ mix credo explain lib/foo/bar.ex:13:6 --format json\n",
- " $ mix credo explain Credo.Check.Refactor.Nesting"
- ]
-
- options =
- """
-
- Explain options:
- --format Display the list in a specific format (json,flycheck,oneline)
-
- General options:
- --[no-]color Toggle colored output
- -v, --version Show version
- -h, --help Show this help
-
- Find advanced usage instructions and more examples here:
- https://hexdocs.pm/credo/explain_command.html
-
- Give feedback and open an issue here:
- https://github.com/rrrene/credo/issues
- """
- |> String.trim_trailing()
-
- UI.puts()
- UI.puts(usage)
- UI.puts(description)
- UI.puts(example)
- UI.puts(options)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/default.ex
deleted file mode 100644
index b5ea092f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/default.ex
+++ /dev/null
@@ -1,605 +0,0 @@
-defmodule Credo.CLI.Command.Explain.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.Code.Scope
-
- @indent 8
- @params_min_indent 10
-
- @doc "Called before the analysis is run."
- def print_before_info(source_files, exec) do
- UI.puts()
-
- case Enum.count(source_files) do
- 0 -> UI.puts("No files found!")
- 1 -> UI.puts("Checking 1 source file ...")
- count -> UI.puts("Checking #{count} source files ...")
- end
-
- Output.print_skipped_checks(exec)
- end
-
- @doc "Called after the analysis has run."
- def print_after_info(explanations, exec, nil, nil) do
- term_width = Output.term_columns()
-
- print_explanations_for_check(explanations, exec, term_width)
- end
-
- def print_after_info(explanations, exec, line_no, column) do
- term_width = Output.term_columns()
-
- print_explanations_for_issue(explanations, exec, term_width, line_no, column)
- end
-
- #
- # CHECK
- #
-
- defp print_explanations_for_check(explanations, _exec, term_width) do
- Enum.each(explanations, &print_check(&1, term_width))
- end
-
- defp print_check(
- %{
- category: category,
- check: check,
- explanation_for_issue: explanation_for_issue,
- priority: priority
- },
- term_width
- ) do
- check_name = check |> to_string |> String.replace(~r/^Elixir\./, "")
- color = Output.check_color(check.category)
-
- UI.puts()
-
- [
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " Check: #{check_name}" |> String.pad_trailing(term_width - 1)
- ]
- |> UI.puts()
-
- UI.puts_edge(color)
-
- outer_color = Output.check_color(category)
- inner_color = Output.check_color(category)
-
- tag_style =
- if outer_color == inner_color do
- :faint
- else
- :bright
- end
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- " ",
- Output.check_tag(check.category),
- :reset,
- " Category: #{check.category} "
- ]
- |> UI.puts()
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- " ",
- priority |> Output.priority_arrow(),
- :reset,
- " Priority: #{Output.priority_name(priority)} "
- ]
- |> UI.puts()
-
- UI.puts_edge(outer_color)
-
- UI.puts_edge([outer_color, :faint], @indent)
-
- print_check_explanation(explanation_for_issue, outer_color)
- print_params_explanation(check, outer_color)
-
- UI.puts_edge([outer_color, :faint])
- end
-
- #
- # ISSUE
- #
-
- defp print_explanations_for_issue(
- [],
- _exec,
- _term_width,
- _line_no,
- _column
- ) do
- nil
- end
-
- defp print_explanations_for_issue(
- explanations,
- _exec,
- term_width,
- _line_no,
- _column
- ) do
- first_explanation = explanations |> List.first()
- scope_name = Scope.mod_name(first_explanation.scope)
- color = Output.check_color(first_explanation.category)
-
- UI.puts()
-
- [
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " #{scope_name}" |> String.pad_trailing(term_width - 1)
- ]
- |> UI.puts()
-
- UI.puts_edge(color)
-
- Enum.each(explanations, &print_issue(&1, term_width))
- end
-
- defp print_issue(
- %{
- category: category,
- check: check,
- column: column,
- explanation_for_issue: explanation_for_issue,
- filename: filename,
- trigger: trigger,
- line_no: line_no,
- message: message,
- priority: priority,
- related_code: related_code,
- scope: scope
- },
- term_width
- ) do
- pos = pos_string(line_no, column)
-
- outer_color = Output.check_color(category)
- inner_color = Output.check_color(category)
- message_color = inner_color
- filename_color = :default_color
-
- tag_style =
- if outer_color == inner_color do
- :faint
- else
- :bright
- end
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- " ",
- Output.check_tag(check.category),
- :reset,
- " Category: #{check.category} "
- ]
- |> UI.puts()
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- " ",
- priority |> Output.priority_arrow(),
- :reset,
- " Priority: #{Output.priority_name(priority)} "
- ]
- |> UI.puts()
-
- UI.puts_edge(outer_color)
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- " ",
- :normal,
- message_color,
- " ",
- message
- ]
- |> UI.puts()
-
- [
- UI.edge(outer_color, @indent),
- filename_color,
- :faint,
- to_string(filename),
- :default_color,
- :faint,
- pos,
- :faint,
- " (#{scope})"
- ]
- |> UI.puts()
-
- if line_no do
- print_issue_line_no(
- term_width,
- line_no,
- column,
- trigger,
- related_code,
- outer_color,
- inner_color
- )
- end
-
- UI.puts_edge([outer_color, :faint], @indent)
-
- print_check_explanation(explanation_for_issue, outer_color)
- print_params_explanation(check, outer_color)
-
- UI.puts_edge([outer_color, :faint])
- end
-
- def print_check_explanation(explanation_for_issue, outer_color) do
- [
- UI.edge([outer_color, :faint]),
- :reset,
- :color239,
- String.duplicate(" ", @indent - 5),
- "__ WHY IT MATTERS"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- (explanation_for_issue || "TODO: Insert explanation")
- |> String.trim()
- |> String.split("\n")
- |> Enum.flat_map(&format_explanation(&1, outer_color))
- |> Enum.slice(0..-2)
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
- end
-
- def format_explanation(line, outer_color) do
- [
- UI.edge([outer_color, :faint], @indent),
- :reset,
- line |> format_explanation_text,
- "\n"
- ]
- end
-
- def format_explanation_text(" " <> line) do
- [:yellow, :faint, " ", line]
- end
-
- def format_explanation_text(line) do
- # TODO: format things in backticks in help texts
- # case Regex.run(~r/(\`[a-zA-Z_\.]+\`)/, line) do
- # v ->
- # # IO.inspect(v)
- [:reset, line]
- # end
- end
-
- defp pos_string(nil, nil), do: ""
- defp pos_string(line_no, nil), do: ":#{line_no}"
- defp pos_string(line_no, column), do: ":#{line_no}:#{column}"
-
- def print_params_explanation(nil, _), do: nil
-
- def print_params_explanation(check, outer_color) do
- check_name = check |> to_string |> String.replace(~r/^Elixir\./, "")
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- :color239,
- String.duplicate(" ", @indent - 5),
- "__ CONFIGURATION OPTIONS"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- print_params_explanation(
- outer_color,
- check_name,
- check.explanations()[:params],
- check.param_defaults()
- )
- end
-
- def print_params_explanation(outer_color, check_name, param_explanations, _defaults)
- when param_explanations in [nil, []] do
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- "You can disable this check by using this tuple"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- " {",
- :cyan,
- check_name,
- :reset,
- ", ",
- :cyan,
- "false",
- :reset,
- "}"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- "There are no other configuration options."
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
- end
-
- def print_params_explanation(outer_color, check_name, keywords, defaults) do
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- "To configure this check, use this tuple"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- " {",
- :cyan,
- check_name,
- :reset,
- ", ",
- :cyan,
- :faint,
- "",
- :reset,
- "}"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- "with ",
- :cyan,
- :faint,
- "",
- :reset,
- " being ",
- :cyan,
- "false",
- :reset,
- " or any combination of these keywords:"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- params_indent = get_params_indent(keywords, @params_min_indent)
-
- keywords
- |> Enum.each(fn {param, text} ->
- [head | tail] = String.split(text, "\n")
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- :cyan,
- " #{param}:" |> String.pad_trailing(params_indent + 3),
- :reset,
- head
- ]
- |> UI.puts()
-
- tail
- |> List.wrap()
- |> Enum.each(fn line ->
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- :cyan,
- String.pad_trailing("", params_indent + 3),
- :reset,
- line
- ]
- |> UI.puts()
- end)
-
- default = defaults[param]
-
- if default do
- default_text = "(defaults to #{inspect(default)})"
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- String.duplicate(" ", @indent - 2),
- :cyan,
- " " |> String.pad_trailing(params_indent + 3),
- :reset,
- :faint,
- default_text
- ]
- |> UI.puts()
- end
- end)
- end
-
- defp get_params_indent(keywords, min_indent) do
- params_indent =
- Enum.reduce(keywords, min_indent, fn {param, _text}, current ->
- size =
- param
- |> to_string
- |> String.length()
-
- if size > current do
- size
- else
- current
- end
- end)
-
- # Round up to the next multiple of 2
- (trunc(params_indent / 2) + 1) * 2
- end
-
- defp print_issue_column(column, trigger, outer_color, inner_color) do
- offset = 0
- # column is one-based
- x = max(column - offset - 1, 0)
-
- w =
- if is_nil(trigger) do
- 1
- else
- trigger
- |> to_string()
- |> String.length()
- end
-
- [
- UI.edge([outer_color, :faint], @indent),
- inner_color,
- String.duplicate(" ", x),
- :faint,
- String.duplicate("^", w)
- ]
- |> UI.puts()
- end
-
- defp print_issue_line_no(
- term_width,
- line_no,
- column,
- trigger,
- related_code,
- outer_color,
- inner_color
- ) do
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- :color239,
- String.duplicate(" ", @indent - 5),
- "__ CODE IN QUESTION"
- ]
- |> UI.puts()
-
- UI.puts_edge([outer_color, :faint])
-
- code_color = :faint
-
- print_source_line(
- related_code,
- line_no - 2,
- term_width,
- code_color,
- outer_color
- )
-
- print_source_line(
- related_code,
- line_no - 1,
- term_width,
- code_color,
- outer_color
- )
-
- print_source_line(
- related_code,
- line_no,
- term_width,
- [:cyan, :bright],
- outer_color
- )
-
- if column, do: print_issue_column(column, trigger, outer_color, inner_color)
-
- print_source_line(
- related_code,
- line_no + 1,
- term_width,
- code_color,
- outer_color
- )
-
- print_source_line(
- related_code,
- line_no + 2,
- term_width,
- code_color,
- outer_color
- )
- end
-
- defp print_source_line(related_code, line_no, term_width, code_color, outer_color) do
- line =
- related_code
- |> Enum.find_value(fn
- {line_no2, line} when line_no2 == line_no -> line
- _ -> nil
- end)
-
- if line do
- line_no_str =
- "#{line_no} "
- |> String.pad_leading(@indent - 2)
-
- [
- UI.edge([outer_color, :faint]),
- :reset,
- :faint,
- line_no_str,
- :reset,
- code_color,
- UI.truncate(line, term_width - @indent)
- ]
- |> UI.puts()
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/json.ex
deleted file mode 100644
index 4404a33d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/explain/output/json.ex
+++ /dev/null
@@ -1,20 +0,0 @@
-defmodule Credo.CLI.Command.Explain.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(explanations, _exec, _, _) do
- JSON.print_map(%{explanations: Enum.map(explanations, &cast_to_json/1)})
- end
-
- defp cast_to_json(%{line_no: _line_no} = explanation) do
- related_code = Enum.map(explanation.related_code, &Tuple.to_list/1)
-
- explanation
- |> Map.put(:related_code, related_code)
- end
-
- defp cast_to_json(explanation), do: explanation
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.check.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.check.ex
deleted file mode 100644
index 9096e76a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.check.ex
+++ /dev/null
@@ -1,113 +0,0 @@
-defmodule Credo.CLI.Command.GenCheck do
- @moduledoc false
-
- @check_template_filename ".template.check.ex"
- @default_check_template_file File.read!(@check_template_filename)
-
- use Credo.CLI.Command,
- short_description: "Create a new custom check"
-
- alias Credo.CLI.Output.UI
-
- @doc false
- def call(exec, _opts) do
- check_file =
- case exec.cli_options do
- %Credo.CLI.Options{args: [], switches: %{files_included: [single_file]}} ->
- single_file
-
- %Credo.CLI.Options{args: [single_file]} ->
- single_file
-
- _ ->
- nil
- end
-
- create_check_file(check_file)
-
- exec
- end
-
- defp create_check_file(nil) do
- output = [
- :red,
- :bright,
- "Please provide a filename:",
- "\n\n",
- " mix credo gen.check lib/my_first_credo_check.ex",
- "\n"
- ]
-
- UI.puts(output)
- end
-
- defp create_check_file(filename) do
- check_name = check_name_for(filename)
-
- if File.exists?(filename) do
- UI.puts([:red, :bright, "File exists: #{filename}, aborted."])
- else
- write_template_file(filename, check_name)
-
- UI.puts([:green, "* creating ", :reset, "#{filename}"])
- UI.puts()
-
- print_config_instructions(filename, check_name)
- end
- end
-
- def check_name_for(filename) do
- filename
- |> String.replace(~r/(\A|(.+)\/)(lib|web)\//, "")
- |> String.replace(~r/\.ex$/, "")
- |> Macro.camelize()
- |> String.replace(~r/\_/, "")
- end
-
- defp write_template_file(filename, check_name) do
- filename
- |> Path.dirname()
- |> File.mkdir_p!()
-
- assigns = [check_name: check_name]
- contents = EEx.eval_string(@default_check_template_file, assigns: assigns)
-
- File.write!(filename, contents)
- end
-
- defp print_config_instructions(filename, check_name) do
- UI.puts("Add the generated file to the list of `requires` in `.credo.exs`:")
- UI.puts()
-
- UI.puts([
- " requires: [",
- :green,
- "\"",
- filename,
- "\"",
- :reset,
- "], ",
- :faint,
- "# <-- add file here"
- ])
-
- UI.puts()
- UI.puts("Remember to add the generated module to the list of `checks`:")
- UI.puts()
- UI.puts([" checks: ["])
-
- UI.puts([
- " {",
- :green,
- check_name,
- :reset,
- "}, ",
- :faint,
- "# <-- add check here"
- ])
-
- UI.puts([" ]"])
- UI.puts()
- UI.puts(["If you do not have a exec file yet, use `mix credo gen.config`"])
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.config.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.config.ex
deleted file mode 100644
index 4e5c0430..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/gen.config.ex
+++ /dev/null
@@ -1,35 +0,0 @@
-defmodule Credo.CLI.Command.GenConfig do
- @moduledoc false
-
- @config_filename ".credo.exs"
- @default_config_file File.read!(@config_filename)
-
- use Credo.CLI.Command,
- short_description: "Initialize a new .credo.exs exec file in the current directory"
-
- alias Credo.CLI.Output.UI
-
- @doc false
- def call(exec, _opts) do
- create_config_file(@config_filename)
-
- exec
- end
-
- defp create_config_file(filename) do
- if File.exists?(filename) do
- UI.puts([:red, :bright, "File exists: #{filename}, aborted."])
- else
- UI.puts([:green, "* creating ", :reset, "#{filename}"])
- write_config_file(filename)
- end
- end
-
- defp write_config_file(filename) do
- filename
- |> Path.dirname()
- |> File.mkdir_p!()
-
- File.write!(filename, @default_config_file)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/help.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/help.ex
deleted file mode 100644
index b310f634..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/help.ex
+++ /dev/null
@@ -1,125 +0,0 @@
-defmodule Credo.CLI.Command.Help do
- @moduledoc false
-
- @ljust 12
- @starting_order ~w(suggest explain)
- @ending_order ~w(help)
-
- alias Credo.CLI.Output.UI
- alias Credo.CLI.Sorter
- alias Credo.CLI.Switch
- alias Credo.Execution
-
- use Credo.CLI.Command,
- short_description: "Show this help message",
- cli_switches: [
- Switch.string("format"),
- Switch.boolean("help", alias: :h)
- ]
-
- @doc false
- def call(exec, _opts) do
- print_banner()
- print_message(exec)
-
- exec
- end
-
- def print_banner do
- banner()
- |> String.split("")
- |> Enum.flat_map(fn char -> [color_for(char), char_for(char)] end)
- |> UI.puts()
-
- UI.puts()
- end
-
- def print_message(exec) do
- UI.puts("Credo Version #{Credo.version()}")
- UI.puts(["Usage: ", :olive, "$ mix credo [options]"])
- UI.puts("\nCommands:\n")
-
- exec
- |> Execution.get_valid_command_names()
- |> Sorter.ensure(@starting_order, @ending_order)
- |> Enum.each(fn name ->
- module = Execution.get_command(exec, name)
-
- padded_name =
- name
- |> to_string
- |> String.pad_trailing(@ljust)
-
- case module.short_description do
- nil ->
- UI.puts(" #{padded_name}")
-
- short_description ->
- UI.puts(" #{padded_name}#{short_description}")
- end
- end)
-
- UI.puts("\nUse `--help` on any command to get further information.")
-
- example = [
- "For example, `",
- :olive,
- "mix credo suggest --help",
- :reset,
- "` for help on the default command."
- ]
-
- UI.puts(example)
- end
-
- def color_for("#"), do: [:reset, :darkgreen]
- def color_for(";"), do: [:reset, :faint, :green]
- def color_for("~"), do: [:reset, :bright, :green]
- def color_for(":"), do: [:reset, :faint, :yellow]
- def color_for("="), do: [:reset, :bright, :yellow]
- def color_for("-"), do: [:reset, :faint, :red]
- def color_for("["), do: [:reset, :bright, :red]
- def color_for("M"), do: [:reset, :blue]
- def color_for(","), do: [:reset, :color235]
- def color_for(_), do: [:reset, :white]
-
- # ~w(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
-
- def char_for(" "), do: " "
- def char_for("\n"), do: "\n"
- def char_for("#"), do: "▇"
- def char_for(";"), do: "▇"
- def char_for("~"), do: "▇"
- def char_for(":"), do: "▇"
- def char_for("="), do: "▇"
- def char_for("-"), do: "▇"
- def char_for("["), do: "▇"
- def char_for("M"), do: "▇"
- def char_for(","), do: "▅"
- def char_for(v), do: v
-
- def banner do
- """
-
- ####################### ##### ###
- #######################,,,,,#####,,, ###
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ~~~~~~~~~~~~~~~~~,,,~~~~~~~~,,,~~~,,,,,,,,,,,
- ;;;;;;~~~~~~~~~~~~~~~~~,,,~~~~~~~~,,,~~~,,,,,,,,,,,
- ;;;;;;;;;;;;;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ::::::::::::::::::::,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- :::::===================,,,==========,,,==,,,,,,,,,,,,,,,,
- ===================,,,==========,,,==,,,,,,,,,,,,,,,,
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ----------------,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- -------[[[[[[[[[[[[[[[[[[[[[[[,,,[[,,,[[[[[[,,,,,,,,,,
- [[[[[[[[[[[[[[[[[[[[[[[,,,[[,,,[[[[[[,,,,,,,,,,
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
- MMMMMMMMMMMMMMMMMMMMMMM,,,,MMMMM,,,, MMM
- MMMMMMMMMMMMMMMMMMMMMMM MMMMM MMM
- """
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_command.ex
deleted file mode 100644
index e6d5312e..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_command.ex
+++ /dev/null
@@ -1,72 +0,0 @@
-defmodule Credo.CLI.Command.Info.InfoCommand do
- @moduledoc false
-
- use Credo.CLI.Command,
- short_description: "Show useful debug information",
- cli_switches: Credo.CLI.Command.Suggest.SuggestCommand.cli_switches()
-
- alias Credo.CLI.Command.Info.InfoOutput
- alias Credo.CLI.Task
- alias Credo.Execution
-
- def init(exec) do
- Execution.put_pipeline(exec, "info",
- load_and_validate_source_files: [
- {Task.LoadAndValidateSourceFiles, []}
- ],
- prepare_analysis: [
- {Task.PrepareChecksToRun, []}
- ],
- print_info: [
- {__MODULE__.PrintInfo, []}
- ]
- )
- end
-
- @doc false
- def call(%Execution{help: true} = exec, _opts), do: InfoOutput.print_help(exec)
- def call(exec, _opts), do: Execution.run_pipeline(exec, __MODULE__)
-
- defmodule PrintInfo do
- def call(exec, _opts \\ []) do
- InfoOutput.print(exec, info(exec))
-
- exec
- end
-
- defp info(exec) do
- %{
- "system" => %{
- "credo" => Credo.version(),
- "elixir" => System.version(),
- "erlang" => System.otp_release()
- },
- "config" => %{
- "plugins" => plugins(exec),
- "checks" => checks(exec),
- "files" => files(exec)
- }
- }
- end
-
- defp plugins(exec) do
- Enum.map(exec.plugins, fn {name, params} ->
- %{"name" => name, "params" => Enum.into(params, %{})}
- end)
- end
-
- defp checks(exec) do
- {checks, _only_matching, _ignore_matching} = Execution.checks(exec)
-
- Enum.map(checks, fn {name, params} ->
- %{"name" => name, "params" => Enum.into(params, %{})}
- end)
- end
-
- defp files(exec) do
- exec
- |> Execution.get_source_files()
- |> Enum.map(& &1.filename)
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_output.ex
deleted file mode 100644
index 8cc7ef97..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/info_output.ex
+++ /dev/null
@@ -1,67 +0,0 @@
-defmodule Credo.CLI.Command.Info.InfoOutput do
- @moduledoc false
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Info.Output.Default,
- json: Credo.CLI.Command.Info.Output.Json
-
- alias Credo.CLI.Output.UI
-
- def print(exec, info) do
- format_mod = format_mod(exec)
-
- format_mod.print(exec, info)
- end
-
- def print_help(exec) do
- usage = ["Usage: ", :olive, "mix credo info [options]"]
-
- description = """
-
- Shows information about Credo and its environment.
- """
-
- example = [
- "Example: ",
- :olive,
- :faint,
- "$ mix credo info --format=json --verbose"
- ]
-
- options =
- """
-
- Info options:
- -c, --checks Only include checks that match the given strings
- --checks-with-tag Only include checks that match the given tag (can be used multiple times)
- --checks-without-tag Ignore checks that match the given tag (can be used multiple times)
- --config-file Use the given config file
- -C, --config-name Use the given config instead of "default"
- --enable-disabled-checks Re-enable disabled checks that match the given strings
- --files-included Only include these files (accepts globs, can be used multiple times)
- --files-excluded Exclude these files (accepts globs, can be used multiple times)
- --format Display the list in a specific format (json,flycheck,oneline)
- -i, --ignore-checks Ignore checks that match the given strings
- --ignore Alias for --ignore-checks
- --min-priority Minimum priority to show issues (high,medium,normal,low,lower or number)
- --only Alias for --checks
- --verbose Display more information (e.g. checked files)
-
- General options:
- -v, --version Show version
- -h, --help Show this help
-
- Feedback:
- Open an issue here: https://github.com/rrrene/credo/issues
- """
- |> String.trim_trailing()
-
- UI.puts()
- UI.puts(usage)
- UI.puts(description)
- UI.puts(example)
- UI.puts(options)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/default.ex
deleted file mode 100644
index af4386ec..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/default.ex
+++ /dev/null
@@ -1,46 +0,0 @@
-defmodule Credo.CLI.Command.Info.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- def print(%Execution{verbose: true}, info) do
- info
- |> verbose_info()
- |> UI.puts()
- end
-
- def print(_exec, info) do
- info
- |> basic_info()
- |> UI.puts()
- end
-
- defp basic_info(info) do
- """
- System:
- Credo: #{info["system"]["credo"]}
- Elixir: #{info["system"]["elixir"]}
- Erlang: #{info["system"]["erlang"]}
- """
- |> String.trim()
- end
-
- defp verbose_info(info) do
- """
- #{basic_info(info)}
- Configuration:
- Files:#{Enum.map(info["config"]["files"], &list_entry/1)}
- Checks:#{Enum.map(info["config"]["checks"], &list_entry/1)}
- """
- |> String.trim()
- end
-
- defp list_entry(%{"name" => name}) do
- "\n - #{name}"
- end
-
- defp list_entry(name) do
- "\n - #{name}"
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/json.ex
deleted file mode 100644
index f507d0db..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/info/output/json.ex
+++ /dev/null
@@ -1,28 +0,0 @@
-defmodule Credo.CLI.Command.Info.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
- alias Credo.Execution
-
- def print(%Execution{verbose: true}, info) do
- info
- |> verbose_info()
- |> JSON.print_map()
- end
-
- def print(_exec, info) do
- info
- |> basic_info()
- |> JSON.print_map()
- end
-
- defp basic_info(info) do
- %{
- system: info["system"]
- }
- end
-
- defp verbose_info(info) do
- info
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_command.ex
deleted file mode 100644
index bfe88d24..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_command.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Credo.CLI.Command.List.ListCommand do
- @moduledoc false
-
- use Credo.CLI.Command,
- short_description: "List all issues grouped by files",
- treat_unknown_args_as_files: true,
- cli_switches: Credo.CLI.Command.Suggest.SuggestCommand.cli_switches()
-
- alias Credo.CLI.Command.List.ListOutput
- alias Credo.CLI.Filter
- alias Credo.CLI.Task
- alias Credo.Execution
-
- def init(exec) do
- Execution.put_pipeline(exec, "list",
- load_and_validate_source_files: [
- {Task.LoadAndValidateSourceFiles, []}
- ],
- prepare_analysis: [
- {Task.PrepareChecksToRun, []}
- ],
- print_before_analysis: [
- {__MODULE__.PrintBeforeInfo, []}
- ],
- run_analysis: [
- {Task.RunChecks, []}
- ],
- filter_issues: [
- {Task.SetRelevantIssues, []}
- ],
- print_after_analysis: [
- {__MODULE__.PrintResultsAndSummary, []}
- ]
- )
- end
-
- @doc false
- def call(%Execution{help: true} = exec, _opts), do: ListOutput.print_help(exec)
- def call(exec, _opts), do: Execution.run_pipeline(exec, __MODULE__)
-
- defmodule PrintBeforeInfo do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec, _opts) do
- source_files =
- exec
- |> Execution.get_source_files()
- |> Filter.important(exec)
-
- ListOutput.print_before_info(source_files, exec)
-
- exec
- end
- end
-
- defmodule PrintResultsAndSummary do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec, _opts) do
- source_files = Execution.get_source_files(exec)
-
- time_load = Execution.get_assign(exec, "credo.time.source_files")
- time_run = Execution.get_assign(exec, "credo.time.run_checks")
-
- ListOutput.print_after_info(source_files, exec, time_load, time_run)
-
- exec
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_output.ex
deleted file mode 100644
index 7397ba93..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/list_output.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Credo.CLI.Command.List.ListOutput do
- @moduledoc false
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.List.Output.Default,
- flycheck: Credo.CLI.Command.List.Output.FlyCheck,
- oneline: Credo.CLI.Command.List.Output.Oneline,
- json: Credo.CLI.Command.List.Output.Json,
- sarif: Credo.CLI.Command.List.Output.Sarif
-
- alias Credo.CLI.Output.UI
-
- def print_help(exec) do
- usage = ["Usage: ", :olive, "mix credo list [options]"]
-
- description = """
-
- Lists objects that Credo thinks can be improved ordered by their priority.
- """
-
- example = [
- "Examples:\n",
- :olive,
- " $ mix credo list --format json\n",
- " $ mix credo list \"lib/**/*.ex\" --only consistency --all\n",
- " $ mix credo list --checks-without-tag formatter --checks-without-tag controversial"
- ]
-
- options =
- """
-
- Arrows (↑ ↗ → ↘ ↓) hint at the importance of an issue.
-
- List options:
- -a, --all Show all issues
- -A, --all-priorities Show all issues including low priority ones
- -c, --checks Only include checks that match the given strings
- --checks-with-tag Only include checks that match the given tag (can be used multiple times)
- --checks-without-tag Ignore checks that match the given tag (can be used multiple times)
- --config-file Use the given config file
- -C, --config-name Use the given config instead of "default"
- --enable-disabled-checks Re-enable disabled checks that match the given strings
- --files-included Only include these files (accepts globs, can be used multiple times)
- --files-excluded Exclude these files (accepts globs, can be used multiple times)
- --format Display the list in a specific format (json,flycheck,oneline)
- -i, --ignore-checks Ignore checks that match the given strings
- --ignore Alias for --ignore-checks
- --min-priority Minimum priority to show issues (high,medium,normal,low,lower or number)
- --mute-exit-status Exit with status zero even if there are issues
- --only Alias for --checks
- --strict Alias for --all-priorities
-
- General options:
- --[no-]color Toggle colored output
- -v, --version Show version
- -h, --help Show this help
-
- Find advanced usage instructions and more examples here:
- https://hexdocs.pm/credo/list_command.html
-
- Give feedback and open an issue here:
- https://github.com/rrrene/credo/issues
- """
- |> String.trim_trailing()
-
- UI.puts()
- UI.puts(usage)
- UI.puts(description)
- UI.puts(example)
- UI.puts(options)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/default.ex
deleted file mode 100644
index dd624d3b..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/default.ex
+++ /dev/null
@@ -1,176 +0,0 @@
-defmodule Credo.CLI.Command.List.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Filename
- alias Credo.CLI.Output
- alias Credo.CLI.Output.Summary
- alias Credo.CLI.Output.UI
- alias Credo.Code.Scope
- alias Credo.Issue
- alias Credo.SourceFile
-
- @indent 8
-
- @doc "Called before the analysis is run."
- def print_before_info(source_files, exec) do
- UI.puts("")
-
- case Enum.count(source_files) do
- 0 -> UI.puts("No files found!")
- 1 -> UI.puts("Checking 1 source file ...")
- count -> UI.puts("Checking #{count} source files ...")
- end
-
- Output.print_skipped_checks(exec)
- end
-
- @doc "Called after the analysis has run."
- def print_after_info(source_files, exec, time_load, time_run) do
- term_width = Output.term_columns()
-
- source_files
- |> Enum.sort_by(& &1.filename)
- |> Enum.each(&print_issues(&1, exec, term_width))
-
- source_files
- |> Summary.print(exec, time_load, time_run)
- end
-
- defp print_issues(
- %SourceFile{filename: filename} = source_file,
- exec,
- term_width
- ) do
- issues = Credo.Execution.get_issues(exec, filename)
-
- issues
- |> print_issues(filename, source_file, exec, term_width)
- end
-
- defp print_issues(issues, _filename, source_file, _exec, term_width) do
- if issues |> Enum.any?() do
- first_issue = issues |> List.first()
- scope_name = Scope.mod_name(first_issue.scope)
- color = Output.check_color(first_issue)
-
- UI.puts()
-
- [
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " #{scope_name}" |> String.pad_trailing(term_width - 1)
- ]
- |> UI.puts()
-
- color
- |> UI.edge()
- |> UI.puts()
-
- issues
- |> Enum.sort_by(& &1.line_no)
- |> Enum.each(&print_issue(&1, source_file, term_width))
- end
- end
-
- defp print_issue(
- %Issue{
- check: check,
- message: message,
- filename: filename,
- priority: priority
- } = issue,
- source_file,
- term_width
- ) do
- outer_color = Output.check_color(issue)
- inner_color = Output.issue_color(issue)
- message_color = inner_color
- filename_color = :default_color
-
- tag_style =
- if outer_color == inner_color do
- :faint
- else
- :bright
- end
-
- [
- UI.edge(outer_color),
- inner_color,
- tag_style,
- Output.check_tag(check.category),
- " ",
- priority |> Output.priority_arrow(),
- :normal,
- message_color,
- " ",
- message
- ]
- |> UI.puts()
-
- [
- UI.edge(outer_color, @indent),
- filename_color,
- :faint,
- filename |> to_string,
- :default_color,
- :faint,
- Filename.pos_suffix(issue.line_no, issue.column),
- :faint,
- " (#{issue.scope})"
- ]
- |> UI.puts()
-
- if issue.line_no do
- print_issue_line_no(source_file, term_width, issue, outer_color, inner_color)
- end
-
- UI.puts_edge([outer_color, :faint], @indent)
- end
-
- defp print_issue_column(raw_line, line, issue, outer_color, inner_color) do
- offset = String.length(raw_line) - String.length(line)
- # column is one-based
- x = max(issue.column - offset - 1, 0)
-
- w =
- if is_nil(issue.trigger) do
- 1
- else
- issue.trigger
- |> to_string()
- |> String.length()
- end
-
- [
- UI.edge([outer_color, :faint], @indent),
- inner_color,
- String.duplicate(" ", x),
- :faint,
- String.duplicate("^", w)
- ]
- |> UI.puts()
- end
-
- defp print_issue_line_no(source_file, term_width, issue, outer_color, inner_color) do
- raw_line = SourceFile.line_at(source_file, issue.line_no)
- line = String.trim(raw_line)
-
- UI.puts_edge([outer_color, :faint])
-
- [
- UI.edge([outer_color, :faint]),
- :cyan,
- :faint,
- String.duplicate(" ", @indent - 2),
- UI.truncate(line, term_width - @indent)
- ]
- |> UI.puts()
-
- if issue.column, do: print_issue_column(raw_line, line, issue, outer_color, inner_color)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/flycheck.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/flycheck.ex
deleted file mode 100644
index ac13c4d7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/flycheck.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.List.Output.FlyCheck do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Flycheck
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Flycheck.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/json.ex
deleted file mode 100644
index a5cb8c2a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/json.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.List.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> JSON.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/oneline.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/oneline.ex
deleted file mode 100644
index 904f8ed9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/oneline.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.List.Output.Oneline do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Oneline
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Oneline.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/sarif.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/sarif.ex
deleted file mode 100644
index 53bedd0a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/list/output/sarif.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.List.Output.Sarif do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.SARIF
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> SARIF.print_issues(exec)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/default.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/default.ex
deleted file mode 100644
index b3f9a63f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/default.ex
+++ /dev/null
@@ -1,344 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.Output.Default do
- @moduledoc false
-
- alias Credo.CLI.Filename
- alias Credo.CLI.Output
- alias Credo.CLI.Output.Summary
- alias Credo.CLI.Output.UI
- alias Credo.CLI.Sorter
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- @category_starting_order [:design, :readability, :refactor]
- @category_ending_order [:warning, :consistency, :custom, :unknown]
- @category_colors [
- design: :olive,
- readability: :blue,
- refactor: :yellow,
- warning: :red,
- consistency: :cyan
- ]
- @category_titles [
- design: "Software Design",
- readability: "Code Readability",
- refactor: "Refactoring opportunities",
- warning: "Warnings - please take a look",
- consistency: "Consistency"
- ]
- @many_source_files 60
- @per_category 5
- @indent 8
-
- @doc "Called before the analysis is run."
- def print_before_info(source_files, exec) do
- case Enum.count(source_files) do
- 0 ->
- UI.puts("No files found!")
-
- 1 ->
- UI.puts("Checking 1 source file ...")
-
- count ->
- UI.puts("Checking #{count} source files#{checking_suffix(count)} ...")
- end
-
- Output.print_skipped_checks(exec)
- end
-
- defp checking_suffix(count) when count > @many_source_files do
- " (this might take a while)"
- end
-
- defp checking_suffix(_), do: ""
-
- @doc "Called after the analysis has run."
- def print_after_info(source_files, exec, time_load, time_run) do
- term_width = Output.term_columns()
-
- issues = Execution.get_issues(exec)
-
- categories =
- issues
- |> Enum.map(& &1.category)
- |> Enum.uniq()
-
- issue_map =
- Enum.into(categories, %{}, fn category ->
- {category, issues |> Enum.filter(&(&1.category == category))}
- end)
-
- source_file_map = Enum.into(source_files, %{}, &{&1.filename, &1})
-
- categories
- |> Sorter.ensure(@category_starting_order, @category_ending_order)
- |> Enum.each(fn category ->
- print_issues_for_category(
- category,
- issue_map[category],
- source_file_map,
- exec,
- term_width
- )
- end)
-
- source_files
- |> Summary.print(exec, time_load, time_run)
- end
-
- defp print_issues_for_category(
- _category,
- nil,
- _source_file_map,
- _exec,
- _term_width
- ) do
- nil
- end
-
- defp print_issues_for_category(
- category,
- issues,
- source_file_map,
- exec,
- term_width
- ) do
- color = @category_colors[category] || :magenta
- title = @category_titles[category] || "Category: #{category}"
-
- UI.puts()
-
- [
- :bright,
- "#{color}_background" |> String.to_atom(),
- color,
- " ",
- Output.foreground_color(color),
- :normal,
- " #{title}" |> String.pad_trailing(term_width - 1)
- ]
- |> UI.puts()
-
- color
- |> UI.edge()
- |> UI.puts()
-
- print_issues(issues, source_file_map, exec, term_width)
-
- if Enum.count(issues) > per_category(exec) do
- not_shown = Enum.count(issues) - per_category(exec)
-
- [
- UI.edge(color),
- :faint,
- " ... (#{not_shown} more, use `--all` to show them)"
- ]
- |> UI.puts()
- end
- end
-
- defp print_issues(issues, source_file_map, exec, term_width) do
- count = per_category(exec)
-
- issues
- |> Enum.sort_by(fn issue ->
- {issue.priority, issue.severity, issue.filename, issue.line_no}
- end)
- |> Enum.reverse()
- |> Enum.take(count)
- |> do_print_issues(source_file_map, exec, term_width)
- end
-
- defp per_category(%Execution{all: true}), do: 1_000_000
- defp per_category(%Execution{all: false}), do: @per_category
-
- defp do_print_issues(
- issues,
- source_file_map,
- %Execution{format: _} = exec,
- term_width
- ) do
- Enum.each(issues, fn %Issue{filename: filename} = issue ->
- source_file = source_file_map[filename]
-
- do_print_issue(issue, source_file, exec, term_width)
- end)
- end
-
- defp do_print_issue(
- %Issue{
- check: check,
- message: message,
- filename: filename,
- priority: priority
- } = issue,
- source_file,
- %Execution{format: _, verbose: verbose} = exec,
- term_width
- ) do
- outer_color = Output.check_color(issue)
- inner_color = Output.issue_color(issue)
- message_color = outer_color
- filename_color = :default_color
-
- tag_style =
- if outer_color == inner_color do
- :faint
- else
- :bright
- end
-
- message =
- if verbose do
- message <> " [" <> inspect(check) <> "]"
- else
- message
- end
-
- message
- |> UI.wrap_at(term_width - @indent)
- |> print_issue_message(
- check,
- outer_color,
- message_color,
- tag_style,
- priority
- )
-
- [
- UI.edge(outer_color, @indent),
- filename_color,
- :faint,
- filename |> to_string,
- :default_color,
- :faint,
- Filename.pos_suffix(issue.line_no, issue.column),
- :conceal,
- " #",
- :reset,
- :faint,
- "(#{issue.scope})"
- ]
- |> UI.puts()
-
- if exec.verbose do
- print_issue_line(issue, source_file, inner_color, outer_color, term_width)
-
- UI.puts_edge([outer_color, :faint])
- end
- end
-
- defp print_issue_message(
- [first_line | other_lines],
- check,
- outer_color,
- message_color,
- tag_style,
- priority
- ) do
- [
- UI.edge(outer_color),
- outer_color,
- tag_style,
- Output.check_tag(check.category),
- " ",
- priority |> Output.priority_arrow(),
- :normal,
- message_color,
- " ",
- first_line
- ]
- |> UI.puts()
-
- other_lines
- |> Enum.each(&print_issue_message(&1, outer_color, message_color))
- end
-
- defp print_issue_message("", _outer_color, _message_color) do
- end
-
- defp print_issue_message(message, outer_color, message_color) do
- [
- UI.edge(outer_color),
- outer_color,
- String.duplicate(" ", @indent - 3),
- :normal,
- message_color,
- " ",
- message
- ]
- |> UI.puts()
- end
-
- defp print_issue_line(
- %Issue{line_no: nil},
- _source_file,
- _inner_color,
- _outer_color,
- _term_width
- ) do
- nil
- end
-
- defp print_issue_line(
- %Issue{} = issue,
- source_file,
- inner_color,
- outer_color,
- term_width
- ) do
- raw_line = SourceFile.line_at(source_file, issue.line_no)
- line = String.trim(raw_line)
-
- [outer_color, :faint]
- |> UI.edge()
- |> UI.puts()
-
- [
- UI.edge([outer_color, :faint]),
- :cyan,
- :faint,
- String.duplicate(" ", @indent - 2),
- UI.truncate(line, term_width - @indent)
- ]
- |> UI.puts()
-
- print_issue_trigger_marker(issue, raw_line, inner_color, outer_color)
- end
-
- defp print_issue_trigger_marker(
- %Issue{column: nil},
- _line,
- _inner_color,
- _outer_color
- ) do
- nil
- end
-
- defp print_issue_trigger_marker(
- %Issue{} = issue,
- line,
- inner_color,
- outer_color
- ) do
- offset = String.length(line) - String.length(String.trim(line))
-
- # column is one-based
- x = max(issue.column - offset - 1, 0)
-
- w =
- case issue.trigger do
- nil -> 1
- atom -> atom |> to_string |> String.length()
- end
-
- [
- UI.edge([outer_color, :faint], @indent),
- inner_color,
- String.duplicate(" ", x),
- :faint,
- String.duplicate("^", w)
- ]
- |> UI.puts()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/flycheck.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/flycheck.ex
deleted file mode 100644
index 42d59cf1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/flycheck.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.Output.FlyCheck do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Flycheck
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Flycheck.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/json.ex
deleted file mode 100644
index 7c0965f7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/json.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.Output.Json do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> JSON.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/oneline.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/oneline.ex
deleted file mode 100644
index 6f0fcee7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/oneline.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.Output.Oneline do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.Oneline
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> Oneline.print_issues()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/sarif.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/sarif.ex
deleted file mode 100644
index 5ca71a3a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/output/sarif.ex
+++ /dev/null
@@ -1,14 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.Output.Sarif do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.SARIF
- alias Credo.Execution
-
- def print_before_info(_source_files, _exec), do: nil
-
- def print_after_info(_source_files, exec, _time_load, _time_run) do
- exec
- |> Execution.get_issues()
- |> SARIF.print_issues(exec)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_command.ex
deleted file mode 100644
index d67a4171..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_command.ex
+++ /dev/null
@@ -1,128 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.SuggestCommand do
- @moduledoc false
-
- alias Credo.Check.Params
- alias Credo.CLI.Command.Suggest.SuggestOutput
- alias Credo.CLI.Switch
- alias Credo.CLI.Task
- alias Credo.Execution
-
- use Credo.CLI.Command,
- short_description: "Suggest code objects to look at next (default)",
- treat_unknown_args_as_files: true,
- cli_switches: [
- Switch.boolean("all_priorities", alias: :A),
- Switch.boolean("all", alias: :a),
- Switch.boolean("crash_on_error"),
- Switch.keep("files_included"),
- Switch.keep("files_excluded"),
- Switch.keep("checks_with_tag"),
- Switch.keep("checks_without_tag"),
- Switch.string("checks", alias: :c),
- Switch.string("enable_disabled_checks"),
- Switch.string("min_priority"),
- Switch.boolean("mute_exit_status"),
- Switch.boolean("first_run"),
- Switch.string("format"),
- Switch.boolean("help", alias: :h),
- Switch.string("ignore_checks"),
- Switch.string("ignore", alias: :i),
- Switch.string("only"),
- Switch.boolean("read_from_stdin"),
- Switch.boolean("strict"),
- Switch.boolean("verbose"),
- Switch.boolean("watch")
- ]
-
- def init(exec) do
- Execution.put_pipeline(exec, "suggest",
- load_and_validate_source_files: [Task.LoadAndValidateSourceFiles],
- prepare_analysis: [Task.PrepareChecksToRun],
- __manipulate_config_if_rerun__: [__MODULE__.ManipulateConfigIfRerun],
- print_before_analysis: [__MODULE__.PrintBeforeInfo],
- run_analysis: [Task.RunChecks],
- filter_issues: [Task.SetRelevantIssues],
- print_after_analysis: [__MODULE__.PrintResultsAndSummary]
- )
- end
-
- def call(%Execution{help: true} = exec, _opts), do: SuggestOutput.print_help(exec)
- def call(exec, _opts), do: Execution.run_pipeline(exec, __MODULE__)
-
- defmodule PrintBeforeInfo do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec) do
- source_files = Execution.get_source_files(exec)
-
- SuggestOutput.print_before_info(source_files, exec)
-
- exec
- end
- end
-
- defmodule PrintResultsAndSummary do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec) do
- source_files = Execution.get_source_files(exec)
-
- time_load = Execution.get_assign(exec, "credo.time.source_files")
- time_run = Execution.get_assign(exec, "credo.time.run_checks")
-
- SuggestOutput.print_after_info(source_files, exec, time_load, time_run)
-
- exec
- end
- end
-
- defmodule ManipulateConfigIfRerun do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec, _opts) do
- case Execution.get_rerun(exec) do
- :notfound ->
- exec
-
- {previous_exec, files_that_changed} ->
- exec
- |> selectively_transfer_issues_from_previous_exec(previous_exec, files_that_changed)
- |> modify_config_to_only_include_needed_checks(files_that_changed)
- end
- end
-
- def selectively_transfer_issues_from_previous_exec(exec, previous_exec, files_that_changed) do
- issues_to_keep =
- previous_exec
- |> Execution.get_issues()
- |> Enum.reject(fn issue ->
- issue.category == :consistency ||
- Enum.member?(files_that_changed, issue.filename)
- end)
-
- # all checks on `files_that_changed`
- # consistency checks on all files
-
- Execution.put_issues(exec, issues_to_keep)
- end
-
- def modify_config_to_only_include_needed_checks(%Credo.Execution{} = exec, files_that_changed) do
- checks =
- Enum.map(exec.checks, fn {check, params} ->
- if check.category == :consistency do
- {check, params}
- else
- {check, Params.put_rerun_files_that_changed(params, files_that_changed)}
- end
- end)
-
- %Execution{exec | checks: checks}
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_output.ex
deleted file mode 100644
index 8860692f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/suggest/suggest_output.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Credo.CLI.Command.Suggest.SuggestOutput do
- @moduledoc false
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Suggest.Output.Default,
- flycheck: Credo.CLI.Command.Suggest.Output.FlyCheck,
- oneline: Credo.CLI.Command.Suggest.Output.Oneline,
- json: Credo.CLI.Command.Suggest.Output.Json,
- sarif: Credo.CLI.Command.Suggest.Output.Sarif
-
- alias Credo.CLI.Output.UI
-
- def print_help(exec) do
- usage = ["Usage: ", :olive, "mix credo suggest [options]"]
-
- description = """
-
- Suggests objects from every category that Credo thinks can be improved.
- """
-
- example = [
- "Examples:\n",
- :olive,
- " $ mix credo suggest --format json\n",
- " $ mix credo suggest \"lib/**/*.ex\" --only consistency --all\n",
- " $ mix credo suggest --checks-without-tag formatter --checks-without-tag controversial"
- ]
-
- options =
- """
-
- Arrows (↑ ↗ → ↘ ↓) hint at the importance of an issue.
-
- Suggest options:
- -a, --all Show all issues
- -A, --all-priorities Show all issues including low priority ones
- -c, --checks Only include checks that match the given strings
- --checks-with-tag Only include checks that match the given tag (can be used multiple times)
- --checks-without-tag Ignore checks that match the given tag (can be used multiple times)
- --config-file Use the given config file
- -C, --config-name Use the given config instead of "default"
- --enable-disabled-checks Re-enable disabled checks that match the given strings
- --files-included Only include these files (accepts globs, can be used multiple times)
- --files-excluded Exclude these files (accepts globs, can be used multiple times)
- --format Display the list in a specific format (json,flycheck,oneline)
- -i, --ignore-checks Ignore checks that match the given strings
- --ignore Alias for --ignore-checks
- --min-priority Minimum priority to show issues (high,medium,normal,low,lower or number)
- --mute-exit-status Exit with status zero even if there are issues
- --only Alias for --checks
- --strict Alias for --all-priorities
-
- General options:
- --[no-]color Toggle colored output
- -v, --version Show version
- -h, --help Show this help
-
- Find advanced usage instructions and more examples here:
- https://hexdocs.pm/credo/suggest_command.html
-
- Give feedback and open an issue here:
- https://github.com/rrrene/credo/issues
- """
- |> String.trim_trailing()
-
- UI.puts()
- UI.puts(usage)
- UI.puts(description)
- UI.puts(example)
- UI.puts(options)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/version.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/command/version.ex
deleted file mode 100644
index fbf92323..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/command/version.ex
+++ /dev/null
@@ -1,28 +0,0 @@
-defmodule Credo.CLI.Command.Version do
- @moduledoc false
-
- alias Credo.CLI.Output.Formatter.JSON
- alias Credo.CLI.Output.UI
- alias Credo.CLI.Switch
- alias Credo.Execution
-
- use Credo.CLI.Command,
- short_description: "Show Credo's version number",
- cli_switches: [
- Switch.string("format"),
- Switch.boolean("version", alias: :v)
- ]
-
- @doc false
- def call(%Execution{format: "json"} = exec, _opts) do
- JSON.print_map(%{version: Credo.version()})
-
- exec
- end
-
- def call(exec, _opts) do
- UI.puts(Credo.version())
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/exit_status.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/exit_status.ex
deleted file mode 100644
index 960dceb4..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/exit_status.ex
+++ /dev/null
@@ -1,7 +0,0 @@
-defmodule Credo.CLI.ExitStatus do
- @moduledoc false
-
- def generic_error, do: 128
- def config_parser_error, do: 129
- def config_loaded_but_invalid, do: 130
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/filename.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/filename.ex
deleted file mode 100644
index ed50e062..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/filename.ex
+++ /dev/null
@@ -1,81 +0,0 @@
-defmodule Credo.CLI.Filename do
- @moduledoc """
- This module can be used to handle filenames given at the command line.
- """
-
- @doc """
- Returns `true` if a given `filename` contains a pos_suffix.
-
- iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex:39:8")
- true
-
- iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex:39")
- true
-
- iex> Credo.CLI.Filename.contains_line_no?("lib/credo/sources.ex")
- false
- """
- def contains_line_no?(nil), do: false
-
- def contains_line_no?(filename) do
- count =
- filename
- |> String.split(":")
- |> Enum.count()
-
- if windows_path?(filename) do
- count == 3 || count == 4
- else
- count == 2 || count == 3
- end
- end
-
- @doc """
- Returns a suffix for a filename, which contains a line and column value.
-
- iex> Credo.CLI.Filename.pos_suffix(39, 8)
- ":39:8"
-
- iex> Credo.CLI.Filename.pos_suffix(39, nil)
- ":39"
-
- These are used in this way: lib/credo/sources.ex:39:8
- """
- def pos_suffix(nil, nil), do: ""
- def pos_suffix(line_no, nil), do: ":#{line_no}"
- def pos_suffix(line_no, column), do: ":#{line_no}:#{column}"
-
- @doc """
- Removes the pos_suffix for a filename.
-
- iex> Credo.CLI.Filename.remove_line_no_and_column("lib/credo/sources.ex:39:8")
- "lib/credo/sources.ex"
- """
- def remove_line_no_and_column(filename) do
- filename
- |> String.split(":")
- |> remove_line_no_and_column(windows_path?(filename))
- end
-
- defp remove_line_no_and_column(parts, true) do
- Enum.at(parts, 0) <> ":" <> Enum.at(parts, 1)
- end
-
- defp remove_line_no_and_column(parts, false) do
- List.first(parts)
- end
-
- defp windows_path?(path) do
- String.contains?(path, ":\/")
- end
-
- @doc """
- Adds a pos_suffix to a filename.
-
- iex> Credo.CLI.Filename.with("test/file.exs", %{:line_no => 1, :column => 2})
- "test/file.exs:1:2"
- """
- def with(filename, opts) do
- filename <> pos_suffix(opts[:line_no], opts[:column])
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/filter.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/filter.ex
deleted file mode 100644
index 0a046aa5..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/filter.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Credo.CLI.Filter do
- @moduledoc false
-
- # TODO: is this the right place for this module?
-
- alias Credo.Check.ConfigComment
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- def important(list, exec) when is_list(list) do
- Enum.filter(list, &important?(&1, exec))
- end
-
- def important?(%Issue{} = issue, exec) do
- issue.priority >= exec.min_priority
- end
-
- def important?(%SourceFile{filename: filename}, exec) do
- exec
- |> Execution.get_issues(filename)
- |> Enum.any?(&important?(&1, exec))
- end
-
- def valid_issues(list, exec) when is_list(list) do
- Enum.reject(list, fn issue ->
- ignored_by_config_comment?(issue, exec)
- end)
- end
-
- def ignored_by_config_comment?(%Issue{} = issue, exec) do
- case exec.config_comment_map[issue.filename] do
- list when is_list(list) ->
- Enum.any?(list, &ConfigComment.ignores_issue?(&1, issue))
-
- _ ->
- false
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/options.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/options.ex
deleted file mode 100644
index efe6f3d4..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/options.ex
+++ /dev/null
@@ -1,245 +0,0 @@
-defmodule Credo.CLI.Options do
- @moduledoc """
- The `Options` struct represents the options given on the command line.
-
- The `Options` struct is stored as part of the `Execution` struct.
- """
-
- alias Credo.Priority
-
- defstruct command: nil,
- path: nil,
- args: [],
- switches: nil,
- unknown_switches: [],
- unknown_args: []
-
- @deprecated "Options.parse/7 is deprecated, use Options.parse/8 instead"
- def parse(
- argv,
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- aliases
- ) do
- parse(
- true,
- argv,
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- aliases
- )
- end
-
- @doc """
- Returns a `Options` struct for the given parameters.
- """
- def parse(
- use_strict_parser?,
- argv,
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- aliases,
- treat_unknown_args_as_files? \\ false
- )
-
- def parse(
- true = _use_strict_parser?,
- argv,
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- aliases,
- treat_unknown_args_as_files?
- ) do
- argv
- |> OptionParser.parse(strict: switches_definition, aliases: aliases)
- |> parse_result(
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- treat_unknown_args_as_files?
- )
- end
-
- def parse(
- false = _use_strict_parser?,
- argv,
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- aliases,
- treat_unknown_args_as_files?
- ) do
- argv
- |> OptionParser.parse(switches: switches_definition, aliases: aliases)
- |> parse_result(
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- [],
- treat_unknown_args_as_files?
- )
- end
-
- defp parse_result(
- {switches_keywords, args, unknown_switches_keywords},
- current_dir,
- command_names,
- given_command_name,
- ignored_args,
- switches_definition,
- treat_unknown_args_as_files?
- ) do
- args = Enum.reject(args, &Enum.member?(ignored_args, &1))
-
- {command, path, unknown_args} =
- split_args(args, current_dir, command_names, switches_keywords[:working_dir])
-
- {switches_keywords, extra_unknown_switches} = patch_switches(switches_keywords)
-
- switch_definitions_for_lists =
- Enum.filter(switches_definition, fn
- {_name, :keep} -> true
- {_name, [_, :keep]} -> true
- {_name, _value} -> false
- end)
-
- switches_with_lists_as_map =
- switch_definitions_for_lists
- |> Enum.map(fn {name, _value} ->
- {name, Keyword.get_values(switches_keywords, name)}
- end)
- |> Enum.into(%{})
-
- switches =
- switches_keywords
- |> Enum.into(%{})
- |> Map.merge(switches_with_lists_as_map)
-
- {path, switches} =
- if File.dir?(path) do
- switches =
- if treat_unknown_args_as_files? do
- Map.put(switches, :files_included, unknown_args)
- else
- switches
- end
-
- {path, switches}
- else
- files_included =
- if treat_unknown_args_as_files? do
- [path] ++ unknown_args
- else
- [path]
- end
-
- {current_dir, Map.put(switches, :files_included, files_included)}
- end
-
- args =
- if treat_unknown_args_as_files? do
- []
- else
- unknown_args
- end
-
- %__MODULE__{
- command: command || given_command_name,
- path: path,
- args: args,
- switches: switches,
- unknown_switches: unknown_switches_keywords ++ extra_unknown_switches
- }
- end
-
- defp patch_switches(switches_keywords) do
- {switches, unknowns} = Enum.map_reduce(switches_keywords, [], &patch_switch/2)
- switches = Enum.reject(switches, &(&1 == nil))
- {switches, unknowns}
- end
-
- defp patch_switch({:min_priority, str}, unknowns) do
- priority = priority_as_name(str) || priority_as_number(str)
-
- case priority do
- nil -> {nil, [{"--min-priority", str} | unknowns]}
- int -> {{:min_priority, int}, unknowns}
- end
- end
-
- defp patch_switch(switch, unknowns), do: {switch, unknowns}
-
- defp priority_as_name(str), do: Priority.to_integer(str)
-
- defp priority_as_number(str) do
- case Integer.parse(str) do
- {int, ""} -> int
- _ -> nil
- end
- end
-
- defp split_args([], current_dir, _, nil) do
- {path, unknown_args} = extract_path([], current_dir)
-
- {nil, path, unknown_args}
- end
-
- defp split_args([], _current_dir, _, given_working_dir) do
- {nil, given_working_dir, []}
- end
-
- defp split_args([head | tail] = args, current_dir, command_names, nil) do
- if Enum.member?(command_names, head) do
- {path, unknown_args} = extract_path(tail, current_dir)
-
- {head, path, unknown_args}
- else
- {path, unknown_args} = extract_path(args, current_dir)
-
- {nil, path, unknown_args}
- end
- end
-
- defp split_args([head | tail] = args, _current_dir, command_names, given_working_dir) do
- if Enum.member?(command_names, head) do
- {head, given_working_dir, tail}
- else
- {nil, given_working_dir, args}
- end
- end
-
- defp extract_path([], base_dir) do
- {base_dir, []}
- end
-
- defp extract_path([path | tail] = args, base_dir) do
- if File.exists?(path) or path =~ ~r/[\?\*]/ do
- {path, tail}
- else
- path_with_base = Path.join(base_dir, path)
-
- if File.exists?(path_with_base) do
- {path_with_base, tail}
- else
- {base_dir, args}
- end
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output.ex
deleted file mode 100644
index d85300ac..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output.ex
+++ /dev/null
@@ -1,255 +0,0 @@
-defmodule Credo.CLI.Output do
- @moduledoc """
- This module provides helper functions regarding command line output.
- """
-
- @category_tag_map %{"refactor" => "F"}
-
- alias Credo.CLI.Output.UI
- alias Credo.Execution
- alias Credo.Priority
-
- def check_tag(category, in_parens \\ true)
-
- def check_tag(category, in_parens) when is_binary(category) do
- default_tag =
- category
- |> String.at(0)
- |> String.upcase()
-
- tag = Map.get(@category_tag_map, category, default_tag)
-
- if in_parens do
- "[#{tag}]"
- else
- tag
- end
- end
-
- def check_tag(category, in_parens) when is_atom(category) do
- category
- |> to_string
- |> check_tag(in_parens)
- end
-
- def check_tag(check_mod, in_parens) do
- check_mod.category
- |> to_string
- |> check_tag(in_parens)
- end
-
- def check_color(category) when is_binary(category) do
- case category do
- "consistency" -> :cyan
- "readability" -> :blue
- "design" -> :olive
- "refactor" -> :yellow
- "warning" -> :red
- _ -> :magenta
- end
- end
-
- def check_color(category) when is_atom(category) do
- category
- |> to_string
- |> check_color
- end
-
- def check_color(check_mod) do
- check_mod.category
- |> to_string
- |> check_color
- end
-
- @doc """
- Returns a suitable color for a given priority.
-
- iex> Credo.CLI.Output.issue_color(%Credo.Issue{priority: :higher})
- :red
-
- iex> Credo.CLI.Output.issue_color(%Credo.Issue{priority: 20})
- :red
-
- """
- def issue_color(issue_or_priority) do
- case Priority.to_atom(issue_or_priority) do
- :higher -> :red
- :high -> :red
- :normal -> :yellow
- :low -> :blue
- :ignore -> :magenta
- _ -> "?"
- end
- end
-
- @doc """
- Returns a suitable arrow for a given priority.
-
- iex> Credo.CLI.Output.priority_arrow(:high)
- "↗"
-
- iex> Credo.CLI.Output.priority_arrow(10)
- "↗"
-
- iex> Credo.CLI.Output.priority_arrow(%Credo.Issue{priority: 10})
- "↗"
- """
- def priority_arrow(issue_or_priority) do
- case Priority.to_atom(issue_or_priority) do
- :higher -> "\u2191"
- :high -> "\u2197"
- :normal -> "\u2192"
- :low -> "\u2198"
- :ignore -> "\u2193"
- _ -> "?"
- end
- end
-
- @doc """
- Returns a suitable name for a given priority.
-
- iex> Credo.CLI.Output.priority_name(:normal)
- "normal"
-
- iex> Credo.CLI.Output.priority_name(1)
- "normal"
-
- iex> Credo.CLI.Output.priority_name(%Credo.Issue{priority: 1})
- "normal"
-
- """
- def priority_name(issue_or_priority) do
- case Priority.to_atom(issue_or_priority) do
- :higher -> "higher"
- :high -> "high"
- :normal -> "normal"
- :low -> "low"
- :ignore -> "ignore"
- _ -> "?"
- end
- end
-
- @doc """
- Returns a suitable foreground color for a given `background_color`.
-
- iex> Credo.CLI.Output.foreground_color(:yellow)
- :black
-
- iex> Credo.CLI.Output.foreground_color(:blue)
- :white
-
- """
- def foreground_color(background_color)
-
- def foreground_color(:cyan), do: :black
- def foreground_color(:yellow), do: :black
- def foreground_color(_), do: :white
-
- def term_columns(default \\ 80) do
- case :io.columns() do
- {:ok, columns} ->
- columns
-
- _ ->
- default
- end
- end
-
- def complain_about_invalid_source_files([]), do: nil
-
- def complain_about_invalid_source_files(invalid_source_files) do
- invalid_source_filenames = Enum.map(invalid_source_files, & &1.filename)
-
- output = [
- :reset,
- :bright,
- :orange,
- "info: ",
- :red,
- "Some source files could not be parsed correctly and are excluded:\n"
- ]
-
- UI.warn(output)
-
- print_numbered_list(invalid_source_filenames)
- end
-
- def complain_about_timed_out_source_files([]), do: nil
-
- def complain_about_timed_out_source_files(large_source_files) do
- large_source_filenames = Enum.map(large_source_files, & &1.filename)
-
- output = [
- :reset,
- :bright,
- :orange,
- "info: ",
- :red,
- "Some source files were not parsed in the time allotted:\n"
- ]
-
- UI.warn(output)
-
- print_numbered_list(large_source_filenames)
- end
-
- def print_skipped_checks(%Execution{skipped_checks: []}), do: nil
-
- def print_skipped_checks(%Execution{skipped_checks: skipped_checks}) do
- msg = [
- :reset,
- :bright,
- :orange,
- "info: ",
- :reset,
- :faint,
- "some checks were skipped because they're not compatible with\n",
- :reset,
- :faint,
- "your version of Elixir (#{System.version()}).\n\n",
- "You can deactivate these checks by adding this to the `checks` list in your config:\n"
- ]
-
- UI.puts("")
- UI.puts(msg)
-
- skipped_checks
- |> Enum.map(&check_name/1)
- |> print_disabled_check_config
- end
-
- defp check_name({check, _check_info}), do: check_name({check})
-
- defp check_name({check}) do
- check
- |> to_string
- |> String.replace(~r/^Elixir\./, "")
- end
-
- defp print_numbered_list(list) do
- list
- |> Enum.with_index()
- |> Enum.flat_map(fn {string, index} ->
- [
- :reset,
- String.pad_leading("#{index + 1})", 5),
- :faint,
- " #{string}\n"
- ]
- end)
- |> UI.warn()
- end
-
- defp print_disabled_check_config(list) do
- list
- |> Enum.flat_map(fn string ->
- [
- :reset,
- String.pad_leading(" ", 4),
- :faint,
- "{#{string}, false},\n"
- ]
- end)
- |> UI.puts()
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/first_run_hint.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/first_run_hint.ex
deleted file mode 100644
index d805aa8a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/first_run_hint.ex
+++ /dev/null
@@ -1,232 +0,0 @@
-defmodule Credo.CLI.Output.FirstRunHint do
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- @lots_of_issue_threshold 30
- @command_padding 40
- @category_count 5
-
- def call(exec) do
- term_width = Output.term_columns()
- issues = Execution.get_issues(exec)
-
- headline = " 8< "
- bar = String.pad_leading("", div(term_width - String.length(headline), 2), "-")
-
- UI.puts()
- UI.puts()
- UI.puts([:magenta, :bright, "#{bar} 8< #{bar}"])
- UI.puts()
- UI.puts()
-
- issue_count = Enum.count(issues)
-
- readability_issue_count =
- issues
- |> Enum.filter(&(&1.category == :readability))
- |> Enum.count()
-
- relative_issue_count_per_category = div(issue_count, @category_count)
-
- mostly_readability_issues =
- readability_issue_count >= div(@lots_of_issue_threshold, 2) &&
- readability_issue_count > relative_issue_count_per_category * 2
-
- readability_hint =
- if mostly_readability_issues do
- [
- """
-
- While not recommended, you could simply start ignoring issues for the time being:
-
- """,
- :cyan,
- String.pad_trailing(" mix credo --ignore readability", @command_padding),
- :faint,
- "# exclude checks matching a given phrase",
- "\n",
- :reset
- ]
- else
- []
- end
-
- if issue_count >= @lots_of_issue_threshold do
- UI.puts([
- :reset,
- :orange,
- """
- # Where to start?
- """,
- :reset,
- """
-
- That's a lot of issues to deal with at once.
- """,
- readability_hint
- ])
- else
- UI.puts([
- :reset,
- :orange,
- """
- # How to introduce Credo
- """,
- :reset,
- """
-
- This is looking pretty already! You can probably just fix the issues above in one go.
-
- """,
- readability_hint
- ])
- end
-
- print_lots_of_issues(exec)
-
- UI.puts([
- :reset,
- :orange,
- """
-
- ## Every project is different
- """,
- :reset,
- """
-
- Introducing code analysis to an existing codebase should not be about following any
- "best practice" in particular, it should be about helping you to get to know the ropes
- and make the changes you want.
-
- Try the options outlined above to see which one is working for this project!
- """
- ])
- end
-
- defp print_lots_of_issues(exec) do
- working_dir = Execution.working_dir(exec)
- now = now()
- default_branch = default_branch(working_dir)
- latest_commit_on_default_branch = latest_commit_on_default_branch(working_dir)
- latest_tag = latest_tag(working_dir)
-
- current_branch = current_branch(working_dir)
-
- if current_branch != default_branch do
- UI.puts([
- :reset,
- """
- You can use `diff` to only show the issues that were introduced on this branch:
- """,
- :cyan,
- """
-
- mix credo diff #{default_branch}
-
- """
- ])
- end
-
- UI.puts([
- :reset,
- :orange,
- """
- ## Compare to a point in history
- """,
- :reset,
- """
-
- Alternatively, you can use `diff` to only show the issues that were introduced after a certain tag or commit:
- """
- ])
-
- if latest_tag do
- UI.puts([
- :cyan,
- String.pad_trailing(" mix credo diff #{latest_tag} ", @command_padding),
- :faint,
- "# use the latest tag",
- "\n"
- ])
- end
-
- UI.puts([
- :reset,
- :cyan,
- String.pad_trailing(
- " mix credo diff #{latest_commit_on_default_branch}",
- @command_padding
- ),
- :faint,
- "# use the current HEAD of #{default_branch}",
- "\n\n",
- :reset,
- """
- Lastly, you can compare your working dir against this point in time:
-
- """,
- :cyan,
- String.pad_trailing(" mix credo diff --since #{now}", @command_padding),
- :faint,
- "# use the current date",
- "\n"
- ])
- end
-
- defp latest_tag(working_dir) do
- case System.cmd("git", ~w"rev-list --tags --max-count=1", cd: working_dir) do
- {"", 0} ->
- nil
-
- {latest_tag_sha1, 0} ->
- case System.cmd("git", ~w"describe --tags #{latest_tag_sha1}", cd: working_dir) do
- {tagname, 0} -> String.trim(tagname)
- _ -> nil
- end
-
- _ ->
- nil
- end
- end
-
- defp current_branch(working_dir) do
- case System.cmd("git", ~w"rev-parse --abbrev-ref HEAD", cd: working_dir) do
- {output, 0} -> String.trim(output)
- _ -> nil
- end
- end
-
- defp default_branch(working_dir) do
- remote_name = default_remote_name(working_dir)
-
- case System.cmd("git", ~w"symbolic-ref refs/remotes/#{remote_name}/HEAD", cd: working_dir) do
- {output, 0} -> ~r"refs/remotes/#{remote_name}/(.+)$" |> Regex.run(output) |> Enum.at(1)
- _ -> nil
- end
- end
-
- defp default_remote_name(_working_dir) do
- "origin"
- end
-
- defp latest_commit_on_default_branch(working_dir) do
- case System.cmd(
- "git",
- ~w"rev-parse --short #{default_remote_name(working_dir)}/#{default_branch(working_dir)}",
- cd: working_dir
- ) do
- {output, 0} -> String.trim(output)
- _ -> nil
- end
- end
-
- defp now do
- %{year: year, month: month, day: day} = DateTime.utc_now()
-
- "#{year}-#{pad(month)}-#{pad(day)}"
- end
-
- defp pad(number) when number < 10, do: "0#{number}"
- defp pad(number), do: to_string(number)
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/format_delegator.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/format_delegator.ex
deleted file mode 100644
index 9b6190ff..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/format_delegator.ex
+++ /dev/null
@@ -1,70 +0,0 @@
-defmodule Credo.CLI.Output.FormatDelegator do
- @moduledoc """
- This module can be used to easily delegate print-statements for different
- formats to different modules.
-
- Example:
-
- use Credo.CLI.Output.FormatDelegator,
- default: Credo.CLI.Command.Suggest.Output.Default,
- flycheck: Credo.CLI.Command.Suggest.Output.FlyCheck,
- oneline: Credo.CLI.Command.Suggest.Output.Oneline,
- json: Credo.CLI.Command.Suggest.Output.Json
-
- """
-
- @doc false
- defmacro __using__(format_list) do
- format_mods =
- Enum.map(format_list, fn {format, output_mod} ->
- case format do
- :default ->
- quote do
- end
-
- _ ->
- quote do
- defp format_mod(%Execution{format: unquote(to_string(format))}) do
- unquote(output_mod)
- end
- end
- end
- end)
-
- default_format_mod =
- Enum.map(format_list, fn {format, output_mod} ->
- case format do
- :default ->
- quote do
- defp format_mod(_) do
- unquote(output_mod)
- end
- end
-
- _ ->
- quote do
- end
- end
- end)
-
- quote do
- alias Credo.Execution
-
- def print_before_info(source_files, exec) do
- format_mod = format_mod(exec)
-
- format_mod.print_before_info(source_files, exec)
- end
-
- def print_after_info(source_files, exec, time_load, time_run) do
- format_mod = format_mod(exec)
-
- format_mod.print_after_info(source_files, exec, time_load, time_run)
- end
-
- unquote(format_mods)
-
- unquote(default_format_mod)
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/flycheck.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/flycheck.ex
deleted file mode 100644
index 0ed4c51d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/flycheck.ex
+++ /dev/null
@@ -1,30 +0,0 @@
-defmodule Credo.CLI.Output.Formatter.Flycheck do
- @moduledoc false
-
- alias Credo.CLI.Filename
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.Issue
-
- def print_issues(issues) do
- Enum.each(issues, fn issue ->
- issue
- |> to_flycheck()
- |> UI.puts()
- end)
- end
-
- def to_flycheck(
- %Issue{
- message: message,
- filename: filename,
- column: column,
- line_no: line_no
- } = issue
- ) do
- pos_suffix = Filename.pos_suffix(line_no, column)
- tag = Output.check_tag(issue, false)
-
- "#{filename}#{pos_suffix}: #{tag}: #{message}"
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/json.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/json.ex
deleted file mode 100644
index 80507229..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/json.ex
+++ /dev/null
@@ -1,87 +0,0 @@
-defmodule Credo.CLI.Output.Formatter.JSON do
- @moduledoc false
-
- alias Credo.CLI.Output.UI
- alias Credo.Issue
-
- def print_issues(issues) do
- %{
- "issues" => Enum.map(issues, &issue_to_json/1)
- }
- |> print_map()
- end
-
- def print_map(map) do
- map
- |> prepare_for_json()
- |> Jason.encode!(pretty: true)
- |> UI.puts()
- end
-
- def prepare_for_json(term)
- when is_atom(term) or is_number(term) or is_binary(term) do
- term
- end
-
- def prepare_for_json(term) when is_list(term), do: Enum.map(term, &prepare_for_json/1)
-
- def prepare_for_json(%Regex{} = regex), do: inspect(regex)
-
- def prepare_for_json(%{} = term) do
- Enum.into(term, %{}, fn {key, value} ->
- {prepare_key_for_json(key), prepare_for_json(value)}
- end)
- end
-
- def prepare_for_json(term) when is_tuple(term) do
- term
- |> Tuple.to_list()
- |> prepare_for_json()
- end
-
- def prepare_for_json(term) do
- inspect(term)
- end
-
- defp prepare_key_for_json(key) when is_atom(key) or is_binary(key) or is_number(key) do
- key
- end
-
- defp prepare_key_for_json(key) do
- inspect(key)
- end
-
- def issue_to_json(
- %Issue{
- check: check,
- category: category,
- message: message,
- filename: filename,
- priority: priority,
- scope: scope
- } = issue
- ) do
- check_name =
- check
- |> to_string()
- |> String.replace(~r/^(Elixir\.)/, "")
-
- column_end =
- if issue.column && issue.trigger do
- issue.column + String.length(to_string(issue.trigger))
- end
-
- %{
- "check" => check_name,
- "category" => to_string(category),
- "filename" => to_string(filename),
- "line_no" => issue.line_no,
- "column" => issue.column,
- "column_end" => column_end,
- "trigger" => issue.trigger,
- "message" => message,
- "priority" => priority,
- "scope" => scope
- }
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/oneline.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/oneline.ex
deleted file mode 100644
index 9c51ce37..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/oneline.ex
+++ /dev/null
@@ -1,48 +0,0 @@
-defmodule Credo.CLI.Output.Formatter.Oneline do
- @moduledoc false
-
- alias Credo.CLI.Filename
- alias Credo.CLI.Output
- alias Credo.CLI.Output.UI
- alias Credo.Issue
-
- def print_issues(issues) do
- issues
- |> Enum.sort_by(fn issue -> {issue.filename, issue.line_no, issue.column} end)
- |> Enum.each(fn issue ->
- UI.puts(to_oneline(issue))
- end)
- end
-
- defp to_oneline(
- %Issue{
- check: check,
- message: message,
- filename: filename,
- priority: priority
- } = issue
- ) do
- inner_color = Output.check_color(issue)
- message_color = inner_color
- filename_color = :default_color
-
- [
- inner_color,
- Output.check_tag(check.category),
- " ",
- priority |> Output.priority_arrow(),
- " ",
- :reset,
- filename_color,
- :faint,
- filename |> to_string,
- :default_color,
- :faint,
- Filename.pos_suffix(issue.line_no, issue.column),
- :reset,
- message_color,
- " ",
- message
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/sarif.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/sarif.ex
deleted file mode 100644
index 76267512..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/formatter/sarif.ex
+++ /dev/null
@@ -1,246 +0,0 @@
-defmodule Credo.CLI.Output.Formatter.SARIF do
- @moduledoc false
-
- alias Credo.Issue
-
- # we use this key and Jason's key ordering to ensure that the "version"
- # is right below the "schema" key in the JSON output
- @version_placeholder_json_key "$schema__this_key_goes_to_line2__version"
-
- def print_issues(issues, exec) do
- issue_list =
- Enum.map(issues, fn issue ->
- issue_to_sarif(issue, exec)
- end)
-
- {_, final_results} = sum_rules_and_results(issue_list, [], [])
-
- final_rules =
- issues
- |> Enum.uniq_by(& &1.check.id)
- |> Enum.map(fn issue ->
- %{
- "id" => issue.check.id,
- "name" => Credo.Code.Name.full(issue.check),
- "fullDescription" => %{
- "text" => issue.check.explanation |> String.replace("`", "'"),
- "markdown" => issue.check.explanation
- },
- "properties" => %{
- "tags" => [
- issue.category
- ]
- },
- "helpUri" => issue.check.docs_uri
- }
- end)
-
- %{
- "$schema" => "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
- @version_placeholder_json_key => "2.1.0",
- "runs" => [
- %{
- "tool" => %{
- "driver" => %{
- "name" => "Credo",
- "informationUri" => "http://credo-ci.org/",
- "version" => "#{Credo.version()}",
- "rules" => final_rules
- }
- },
- "results" => final_results,
- "originalUriBaseIds" => %{
- "ROOTPATH" => %{
- "uri" => to_file_uri(exec.cli_options.path)
- }
- },
- "columnKind" => "utf16CodeUnits"
- }
- ]
- }
- |> print_map()
- end
-
- def print_map(map) do
- map
- |> prepare_for_json()
- |> Jason.encode!(pretty: true)
- |> move_version_to_top()
- |> IO.puts()
- end
-
- defp prepare_for_json(term)
- when is_atom(term) or is_number(term) or is_binary(term) do
- term
- end
-
- defp prepare_for_json(term) when is_list(term), do: Enum.map(term, &prepare_for_json/1)
-
- defp prepare_for_json(%Regex{} = regex), do: inspect(regex)
-
- defp prepare_for_json(%{} = term) do
- Enum.into(term, %{}, fn {key, value} ->
- {prepare_key_for_json(key), prepare_for_json(value)}
- end)
- end
-
- defp prepare_for_json(term) when is_tuple(term) do
- term
- |> Tuple.to_list()
- |> prepare_for_json()
- end
-
- defp prepare_for_json(term) do
- inspect(term)
- end
-
- defp prepare_key_for_json(key) when is_atom(key) or is_binary(key) or is_number(key) do
- key
- end
-
- defp prepare_key_for_json(key) do
- inspect(key)
- end
-
- defp move_version_to_top(sarif) do
- String.replace(sarif, ~s("#{@version_placeholder_json_key}": "), ~s("version": "))
- end
-
- defp to_file_uri(path) do
- "file:///" <>
- (path
- |> String.replace("\\", "/")
- |> String.replace_leading("/", "")
- |> String.replace_trailing("/", "")) <> "/"
- end
-
- defp priority_to_sarif_level(priority) when is_number(priority) do
- cond do
- # :higher
- priority > 19 -> :error
- # :high
- priority in 10..19 -> :error
- # :normal
- priority in 0..9 -> :warning
- # :low
- priority in -10..-1 -> :note
- # :ignore
- priority < -10 -> :note
- end
- end
-
- defp priority_to_sarif_level(_), do: :warning
-
- defp priority_to_sarif_rank(priority) when is_number(priority) do
- cond do
- priority < -10 -> 1
- priority > 89 -> 100
- true -> priority + 11
- end
- end
-
- defp priority_to_sarif_rank(_), do: 0
-
- defp issue_to_sarif(%Issue{} = issue, exec) do
- sarif_level = priority_to_sarif_level(issue.priority)
-
- column_end =
- if issue.column && issue.trigger do
- issue.column + String.length(to_string(issue.trigger))
- end
-
- rule_and_issue = {
- %{
- "id" => issue.check.id,
- "name" => Credo.Code.Name.full(issue.check),
- "fullDescription" => %{
- "text" => issue.check.explanation |> String.replace("`", "'"),
- "markdown" => issue.check.explanation
- },
- "properties" => %{
- "tags" => [
- issue.category
- ]
- },
- "helpUri" => issue.check.docs_uri
- },
- %{
- "ruleId" => issue.check.id,
- "level" => sarif_level,
- "rank" => priority_to_sarif_rank(issue.priority),
- "message" => %{
- "text" => issue.message |> String.replace("`", "'"),
- "markdown" => issue.message
- },
- "locations" => [
- %{
- "physicalLocation" => %{
- "artifactLocation" => %{
- "uri" => to_string(Path.relative_to(issue.filename, exec.cli_options.path)),
- "uriBaseId" => "ROOTPATH"
- },
- "region" => %{
- "startLine" => issue.line_no,
- "startColumn" => issue.column || 1,
- "endColumn" => column_end,
- "snippet" => %{
- "text" => issue.trigger
- }
- }
- },
- "logicalLocations" => [
- %{
- "fullyQualifiedName" => issue.scope
- }
- ]
- }
- ]
- }
- }
-
- rule_and_issue
- |> remove_nil_endcolumn(!column_end)
- |> remove_warning_level(sarif_level == :warning)
- |> remove_redundant_name(issue.check.id == Credo.Code.Name.full(issue.check))
- end
-
- defp remove_nil_endcolumn(sarif, false), do: sarif
-
- defp remove_nil_endcolumn(sarif, true) do
- {atom1, atom2} = sarif
-
- {atom1,
- pop_in(atom2, ["locations", Access.at(0), "physicalLocation", "region", "endColumn"])
- |> elem(1)}
- end
-
- defp remove_warning_level(sarif, false), do: sarif
-
- defp remove_warning_level(sarif, true) do
- {atom1, atom2} = sarif
-
- {atom1, pop_in(atom2, ["level"]) |> elem(1)}
- end
-
- defp remove_redundant_name(sarif, false), do: sarif
-
- defp remove_redundant_name(sarif, true) do
- {atom1, atom2} = sarif
-
- {pop_in(atom1, ["name"]) |> elem(1), atom2}
- end
-
- defp sum_rules_and_results([head | tail], rules, results) do
- {current_rule, current_result} = head
- existing_rule = Enum.find_index(rules, fn x -> x["id"] == current_rule["id"] end)
-
- case existing_rule do
- nil -> sum_rules_and_results(tail, [current_rule | rules], [current_result | results])
- _ -> sum_rules_and_results(tail, rules, [current_result | results])
- end
- end
-
- defp sum_rules_and_results([], rules, results) do
- {rules, results}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/shell.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/shell.ex
deleted file mode 100644
index 98575f2f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/shell.ex
+++ /dev/null
@@ -1,120 +0,0 @@
-defmodule Credo.CLI.Output.Shell do
- @moduledoc false
-
- # This module is used by `Credo.CLI.Output.UI` to write to the shell.
-
- use GenServer
-
- def start_link(opts \\ []) do
- {:ok, _pid} = GenServer.start_link(__MODULE__, opts, name: __MODULE__)
- end
-
- def puts do
- puts("")
- end
-
- @doc "Write the given `value` to `:stdout`."
- def puts(value) do
- GenServer.call(__MODULE__, {:puts, value})
- end
-
- def use_colors(use_colors) do
- GenServer.call(__MODULE__, {:use_colors, use_colors})
- end
-
- def suppress_output(callback_fn) do
- GenServer.call(__MODULE__, {:suppress_output, true})
- callback_fn.()
- GenServer.call(__MODULE__, {:suppress_output, false})
- end
-
- @doc "Like `puts/1`, but writes to `:stderr`."
- def warn(value) do
- GenServer.call(__MODULE__, {:warn, value})
- end
-
- # callbacks
-
- def init(_) do
- {:ok, %{use_colors: true, suppress_output: false}}
- end
-
- def handle_call({:suppress_output, suppress_output}, _from, current_state) do
- new_state = Map.put(current_state, :suppress_output, suppress_output)
-
- {:reply, nil, new_state}
- end
-
- def handle_call({:use_colors, use_colors}, _from, current_state) do
- new_state = Map.put(current_state, :use_colors, use_colors)
-
- {:reply, nil, new_state}
- end
-
- def handle_call({:puts, _value}, _from, %{suppress_output: true} = current_state) do
- {:reply, nil, current_state}
- end
-
- def handle_call(
- {:puts, value},
- _from,
- %{use_colors: true, suppress_output: false} = current_state
- ) do
- do_puts(value)
-
- {:reply, nil, current_state}
- end
-
- def handle_call(
- {:puts, value},
- _from,
- %{use_colors: false, suppress_output: false} = current_state
- ) do
- value
- |> remove_colors()
- |> do_puts()
-
- {:reply, nil, current_state}
- end
-
- def handle_call({:warn, _value}, _from, %{suppress_output: true} = current_state) do
- {:reply, nil, current_state}
- end
-
- def handle_call(
- {:warn, value},
- _from,
- %{use_colors: true, suppress_output: false} = current_state
- ) do
- do_warn(value)
-
- {:reply, nil, current_state}
- end
-
- def handle_call(
- {:warn, value},
- _from,
- %{use_colors: false, suppress_output: false} = current_state
- ) do
- value
- |> remove_colors()
- |> do_warn()
-
- {:reply, nil, current_state}
- end
-
- defp remove_colors(value) do
- value
- |> List.wrap()
- |> List.flatten()
- |> Enum.reject(&is_atom/1)
- end
-
- defp do_puts(value) do
- Bunt.puts(value)
- end
-
- defp do_warn(value) do
- Bunt.warn(value)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/summary.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/summary.ex
deleted file mode 100644
index 39b85b8c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/summary.ex
+++ /dev/null
@@ -1,188 +0,0 @@
-defmodule Credo.CLI.Output.Summary do
- @moduledoc false
-
- # This module is responsible for printing the summary at the end of the analysis.
-
- @category_wording [
- {:consistency, "consistency issue", "consistency issues"},
- {:warning, "warning", "warnings"},
- {:refactor, "refactoring opportunity", "refactoring opportunities"},
- {:readability, "code readability issue", "code readability issues"},
- {:design, "software design suggestion", "software design suggestions"}
- ]
- @cry_for_help "Please report incorrect results: https://github.com/rrrene/credo/issues"
-
- alias Credo.CLI.Output
- alias Credo.CLI.Output.FirstRunHint
- alias Credo.CLI.Output.UI
- alias Credo.Execution
- alias Credo.SourceFile
-
- def print(
- _source_files,
- %Execution{format: "flycheck"},
- _time_load,
- _time_run
- ) do
- nil
- end
-
- def print(_source_files, %Execution{format: "oneline"}, _time_load, _time_run) do
- nil
- end
-
- def print(source_files, exec, time_load, time_run) do
- issues = Execution.get_issues(exec)
- source_file_count = exec |> Execution.get_source_files() |> Enum.count()
- checks_count = count_checks(exec)
-
- UI.puts()
- UI.puts([:faint, @cry_for_help])
- UI.puts()
- UI.puts([:faint, format_time_spent(checks_count, source_file_count, time_load, time_run)])
-
- UI.puts(summary_parts(source_files, issues))
- UI.puts()
-
- print_priority_hint(exec)
- print_first_run_hint(exec)
- end
-
- defp print_first_run_hint(%Execution{cli_options: %{switches: %{first_run: true}}} = exec) do
- FirstRunHint.call(exec)
- end
-
- defp print_first_run_hint(exec), do: exec
-
- defp count_checks(exec) do
- {result, _only_matching, _ignore_matching} = Execution.checks(exec)
-
- Enum.count(result)
- end
-
- defp print_priority_hint(%Execution{min_priority: min_priority})
- when min_priority >= 0 do
- UI.puts([
- :faint,
- "Showing priority issues: ↑ ↗ → (use `mix credo explain` to explain issues, `mix credo --help` for options)."
- ])
- end
-
- defp print_priority_hint(_) do
- UI.puts([
- :faint,
- "Use `mix credo explain` to explain issues, `mix credo --help` for options."
- ])
- end
-
- defp format_time_spent(check_count, source_file_count, time_load, time_run) do
- time_run = time_run |> div(10_000)
- time_load = time_load |> div(10_000)
-
- formatted_total = format_in_seconds(time_run + time_load)
-
- time_to_load = format_in_seconds(time_load)
- time_to_run = format_in_seconds(time_run)
-
- total_in_seconds =
- case formatted_total do
- "1.0" -> "1 second"
- value -> "#{value} seconds"
- end
-
- checks =
- if check_count == 1 do
- "1 check"
- else
- "#{check_count} checks"
- end
-
- source_files =
- if source_file_count == 1 do
- "1 file"
- else
- "#{source_file_count} files"
- end
-
- breakdown = "#{time_to_load}s to load, #{time_to_run}s running #{checks} on #{source_files}"
-
- "Analysis took #{total_in_seconds} (#{breakdown})"
- end
-
- defp format_in_seconds(t) do
- if t < 10 do
- "0.0#{t}"
- else
- t = div(t, 10)
- "#{div(t, 10)}.#{rem(t, 10)}"
- end
- end
-
- defp category_count(issues, category) do
- issues
- |> Enum.filter(&(&1.category == category))
- |> Enum.count()
- end
-
- defp summary_parts(source_files, issues) do
- parts =
- @category_wording
- |> Enum.flat_map(&summary_part(&1, issues))
-
- parts =
- parts
- |> List.update_at(Enum.count(parts) - 1, fn last_part ->
- String.replace(last_part, ", ", "")
- end)
-
- parts =
- if Enum.empty?(parts) do
- "no issues"
- else
- parts
- end
-
- [
- :green,
- "#{scope_count(source_files)} mods/funs, ",
- :reset,
- "found ",
- parts,
- "."
- ]
- end
-
- defp summary_part({category, singular, plural}, issues) do
- color = Output.check_color(category)
-
- case category_count(issues, category) do
- 0 -> []
- 1 -> [color, "1 #{singular}, "]
- x -> [color, "#{x} #{plural}, "]
- end
- end
-
- defp scope_count(%SourceFile{} = source_file) do
- Credo.Code.prewalk(source_file, &scope_count_traverse/2, 0)
- end
-
- defp scope_count([]), do: 0
-
- defp scope_count(source_files) when is_list(source_files) do
- source_files
- |> Enum.map(&Task.async(fn -> scope_count(&1) end))
- |> Enum.map(&Task.await/1)
- |> Enum.reduce(&(&1 + &2))
- end
-
- @def_ops [:defmodule, :def, :defp, :defmacro]
- for op <- @def_ops do
- defp scope_count_traverse({unquote(op), _, _} = ast, count) do
- {ast, count + 1}
- end
- end
-
- defp scope_count_traverse(ast, count) do
- {ast, count}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/ui.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/output/ui.ex
deleted file mode 100644
index 4a6bce48..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/output/ui.ex
+++ /dev/null
@@ -1,100 +0,0 @@
-defmodule Credo.CLI.Output.UI do
- @moduledoc """
- This module provides functions used to create the UI.
-
- >>> alias Credo.CLI.Output.UI
- >>> UI.puts "This is a test."
- This is a test.
- nil
-
- >>> alias Credo.CLI.Output.UI
- >>> UI.warn "This is a warning."
- This is a warning.
- nil
-
- """
-
- @edge "┃"
- @ellipsis "…"
- @shell_service Credo.CLI.Output.Shell
-
- if Mix.env() == :test do
- def puts, do: nil
- def puts(_), do: nil
- def puts(_, color) when is_atom(color), do: nil
-
- def warn(_), do: nil
- else
- defdelegate puts, to: @shell_service
- defdelegate puts(v), to: @shell_service
-
- def puts(v, color) when is_atom(color) do
- @shell_service.puts([color, v])
- end
-
- defdelegate warn(v), to: @shell_service
- end
-
- def edge(color, indent \\ 2) when is_integer(indent) do
- [:reset, color, @edge |> String.pad_trailing(indent)]
- end
-
- @doc "Returns the edge (`┃`) which is used in much of Credo's output as a binary."
- def edge, do: @edge
-
- def use_colors(exec) do
- @shell_service.use_colors(exec.color)
-
- exec
- end
-
- def puts_edge(color, indent \\ 2) when is_integer(indent) do
- color
- |> edge(indent)
- |> puts
- end
-
- def wrap_at(text, number) do
- "(?:((?>.{1,#{number}}(?:(?<=[^\\S\\r\\n])[^\\S\\r\\n]?|(?=\\r?\\n)|$|[^\\S\\r\\n]))|.{1,#{number}})(?:\\r?\\n)?|(?:\\r?\\n|$))"
- |> Regex.compile!("u")
- |> Regex.scan(text)
- |> Enum.map(&List.first/1)
- |> List.delete_at(-1)
- end
-
- @doc """
- Truncate a line to fit within a specified maximum length.
- Truncation is indicated by a trailing ellipsis (…), and you can override this
- using an optional third argument.
-
- iex> Credo.CLI.Output.UI.truncate(nil, 7)
- ""
- iex> Credo.CLI.Output.UI.truncate(" 7 chars\\n", 7)
- " 7 ch…"
- iex> Credo.CLI.Output.UI.truncate(" more than 7\\n", 7)
- " more…"
- iex> Credo.CLI.Output.UI.truncate(" more than 7\\n", 7, " ...")
- " m ..."
- """
- def truncate(line, max_length) when max_length <= 0 or is_nil(line), do: ""
-
- def truncate(line, max_length) when max_length > 0 do
- truncate(line, max_length, @ellipsis)
- end
-
- def truncate(_line, max_length, _ellipsis) when max_length <= 0, do: ""
-
- def truncate(line, max_length, ellipsis) when max_length > 0 do
- cond do
- String.length(line) <= max_length ->
- line
-
- String.length(ellipsis) >= max_length ->
- ellipsis
-
- true ->
- chars_to_display = max_length - String.length(ellipsis)
- String.slice(line, 0, chars_to_display) <> ellipsis
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/sorter.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/sorter.ex
deleted file mode 100644
index d4c08e83..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/sorter.ex
+++ /dev/null
@@ -1,23 +0,0 @@
-defmodule Credo.CLI.Sorter do
- @moduledoc false
-
- # TODO: is this the right place for this module?
-
- def ensure(list, list_start, list_end \\ []) do
- list
- |> to_start(list_start)
- |> to_end(list_end)
- end
-
- def to_start(list, list_start) do
- list_start = Enum.filter(list_start, &Enum.member?(list, &1))
-
- list_start ++ (list -- list_start)
- end
-
- def to_end(list, list_end) do
- list_end = Enum.filter(list_end, &Enum.member?(list, &1))
-
- (list -- list_end) ++ list_end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/switch.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/switch.ex
deleted file mode 100644
index 317146f2..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/switch.ex
+++ /dev/null
@@ -1,42 +0,0 @@
-defmodule Credo.CLI.Switch do
- defstruct name: nil,
- type: :string,
- alias: nil
-
- def boolean(name, keywords \\ []) when is_atom(name) or is_binary(name) do
- from_keywords(name, Keyword.put(keywords, :type, :boolean))
- end
-
- def string(name, keywords \\ []) when is_atom(name) or is_binary(name) do
- from_keywords(name, Keyword.put(keywords, :type, :string))
- end
-
- def keep(name, keywords \\ []) when is_atom(name) or is_binary(name) do
- from_keywords(name, Keyword.put(keywords, :type, :keep))
- end
-
- def ensure(%__MODULE__{} = switch), do: switch
- def ensure(%{} = switch), do: from_map(switch)
-
- def ensure(switch) do
- raise("Expected Credo.CLI.Switch, got: #{inspect(switch, pretty: true)}")
- end
-
- defp from_map(%{name: name} = switch) when is_atom(name) or is_binary(name) do
- name = String.to_atom(to_string(switch.name))
-
- struct(__MODULE__, %{switch | name: name})
- end
-
- defp from_keywords(name, keywords) when is_atom(name) or is_binary(name) do
- name = String.to_atom(to_string(name))
- type = keywords[:type] || :string
-
- keywords =
- keywords
- |> Keyword.put(:type, type)
- |> Keyword.put(:name, name)
-
- struct(__MODULE__, keywords)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/load_and_validate_source_files.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/task/load_and_validate_source_files.ex
deleted file mode 100644
index 132859de..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/load_and_validate_source_files.ex
+++ /dev/null
@@ -1,26 +0,0 @@
-defmodule Credo.CLI.Task.LoadAndValidateSourceFiles do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Output
- alias Credo.Sources
-
- def call(exec, _opts \\ []) do
- {time_load, source_files} =
- :timer.tc(fn ->
- exec
- |> Sources.find()
- |> Enum.group_by(& &1.status)
- end)
-
- Output.complain_about_invalid_source_files(Map.get(source_files, :invalid, []))
- Output.complain_about_timed_out_source_files(Map.get(source_files, :timed_out, []))
-
- valid_source_files = Map.get(source_files, :valid, [])
-
- exec
- |> put_source_files(valid_source_files)
- |> put_assign("credo.time.source_files", time_load)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/prepare_checks_to_run.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/task/prepare_checks_to_run.ex
deleted file mode 100644
index 0da82349..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/prepare_checks_to_run.ex
+++ /dev/null
@@ -1,102 +0,0 @@
-defmodule Credo.CLI.Task.PrepareChecksToRun do
- @moduledoc false
-
- use Credo.Execution.Task
-
- def call(exec, _opts \\ []) do
- source_files = Execution.get_source_files(exec)
-
- exec
- |> set_config_comments(source_files)
- |> enable_disabled_checks_if_applicable()
- |> exclude_low_priority_checks(exec.min_priority - 9)
- |> exclude_checks_based_on_elixir_version
- end
-
- defp set_config_comments(exec, source_files) do
- config_comment_map =
- source_files
- |> Credo.Check.ConfigCommentFinder.run()
- |> Enum.into(%{})
-
- %Execution{exec | config_comment_map: config_comment_map}
- end
-
- defp enable_disabled_checks_if_applicable(%Execution{enable_disabled_checks: nil} = exec) do
- exec
- end
-
- defp enable_disabled_checks_if_applicable(exec) do
- enable_disabled_checks_regexes = to_match_regexes(exec.enable_disabled_checks)
-
- enable_disabled_checks =
- Enum.map(exec.checks.disabled, fn
- {check, params} ->
- if matches?(to_string(check), enable_disabled_checks_regexes) do
- {check, params}
- else
- {check, false}
- end
- end)
-
- checks = Keyword.merge(exec.checks.enabled, enable_disabled_checks)
-
- %Execution{exec | checks: %{enabled: checks, disabled: exec.checks.disabled}}
- end
-
- defp exclude_low_priority_checks(exec, below_priority) do
- checks =
- Enum.reject(exec.checks.enabled, fn
- # deprecated
- {check} ->
- Credo.Priority.to_integer(check.base_priority) < below_priority
-
- {_check, false} ->
- true
-
- {check, params} ->
- priority =
- params
- |> Credo.Check.Params.priority(check)
- |> Credo.Priority.to_integer()
-
- priority < below_priority
- end)
-
- %Execution{exec | checks: %{enabled: checks, disabled: exec.checks.disabled}}
- end
-
- defp exclude_checks_based_on_elixir_version(exec) do
- elixir_version = System.version()
- skipped_checks = Enum.reject(exec.checks.enabled, &matches_requirement?(&1, elixir_version))
- checks = Enum.filter(exec.checks.enabled, &matches_requirement?(&1, elixir_version))
-
- %Execution{
- exec
- | checks: %{enabled: checks, disabled: exec.checks.disabled},
- skipped_checks: skipped_checks
- }
- end
-
- defp matches_requirement?({check, _}, elixir_version) do
- matches_requirement?({check}, elixir_version)
- end
-
- defp matches_requirement?({check}, elixir_version) do
- Version.match?(elixir_version, check.elixir_version)
- end
-
- defp to_match_regexes(nil), do: []
-
- defp to_match_regexes(list) do
- Enum.map(list, fn match_check ->
- {:ok, match_pattern} = Regex.compile(match_check, "i")
- match_pattern
- end)
- end
-
- defp matches?(_string, nil), do: false
- defp matches?(string, list) when is_list(list), do: Enum.any?(list, &matches?(string, &1))
- defp matches?(string, %Regex{} = regex), do: Regex.match?(regex, string)
- defp matches?(string, pattern) when is_binary(pattern), do: String.contains?(string, pattern)
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/run_checks.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/task/run_checks.ex
deleted file mode 100644
index 2cd35f1c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/run_checks.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule Credo.CLI.Task.RunChecks do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Check.Runner
-
- def call(exec, _opts \\ []) do
- source_files = get_source_files(exec)
-
- {time_run, :ok} =
- :timer.tc(fn ->
- Runner.run(source_files, exec)
- end)
-
- put_assign(exec, "credo.time.run_checks", time_run)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/set_relevant_issues.ex b/apps/plataforma_digital/deps/credo/lib/credo/cli/task/set_relevant_issues.ex
deleted file mode 100644
index 51483f68..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/cli/task/set_relevant_issues.ex
+++ /dev/null
@@ -1,20 +0,0 @@
-defmodule Credo.CLI.Task.SetRelevantIssues do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Filter
-
- def call(exec, _opts \\ []) do
- issues =
- exec
- |> get_issues()
- |> Filter.important(exec)
- |> Filter.valid_issues(exec)
- |> Enum.sort_by(fn issue ->
- {issue.check.id, issue.filename, issue.line_no}
- end)
-
- put_issues(exec, issues)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code.ex b/apps/plataforma_digital/deps/credo/lib/credo/code.ex
deleted file mode 100644
index 8a73f8de..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code.ex
+++ /dev/null
@@ -1,197 +0,0 @@
-defmodule Credo.Code do
- @moduledoc """
- `Credo.Code` contains a lot of utility or helper functions that deal with the
- analysis of - you guessed it - code.
-
- Whenever a function serves a general purpose in this area, e.g. getting the
- value of a module attribute inside a given module, we want to extract that
- function and put it in the `Credo.Code` namespace, so others can utilize them
- without reinventing the wheel.
- """
-
- alias Credo.Code.Charlists
- alias Credo.Code.Heredocs
- alias Credo.Code.Sigils
- alias Credo.Code.Strings
-
- alias Credo.SourceFile
-
- defmodule ParserError do
- @moduledoc """
- This is an internal `Issue` raised by Credo when it finds itself unable to
- parse the source code in a file.
- """
- end
-
- @doc """
- Prewalks a given `Credo.SourceFile`'s AST or a given AST.
-
- Technically this is just a wrapper around `Macro.prewalk/3`.
- """
- def prewalk(ast_or_source_file, fun, accumulator \\ [])
-
- def prewalk(%SourceFile{} = source_file, fun, accumulator) do
- source_file
- |> SourceFile.ast()
- |> prewalk(fun, accumulator)
- end
-
- def prewalk(source_ast, fun, accumulator) do
- {_, accumulated} = Macro.prewalk(source_ast, accumulator, fun)
-
- accumulated
- end
-
- @doc """
- Postwalks a given `Credo.SourceFile`'s AST or a given AST.
-
- Technically this is just a wrapper around `Macro.postwalk/3`.
- """
- def postwalk(ast_or_source_file, fun, accumulator \\ [])
-
- def postwalk(%SourceFile{} = source_file, fun, accumulator) do
- source_file
- |> SourceFile.ast()
- |> postwalk(fun, accumulator)
- end
-
- def postwalk(source_ast, fun, accumulator) do
- {_, accumulated} = Macro.postwalk(source_ast, accumulator, fun)
-
- accumulated
- end
-
- @doc """
- Returns an AST for a given `String` or `Credo.SourceFile`.
- """
- def ast(string_or_source_file)
-
- def ast(%SourceFile{filename: filename} = source_file) do
- source_file
- |> SourceFile.source()
- |> ast(filename)
- end
-
- @doc false
- def ast(source, filename \\ "nofilename") when is_binary(source) do
- case Code.string_to_quoted(source, line: 1, columns: true, file: filename) do
- {:ok, value} ->
- {:ok, value}
-
- {:error, error} ->
- {:error, [issue_for(error, filename)]}
- end
- rescue
- e in UnicodeConversionError ->
- {:error, [issue_for({1, e.message, nil}, filename)]}
- end
-
- defp issue_for({line_no, error_message, _}, filename) do
- %Credo.Issue{
- check: ParserError,
- category: :error,
- filename: filename,
- message: error_message,
- line_no: line_no
- }
- end
-
- @doc """
- Converts a String or `Credo.SourceFile` into a List of tuples of `{line_no, line}`.
- """
- def to_lines(string_or_source_file)
-
- def to_lines(%SourceFile{} = source_file) do
- source_file
- |> SourceFile.source()
- |> to_lines()
- end
-
- def to_lines(source) when is_binary(source) do
- source
- |> String.split("\n")
- |> Enum.with_index()
- |> Enum.map(fn {line, i} -> {i + 1, line} end)
- end
-
- @doc """
- Converts a String or `Credo.SourceFile` into a List of tokens using the `:elixir_tokenizer`.
- """
- def to_tokens(string_or_source_file)
-
- def to_tokens(%SourceFile{} = source_file) do
- source_file
- |> SourceFile.source()
- |> to_tokens(source_file.filename)
- end
-
- def to_tokens(source, filename \\ "nofilename") when is_binary(source) do
- source
- |> String.to_charlist()
- |> :elixir_tokenizer.tokenize(1, file: filename)
- |> case do
- # Elixir < 1.6
- {_, _, _, tokens} ->
- tokens
-
- # Elixir >= 1.6
- {:ok, tokens} ->
- tokens
-
- # Elixir >= 1.13
- {:ok, _, _, _, tokens} ->
- tokens
-
- {:error, _, _, _, tokens} ->
- tokens
- end
- end
-
- @doc """
- Returns true if the given `child` AST node is part of the larger
- `parent` AST node.
- """
- def contains_child?(parent, child) do
- Credo.Code.prewalk(parent, &find_child(&1, &2, child), false)
- end
-
- defp find_child({parent, _meta, child}, _acc, child), do: {parent, true}
-
- defp find_child(parent, acc, child), do: {parent, acc || parent == child}
-
- @doc """
- Takes a SourceFile and returns its source code stripped of all Strings and
- Sigils.
- """
- def clean_charlists_strings_and_sigils(source_file_or_source) do
- {_source, filename} = Credo.SourceFile.source_and_filename(source_file_or_source)
-
- source_file_or_source
- |> Sigils.replace_with_spaces(" ", " ", filename)
- |> Strings.replace_with_spaces(" ", " ", filename)
- |> Heredocs.replace_with_spaces(" ", " ", "", filename)
- |> Charlists.replace_with_spaces(" ", " ", filename)
- end
-
- @doc """
- Takes a SourceFile and returns its source code stripped of all Strings, Sigils
- and code comments.
- """
- def clean_charlists_strings_sigils_and_comments(source_file_or_source, sigil_replacement \\ " ") do
- {_source, filename} = Credo.SourceFile.source_and_filename(source_file_or_source)
-
- source_file_or_source
- |> Heredocs.replace_with_spaces(" ", " ", "", filename)
- |> Sigils.replace_with_spaces(sigil_replacement, " ", filename)
- |> Strings.replace_with_spaces(" ", " ", filename)
- |> Charlists.replace_with_spaces(" ", " ", filename)
- |> String.replace(~r/(\A|[^\?])#.+/, "\\1")
- end
-
- @doc """
- Returns an AST without its metadata.
- """
- def remove_metadata(ast) do
- Macro.prewalk(ast, &Macro.update_meta(&1, fn _meta -> [] end))
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/block.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/block.ex
deleted file mode 100644
index 9f689391..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/block.ex
+++ /dev/null
@@ -1,312 +0,0 @@
-defmodule Credo.Code.Block do
- @moduledoc """
- This module provides helper functions to analyse blocks, e.g. the block taken
- by the `if` macro.
- """
-
- @doc """
- Returns the do: block of a given AST node.
- """
- def all_blocks_for!(ast) do
- [
- do_block_for!(ast),
- else_block_for!(ast),
- rescue_block_for!(ast),
- after_block_for!(ast)
- ]
- end
-
- @doc """
- Returns true if the given `ast` has a do block.
- """
- def do_block?(ast) do
- case do_block_for(ast) do
- {:ok, _block} ->
- true
-
- nil ->
- false
- end
- end
-
- @doc """
- Returns the do: block of a given AST node.
- """
- def do_block_for!(ast) do
- case do_block_for(ast) do
- {:ok, block} ->
- block
-
- nil ->
- nil
- end
- end
-
- @doc """
- Returns a tuple {:ok, do_block} or nil for a given AST node.
- """
- def do_block_for({_atom, _meta, arguments}) when is_list(arguments) do
- do_block_for(arguments)
- end
-
- def do_block_for(do: block) do
- {:ok, block}
- end
-
- def do_block_for(do: do_block, else: _else_block) do
- {:ok, do_block}
- end
-
- def do_block_for(arguments) when is_list(arguments) do
- Enum.find_value(arguments, &find_keyword(&1, :do))
- end
-
- def do_block_for(_) do
- nil
- end
-
- @doc """
- Returns true if the given `ast` has an else block.
- """
- def else_block?(ast) do
- case else_block_for(ast) do
- {:ok, _block} ->
- true
-
- nil ->
- false
- end
- end
-
- @doc """
- Returns the `else` block of a given AST node.
- """
- def else_block_for!(ast) do
- case else_block_for(ast) do
- {:ok, block} ->
- block
-
- nil ->
- nil
- end
- end
-
- @doc """
- Returns a tuple {:ok, else_block} or nil for a given AST node.
- """
- def else_block_for({_atom, _meta, arguments}) when is_list(arguments) do
- else_block_for(arguments)
- end
-
- def else_block_for(do: _do_block, else: else_block) do
- {:ok, else_block}
- end
-
- def else_block_for(arguments) when is_list(arguments) do
- Enum.find_value(arguments, &find_keyword(&1, :else))
- end
-
- def else_block_for(_) do
- nil
- end
-
- @doc """
- Returns true if the given `ast` has an rescue block.
- """
- def rescue_block?(ast) do
- case rescue_block_for(ast) do
- {:ok, _block} ->
- true
-
- nil ->
- false
- end
- end
-
- @doc """
- Returns the rescue: block of a given AST node.
- """
- def rescue_block_for!(ast) do
- case rescue_block_for(ast) do
- {:ok, block} ->
- block
-
- nil ->
- nil
- end
- end
-
- @doc """
- Returns a tuple {:ok, rescue_block} or nil for a given AST node.
- """
- def rescue_block_for({_atom, _meta, arguments}) when is_list(arguments) do
- rescue_block_for(arguments)
- end
-
- def rescue_block_for(do: _do_block, rescue: rescue_block) do
- {:ok, rescue_block}
- end
-
- def rescue_block_for(arguments) when is_list(arguments) do
- Enum.find_value(arguments, &find_keyword(&1, :rescue))
- end
-
- def rescue_block_for(_) do
- nil
- end
-
- @doc """
- Returns true if the given `ast` has an catch block.
- """
- def catch_block?(ast) do
- case catch_block_for(ast) do
- {:ok, _block} ->
- true
-
- nil ->
- false
- end
- end
-
- @doc """
- Returns the catch: block of a given AST node.
- """
- def catch_block_for!(ast) do
- case catch_block_for(ast) do
- {:ok, block} ->
- block
-
- nil ->
- nil
- end
- end
-
- @doc """
- Returns a tuple {:ok, catch_block} or nil for a given AST node.
- """
- def catch_block_for({_atom, _meta, arguments}) when is_list(arguments) do
- catch_block_for(arguments)
- end
-
- def catch_block_for(do: _do_block, catch: catch_block) do
- {:ok, catch_block}
- end
-
- def catch_block_for(arguments) when is_list(arguments) do
- Enum.find_value(arguments, &find_keyword(&1, :catch))
- end
-
- def catch_block_for(_) do
- nil
- end
-
- @doc """
- Returns true if the given `ast` has an after block.
- """
- def after_block?(ast) do
- case after_block_for(ast) do
- {:ok, _block} ->
- true
-
- nil ->
- false
- end
- end
-
- @doc """
- Returns the after: block of a given AST node.
- """
- def after_block_for!(ast) do
- case after_block_for(ast) do
- {:ok, block} ->
- block
-
- nil ->
- nil
- end
- end
-
- @doc """
- Returns a tuple {:ok, after_block} or nil for a given AST node.
- """
- def after_block_for({_atom, _meta, arguments}) when is_list(arguments) do
- after_block_for(arguments)
- end
-
- def after_block_for(do: _do_block, after: after_block) do
- {:ok, after_block}
- end
-
- def after_block_for(arguments) when is_list(arguments) do
- Enum.find_value(arguments, &find_keyword(&1, :after))
- end
-
- def after_block_for(_) do
- nil
- end
-
- defp find_keyword(list, keyword) when is_list(list) do
- if Keyword.has_key?(list, keyword) do
- {:ok, list[keyword]}
- else
- nil
- end
- end
-
- defp find_keyword(_, _) do
- nil
- end
-
- @doc """
- Returns the children of the `do` block of the given AST node.
- """
- def calls_in_do_block({_op, _meta, arguments}) do
- arguments
- |> do_block_for!
- |> instructions_for
- end
-
- def calls_in_do_block(arg) do
- arg
- |> do_block_for!
- |> instructions_for
- end
-
- @doc """
- Returns the children of the `rescue` block of the given AST node.
- """
- def calls_in_rescue_block({_op, _meta, arguments}) do
- arguments
- |> rescue_block_for!
- |> instructions_for
- end
-
- def calls_in_rescue_block(arg) do
- arg
- |> rescue_block_for!
- |> instructions_for
- end
-
- @doc """
- Returns the children of the `catch` block of the given AST node.
- """
- def calls_in_catch_block({_op, _meta, arguments}) do
- arguments
- |> catch_block_for!
- |> instructions_for
- end
-
- def calls_in_catch_block(arg) do
- arg
- |> catch_block_for!
- |> instructions_for
- end
-
- defp instructions_for({:__block__, _meta, calls}), do: calls
-
- defp instructions_for(v)
- when is_atom(v) or is_tuple(v) or is_binary(v) or is_float(v) or is_integer(v),
- do: List.wrap(v)
-
- defp instructions_for(v) when is_list(v), do: [v]
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/charlists.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/charlists.ex
deleted file mode 100644
index 3c903690..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/charlists.ex
+++ /dev/null
@@ -1,415 +0,0 @@
-defmodule Credo.Code.Charlists do
- @moduledoc """
- This module lets you strip charlists from source code.
- """
-
- alias Credo.Code.InterpolationHelper
- alias Credo.SourceFile
-
- string_sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"\"", "\""},
- {"'", "'"}
- ]
-
- heredocs_sigil_delimiters = [
- {"'''", "'''"},
- {~s("""), ~s(""")}
- ]
-
- all_string_sigils =
- Enum.flat_map(string_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- all_string_sigil_ends = Enum.map(string_sigil_delimiters, &elem(&1, 1))
-
- all_heredocs_sigils =
- Enum.flat_map(heredocs_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- alphabet = ~w(a b c d e f g h i j k l m n o p q r t u v w x y z)
-
- sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"/", "/"},
- {"\"\"\"", "\"\"\""},
- {"\"", "\""},
- {"'", "'"}
- ]
-
- all_sigil_chars =
- Enum.flat_map(alphabet, fn a ->
- [a, String.upcase(a)]
- end)
-
- all_sigil_starts = Enum.map(all_sigil_chars, fn c -> "~#{c}" end)
-
- removable_sigil_ends = Enum.map(sigil_delimiters, &elem(&1, 1))
-
- removable_sigils =
- sigil_delimiters
- |> Enum.flat_map(fn {b, e} ->
- Enum.flat_map(all_sigil_starts, fn start ->
- [{"#{start}#{b}", e}, {"#{start}#{b}", e}]
- end)
- end)
- |> Enum.uniq()
-
- @doc """
- Replaces all characters inside charlists with the equivalent amount of
- white-space.
- """
- def replace_with_spaces(
- source_file,
- replacement \\ " ",
- interpolation_replacement \\ " ",
- filename \\ "nofilename"
- ) do
- {source, filename} = SourceFile.source_and_filename(source_file, filename)
-
- source
- |> InterpolationHelper.replace_interpolations(interpolation_replacement, filename)
- |> parse_code("", replacement)
- end
-
- defp parse_code("", acc, _replacement) do
- acc
- end
-
- for {sigil_start, sigil_end} <- removable_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_removable_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- for {sigil_start, sigil_end} <- all_heredocs_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_heredoc(
- t,
- acc <> unquote(sigil_start),
- replacement,
- unquote(sigil_end)
- )
- end
- end
-
- defp parse_code(<<"\"\"\""::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s("""), replacement, ~s("""))
- end
-
- defp parse_code(<<"\'\'\'"::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s('''), replacement, ~s('''))
- end
-
- for {sigil_start, sigil_end} <- all_string_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_string_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- defp parse_code(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\\\'", replacement)
- end
-
- defp parse_code(<<"?'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?'", replacement)
- end
-
- defp parse_code(<<"?\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?\"", replacement)
- end
-
- defp parse_code(<<"'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "'", replacement)
- end
-
- defp parse_code(<<"#"::utf8, t::binary>>, acc, replacement) do
- parse_comment(t, acc <> "#", replacement)
- end
-
- defp parse_code(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\"", replacement)
- end
-
- defp parse_code(<>, acc, replacement) do
- parse_code(t, acc <> <>, replacement)
- end
-
- defp parse_code(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_code(t, acc <> h, replacement)
- end
-
- #
- # Comments
- #
-
- defp parse_comment("", acc, _replacement) do
- acc
- end
-
- defp parse_comment(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\n", replacement)
- end
-
- defp parse_comment(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_comment(t, acc <> h, replacement)
- end
-
- #
- # String Literals
- #
-
- defp parse_string_literal("", acc, _replacement) do
- acc
- end
-
- defp parse_string_literal(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc, replacement)
- end
-
- defp parse_string_literal(<<"\\\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc, replacement)
- end
-
- defp parse_string_literal(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> ~s("), replacement)
- end
-
- defp parse_string_literal(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\n", replacement)
- end
-
- defp parse_string_literal(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
- parse_string_literal(t, acc <> h, replacement)
- end
-
- #
- # Charlists
- #
-
- defp parse_charlist("", acc, _replacement) do
- acc
- end
-
- defp parse_charlist(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> replacement <> replacement, replacement)
- end
-
- defp parse_charlist(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc, replacement)
- end
-
- defp parse_charlist(<<"\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "'", replacement)
- end
-
- defp parse_charlist(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\n", replacement)
- end
-
- defp parse_charlist(<<_::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> replacement, replacement)
- end
-
- #
- # Non-String Sigils
- #
-
- for sigil_end <- removable_sigil_ends do
- defp parse_removable_sigil("", acc, unquote(sigil_end), _replacement) do
- acc
- end
-
- defp parse_removable_sigil(
- <<"\\"::utf8, s::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- {h, t} = String.next_codepoint(s)
-
- parse_removable_sigil(t, acc <> "\\" <> h, unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- # \\
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\\\\", unquote(sigil_end), replacement)
- end
-
- if sigil_end != "\"" do
- defp parse_removable_sigil(
- <<"\""::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\"", unquote(sigil_end), replacement)
- end
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(
- t,
- acc <> unquote("\\#{sigil_end}"),
- unquote(sigil_end),
- replacement
- )
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\n", unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- str,
- acc,
- unquote(sigil_end),
- replacement
- )
- when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_removable_sigil(t, acc <> h, unquote(sigil_end), replacement)
- end
- end
-
- #
- # Sigils
- #
-
- for sigil_end <- all_string_sigil_ends do
- defp parse_string_sigil("", acc, unquote(sigil_end), _replacement) do
- acc
- end
-
- defp parse_string_sigil(
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc, unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <<"\\\""::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc, unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc <> "\n", unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- str,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- {h, t} = String.next_codepoint(str)
-
- parse_string_sigil(t, acc <> h, unquote(sigil_end), replacement)
- end
- end
-
- #
- # Heredocs
- #
-
- defp parse_heredoc(<<"\"\"\""::utf8, t::binary>>, acc, replacement, "\"\"\"") do
- parse_code(t, acc <> ~s("""), replacement)
- end
-
- defp parse_heredoc(<<"\'\'\'"::utf8, t::binary>>, acc, replacement, "\'\'\'") do
- parse_code(t, acc <> ~s('''), replacement)
- end
-
- defp parse_heredoc("", acc, _replacement, _delimiter) do
- acc
- end
-
- defp parse_heredoc(<<"\\\\"::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc, replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\\\""::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc, replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\n"::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc <> "\n", replacement, delimiter)
- end
-
- defp parse_heredoc(str, acc, replacement, delimiter) do
- {h, t} = String.next_codepoint(str)
-
- parse_heredoc(t, acc <> h, replacement, delimiter)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/heredocs.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/heredocs.ex
deleted file mode 100644
index 9bbcec03..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/heredocs.ex
+++ /dev/null
@@ -1,605 +0,0 @@
-defmodule Credo.Code.Heredocs do
- @moduledoc """
- This module lets you strip heredocs from source code.
- """
-
- alias Credo.Code.InterpolationHelper
- alias Credo.SourceFile
-
- alphabet = ~w(a b c d e f g h i j k l m n o p q r s t u v w x y z)
-
- sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"/", "/"},
- {"\"", "\""},
- {"'", "'"}
- ]
-
- all_sigil_chars =
- Enum.flat_map(alphabet, fn a ->
- [a, String.upcase(a)]
- end)
-
- all_sigil_starts = Enum.map(all_sigil_chars, fn c -> "~#{c}" end)
-
- non_removable_normal_sigils =
- sigil_delimiters
- |> Enum.flat_map(fn {b, e} ->
- Enum.flat_map(all_sigil_starts, fn start ->
- [{"#{start}#{b}", e}, {"#{start}#{b}", e}]
- end)
- end)
- |> Enum.uniq()
-
- non_removable_normal_sigil_ends = Enum.map(sigil_delimiters, &elem(&1, 1))
-
- removable_heredoc_sigil_delimiters = [
- {"\"\"\"", "\"\"\""},
- {"'''", "'''"}
- ]
-
- removable_heredoc_sigils =
- removable_heredoc_sigil_delimiters
- |> Enum.flat_map(fn {b, e} ->
- Enum.flat_map(all_sigil_starts, fn start ->
- [{"#{start}#{b}", e}, {"#{start}#{b}", e}]
- end)
- end)
- |> Enum.uniq()
-
- removable_heredoc_sigil_ends = Enum.map(removable_heredoc_sigil_delimiters, &elem(&1, 1))
-
- @doc """
- Replaces all characters inside heredocs
- with the equivalent amount of white-space.
- """
- def replace_with_spaces(
- source_file,
- replacement \\ " ",
- interpolation_replacement \\ " ",
- empty_line_replacement \\ "",
- filename \\ "nofilename"
- ) do
- {source, filename} = SourceFile.source_and_filename(source_file, filename)
-
- source
- |> InterpolationHelper.replace_interpolations(interpolation_replacement, filename)
- |> parse_code("", replacement, empty_line_replacement)
- end
-
- defp parse_code("", acc, _replacement, _empty_line_replacement) do
- acc
- end
-
- for {sigil_start, sigil_end} <- removable_heredoc_sigils do
- defp parse_code(
- <>,
- acc,
- replacement,
- empty_line_replacement
- ) do
- parse_removable_heredoc_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- "",
- byte_size(acc <> unquote(sigil_start))
- )
- end
- end
-
- for {sigil_start, sigil_end} <- non_removable_normal_sigils do
- defp parse_code(
- <>,
- acc,
- replacement,
- empty_line_replacement
- ) do
- parse_non_removable_normal_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- )
- end
- end
-
- defp parse_code(<<"\"\"\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_heredoc(
- t,
- acc <> ~s("""),
- replacement,
- empty_line_replacement,
- ~s("""),
- "",
- byte_size(acc <> ~s("""))
- )
- end
-
- defp parse_code(<<"\'\'\'"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_heredoc(
- t,
- acc <> ~s('''),
- replacement,
- empty_line_replacement,
- ~s('''),
- "",
- byte_size(acc <> ~s('''))
- )
- end
-
- defp parse_code(<<"\\\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> "\\\"", replacement, empty_line_replacement)
- end
-
- defp parse_code(<<"#"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_comment(t, acc <> "#", replacement, empty_line_replacement)
- end
-
- defp parse_code(<<"?\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> "?\"", replacement, empty_line_replacement)
- end
-
- defp parse_code(<<"?'"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> "?\'", replacement, empty_line_replacement)
- end
-
- defp parse_code(<<"'"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_charlist(t, acc <> "'", replacement, empty_line_replacement)
- end
-
- defp parse_code(<<"\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_string_literal(t, acc <> "\"", replacement, empty_line_replacement)
- end
-
- defp parse_code(<>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> <>, replacement, empty_line_replacement)
- end
-
- defp parse_code(str, acc, replacement, empty_line_replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_code(t, acc <> h, replacement, empty_line_replacement)
- end
-
- #
- # Charlists
- #
-
- defp parse_charlist("", acc, _replacement, _empty_line_replacement) do
- acc
- end
-
- defp parse_charlist(<<"\\\\"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_charlist(t, acc <> "\\\\", replacement, empty_line_replacement)
- end
-
- defp parse_charlist(<<"\\\'"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_charlist(t, acc <> "\\\'", replacement, empty_line_replacement)
- end
-
- defp parse_charlist(<<"\'"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> "'", replacement, empty_line_replacement)
- end
-
- defp parse_charlist(<<"\n"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_charlist(t, acc <> "\n", replacement, empty_line_replacement)
- end
-
- defp parse_charlist(str, acc, replacement, empty_line_replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_comment(t, acc <> h, replacement, empty_line_replacement)
- end
-
- #
- # Comments
- #
-
- defp parse_comment("", acc, _replacement, _empty_line_replacement) do
- acc
- end
-
- defp parse_comment(<<"\n"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> "\n", replacement, empty_line_replacement)
- end
-
- defp parse_comment(str, acc, replacement, empty_line_replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_comment(t, acc <> h, replacement, empty_line_replacement)
- end
-
- #
- # "Normal" Sigils (e.g. `~S"..."` or `~s(...)`)
- #
-
- for sigil_end <- non_removable_normal_sigil_ends do
- defp parse_non_removable_normal_sigil(
- "",
- acc,
- unquote(sigil_end),
- _replacement,
- _empty_line_replacement
- ) do
- acc
- end
-
- defp parse_non_removable_normal_sigil(
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- ) do
- parse_non_removable_normal_sigil(
- t,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- )
- end
-
- defp parse_non_removable_normal_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- ) do
- parse_non_removable_normal_sigil(
- t,
- acc <> replacement <> replacement,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- )
- end
-
- defp parse_non_removable_normal_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement, empty_line_replacement)
- end
-
- defp parse_non_removable_normal_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- ) do
- parse_non_removable_normal_sigil(
- t,
- acc <> "\n",
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- )
- end
-
- defp parse_non_removable_normal_sigil(
- str,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- ) do
- {h, t} = String.next_codepoint(str)
-
- parse_non_removable_normal_sigil(
- t,
- acc <> h,
- unquote(sigil_end),
- replacement,
- empty_line_replacement
- )
- end
- end
-
- #
- # Removable Sigils (e.g. `~S"""`)
- #
-
- for sigil_end <- removable_heredoc_sigil_ends do
- defp parse_removable_heredoc_sigil(
- "",
- acc,
- unquote(sigil_end),
- _replacement,
- _empty_line_replacement,
- _current_line,
- _byte_index_heredoc_start
- ) do
- acc
- end
-
- defp parse_removable_heredoc_sigil(
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_removable_heredoc_sigil(
- t,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- )
- end
-
- defp parse_removable_heredoc_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_removable_heredoc_sigil(
- t,
- acc <> replacement <> replacement,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line <> replacement <> replacement,
- byte_index_heredoc_start
- )
- end
-
- defp parse_removable_heredoc_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- ) do
- acc = pad_replaced_heredoc(acc, unquote(sigil_end), current_line, byte_index_heredoc_start)
-
- parse_code(t, acc <> unquote(sigil_end), replacement, empty_line_replacement)
- end
-
- defp parse_removable_heredoc_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- ) do
- acc =
- if current_line == "\n" do
- acc <> empty_line_replacement
- else
- acc
- end
-
- parse_removable_heredoc_sigil(
- t,
- acc <> "\n",
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- "\n",
- byte_index_heredoc_start
- )
- end
-
- defp parse_removable_heredoc_sigil(
- <<_::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_removable_heredoc_sigil(
- t,
- acc <> replacement,
- unquote(sigil_end),
- replacement,
- empty_line_replacement,
- current_line <> replacement,
- byte_index_heredoc_start
- )
- end
- end
-
- #
- # Heredocs
- #
-
- defp parse_heredoc(
- "",
- acc,
- _replacement,
- _empty_line_replacement,
- _here_doc_delimiter,
- _current_line,
- _byte_index_heredoc_start
- ) do
- acc
- end
-
- defp parse_heredoc(
- <<"\\\\"::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_heredoc(
- t,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- )
- end
-
- defp parse_heredoc(
- <<"\\\""::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_heredoc(
- t,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- )
- end
-
- defp parse_heredoc(
- <<"\"\"\""::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- "\"\"\"",
- current_line,
- byte_index_heredoc_start
- ) do
- acc = pad_replaced_heredoc(acc, ~s("""), current_line, byte_index_heredoc_start)
-
- parse_code(t, acc <> ~s("""), replacement, empty_line_replacement)
- end
-
- defp parse_heredoc(
- <<"\'\'\'"::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- "\'\'\'",
- current_line,
- byte_index_heredoc_start
- ) do
- acc = pad_replaced_heredoc(acc, ~s('''), current_line, byte_index_heredoc_start)
-
- parse_code(t, acc <> ~s('''), replacement, empty_line_replacement)
- end
-
- defp parse_heredoc(
- <<"\n"::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- ) do
- acc =
- if current_line == "\n" do
- acc <> empty_line_replacement
- else
- acc
- end
-
- parse_heredoc(
- t,
- acc <> "\n",
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- "\n",
- byte_index_heredoc_start
- )
- end
-
- defp parse_heredoc(
- <<_::utf8, t::binary>>,
- acc,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line,
- byte_index_heredoc_start
- ) do
- parse_heredoc(
- t,
- acc <> replacement,
- replacement,
- empty_line_replacement,
- here_doc_delimiter,
- current_line <> replacement,
- byte_index_heredoc_start
- )
- end
-
- #
- # String Literals
- #
-
- defp parse_string_literal("", acc, _replacement, _empty_line_replacement) do
- acc
- end
-
- defp parse_string_literal(<<"\\\\"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_string_literal(t, acc <> "\\\\", replacement, empty_line_replacement)
- end
-
- defp parse_string_literal(<<"\\\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_string_literal(t, acc <> "\\\"", replacement, empty_line_replacement)
- end
-
- defp parse_string_literal(<<"\""::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_code(t, acc <> ~s("), replacement, empty_line_replacement)
- end
-
- defp parse_string_literal(<<"\n"::utf8, t::binary>>, acc, replacement, empty_line_replacement) do
- parse_string_literal(t, acc <> "\n", replacement, empty_line_replacement)
- end
-
- defp parse_string_literal(str, acc, replacement, empty_line_replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_string_literal(t, acc <> h, replacement, empty_line_replacement)
- end
-
- defp pad_replaced_heredoc(acc, _delimiter, current_line, byte_index_heredoc_start) do
- no_of_chars_to_replace = String.length(current_line) - 1
- pad_string = "\n" <> String.pad_leading("", no_of_chars_to_replace)
-
- start_binary = binary_part(acc, 0, byte_index_heredoc_start)
-
- new_acc =
- acc
- |> binary_part(byte_index_heredoc_start, byte_size(acc) - byte_index_heredoc_start)
- |> String.replace(~r/\n(.{#{no_of_chars_to_replace}})/, pad_string)
-
- start_binary <> new_acc
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/interpolation_helper.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/interpolation_helper.ex
deleted file mode 100644
index ab46a4aa..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/interpolation_helper.ex
+++ /dev/null
@@ -1,276 +0,0 @@
-defmodule Credo.Code.InterpolationHelper do
- @moduledoc false
-
- alias Credo.Code.Token
-
- @doc false
- def replace_interpolations(source, char \\ " ", filename \\ "nofilename")
- when is_binary(source) do
- positions = interpolation_positions(source, filename)
- lines = String.split(source, "\n")
-
- positions
- |> Enum.reverse()
- |> Enum.reduce(lines, &replace_line(&1, &2, char))
- |> Enum.join("\n")
- end
-
- defp replace_line({line_no, col_start, line_no, col_end}, lines, char) do
- List.update_at(
- lines,
- line_no - 1,
- &replace_line(&1, col_start, col_end, char)
- )
- end
-
- defp replace_line(position, lines, char) do
- {line_no_start, col_start, line_no_end, col_end} = position
-
- Enum.reduce(line_no_start..line_no_end, lines, fn
- line_no, memo
- when line_no == line_no_start ->
- List.update_at(
- memo,
- line_no - 1,
- &replace_line(&1, col_start, String.length(&1) + 1, char)
- )
-
- line_no, memo
- when line_no == line_no_end ->
- List.update_at(
- memo,
- line_no - 1,
- &replace_line(&1, 1, col_end, char)
- )
-
- line_no, memo
- when line_no < line_no_end ->
- List.update_at(
- memo,
- line_no - 1,
- &replace_line(&1, 1, String.length(&1) + 1, char)
- )
- end)
- end
-
- defp replace_line(line, col_start, col_end, char) do
- length = max(col_end - col_start, 0)
- line = String.to_charlist(line)
- part1 = Enum.slice(line, 0, col_start - 1)
- part2 = String.to_charlist(String.duplicate(char, length))
- part3 = Enum.slice(line, (col_end - 1)..-1)
- List.to_string(part1 ++ part2 ++ part3)
- end
-
- @doc false
- def interpolation_positions(source, filename \\ "nofilename") do
- source
- |> Credo.Code.to_tokens(filename)
- |> Enum.flat_map(&map_interpolations(&1, source))
- |> Enum.reject(&is_nil/1)
- end
-
- #
- # Elixir >= 1.13.0
- #
- defp map_interpolations(
- {:bin_heredoc, {_line_no, _col_start, _}, _, _list} = token,
- source
- ) do
- handle_heredoc(token, source)
- end
-
- #
- # Elixir >= 1.11.0
- #
- defp map_interpolations(
- {:sigil, {_line_no, _col_start, nil}, _, list, _empty_list, nil, _another_binary} =
- token,
- source
- ) do
- handle_atom_string_or_sigil(token, list, source)
- end
-
- #
- # Elixir >= 1.6.0
- #
- defp map_interpolations(
- {:sigil, {_line_no, _col_start, nil}, _, list, _, _sigil_start_char} = token,
- source
- ) do
- handle_atom_string_or_sigil(token, list, source)
- end
-
- defp map_interpolations(
- {:bin_heredoc, {_line_no, _col_start, _}, _list} = token,
- source
- ) do
- handle_heredoc(token, source)
- end
-
- defp map_interpolations(
- {:bin_string, {_line_no, _col_start, _}, list} = token,
- source
- ) do
- handle_atom_string_or_sigil(token, list, source)
- end
-
- defp map_interpolations(
- {:kw_identifier_unsafe, {_line_no, _col_start, _}, list} = token,
- source
- ) do
- handle_atom_string_or_sigil(token, list, source)
- end
-
- defp map_interpolations(
- {:atom_unsafe, {_line_no, _col_start, _}, list} = token,
- source
- ) do
- handle_atom_string_or_sigil(token, list, source)
- end
-
- defp map_interpolations(_token, _source) do
- []
- end
-
- defp handle_atom_string_or_sigil(_token, list, source) do
- find_interpolations(list, source)
- end
-
- defp handle_heredoc({_atom, {line_no, _, _}, list}, source) do
- first_line_in_heredoc = get_line(source, line_no + 1)
-
- # TODO: this seems to be wrong. the closing """ determines the
- # indentation, not the first line of the heredoc.
- padding_in_first_line = determine_heredoc_padding_at_start_of_line(first_line_in_heredoc)
-
- list
- |> find_interpolations(source)
- |> Enum.reject(&is_nil/1)
- |> add_to_col_start_and_end(padding_in_first_line)
- end
-
- # Elixir 1.13+
- defp handle_heredoc({atom, {line_no, col_start, col_end}, _, list}, source) do
- handle_heredoc({atom, {line_no, col_start, col_end}, list}, source)
- end
-
- defp find_interpolations(list, source) when is_list(list) do
- Enum.map(list, &find_interpolations(&1, source))
- end
-
- # Elixir < 1.9.0
- #
- defp find_interpolations(
- {{line_no, col_start, nil}, {line_no_end, col_end, nil}, list} = _token,
- _source
- )
- when is_list(list) do
- {line_no, col_start, line_no_end, col_end + 1}
- end
-
- # {{1, 25, 32}, [{:identifier, {1, 27, 31}, :name}]}
- defp find_interpolations({{_line_no, _col_start2, _}, _list} = token, source) do
- {line_no, col_start, line_no_end, col_end} = Token.position(token)
-
- col_end =
- if line_no_end > line_no && col_end == 1 do
- # This means we encountered :eol and jumped in the next line.
- # We need to add the closing `}`.
- col_end + 1
- else
- col_end
- end
-
- line = get_line(source, line_no_end)
-
- # `col_end - 1` to account for the closing `}`
- rest_of_line = get_rest_of_line(line, col_end - 1)
-
- # IO.inspect(rest_of_line, label: "rest_of_line")
-
- padding = determine_padding_at_start_of_line(rest_of_line, ~r/^\s*\}/)
-
- # -1 to remove the accounted-for `}`
- padding = max(padding - 1, 0)
-
- # IO.inspect(padding, label: "padding")
-
- {line_no, col_start, line_no_end, col_end + padding}
- end
-
- # Elixir >= 1.9.0
- #
- # {{1, 25, nil}, {1, 31, nil}, [{:identifier, {1, 27, nil}, :name}]}
- defp find_interpolations(
- {{_line_no, _col_start, nil}, {_line_no2, _col_start2, nil}, _list} = token,
- source
- ) do
- {line_no, col_start, line_no_end, col_end} = Token.position(token)
-
- col_end =
- if line_no_end > line_no && col_end == 1 do
- # This means we encountered :eol and jumped in the next line.
- # We need to add the closing `}`.
- col_end + 1
- else
- col_end
- end
-
- line = get_line(source, line_no_end)
-
- # `col_end - 1` to account for the closing `}`
- rest_of_line = get_rest_of_line(line, col_end - 1)
-
- # IO.inspect(rest_of_line, label: "rest_of_line")
-
- padding = determine_padding_at_start_of_line(rest_of_line, ~r/^\s*\}/)
-
- # -1 to remove the accounted-for `}`
- padding = max(padding - 1, 0)
-
- {line_no, col_start, line_no_end, col_end + padding}
- end
-
- defp find_interpolations(_value, _source) do
- nil
- end
-
- if Version.match?(System.version(), ">= 1.12.0-rc") do
- # Elixir >= 1.12.0
- #
- defp determine_heredoc_padding_at_start_of_line(_line), do: 0
- else
- # Elixir < 1.12.0
- #
- defp determine_heredoc_padding_at_start_of_line(line),
- do: determine_padding_at_start_of_line(line, ~r/^\s+/)
- end
-
- defp determine_padding_at_start_of_line(line, regex) do
- regex
- |> Regex.run(line)
- |> List.wrap()
- |> Enum.join()
- |> String.length()
- end
-
- defp add_to_col_start_and_end(positions, padding) do
- Enum.map(positions, fn {line_no, col_start, line_no_end, col_end} ->
- {line_no, col_start + padding, line_no_end, col_end + padding}
- end)
- end
-
- defp get_line(source, line_no) do
- source
- |> String.split("\n")
- |> Enum.at(line_no - 1)
- end
-
- defp get_rest_of_line(line, col_end) do
- # col-1 to account for col being 1-based
- start = max(col_end - 1, 0)
-
- String.slice(line, start..-1)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/module.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/module.ex
deleted file mode 100644
index 9651eda5..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/module.ex
+++ /dev/null
@@ -1,450 +0,0 @@
-defmodule Credo.Code.Module do
- @moduledoc """
- This module provides helper functions to analyse modules, return the defined
- functions or module attributes.
- """
-
- alias Credo.Code.Block
- alias Credo.Code.Name
-
- @type module_part ::
- :moduledoc
- | :shortdoc
- | :behaviour
- | :use
- | :import
- | :alias
- | :require
- | :module_attribute
- | :defstruct
- | :opaque
- | :type
- | :typep
- | :callback
- | :macrocallback
- | :optional_callbacks
- | :public_fun
- | :private_fun
- | :public_macro
- | :private_macro
- | :public_guard
- | :private_guard
- | :callback_fun
- | :callback_macro
- | :module
-
- @type location :: [line: pos_integer, column: pos_integer]
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc "Returns the list of aliases defined in a given module source code."
- def aliases({:defmodule, _, _arguments} = ast) do
- ast
- |> Credo.Code.postwalk(&find_aliases/2)
- |> Enum.uniq()
- end
-
- defp find_aliases({:alias, _, [{:__aliases__, _, mod_list}]} = ast, aliases) do
- module_names =
- mod_list
- |> Name.full()
- |> List.wrap()
-
- {ast, aliases ++ module_names}
- end
-
- # Multi alias
- defp find_aliases(
- {:alias, _,
- [
- {{:., _, [{:__aliases__, _, mod_list}, :{}]}, _, multi_mod_list}
- ]} = ast,
- aliases
- ) do
- module_names =
- Enum.map(multi_mod_list, fn tuple ->
- Name.full([Name.full(mod_list), Name.full(tuple)])
- end)
-
- {ast, aliases ++ module_names}
- end
-
- defp find_aliases(ast, aliases) do
- {ast, aliases}
- end
-
- @doc "Reads an attribute from a module's `ast`"
- def attribute(ast, attr_name) do
- case Credo.Code.postwalk(ast, &find_attribute(&1, &2, attr_name), {:error, nil}) do
- {:ok, value} ->
- value
-
- error ->
- error
- end
- end
-
- defp find_attribute({:@, _meta, arguments} = ast, tuple, attribute_name) do
- case List.first(arguments) do
- {^attribute_name, _meta, [value]} ->
- {:ok, value}
-
- _ ->
- {ast, tuple}
- end
- end
-
- defp find_attribute(ast, tuple, _name) do
- {ast, tuple}
- end
-
- @doc "Returns the function/macro count for the given module's AST"
- def def_count(nil), do: 0
-
- def def_count({:defmodule, _, _arguments} = ast) do
- ast
- |> Credo.Code.postwalk(&collect_defs/2)
- |> Enum.count()
- end
-
- def defs(nil), do: []
-
- def defs({:defmodule, _, _arguments} = ast) do
- Credo.Code.postwalk(ast, &collect_defs/2)
- end
-
- @doc "Returns the arity of the given function definition `ast`"
- def def_arity(ast)
-
- for op <- @def_ops do
- def def_arity({unquote(op) = op, _, [{:when, _, fun_ast}, _]}) do
- def_arity({op, nil, fun_ast})
- end
-
- def def_arity({unquote(op), _, [{_fun_name, _, arguments}, _]})
- when is_list(arguments) do
- Enum.count(arguments)
- end
-
- def def_arity({unquote(op), _, [{_fun_name, _, _}, _]}), do: 0
- end
-
- def def_arity(_), do: nil
-
- @doc "Returns the name of the function/macro defined in the given `ast`"
- for op <- @def_ops do
- def def_name({unquote(op) = op, _, [{:when, _, fun_ast}, _]}) do
- def_name({op, nil, fun_ast})
- end
-
- def def_name({unquote(op), _, [{fun_name, _, _arguments}, _]})
- when is_atom(fun_name) do
- fun_name
- end
- end
-
- def def_name(_), do: nil
-
- @doc "Returns the {fun_name, op} tuple of the function/macro defined in the given `ast`"
- for op <- @def_ops do
- def def_name_with_op({unquote(op) = op, _, _} = ast) do
- {def_name(ast), op}
- end
-
- def def_name_with_op({unquote(op) = op, _, _} = ast, arity) do
- if def_arity(ast) == arity do
- {def_name(ast), op}
- else
- nil
- end
- end
- end
-
- def def_name_with_op(_), do: nil
-
- @doc "Returns the name of the functions/macros for the given module's `ast`"
- def def_names(nil), do: []
-
- def def_names({:defmodule, _, _arguments} = ast) do
- ast
- |> Credo.Code.postwalk(&collect_defs/2)
- |> Enum.map(&def_name/1)
- |> Enum.uniq()
- end
-
- @doc "Returns the name of the functions/macros for the given module's `ast`"
- def def_names_with_op(nil), do: []
-
- def def_names_with_op({:defmodule, _, _arguments} = ast) do
- ast
- |> Credo.Code.postwalk(&collect_defs/2)
- |> Enum.map(&def_name_with_op/1)
- |> Enum.uniq()
- end
-
- @doc "Returns the name of the functions/macros for the given module's `ast` if it has the given `arity`."
- def def_names_with_op(nil, _arity), do: []
-
- def def_names_with_op({:defmodule, _, _arguments} = ast, arity) do
- ast
- |> Credo.Code.postwalk(&collect_defs/2)
- |> Enum.map(&def_name_with_op(&1, arity))
- |> Enum.reject(&is_nil/1)
- |> Enum.uniq()
- end
-
- for op <- @def_ops do
- defp collect_defs({:@, _, [{unquote(op), _, arguments} = ast]}, defs)
- when is_list(arguments) do
- {ast, defs -- [ast]}
- end
-
- defp collect_defs({unquote(op), _, arguments} = ast, defs)
- when is_list(arguments) do
- {ast, defs ++ [ast]}
- end
- end
-
- defp collect_defs(ast, defs) do
- {ast, defs}
- end
-
- @doc "Returns the list of modules used in a given module source code."
- def modules({:defmodule, _, _arguments} = ast) do
- ast
- |> Credo.Code.postwalk(&find_dependent_modules/2)
- |> Enum.uniq()
- end
-
- # exclude module name
- defp find_dependent_modules(
- {:defmodule, _, [{:__aliases__, _, mod_list}, _do_block]} = ast,
- modules
- ) do
- module_names =
- mod_list
- |> Name.full()
- |> List.wrap()
-
- {ast, modules -- module_names}
- end
-
- # single alias
- defp find_dependent_modules(
- {:alias, _, [{:__aliases__, _, mod_list}]} = ast,
- aliases
- ) do
- module_names =
- mod_list
- |> Name.full()
- |> List.wrap()
-
- {ast, aliases -- module_names}
- end
-
- # multi alias
- defp find_dependent_modules(
- {:alias, _,
- [
- {{:., _, [{:__aliases__, _, mod_list}, :{}]}, _, multi_mod_list}
- ]} = ast,
- modules
- ) do
- module_names =
- Enum.flat_map(multi_mod_list, fn tuple ->
- [Name.full(mod_list), Name.full(tuple)]
- end)
-
- {ast, modules -- module_names}
- end
-
- defp find_dependent_modules({:__aliases__, _, mod_list} = ast, modules) do
- module_names =
- mod_list
- |> Name.full()
- |> List.wrap()
-
- {ast, modules ++ module_names}
- end
-
- defp find_dependent_modules(ast, modules) do
- {ast, modules}
- end
-
- @doc """
- Returns the name of a module's given ast node.
- """
- def name(ast)
-
- def name({:defmodule, _, [{:__aliases__, _, name_list}, _]}) do
- Enum.map_join(name_list, ".", &name/1)
- end
-
- def name({:__MODULE__, _meta, nil}), do: "__MODULE__"
-
- def name(atom) when is_atom(atom), do: atom |> to_string |> String.replace(~r/^Elixir\./, "")
-
- def name(string) when is_binary(string), do: string
-
- def name(_), do: ""
-
- # TODO: write unit test
- def exception?({:defmodule, _, [{:__aliases__, _, _name_list}, arguments]}) do
- arguments
- |> Block.calls_in_do_block()
- |> Enum.any?(&defexception?/1)
- end
-
- def exception?(_), do: nil
-
- defp defexception?({:defexception, _, _}), do: true
- defp defexception?(_), do: false
-
- @spec analyze(Macro.t()) :: [{module, [{module_part, location}]}]
- def analyze(ast) do
- {_ast, state} = Macro.prewalk(ast, initial_state(), &traverse_file/2)
- module_parts(state)
- end
-
- defp traverse_file({:defmodule, meta, args}, state) do
- [first_arg, [do: module_ast]] = args
-
- state = start_module(state, meta)
- {_ast, state} = Macro.prewalk(module_ast, state, &traverse_module/2)
-
- module_name = module_name(first_arg)
- this_module = {module_name, state.current_module}
- submodules = find_inner_modules(module_name, module_ast)
-
- state = update_in(state.modules, &(&1 ++ [this_module | submodules]))
- {[], state}
- end
-
- defp traverse_file(ast, state), do: {ast, state}
-
- defp module_name({:__aliases__, _, name_parts}) do
- name_parts
- |> Enum.map(fn
- atom when is_atom(atom) -> atom
- _other -> Unknown
- end)
- |> Module.concat()
- end
-
- defp module_name(_other), do: Unknown
-
- defp find_inner_modules(module_name, module_ast) do
- {_ast, definitions} = Macro.prewalk(module_ast, initial_state(), &traverse_file/2)
-
- Enum.map(
- definitions.modules,
- fn {submodule_name, submodule_spec} ->
- {Module.concat(module_name, submodule_name), submodule_spec}
- end
- )
- end
-
- defp traverse_module(ast, state) do
- case analyze(state, ast) do
- nil -> traverse_deeper(ast, state)
- state -> traverse_sibling(state)
- end
- end
-
- defp traverse_deeper(ast, state), do: {ast, state}
- defp traverse_sibling(state), do: {[], state}
-
- # Part extractors
-
- defp analyze(state, {:@, _meta, [{:doc, _, [value]}]}),
- do: set_next_fun_modifier(state, if(value == false, do: :private, else: nil))
-
- defp analyze(state, {:@, _meta, [{:impl, _, [value]}]}),
- do: set_next_fun_modifier(state, if(value == false, do: nil, else: :impl))
-
- defp analyze(state, {:@, meta, [{attribute, _, _}]})
- when attribute in ~w/moduledoc shortdoc behaviour type typep opaque callback macrocallback optional_callbacks/a,
- do: add_module_element(state, attribute, meta)
-
- defp analyze(state, {:@, _meta, [{ignore_attribute, _, _}]})
- when ignore_attribute in ~w/after_compile before_compile compile impl deprecated doc
- typedoc dialyzer external_resource file on_definition on_load vsn spec/a,
- do: state
-
- defp analyze(state, {:@, meta, _}),
- do: add_module_element(state, :module_attribute, meta)
-
- defp analyze(state, {clause, meta, args})
- when clause in ~w/use import alias require defstruct/a and is_list(args),
- do: add_module_element(state, clause, meta)
-
- defp analyze(state, {clause, meta, [{:when, _, [fun | _rest]}, body]})
- when clause in ~w/def defmacro defguard defp defmacrop defguardp/a do
- analyze(state, {clause, meta, [fun, body]})
- end
-
- defp analyze(state, {clause, meta, definition})
- when clause in ~w/def defmacro defguard defp defmacrop defguardp/a do
- fun_name = fun_name(definition)
-
- if fun_name != state.last_fun_name do
- state
- |> add_module_element(code_type(clause, state.next_fun_modifier), meta)
- |> Map.put(:last_fun_name, fun_name)
- |> clear_next_fun_modifier()
- else
- state
- end
- end
-
- defp analyze(state, {:do, _code}) do
- # Not entering a do block, since this is possibly a custom macro invocation we can't
- # understand.
- state
- end
-
- defp analyze(state, {:defmodule, meta, _args}),
- do: add_module_element(state, :module, meta)
-
- defp analyze(_state, _ast), do: nil
-
- defp fun_name([{name, _context, arity} | _]) when is_list(arity), do: {name, length(arity)}
- defp fun_name([{name, _context, _} | _]), do: {name, 0}
- defp fun_name(_), do: nil
-
- defp code_type(:def, nil), do: :public_fun
- defp code_type(:def, :impl), do: :callback_fun
- defp code_type(:def, :private), do: :private_fun
- defp code_type(:defp, _), do: :private_fun
-
- defp code_type(:defmacro, nil), do: :public_macro
- defp code_type(:defmacro, :impl), do: :callback_macro
- defp code_type(macro, _) when macro in ~w/defmacro defmacrop/a, do: :private_macro
-
- defp code_type(:defguard, nil), do: :public_guard
- defp code_type(guard, _) when guard in ~w/defguard defguardp/a, do: :private_guard
-
- # Internal state
-
- defp initial_state,
- do: %{modules: [], current_module: nil, next_fun_modifier: nil, last_fun_name: nil}
-
- defp set_next_fun_modifier(state, value), do: %{state | next_fun_modifier: value}
-
- defp clear_next_fun_modifier(state), do: set_next_fun_modifier(state, nil)
-
- defp module_parts(state) do
- state.modules
- |> Enum.sort_by(fn {_name, module} -> module.location end)
- |> Enum.map(fn {name, module} -> {name, Enum.reverse(module.parts)} end)
- end
-
- defp start_module(state, meta) do
- %{state | current_module: %{parts: [], location: Keyword.take(meta, ~w/line column/a)}}
- end
-
- defp add_module_element(state, element, meta) do
- location = Keyword.take(meta, ~w/line column/a)
- update_in(state.current_module.parts, &[{element, location} | &1])
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/name.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/name.ex
deleted file mode 100644
index 65650b3d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/name.ex
+++ /dev/null
@@ -1,137 +0,0 @@
-defmodule Credo.Code.Name do
- @moduledoc """
- This module provides helper functions to process names of functions, module
- attributes and modules.
- """
-
- def last(name) when is_atom(name) do
- name
- |> to_string
- |> String.split(".")
- |> List.last()
- end
-
- def last(name) when is_binary(name) do
- name
- |> String.split(".")
- |> List.last()
- end
-
- def last(mod_list) when is_list(mod_list) do
- mod_list
- |> List.last()
- |> to_string
- end
-
- # Credo.Code.Name |> to_string
- # => "Elixir.Credo.Code.Name"
- def first(name) when is_atom(name) do
- name
- |> to_string
- |> String.split(".")
- |> Enum.at(1)
- end
-
- def first(name) when is_binary(name) do
- name
- |> String.split(".")
- |> List.first()
- end
-
- def first(mod_list) when is_list(mod_list) do
- mod_list
- |> List.first()
- |> to_string
- end
-
- def full(mod_list) when is_list(mod_list) do
- Enum.map_join(mod_list, ".", &full/1)
- end
-
- def full(name) when is_atom(name) do
- name
- |> to_string
- |> String.split(".")
- |> name_from_splitted_parts
- end
-
- def full(name) when is_binary(name) do
- name
- end
-
- def full(name) when is_integer(name) do
- to_string(name)
- end
-
- def full({name, _, nil}) when is_atom(name) do
- full(name)
- end
-
- def full({:__aliases__, _, mod_list}) do
- full(mod_list)
- end
-
- def full({{:., _, [{:__aliases__, _, mod_list}, name]}, _, _}) do
- full([full(mod_list), name])
- end
-
- def full({:@, _, [{name, _, nil}]}) when is_atom(name) do
- "@#{name}"
- end
-
- def full({name, _, arguments}) when is_atom(name) and is_list(arguments) do
- arg_list = Enum.map_join(arguments, ", ", &full/1)
-
- "#{full(name)}(#{arg_list})"
- end
-
- def parts_count(module_name) do
- module_name
- |> String.split(".")
- |> length
- end
-
- def pascal_case?(name) do
- String.match?(name, ~r/^[A-Z][a-zA-Z0-9]*$/)
- end
-
- def split_pascal_case(name) do
- name
- |> String.replace(~r/([A-Z])/, " \\1")
- |> String.split()
- end
-
- def snake_case?(name) do
- String.match?(name, ~r/^[[:lower:][:digit:]\_\?\!]+$/u)
- end
-
- def snake_case?(name, true) do
- snake_case?(name) || snake_case_with_acronyms?(name)
- end
-
- def snake_case?(name, _) do
- snake_case?(name)
- end
-
- defp snake_case_with_acronyms?(name) do
- name
- |> String.split("_")
- |> Enum.all?(fn part ->
- String.match?(part, ~r/^([[:lower:][:digit:]]+|[[:upper:][:digit:]]+)[\?!]?$/u)
- end)
- end
-
- def no_case?(name) do
- String.match?(name, ~r/^[^a-zA-Z0-9]+$/)
- end
-
- defp name_from_splitted_parts(parts) when length(parts) > 1 do
- parts
- |> Enum.slice(1, length(parts))
- |> Enum.join(".")
- end
-
- defp name_from_splitted_parts(parts) do
- Enum.join(parts, ".")
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/parameters.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/parameters.ex
deleted file mode 100644
index b29f0e60..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/parameters.ex
+++ /dev/null
@@ -1,93 +0,0 @@
-defmodule Credo.Code.Parameters do
- @moduledoc """
- This module provides helper functions to analyse the parameters taken by a
- function.
- """
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc "Returns the parameter count for the given function's AST"
- def count(nil), do: 0
-
- for op <- @def_ops do
- def count({unquote(op), _, arguments}) when is_list(arguments) do
- case List.first(arguments) do
- {_atom, _meta, nil} ->
- 0
-
- {_atom, _meta, list} ->
- Enum.count(list)
-
- _ ->
- 0
- end
- end
- end
-
- @doc "Returns the names of all parameters for the given function's AST"
- def names(nil), do: nil
-
- for op <- @def_ops do
- def names({unquote(op), _meta, arguments}) when is_list(arguments) do
- arguments
- |> List.first()
- |> get_param_names
- end
- end
-
- defp get_param_names({:when, _meta, arguments}) do
- arguments
- |> List.first()
- |> get_param_names
- end
-
- defp get_param_names(arguments) when is_tuple(arguments) do
- arguments
- |> Tuple.to_list()
- |> List.last()
- |> Enum.map(&get_param_name/1)
- |> Enum.reject(&is_nil/1)
- end
-
- defp get_param_name({:"::", _, [var, _type]}) do
- get_param_name(var)
- end
-
- defp get_param_name({:<<>>, _, arguments}) do
- arguments
- |> Enum.map(&get_param_name/1)
- |> Enum.reject(&is_nil/1)
- end
-
- defp get_param_name({:=, _, arguments}) do
- arguments
- |> Enum.map(&get_param_name/1)
- |> Enum.reject(&is_nil/1)
- end
-
- defp get_param_name({:%, _, [{:__aliases__, _meta, _mod_list}, {:%{}, _meta2, arguments}]}) do
- get_param_name(arguments)
- end
-
- defp get_param_name({:%{}, _, arguments}) do
- get_param_name(arguments)
- end
-
- defp get_param_name({:\\, _, arguments}) do
- Enum.find_value(arguments, &get_param_name/1)
- end
-
- defp get_param_name(list) when is_list(list) do
- list
- |> Enum.map(fn {atom, tuple} when is_atom(atom) and is_tuple(tuple) ->
- get_param_name(tuple)
- end)
- |> Enum.reject(&is_nil/1)
- end
-
- defp get_param_name({name, _, nil}) when is_atom(name), do: name
-
- defp get_param_name(_) do
- nil
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/scope.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/scope.ex
deleted file mode 100644
index d6187fb0..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/scope.ex
+++ /dev/null
@@ -1,140 +0,0 @@
-defmodule Credo.Code.Scope do
- @moduledoc """
- This module provides helper functions to determine the scope name at a certain
- point in the analysed code.
- """
-
- @def_ops [:def, :defp, :defmacro]
-
- @doc """
- Returns the module part of a scope.
-
- iex> Credo.Code.Scope.mod_name("Credo.Code")
- "Credo.Code"
-
- iex> Credo.Code.Scope.mod_name("Credo.Code.ast")
- "Credo.Code"
-
- """
- def mod_name(nil), do: nil
-
- def mod_name(scope_name) do
- names = String.split(scope_name, ".")
- base_name = List.last(names)
-
- if String.match?(base_name, ~r/^[_a-z]/) do
- names
- |> Enum.slice(0..(length(names) - 2))
- |> Enum.join(".")
- else
- scope_name
- end
- end
-
- @doc """
- Returns the scope for the given line as a tuple consisting of the call to
- define the scope (`:defmodule`, `:def`, `:defp` or `:defmacro`) and the
- name of the scope.
-
- Examples:
-
- {:defmodule, "Foo.Bar"}
- {:def, "Foo.Bar.baz"}
- """
- def name(_ast, line: 0), do: nil
-
- def name(ast, line: line) do
- ast
- |> scope_info_list()
- |> name_from_scope_info_list(line)
- end
-
- @doc false
- def name_from_scope_info_list(scope_info_list, line) do
- result =
- Enum.find(scope_info_list, fn
- {line_no, _op, _arguments} when line_no <= line -> true
- _ -> false
- end)
-
- case result do
- {_line_no, op, arguments} ->
- name = Credo.Code.Name.full(arguments)
- {op, name}
-
- _ ->
- {nil, ""}
- end
- end
-
- @doc false
- def scope_info_list(ast) do
- {_, scope_info_list} = Macro.prewalk(ast, [], &traverse_modules(&1, &2, nil, nil))
-
- Enum.reverse(scope_info_list)
- end
-
- defp traverse_modules({:defmodule, meta, arguments} = ast, acc, current_scope, _current_op)
- when is_list(arguments) do
- new_scope_part = Credo.Code.Module.name(ast)
-
- scope_name =
- [current_scope, new_scope_part]
- |> Enum.reject(&is_nil/1)
- |> Credo.Code.Name.full()
-
- defmodule_scope_info = {meta[:line], :defmodule, scope_name}
-
- {_, def_scope_infos} =
- Macro.prewalk(arguments, [], &traverse_defs(&1, &2, scope_name, :defmodule))
-
- new_acc = (acc ++ [defmodule_scope_info]) ++ def_scope_infos
-
- {nil, new_acc}
- end
-
- defp traverse_modules({_op, meta, _arguments} = ast, acc, current_scope, current_op) do
- scope_info = {meta[:line], current_op, current_scope}
-
- {ast, acc ++ [scope_info]}
- end
-
- defp traverse_modules(ast, acc, _current_scope, _current_op) do
- {ast, acc}
- end
-
- defp traverse_defs({:defmodule, _meta, arguments} = ast, acc, current_scope, _current_op)
- when is_list(arguments) do
- {_, scopes} = Macro.prewalk(ast, [], &traverse_modules(&1, &2, current_scope, :defmodule))
-
- {nil, acc ++ scopes}
- end
-
- for op <- @def_ops do
- defp traverse_defs({unquote(op), meta, arguments} = ast, acc, current_scope, _current_op)
- when is_list(arguments) do
- new_scope_part = Credo.Code.Module.def_name(ast)
-
- scope_name =
- [current_scope, new_scope_part]
- |> Enum.reject(&is_nil/1)
- |> Credo.Code.Name.full()
-
- scope_info = {meta[:line], unquote(op), scope_name}
-
- new_acc = acc ++ [scope_info]
-
- {nil, new_acc}
- end
- end
-
- defp traverse_defs({_op, meta, _arguments} = ast, acc, current_scope, current_op) do
- scope_info = {meta[:line], current_op, current_scope}
-
- {ast, acc ++ [scope_info]}
- end
-
- defp traverse_defs(ast, acc, _current_scope, _current_op) do
- {ast, acc}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/sigils.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/sigils.ex
deleted file mode 100644
index a4bfa5fd..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/sigils.ex
+++ /dev/null
@@ -1,364 +0,0 @@
-defmodule Credo.Code.Sigils do
- @moduledoc """
- This module lets you strip sigils from source code.
- """
-
- alias Credo.Code.InterpolationHelper
- alias Credo.SourceFile
-
- string_sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"\"", "\""},
- {"'", "'"},
- {"/", "/"}
- ]
-
- heredocs_sigil_delimiters = [
- {"'''", "'''"},
- {~s("""), ~s(""")}
- ]
-
- all_string_sigils =
- Enum.flat_map(string_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- all_heredocs_sigils =
- Enum.flat_map(heredocs_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- alphabet = ~w(a b c d e f g h i j k l m n o p q r t u v w x y z)
-
- sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"/", "/"},
- {"\"\"\"", "\"\"\""},
- {"\"", "\""},
- {"'", "'"}
- ]
-
- all_sigil_chars =
- Enum.flat_map(alphabet, fn a ->
- [a, String.upcase(a)]
- end)
-
- all_sigil_starts = Enum.map(all_sigil_chars, fn c -> "~#{c}" end)
-
- removable_sigil_ends = Enum.map(sigil_delimiters, &elem(&1, 1))
-
- removable_sigils =
- sigil_delimiters
- |> Enum.flat_map(fn {b, e} ->
- Enum.flat_map(all_sigil_starts, fn start ->
- [{"#{start}#{b}", e}, {"#{start}#{b}", e}]
- end)
- end)
- |> Enum.uniq()
-
- @doc """
- Replaces all characters inside all sigils with the equivalent amount of
- white-space.
- """
- def replace_with_spaces(
- source_file,
- replacement \\ " ",
- interpolation_replacement \\ " ",
- filename \\ "nofilename"
- ) do
- {source, filename} = SourceFile.source_and_filename(source_file, filename)
-
- source
- |> InterpolationHelper.replace_interpolations(interpolation_replacement, filename)
- |> parse_code("", replacement)
- end
-
- defp parse_code("", acc, _replacement) do
- acc
- end
-
- defp parse_code(<<"\\\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\\\"", replacement)
- end
-
- defp parse_code(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\\\'", replacement)
- end
-
- defp parse_code(<<"?'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?'", replacement)
- end
-
- defp parse_code(<<"'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "'", replacement)
- end
-
- defp parse_code(<<"?\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?\"", replacement)
- end
-
- defp parse_code(<<"#"::utf8, t::binary>>, acc, replacement) do
- parse_comment(t, acc <> "#", replacement)
- end
-
- for {sigil_start, sigil_end} <- removable_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_removable_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- for {sigil_start, sigil_end} <- all_heredocs_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_heredoc(
- t,
- acc <> unquote(sigil_start),
- replacement,
- unquote(sigil_end)
- )
- end
- end
-
- defp parse_code(<<"\"\"\""::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s("""), replacement, ~s("""))
- end
-
- defp parse_code(<<"\'\'\'"::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s('''), replacement, ~s('''))
- end
-
- for {sigil_start, sigil_end} <- all_string_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_removable_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- defp parse_code(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\"", replacement)
- end
-
- defp parse_code(<>, acc, replacement) do
- parse_code(t, acc <> <>, replacement)
- end
-
- defp parse_code(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_code(t, acc <> h, replacement)
- end
-
- #
- # Charlists
- #
-
- defp parse_charlist("", acc, _replacement) do
- acc
- end
-
- defp parse_charlist(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\\\\", replacement)
- end
-
- defp parse_charlist(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\\\'", replacement)
- end
-
- defp parse_charlist(<<"\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "'", replacement)
- end
-
- defp parse_charlist(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\n", replacement)
- end
-
- defp parse_charlist(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_charlist(t, acc <> h, replacement)
- end
-
- #
- # Comments
- #
-
- defp parse_comment("", acc, _replacement) do
- acc
- end
-
- defp parse_comment(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\n", replacement)
- end
-
- defp parse_comment(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_comment(t, acc <> h, replacement)
- end
-
- #
- # String Literals
- #
-
- defp parse_string_literal("", acc, _replacement) do
- acc
- end
-
- defp parse_string_literal(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\\\\", replacement)
- end
-
- defp parse_string_literal(<<"\\\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\\\"", replacement)
- end
-
- defp parse_string_literal(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> ~s("), replacement)
- end
-
- defp parse_string_literal(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\n", replacement)
- end
-
- defp parse_string_literal(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
- parse_string_literal(t, acc <> h, replacement)
- end
-
- #
- # Sigils
- #
-
- for sigil_end <- removable_sigil_ends do
- defp parse_removable_sigil("", acc, unquote(sigil_end), _replacement) do
- acc
- end
-
- defp parse_removable_sigil(
- <<"\\"::utf8, s::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- {_h, t} = String.next_codepoint(s)
-
- parse_removable_sigil(t, acc <> replacement <> replacement, unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- # \\
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> replacement <> replacement, unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(
- t,
- acc <> replacement <> replacement,
- unquote(sigil_end),
- replacement
- )
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement)
- end
-
- if sigil_end != "\"" do
- defp parse_removable_sigil(
- <<"\""::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> replacement, unquote(sigil_end), replacement)
- end
- end
-
- defp parse_removable_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\n", unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- <<_::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(
- t,
- acc <> replacement,
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- #
- # Heredocs
- #
-
- defp parse_heredoc(<<"\"\"\""::utf8, t::binary>>, acc, replacement, "\"\"\"") do
- parse_code(t, acc <> "\"\"\"", replacement)
- end
-
- defp parse_heredoc(<<"\'\'\'"::utf8, t::binary>>, acc, replacement, "\'\'\'") do
- parse_code(t, acc <> "\'\'\'", replacement)
- end
-
- defp parse_heredoc("", acc, _replacement, _delimiter) do
- acc
- end
-
- defp parse_heredoc(<<"\\\\"::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc <> "\\\\", replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\\\""::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc <> "\\\"", replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\n"::utf8, t::binary>>, acc, replacement, delimiter) do
- parse_heredoc(t, acc <> "\n", replacement, delimiter)
- end
-
- defp parse_heredoc(str, acc, replacement, delimiter) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
- parse_heredoc(t, acc <> h, replacement, delimiter)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/strings.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/strings.ex
deleted file mode 100644
index 09844372..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/strings.ex
+++ /dev/null
@@ -1,458 +0,0 @@
-defmodule Credo.Code.Strings do
- @moduledoc """
- This module lets you strip strings from source code.
- """
-
- alias Credo.Code.InterpolationHelper
- alias Credo.SourceFile
-
- string_sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"\"", "\""},
- {"'", "'"},
- {"/", "/"}
- ]
-
- heredocs_sigil_delimiters = [
- {"'''", "'''"},
- {~s("""), ~s(""")}
- ]
-
- all_string_sigils =
- Enum.flat_map(string_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- all_string_sigil_ends = Enum.map(string_sigil_delimiters, &elem(&1, 1))
-
- all_heredocs_sigils =
- Enum.flat_map(heredocs_sigil_delimiters, fn {b, e} ->
- [{"~s#{b}", e}, {"~S#{b}", e}]
- end)
-
- alphabet = ~w(a b c d e f g h i j k l m n o p q r t u v w x y z)
-
- sigil_delimiters = [
- {"(", ")"},
- {"[", "]"},
- {"{", "}"},
- {"<", ">"},
- {"|", "|"},
- {"/", "/"},
- {"\"\"\"", "\"\"\""},
- {"\"", "\""},
- {"'", "'"}
- ]
-
- all_sigil_chars =
- Enum.flat_map(alphabet, fn a ->
- [a, String.upcase(a)]
- end)
-
- all_sigil_starts = Enum.map(all_sigil_chars, fn c -> "~#{c}" end)
-
- removable_sigil_ends = Enum.map(sigil_delimiters, &elem(&1, 1))
-
- removable_sigils =
- sigil_delimiters
- |> Enum.flat_map(fn {b, e} ->
- Enum.flat_map(all_sigil_starts, fn start ->
- [{"#{start}#{b}", e}, {"#{start}#{b}", e}]
- end)
- end)
- |> Enum.uniq()
-
- @doc """
- Replaces all characters inside string literals and string sigils
- with the equivalent amount of white-space.
- """
- def replace_with_spaces(
- source_file,
- replacement \\ " ",
- interpolation_replacement \\ " ",
- filename \\ "nofilename"
- ) do
- {source, filename} = SourceFile.source_and_filename(source_file, filename)
-
- source
- |> InterpolationHelper.replace_interpolations(interpolation_replacement, filename)
- |> parse_code("", replacement)
- end
-
- defp parse_code("", acc, _replacement) do
- acc
- end
-
- for {sigil_start, sigil_end} <- removable_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_removable_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- for {sigil_start, sigil_end} <- all_heredocs_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_heredoc(
- t,
- acc <> unquote(sigil_start),
- "",
- replacement,
- unquote(sigil_end)
- )
- end
- end
-
- defp parse_code(<<"\"\"\""::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s("""), "", replacement, ~s("""))
- end
-
- defp parse_code(<<"\'\'\'"::utf8, t::binary>>, acc, replacement) do
- parse_heredoc(t, acc <> ~s('''), "", replacement, ~s('''))
- end
-
- for {sigil_start, sigil_end} <- all_string_sigils do
- defp parse_code(<>, acc, replacement) do
- parse_string_sigil(
- t,
- acc <> unquote(sigil_start),
- unquote(sigil_end),
- replacement
- )
- end
- end
-
- defp parse_code(<<"\\\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\\\"", replacement)
- end
-
- defp parse_code(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\\\'", replacement)
- end
-
- defp parse_code(<<"?'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?'", replacement)
- end
-
- defp parse_code(<<"'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "'", replacement)
- end
-
- defp parse_code(<<"?\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "?\"", replacement)
- end
-
- defp parse_code(<<"#"::utf8, t::binary>>, acc, replacement) do
- parse_comment(t, acc <> "#", replacement)
- end
-
- defp parse_code(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\"", replacement)
- end
-
- defp parse_code(<>, acc, replacement) do
- parse_code(t, acc <> <>, replacement)
- end
-
- defp parse_code(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_code(t, acc <> h, replacement)
- end
-
- #
- # Charlists
- #
-
- defp parse_charlist("", acc, _replacement) do
- acc
- end
-
- defp parse_charlist(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\\\\", replacement)
- end
-
- defp parse_charlist(<<"\\\'"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\\\'", replacement)
- end
-
- defp parse_charlist(<<"\'"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "'", replacement)
- end
-
- defp parse_charlist(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_charlist(t, acc <> "\n", replacement)
- end
-
- defp parse_charlist(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_charlist(t, acc <> h, replacement)
- end
-
- #
- # Comments
- #
-
- defp parse_comment("", acc, _replacement) do
- acc
- end
-
- defp parse_comment(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> "\n", replacement)
- end
-
- defp parse_comment(str, acc, replacement) when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_comment(t, acc <> h, replacement)
- end
-
- #
- # String Literals
- #
-
- defp parse_string_literal("", acc, _replacement) do
- acc
- end
-
- defp parse_string_literal(<<"\\\\"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc, replacement)
- end
-
- defp parse_string_literal(<<"\\\""::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc, replacement)
- end
-
- defp parse_string_literal(<<"\""::utf8, t::binary>>, acc, replacement) do
- parse_code(t, acc <> ~s("), replacement)
- end
-
- defp parse_string_literal(<<"\n"::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> "\n", replacement)
- end
-
- defp parse_string_literal(<<_::utf8, t::binary>>, acc, replacement) do
- parse_string_literal(t, acc <> replacement, replacement)
- end
-
- #
- # Non-String Sigils
- #
-
- for sigil_end <- removable_sigil_ends do
- defp parse_removable_sigil("", acc, unquote(sigil_end), _replacement) do
- acc
- end
-
- defp parse_removable_sigil(
- <<"\\"::utf8, s::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- {h, t} = String.next_codepoint(s)
-
- parse_removable_sigil(t, acc <> "\\" <> h, unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- # \\
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\\\\", unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(
- t,
- acc <> unquote("\\#{sigil_end}"),
- unquote(sigil_end),
- replacement
- )
- end
-
- if sigil_end != "\"" do
- defp parse_removable_sigil(
- <<"\""::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\"", unquote(sigil_end), replacement)
- end
- end
-
- defp parse_removable_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_removable_sigil(t, acc <> "\n", unquote(sigil_end), replacement)
- end
-
- defp parse_removable_sigil(
- str,
- acc,
- unquote(sigil_end),
- replacement
- )
- when is_binary(str) do
- {h, t} = String.next_codepoint(str)
-
- parse_removable_sigil(t, acc <> h, unquote(sigil_end), replacement)
- end
- end
-
- #
- # Sigils
- #
-
- for sigil_end <- all_string_sigil_ends do
- defp parse_string_sigil("", acc, unquote(sigil_end), _replacement) do
- acc
- end
-
- defp parse_string_sigil(
- <<"\\\\"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc <> replacement <> replacement, unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <<"\\\""::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc <> replacement <> replacement, unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_code(t, acc <> unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <<"\n"::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc <> "\n", unquote(sigil_end), replacement)
- end
-
- defp parse_string_sigil(
- <<_::utf8, t::binary>>,
- acc,
- unquote(sigil_end),
- replacement
- ) do
- parse_string_sigil(t, acc <> replacement, unquote(sigil_end), replacement)
- end
- end
-
- #
- # Heredocs
- #
-
- defp parse_heredoc(<<"\"\"\""::utf8, t::binary>>, acc, heredoc_acc, "" = replacement, "\"\"\"") do
- parse_code(t, acc <> heredoc_acc <> "\"\"\"", replacement)
- end
-
- defp parse_heredoc(<<"\"\"\""::utf8, t::binary>>, acc, heredoc_acc, " " = replacement, "\"\"\"") do
- parse_code(t, acc <> heredoc_acc <> "\"\"\"", replacement)
- end
-
- defp parse_heredoc(<<"\"\"\""::utf8, t::binary>>, acc, heredoc_acc, replacement, "\"\"\"") do
- heredoc_acc = heredoc_acc <> "\"\"\""
-
- heredoc_acc =
- case Regex.run(~r/\n([#{replacement}]+)\"\"\"\z/m, heredoc_acc) do
- [_, indent_string] ->
- x = String.length(indent_string)
- Regex.replace(~r/^(.{#{x}})/m, heredoc_acc, String.pad_trailing("", x))
-
- _ ->
- heredoc_acc
- end
-
- parse_code(t, acc <> heredoc_acc, replacement)
- end
-
- defp parse_heredoc(<<"\'\'\'"::utf8, t::binary>>, acc, heredoc_acc, "" = replacement, "\'\'\'") do
- parse_code(t, acc <> heredoc_acc <> "\'\'\'", replacement)
- end
-
- defp parse_heredoc(<<"\'\'\'"::utf8, t::binary>>, acc, heredoc_acc, " " = replacement, "\'\'\'") do
- parse_code(t, acc <> heredoc_acc <> "\'\'\'", replacement)
- end
-
- defp parse_heredoc(<<"\'\'\'"::utf8, t::binary>>, acc, heredoc_acc, replacement, "\'\'\'") do
- heredoc_acc = heredoc_acc <> "\'\'\'"
-
- heredoc_acc =
- case Regex.run(~r/\n([#{replacement}]+)\'\'\'\z/m, heredoc_acc) do
- [_, indent_string] ->
- x = String.length(indent_string)
- Regex.replace(~r/^(.{#{x}})/m, heredoc_acc, String.pad_trailing("", x))
-
- _ ->
- heredoc_acc
- end
-
- parse_code(t, acc <> heredoc_acc, replacement)
- end
-
- defp parse_heredoc("", acc, _heredoc_acc, _replacement, _delimiter) do
- acc
- end
-
- defp parse_heredoc(<<"\\\\"::utf8, t::binary>>, acc, heredoc_acc, replacement, delimiter) do
- parse_heredoc(t, acc, heredoc_acc, replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\\\""::utf8, t::binary>>, acc, heredoc_acc, replacement, delimiter) do
- parse_heredoc(t, acc, heredoc_acc, replacement, delimiter)
- end
-
- defp parse_heredoc(<<"\n"::utf8, t::binary>>, acc, heredoc_acc, replacement, delimiter) do
- parse_heredoc(t, acc, heredoc_acc <> "\n", replacement, delimiter)
- end
-
- defp parse_heredoc(<<_::utf8, t::binary>>, acc, heredoc_acc, replacement, delimiter) do
- parse_heredoc(t, acc, heredoc_acc <> replacement, replacement, delimiter)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/token.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/token.ex
deleted file mode 100644
index 88116def..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/token.ex
+++ /dev/null
@@ -1,269 +0,0 @@
-defmodule Credo.Code.Token do
- @moduledoc """
- This module provides helper functions to analyse tokens returned by `Credo.Code.to_tokens/1`.
- """
-
- @doc """
- Returns `true` if the given `token` contains a line break.
- """
- def eol?(token)
-
- def eol?(list) when is_list(list) do
- Enum.any?(list, &eol?/1)
- end
-
- def eol?({_, {_, _, _}, _, list, _, _}) when is_list(list) do
- Enum.any?(list, &eol?/1)
- end
-
- def eol?({_, {_, _, _}, list}) when is_list(list) do
- Enum.any?(list, &eol?/1)
- end
-
- def eol?({{_, _, _}, list}) when is_list(list) do
- Enum.any?(list, &eol?/1)
- end
-
- def eol?({:eol, {_, _, _}}), do: true
- def eol?(_), do: false
-
- @doc """
- Returns the position of a token in the form
-
- {line_no_start, col_start, line_no_end, col_end}
- """
- def position(token)
-
- def position({_, {line_no, col_start, _}, atom_or_charlist, _, _, _}) do
- position_tuple(atom_or_charlist, line_no, col_start)
- end
-
- def position({_, {line_no, col_start, _}, atom_or_charlist, _, _}) do
- position_tuple(atom_or_charlist, line_no, col_start)
- end
-
- def position({_, {line_no, col_start, _}, atom_or_charlist, _}) do
- position_tuple(atom_or_charlist, line_no, col_start)
- end
-
- def position({:bin_string, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- def position({:list_string, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- def position({:bin_heredoc, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_heredoc(atom_or_charlist, line_no, col_start)
- end
-
- def position({:list_heredoc, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_heredoc(atom_or_charlist, line_no, col_start)
- end
-
- def position({:atom_unsafe, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- # Elixir >= 1.10.0 tuple syntax
- def position({:sigil, {line_no, col_start, nil}, _, atom_or_charlist, _list, _number, _binary}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- # Elixir >= 1.9.0 tuple syntax
- def position({{line_no, col_start, nil}, {_line_no2, _col_start2, nil}, atom_or_charlist}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- def position({:kw_identifier_unsafe, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple_for_quoted_string(atom_or_charlist, line_no, col_start)
- end
-
- # Elixir < 1.9.0 tuple syntax
- def position({_, {line_no, col_start, _}, atom_or_charlist}) do
- position_tuple(atom_or_charlist, line_no, col_start)
- end
-
- def position({atom_or_charlist, {line_no, col_start, _}}) do
- position_tuple(atom_or_charlist, line_no, col_start)
- end
-
- # interpolation
- def position({{line_no, col_start, _}, list}) when is_list(list) do
- {line_no, col_start, line_no_end, col_end} =
- position_tuple_for_quoted_string(list, line_no, col_start)
-
- {line_no, col_start, line_no_end, col_end}
- end
-
- #
-
- defp position_tuple(list, line_no, col_start) when is_list(list) do
- binary = to_string(list)
- col_end = col_start + String.length(binary)
-
- {line_no, col_start, line_no, col_end}
- end
-
- defp position_tuple(atom, line_no, col_start) when is_atom(atom) do
- binary = to_string(atom)
- col_end = col_start + String.length(binary)
-
- {line_no, col_start, line_no, col_end}
- end
-
- defp position_tuple(number, line_no, col_start) when is_number(number) do
- binary = to_string([number])
- col_end = col_start + String.length(binary)
-
- {line_no, col_start, line_no, col_end}
- end
-
- defp position_tuple(_, _line_no, _col_start), do: nil
-
- defp position_tuple_for_heredoc(list, line_no, col_start)
- when is_list(list) do
- # add 3 for """ (closing double quote)
- {line_no_end, col_end, _terminator} = convert_to_col_end(line_no, col_start, list)
-
- col_end = col_end + 3
-
- {line_no, col_start, line_no_end, col_end}
- end
-
- @doc false
- def position_tuple_for_quoted_string(list, line_no, col_start)
- when is_list(list) do
- # add 1 for " (closing double quote)
- {line_no_end, col_end, terminator} = convert_to_col_end(line_no, col_start, list)
-
- {line_no_end, col_end} =
- case terminator do
- :eol ->
- # move to next line
- {line_no_end + 1, 1}
-
- _ ->
- # add 1 for " (closing double quote)
- {line_no_end, col_end + 1}
- end
-
- {line_no, col_start, line_no_end, col_end}
- end
-
- #
-
- defp convert_to_col_end(line_no, col_start, list) when is_list(list) do
- Enum.reduce(list, {line_no, col_start, nil}, &reduce_to_col_end/2)
- end
-
- # Elixir < 1.9.0
- #
- # {{1, 25, 32}, [{:identifier, {1, 27, 31}, :name}]}
- defp convert_to_col_end(_, _, {{line_no, col_start, _}, list}) do
- {line_no_end, col_end, _terminator} = convert_to_col_end(line_no, col_start, list)
-
- # add 1 for } (closing parens of interpolation)
- col_end = col_end + 1
-
- {line_no_end, col_end, :interpolation}
- end
-
- # Elixir >= 1.9.0
- #
- # {{1, 25, nil}, {1, 31, nil}, [{:identifier, {1, 27, nil}, :name}]}
- defp convert_to_col_end(
- _,
- _,
- {{line_no, col_start, nil}, {_line_no2, _col_start2, nil}, list}
- ) do
- {line_no_end, col_end, _terminator} = convert_to_col_end(line_no, col_start, list)
-
- # add 1 for } (closing parens of interpolation)
- col_end = col_end + 1
-
- {line_no_end, col_end, :interpolation}
- end
-
- defp convert_to_col_end(_, _, {:eol, {line_no, col_start, _}}) do
- {line_no, col_start, :eol}
- end
-
- defp convert_to_col_end(_, _, {value, {line_no, col_start, _}}) do
- {line_no, to_col_end(col_start, value), nil}
- end
-
- defp convert_to_col_end(_, _, {:bin_string, {line_no, col_start, nil}, list})
- when is_list(list) do
- # add 2 for opening and closing "
- {line_no, col_end, terminator} =
- Enum.reduce(list, {line_no, col_start, nil}, &reduce_to_col_end/2)
-
- {line_no, col_end + 2, terminator}
- end
-
- defp convert_to_col_end(_, _, {:bin_string, {line_no, col_start, nil}, value}) do
- # add 2 for opening and closing "
- {line_no, to_col_end(col_start, value, 2), :bin_string}
- end
-
- defp convert_to_col_end(_, _, {:list_string, {line_no, col_start, nil}, value}) do
- # add 2 for opening and closing '
- {line_no, to_col_end(col_start, value, 2), :bin_string}
- end
-
- defp convert_to_col_end(_, _, {_, {line_no, col_start, nil}, list})
- when is_list(list) do
- Enum.reduce(list, {line_no, col_start, nil}, &reduce_to_col_end/2)
- end
-
- defp convert_to_col_end(_, _, {_, {line_no, col_start, nil}, value}) do
- {line_no, to_col_end(col_start, value), nil}
- end
-
- defp convert_to_col_end(_, _, {:aliases, {line_no, col_start, _}, list}) do
- value = Enum.map(list, &to_string/1)
-
- {line_no, to_col_end(col_start, value), nil}
- end
-
- defp convert_to_col_end(_, _, {_, {line_no, col_start, _}, value}) do
- {line_no, to_col_end(col_start, value), nil}
- end
-
- defp convert_to_col_end(_, _, {:sigil, {line_no, col_start, nil}, _, list, _, _})
- when is_list(list) do
- Enum.reduce(list, {line_no, col_start, nil}, &reduce_to_col_end/2)
- end
-
- # Elixir >= 1.11
- defp convert_to_col_end(
- _,
- _,
- {:sigil, {line_no, col_start, nil}, _, list, _list, _number, _binary}
- )
- when is_list(list) do
- Enum.reduce(list, {line_no, col_start, nil}, &reduce_to_col_end/2)
- end
-
- defp convert_to_col_end(_, _, {:sigil, {line_no, col_start, nil}, _, value, _, _}) do
- {line_no, to_col_end(col_start, value), nil}
- end
-
- defp convert_to_col_end(line_no, col_start, value) do
- {line_no, to_col_end(col_start, value), nil}
- end
-
- #
-
- defp reduce_to_col_end(value, {current_line_no, current_col_start, _}) do
- convert_to_col_end(current_line_no, current_col_start, value)
- end
-
- #
-
- def to_col_end(col_start, value, add \\ 0) do
- col_start + String.length(to_string(value)) + add
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/code/token_ast_correlation.ex b/apps/plataforma_digital/deps/credo/lib/credo/code/token_ast_correlation.ex
deleted file mode 100644
index fb5e3308..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/code/token_ast_correlation.ex
+++ /dev/null
@@ -1,31 +0,0 @@
-defmodule Credo.Code.TokenAstCorrelation do
- # Elixir >= 1.6.0
- def find_tokens_in_ast(wanted_token, ast) do
- Credo.Code.prewalk(ast, &traverse_ast_for_token(&1, &2, wanted_token))
- end
-
- defp traverse_ast_for_token({:., meta, arguments} = ast, acc, token)
- when is_list(arguments) do
- {line_no_start, col_start, _line_no_end, _col_end} = Credo.Code.Token.position(token)
-
- if meta[:line] == line_no_start && meta[:column] == col_start - 1 do
- {nil, acc ++ [ast]}
- else
- {ast, acc}
- end
- end
-
- defp traverse_ast_for_token({_name, meta, _arguments} = ast, acc, token) do
- {line_no_start, col_start, _line_no_end, _col_end} = Credo.Code.Token.position(token)
-
- if meta[:line] == line_no_start && meta[:column] == col_start do
- {nil, acc ++ [ast]}
- else
- {ast, acc}
- end
- end
-
- defp traverse_ast_for_token(ast, acc, _token) do
- {ast, acc}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/config_builder.ex b/apps/plataforma_digital/deps/credo/lib/credo/config_builder.ex
deleted file mode 100644
index 689002a4..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/config_builder.ex
+++ /dev/null
@@ -1,323 +0,0 @@
-defmodule Credo.ConfigBuilder do
- alias Credo.CLI.Filename
- alias Credo.CLI.Options
- alias Credo.ConfigFile
- alias Credo.Execution
-
- @pattern_split_regex ~r/,\s*/
-
- def parse(exec) do
- options = exec.cli_options
-
- case get_config_file(exec, options) do
- {:ok, config_file} ->
- exec
- |> add_config_file_to_exec(config_file)
- |> add_strict_to_exec(config_file, options)
- |> add_switches_to_exec(options.switches)
- |> run_cli_switch_plugin_param_converters()
-
- {:error, _} = error ->
- error
- end
- end
-
- defp get_config_file(exec, %Options{} = options) do
- config_name = options.switches[:config_name]
- config_filename = options.switches[:config_file]
- dir = Filename.remove_line_no_and_column(options.path)
-
- if is_binary(config_filename) do
- filename = Path.expand(config_filename)
-
- ConfigFile.read_from_file_path(exec, dir, filename, config_name)
- else
- ConfigFile.read_or_default(exec, dir, config_name)
- end
- end
-
- defp add_config_file_to_exec(exec, %ConfigFile{} = config_file) do
- %Execution{
- exec
- | files: config_file.files,
- color: config_file.color,
- checks: config_file.checks,
- requires: config_file.requires,
- plugins: config_file.plugins,
- parse_timeout: config_file.parse_timeout
- }
- end
-
- defp add_strict_to_exec(exec, %ConfigFile{} = config_file, options) do
- %Execution{
- exec
- | strict: strict_via_args_or_config_file?(options.args, config_file)
- }
- end
-
- defp strict_via_args_or_config_file?([], config_file) do
- config_file.strict
- end
-
- defp strict_via_args_or_config_file?([potential_path | _], config_file) do
- user_expecting_explain_command? = Filename.contains_line_no?(potential_path)
-
- user_expecting_explain_command? || config_file.strict
- end
-
- defp add_switches_to_exec(%Execution{} = exec, switches) do
- exec
- |> add_switch_all(switches)
- |> add_switch_color(switches)
- |> add_switch_crash_on_error(switches)
- |> add_switch_debug(switches)
- |> add_switch_enable_disabled_checks(switches)
- |> add_switch_files_excluded(switches)
- |> add_switch_files_included(switches)
- |> add_switch_checks_without_tag(switches)
- |> add_switch_checks_with_tag(switches)
- |> add_switch_format(switches)
- |> add_switch_help(switches)
- |> add_switch_ignore(switches)
- |> add_switch_mute_exit_status(switches)
- |> add_switch_only(switches)
- |> add_switch_read_from_stdin(switches)
- |> add_switch_strict(switches)
- |> add_switch_min_priority(switches)
- |> add_switch_verbose(switches)
- |> add_switch_version(switches)
- end
-
- # add_switch_all
-
- defp add_switch_all(exec, %{all: true}) do
- %Execution{exec | all: true}
- end
-
- defp add_switch_all(exec, _), do: exec
-
- # add_switch_files_included
-
- defp add_switch_files_included(exec, %{files_included: [_head | _tail] = files_included}) do
- %Execution{exec | files: %{exec.files | included: files_included}}
- end
-
- defp add_switch_files_included(exec, _), do: exec
-
- # add_switch_files_excluded
-
- defp add_switch_files_excluded(exec, %{files_excluded: [_head | _tail] = files_excluded}) do
- %Execution{exec | files: %{exec.files | excluded: files_excluded}}
- end
-
- defp add_switch_files_excluded(exec, _), do: exec
-
- # add_switch_checks_with_tag
-
- defp add_switch_checks_with_tag(exec, %{
- checks_with_tag: [_head | _tail] = checks_with_tag
- }) do
- %Execution{exec | only_checks_tags: checks_with_tag}
- end
-
- defp add_switch_checks_with_tag(exec, _), do: exec
-
- # add_switch_checks_without_tag
-
- defp add_switch_checks_without_tag(exec, %{
- checks_without_tag: [_head | _tail] = checks_without_tag
- }) do
- %Execution{exec | ignore_checks_tags: checks_without_tag}
- end
-
- defp add_switch_checks_without_tag(exec, _), do: exec
-
- # add_switch_color
-
- defp add_switch_color(exec, %{color: color}) do
- %Execution{exec | color: color}
- end
-
- defp add_switch_color(exec, _), do: exec
-
- # add_switch_debug
-
- defp add_switch_debug(exec, %{debug: debug}) do
- %Execution{exec | debug: debug}
- end
-
- defp add_switch_debug(exec, _), do: exec
-
- # add_switch_strict
-
- defp add_switch_strict(exec, %{all_priorities: true}) do
- add_switch_strict(exec, %{strict: true})
- end
-
- defp add_switch_strict(exec, %{strict: true}) do
- new_config = %Execution{exec | strict: true}
-
- Execution.set_strict(new_config)
- end
-
- defp add_switch_strict(exec, %{strict: false}) do
- new_config = %Execution{exec | strict: false}
-
- Execution.set_strict(new_config)
- end
-
- defp add_switch_strict(exec, _), do: Execution.set_strict(exec)
-
- defp add_switch_help(exec, %{help: true}) do
- %Execution{exec | help: true}
- end
-
- defp add_switch_help(exec, _), do: exec
-
- # add_switch_verbose
-
- defp add_switch_verbose(exec, %{verbose: true}) do
- %Execution{exec | verbose: true}
- end
-
- defp add_switch_verbose(exec, _), do: exec
-
- # add_switch_crash_on_error
-
- defp add_switch_crash_on_error(exec, %{crash_on_error: true}) do
- %Execution{exec | crash_on_error: true}
- end
-
- defp add_switch_crash_on_error(exec, _), do: exec
-
- # add_switch_mute_exit_status
-
- defp add_switch_mute_exit_status(exec, %{mute_exit_status: true}) do
- %Execution{exec | mute_exit_status: true}
- end
-
- defp add_switch_mute_exit_status(exec, _), do: exec
-
- # add_switch_read_from_stdin
-
- defp add_switch_read_from_stdin(exec, %{read_from_stdin: true}) do
- %Execution{exec | read_from_stdin: true}
- end
-
- defp add_switch_read_from_stdin(exec, _), do: exec
-
- # add_switch_version
-
- defp add_switch_version(exec, %{version: true}) do
- %Execution{exec | version: true}
- end
-
- defp add_switch_version(exec, _), do: exec
-
- # add_switch_format
-
- defp add_switch_format(exec, %{format: format}) do
- %Execution{exec | format: format}
- end
-
- defp add_switch_format(exec, _), do: exec
-
- # add_switch_min_priority
-
- defp add_switch_min_priority(exec, %{min_priority: min_priority}) do
- %Execution{exec | min_priority: min_priority}
- end
-
- defp add_switch_min_priority(exec, _), do: exec
-
- # add_switch_enable_disabled_checks
-
- defp add_switch_enable_disabled_checks(exec, %{enable_disabled_checks: check_pattern}) do
- %Execution{exec | enable_disabled_checks: String.split(check_pattern, @pattern_split_regex)}
- end
-
- defp add_switch_enable_disabled_checks(exec, _), do: exec
-
- # add_switch_only
-
- # exclude/ignore certain checks
- defp add_switch_only(exec, %{only: only}) do
- add_switch_only(exec, %{checks: only})
- end
-
- # this catches a `--checks/only` without an argument after it
- defp add_switch_only(exec, %{checks: true}) do
- exec
- end
-
- defp add_switch_only(exec, %{checks: check_pattern}) do
- new_config = %Execution{
- exec
- | strict: true,
- only_checks: String.split(check_pattern, @pattern_split_regex)
- }
-
- Execution.set_strict(new_config)
- end
-
- defp add_switch_only(exec, _), do: exec
-
- # add_switch_ignore
-
- # exclude/ignore certain checks
- defp add_switch_ignore(exec, %{ignore: ignore}) do
- add_switch_ignore(exec, %{ignore_checks: ignore})
- end
-
- # this catches a `--ignore-checks/ignore` without an argument after it
- defp add_switch_ignore(exec, %{ignore_checks: true}) do
- exec
- end
-
- defp add_switch_ignore(exec, %{ignore_checks: ignore_pattern}) do
- %Execution{exec | ignore_checks: String.split(ignore_pattern, @pattern_split_regex)}
- end
-
- defp add_switch_ignore(exec, _), do: exec
-
- defp run_cli_switch_plugin_param_converters(exec) do
- Enum.reduce(
- exec.cli_switch_plugin_param_converters,
- exec,
- &reduce_converters/2
- )
- end
-
- defp reduce_converters({_switch_name, _plugin_mod, false}, exec) do
- exec
- end
-
- defp reduce_converters({switch_name, plugin_mod, true}, exec) do
- reduce_converters({switch_name, plugin_mod, switch_name}, exec)
- end
-
- defp reduce_converters({switch_name, plugin_mod, param_name}, exec) when is_atom(param_name) do
- converter_fun = fn switch_value -> {param_name, switch_value} end
-
- reduce_converters({switch_name, plugin_mod, converter_fun}, exec)
- end
-
- defp reduce_converters({switch_name, plugin_mod, converter_fun}, exec)
- when is_function(converter_fun) do
- case Execution.get_given_cli_switch(exec, switch_name) do
- {:ok, switch_value} ->
- validate_converter_fun_result(exec, plugin_mod, switch_name, converter_fun.(switch_value))
-
- _ ->
- exec
- end
- end
-
- defp validate_converter_fun_result(exec, plugin_mod, _switch_name, {param_name, param_value}) do
- Execution.put_plugin_param(exec, plugin_mod, param_name, param_value)
- end
-
- defp validate_converter_fun_result(_exec, plugin_mod, switch_name, value) do
- raise "Expected CLI switch to plugin param converter function to return a two-element tuple of {param_name, param_value}, got #{inspect(value)} (plugin: #{inspect(plugin_mod)}, switch: #{inspect(switch_name)})"
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/config_file.ex b/apps/plataforma_digital/deps/credo/lib/credo/config_file.ex
deleted file mode 100644
index fc180115..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/config_file.ex
+++ /dev/null
@@ -1,466 +0,0 @@
-defmodule Credo.ConfigFile do
- @moduledoc """
- `ConfigFile` structs represent all loaded and merged config files in a run.
- """
-
- @config_filename ".credo.exs"
- @default_config_name "default"
- @origin_user :file
-
- @default_glob "**/*.{ex,exs}"
- @default_files_included [@default_glob]
- @default_files_excluded []
- @default_parse_timeout 5000
- @default_strict false
- @default_color true
- @valid_checks_keys ~w(enabled disabled extra)a
-
- alias Credo.Execution
-
- defstruct origin: nil,
- filename: nil,
- config_name_found?: nil,
- files: nil,
- color: true,
- checks: nil,
- requires: [],
- plugins: [],
- parse_timeout: nil,
- strict: false
-
- @doc """
- Returns Execution struct representing a consolidated Execution for all `.credo.exs`
- files in `relevant_directories/1` merged into the default configuration.
-
- - `config_name`: name of the configuration to load
- - `safe`: if +true+, the config files are loaded using static analysis rather
- than `Code.eval_string/1`
- """
- def read_or_default(exec, dir, config_name \\ nil, safe \\ false) do
- dir
- |> relevant_config_files
- |> combine_configs(exec, dir, config_name, safe)
- end
-
- @doc """
- Returns the provided config_file merged into the default configuration.
-
- - `config_file`: full path to the custom configuration file
- - `config_name`: name of the configuration to load
- - `safe`: if +true+, the config files are loaded using static analysis rather
- than `Code.eval_string/1`
- """
- def read_from_file_path(exec, dir, config_filename, config_name \\ nil, safe \\ false) do
- if File.exists?(config_filename) do
- combine_configs([config_filename], exec, dir, config_name, safe)
- else
- {:error, {:notfound, "Given config file does not exist: #{config_filename}"}}
- end
- end
-
- defp combine_configs(files, exec, dir, config_name, safe) do
- config_files =
- files
- |> Enum.filter(&File.exists?/1)
- |> Enum.map(&{@origin_user, &1, File.read!(&1)})
-
- exec = Enum.reduce(config_files, exec, &Execution.append_config_file(&2, &1))
-
- Execution.get_config_files(exec)
- |> Enum.map(&from_exs(exec, dir, config_name || @default_config_name, &1, safe))
- |> ensure_any_config_found(config_name)
- |> merge()
- |> map_ok_files()
- |> ensure_values_present()
- end
-
- defp ensure_any_config_found(list, config_name) do
- config_not_found =
- Enum.all?(list, fn
- {:ok, %__MODULE__{config_name_found?: false}} -> true
- _ -> false
- end)
-
- if config_not_found do
- filenames_as_list =
- list
- |> Enum.map(fn
- {:ok, %__MODULE__{origin: :file, filename: filename}} -> " * #{filename}\n"
- _ -> nil
- end)
- |> Enum.reject(&is_nil/1)
-
- message =
- case filenames_as_list do
- [] ->
- "Given config name #{inspect(config_name)} does not exist."
-
- filenames_as_list ->
- """
- Given config name #{inspect(config_name)} does not exist in any config file:
-
- #{filenames_as_list}
- """
- end
- |> String.trim()
-
- {:error, {:config_name_not_found, message}}
- else
- list
- end
- end
-
- defp relevant_config_files(dir) do
- dir
- |> relevant_directories
- |> add_config_files
- end
-
- @doc """
- Returns all parent directories of the given `dir` as well as each `./config`
- sub-directory.
- """
- def relevant_directories(dir) do
- dir
- |> Path.expand()
- |> Path.split()
- |> Enum.reverse()
- |> get_dir_paths
- |> add_config_dirs
- end
-
- defp ensure_values_present({:ok, config}) do
- # TODO: config.check_for_updates is deprecated, but should not lead to a validation error
- config = %__MODULE__{
- origin: config.origin,
- filename: config.filename,
- config_name_found?: config.config_name_found?,
- checks: config.checks,
- color: merge_boolean(@default_color, config.color),
- files: %{
- included: merge_files_default(@default_files_included, config.files.included),
- excluded: merge_files_default(@default_files_excluded, config.files.excluded)
- },
- parse_timeout: merge_parse_timeout(@default_parse_timeout, config.parse_timeout),
- plugins: config.plugins || [],
- requires: config.requires || [],
- strict: merge_boolean(@default_strict, config.strict)
- }
-
- {:ok, config}
- end
-
- defp ensure_values_present(error), do: error
-
- defp get_dir_paths(dirs), do: do_get_dir_paths(dirs, [])
-
- defp do_get_dir_paths(dirs, acc) when length(dirs) < 2, do: acc
-
- defp do_get_dir_paths([dir | tail], acc) do
- expanded_path =
- tail
- |> Enum.reverse()
- |> Path.join()
- |> Path.join(dir)
-
- do_get_dir_paths(tail, [expanded_path | acc])
- end
-
- defp add_config_dirs(paths) do
- Enum.flat_map(paths, fn path -> [path, Path.join(path, "config")] end)
- end
-
- defp add_config_files(paths) do
- for path <- paths, do: Path.join(path, @config_filename)
- end
-
- defp from_exs(exec, dir, config_name, {origin, filename, exs_string}, safe) do
- case Credo.ExsLoader.parse(exs_string, filename, exec, safe) do
- {:ok, data} ->
- from_data(data, dir, filename, origin, config_name)
-
- {:error, {line_no, description, trigger}} ->
- {:error, {:badconfig, filename, line_no, description, trigger}}
-
- {:error, reason} ->
- {:error, {:badconfig, filename, reason}}
- end
- end
-
- defp from_data(data, dir, filename, origin, config_name) do
- data =
- data[:configs]
- |> List.wrap()
- |> Enum.find(&(&1[:name] == config_name))
-
- config_name_found? = not is_nil(data)
-
- config_file = %__MODULE__{
- origin: origin,
- filename: filename,
- config_name_found?: config_name_found?,
- checks: checks_from_data(data, filename),
- color: data[:color],
- files: files_from_data(data, dir),
- parse_timeout: data[:parse_timeout],
- plugins: data[:plugins] || [],
- requires: data[:requires] || [],
- strict: data[:strict]
- }
-
- {:ok, config_file}
- end
-
- defp files_from_data(data, dir) do
- case data[:files] do
- nil ->
- nil
-
- %{} = files ->
- included_files = files[:included] || dir
-
- included_dir =
- included_files
- |> List.wrap()
- |> Enum.map(&join_default_files_if_directory/1)
-
- %{
- included: included_dir,
- excluded: files[:excluded] || @default_files_excluded
- }
- end
- end
-
- defp checks_from_data(data, filename) do
- case data[:checks] do
- checks when is_list(checks) ->
- checks
-
- %{} = checks ->
- do_warn_if_check_params_invalid(checks, filename)
-
- checks
-
- _ ->
- []
- end
- end
-
- defp do_warn_if_check_params_invalid(checks, filename) do
- Enum.each(checks, fn
- {checks_key, _name} when checks_key not in @valid_checks_keys ->
- candidate = find_best_match(@valid_checks_keys, checks_key)
- warning = warning_message_for(filename, checks_key, candidate)
-
- Credo.CLI.Output.UI.warn([:red, warning])
-
- _ ->
- nil
- end)
- end
-
- defp warning_message_for(filename, checks_key, candidate) do
- if candidate do
- "** (config) #{filename}: config field `:checks` contains unknown key `#{inspect(checks_key)}`. Did you mean `#{inspect(candidate)}`?"
- else
- "** (config) #{filename}: config field `:checks` contains unknown key `#{inspect(checks_key)}`."
- end
- end
-
- defp find_best_match(candidates, given, threshold \\ 0.8) do
- given_string = to_string(given)
-
- {jaro_distance, candidate} =
- candidates
- |> Enum.map(fn candidate_name ->
- distance = String.jaro_distance(given_string, to_string(candidate_name))
- {distance, candidate_name}
- end)
- |> Enum.sort()
- |> List.last()
-
- if jaro_distance > threshold do
- candidate
- end
- end
-
- @doc """
- Merges the given structs from left to right, meaning that later entries
- overwrites earlier ones.
-
- merge(base, other)
-
- Any options in `other` will overwrite those in `base`.
-
- The `files:` field is merged, meaning that you can define `included` and/or
- `excluded` and only override the given one.
-
- The `checks:` field is merged.
- """
- def merge(list) when is_list(list) do
- base = List.first(list)
- tail = List.delete_at(list, 0)
-
- merge(tail, base)
- end
-
- # bubble up errors from parsing the config so we can deal with them at the top-level
- def merge({:error, _} = error), do: error
-
- def merge([], config), do: config
-
- def merge([other | tail], base) do
- new_base = merge(base, other)
-
- merge(tail, new_base)
- end
-
- # bubble up errors from parsing the config so we can deal with them at the top-level
- def merge({:error, _} = a, _), do: a
- def merge(_, {:error, _} = a), do: a
-
- def merge({:ok, base}, {:ok, other}) do
- config_file = %__MODULE__{
- checks: merge_checks(base, other),
- color: merge_boolean(base.color, other.color),
- files: merge_files(base, other),
- parse_timeout: merge_parse_timeout(base.parse_timeout, other.parse_timeout),
- plugins: base.plugins ++ other.plugins,
- requires: base.requires ++ other.requires,
- strict: merge_boolean(base.strict, other.strict)
- }
-
- {:ok, config_file}
- end
-
- defp merge_boolean(base, other)
-
- defp merge_boolean(_base, true), do: true
- defp merge_boolean(_base, false), do: false
- defp merge_boolean(base, _), do: base
-
- defp merge_files_default(_base, [_head | _tail] = non_empty_list), do: non_empty_list
- defp merge_files_default(base, _), do: base
-
- defp merge_parse_timeout(_base, timeout) when is_integer(timeout), do: timeout
- defp merge_parse_timeout(base, _), do: base
-
- def merge_checks(%__MODULE__{checks: checks_list_base}, %__MODULE__{checks: checks_list_other})
- when is_list(checks_list_base) and is_list(checks_list_other) do
- base = %__MODULE__{checks: %{enabled: checks_list_base}}
- other = %__MODULE__{checks: %{extra: checks_list_other}}
-
- merge_checks(base, other)
- end
-
- def merge_checks(%__MODULE__{checks: checks_base}, %__MODULE__{
- checks: %{extra: _} = checks_map_other
- })
- when is_list(checks_base) do
- base = %__MODULE__{checks: %{enabled: checks_base}}
- other = %__MODULE__{checks: checks_map_other}
-
- merge_checks(base, other)
- end
-
- def merge_checks(%__MODULE__{checks: %{enabled: checks_list_base}}, %__MODULE__{
- checks: checks_other
- })
- when is_list(checks_list_base) and is_list(checks_other) do
- base = %__MODULE__{checks: %{enabled: checks_list_base}}
- other = %__MODULE__{checks: %{extra: checks_other}}
-
- merge_checks(base, other)
- end
-
- def merge_checks(%__MODULE__{checks: _checks_base}, %__MODULE__{
- checks: %{enabled: checks_other_enabled} = checks_other
- })
- when is_list(checks_other_enabled) do
- disabled = disable_check_tuples(checks_other[:disabled])
-
- %{
- enabled: checks_other_enabled |> normalize_check_tuples() |> Keyword.merge(disabled),
- disabled: checks_other[:disabled] || []
- }
- end
-
- def merge_checks(%__MODULE__{checks: %{enabled: checks_base}}, %__MODULE__{
- checks: %{} = checks_other
- })
- when is_list(checks_base) do
- base = normalize_check_tuples(checks_base)
- other = normalize_check_tuples(checks_other[:extra])
- disabled = disable_check_tuples(checks_other[:disabled])
-
- %{
- enabled: base |> Keyword.merge(other) |> Keyword.merge(disabled),
- disabled: checks_other[:disabled] || []
- }
- end
-
- # this def catches all the cases where no valid key was found in `checks_map_other`
- def merge_checks(%__MODULE__{checks: %{enabled: checks_base}}, %__MODULE__{
- checks: %{}
- })
- when is_list(checks_base) do
- base = %__MODULE__{checks: %{enabled: checks_base}}
- other = %__MODULE__{checks: []}
-
- merge_checks(base, other)
- end
-
- #
-
- def merge_files(%__MODULE__{files: files_base}, %__MODULE__{files: files_other}) do
- %{
- included: files_other[:included] || files_base[:included],
- excluded: files_other[:excluded] || files_base[:excluded]
- }
- end
-
- defp normalize_check_tuples(nil), do: []
-
- defp normalize_check_tuples(list) when is_list(list) do
- Enum.map(list, &normalize_check_tuple/1)
- end
-
- defp normalize_check_tuple({name}), do: {name, []}
- defp normalize_check_tuple(tuple), do: tuple
-
- defp disable_check_tuples(nil), do: []
-
- defp disable_check_tuples(list) when is_list(list) do
- Enum.map(list, &disable_check_tuple/1)
- end
-
- defp disable_check_tuple({name}), do: {name, false}
- defp disable_check_tuple({name, _params}), do: {name, false}
-
- defp join_default_files_if_directory(dir) do
- if File.dir?(dir) do
- Path.join(dir, @default_files_included)
- else
- dir
- end
- end
-
- defp map_ok_files({:error, _} = error) do
- error
- end
-
- defp map_ok_files({:ok, %__MODULE__{files: files} = config}) do
- files = %{
- included:
- files[:included]
- |> List.wrap()
- |> Enum.uniq(),
- excluded:
- files[:excluded]
- |> List.wrap()
- |> Enum.uniq()
- }
-
- {:ok, %__MODULE__{config | files: files}}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution.ex
deleted file mode 100644
index 506ddcf0..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution.ex
+++ /dev/null
@@ -1,812 +0,0 @@
-defmodule Credo.Execution do
- @moduledoc """
- Every run of Credo is configured via an `Credo.Execution` struct, which is created and
- manipulated via the `Credo.Execution` module.
- """
-
- @doc """
- The `Credo.Execution` struct is created and manipulated via the `Credo.Execution` module.
- """
- defstruct argv: [],
- cli_options: nil,
- # TODO: these initial switches should also be %Credo.CLI.Switch{} struct
- cli_switches: [
- debug: :boolean,
- color: :boolean,
- config_name: :string,
- config_file: :string,
- working_dir: :string
- ],
- cli_aliases: [C: :config_name, D: :debug],
- cli_switch_plugin_param_converters: [],
-
- # config
- files: nil,
- color: true,
- debug: false,
- checks: nil,
- requires: [],
- plugins: [],
- parse_timeout: 5000,
- strict: false,
-
- # options, set by the command line
- format: nil,
- help: false,
- verbose: false,
- version: false,
-
- # options, that are kept here for legacy reasons
- all: false,
- crash_on_error: true,
- enable_disabled_checks: nil,
- ignore_checks_tags: [],
- ignore_checks: nil,
- max_concurrent_check_runs: nil,
- min_priority: 0,
- mute_exit_status: false,
- only_checks_tags: [],
- only_checks: nil,
- read_from_stdin: false,
-
- # state, which is accessed and changed over the course of Credo's execution
- pipeline_map: %{},
- commands: %{},
- config_files: [],
- current_task: nil,
- parent_task: nil,
- initializing_plugin: nil,
- halted: false,
- config_files_pid: nil,
- source_files_pid: nil,
- issues_pid: nil,
- timing_pid: nil,
- skipped_checks: nil,
- assigns: %{},
- results: %{},
- config_comment_map: %{}
-
- @typedoc false
- @type t :: %__MODULE__{}
-
- @execution_pipeline_key __MODULE__
- @execution_pipeline_key_backwards_compatibility_map %{
- Credo.CLI.Command.Diff.DiffCommand => "diff",
- Credo.CLI.Command.List.ListCommand => "list",
- Credo.CLI.Command.Suggest.SuggestCommand => "suggest",
- Credo.CLI.Command.Info.InfoCommand => "info"
- }
- @execution_pipeline [
- __pre__: [
- Credo.Execution.Task.AppendDefaultConfig,
- Credo.Execution.Task.AppendExtraConfig,
- {Credo.Execution.Task.ParseOptions, parser_mode: :preliminary},
- Credo.Execution.Task.ConvertCLIOptionsToConfig,
- Credo.Execution.Task.InitializePlugins
- ],
- parse_cli_options: [{Credo.Execution.Task.ParseOptions, parser_mode: :preliminary}],
- initialize_plugins: [
- # This is where plugins can "put" their hooks using `Credo.Plugin.append_task/3`
- # to initialize themselves based on the params given in the config as well as
- # in their own command line switches.
- #
- # Example:
- #
- # defmodule CredoDemoPlugin do
- # import Credo.Plugin
- #
- # def init(exec) do
- # append_task(exec, :initialize_plugins, CredoDemoPlugin.SetDiffAsDefaultCommand)
- # end
- # end
- ],
- determine_command: [Credo.Execution.Task.DetermineCommand],
- set_default_command: [Credo.Execution.Task.SetDefaultCommand],
- initialize_command: [Credo.Execution.Task.InitializeCommand],
- parse_cli_options_final: [{Credo.Execution.Task.ParseOptions, parser_mode: :strict}],
- validate_cli_options: [Credo.Execution.Task.ValidateOptions],
- convert_cli_options_to_config: [Credo.Execution.Task.ConvertCLIOptionsToConfig],
- resolve_config: [Credo.Execution.Task.UseColors, Credo.Execution.Task.RequireRequires],
- validate_config: [Credo.Execution.Task.ValidateConfig],
- run_command: [Credo.Execution.Task.RunCommand],
- halt_execution: [Credo.Execution.Task.AssignExitStatusForIssues]
- ]
-
- alias Credo.Execution.ExecutionConfigFiles
- alias Credo.Execution.ExecutionIssues
- alias Credo.Execution.ExecutionSourceFiles
- alias Credo.Execution.ExecutionTiming
-
- @doc "Builds an Execution struct for the the given `argv`."
- def build(argv \\ []) when is_list(argv) do
- max_concurrent_check_runs = System.schedulers_online()
-
- %__MODULE__{argv: argv, max_concurrent_check_runs: max_concurrent_check_runs}
- |> put_pipeline(@execution_pipeline_key, @execution_pipeline)
- |> put_builtin_command("categories", Credo.CLI.Command.Categories.CategoriesCommand)
- |> put_builtin_command("diff", Credo.CLI.Command.Diff.DiffCommand)
- |> put_builtin_command("explain", Credo.CLI.Command.Explain.ExplainCommand)
- |> put_builtin_command("gen.check", Credo.CLI.Command.GenCheck)
- |> put_builtin_command("gen.config", Credo.CLI.Command.GenConfig)
- |> put_builtin_command("help", Credo.CLI.Command.Help)
- |> put_builtin_command("info", Credo.CLI.Command.Info.InfoCommand)
- |> put_builtin_command("list", Credo.CLI.Command.List.ListCommand)
- |> put_builtin_command("suggest", Credo.CLI.Command.Suggest.SuggestCommand)
- |> put_builtin_command("version", Credo.CLI.Command.Version)
- |> start_servers()
- end
-
- @doc false
- def build(%__MODULE__{} = previous_exec, files_that_changed) when is_list(files_that_changed) do
- previous_exec.argv
- |> build()
- |> put_rerun(previous_exec, files_that_changed)
- end
-
- def build(argv, files_that_changed) when is_list(files_that_changed) do
- build(argv)
- end
-
- @doc false
- defp start_servers(%__MODULE__{} = exec) do
- exec
- |> ExecutionConfigFiles.start_server()
- |> ExecutionIssues.start_server()
- |> ExecutionSourceFiles.start_server()
- |> ExecutionTiming.start_server()
- end
-
- @doc """
- Returns the checks that should be run for a given `exec` struct.
-
- Takes all checks from the `checks:` field of the exec, matches those against
- any patterns to include or exclude certain checks given via the command line.
- """
- def checks(exec)
-
- def checks(%__MODULE__{checks: nil}) do
- {[], [], []}
- end
-
- def checks(%__MODULE__{
- checks: %{enabled: checks},
- only_checks: only_checks,
- only_checks_tags: only_checks_tags,
- ignore_checks: ignore_checks,
- ignore_checks_tags: ignore_checks_tags
- }) do
- only_matching =
- checks |> filter_only_checks_by_tags(only_checks_tags) |> filter_only_checks(only_checks)
-
- ignore_matching_by_name = filter_ignore_checks(checks, ignore_checks)
- ignore_matching_by_tags = filter_ignore_checks_by_tags(checks, ignore_checks_tags)
- ignore_matching = ignore_matching_by_name ++ ignore_matching_by_tags
-
- result = only_matching -- ignore_matching
-
- {result, only_matching, ignore_matching}
- end
-
- defp filter_only_checks(checks, nil), do: checks
- defp filter_only_checks(checks, []), do: checks
- defp filter_only_checks(checks, patterns), do: filter_checks(checks, patterns)
-
- defp filter_ignore_checks(_checks, nil), do: []
- defp filter_ignore_checks(_checks, []), do: []
- defp filter_ignore_checks(checks, patterns), do: filter_checks(checks, patterns)
-
- defp filter_checks(checks, patterns) do
- regexes =
- patterns
- |> List.wrap()
- |> to_match_regexes
-
- Enum.filter(checks, &match_regex(&1, regexes, true))
- end
-
- defp match_regex(_tuple, [], default_for_empty), do: default_for_empty
-
- defp match_regex(tuple, regexes, _default_for_empty) do
- check_name =
- tuple
- |> Tuple.to_list()
- |> List.first()
- |> to_string
-
- Enum.any?(regexes, &Regex.run(&1, check_name))
- end
-
- defp to_match_regexes(list) do
- Enum.map(list, fn match_check ->
- {:ok, match_pattern} = Regex.compile(match_check, "i")
- match_pattern
- end)
- end
-
- defp filter_only_checks_by_tags(checks, nil), do: checks
- defp filter_only_checks_by_tags(checks, []), do: checks
- defp filter_only_checks_by_tags(checks, tags), do: filter_checks_by_tags(checks, tags)
-
- defp filter_ignore_checks_by_tags(_checks, nil), do: []
- defp filter_ignore_checks_by_tags(_checks, []), do: []
- defp filter_ignore_checks_by_tags(checks, tags), do: filter_checks_by_tags(checks, tags)
-
- defp filter_checks_by_tags(_checks, nil), do: []
- defp filter_checks_by_tags(_checks, []), do: []
-
- defp filter_checks_by_tags(checks, tags) do
- tags = Enum.map(tags, &String.to_atom/1)
-
- Enum.filter(checks, &match_tags(&1, tags, true))
- end
-
- defp match_tags(_tuple, [], default_for_empty), do: default_for_empty
-
- defp match_tags({check, params}, tags, _default_for_empty) do
- tags_for_check = tags_for_check(check, params)
-
- Enum.any?(tags, &Enum.member?(tags_for_check, &1))
- end
-
- @doc """
- Returns the tags for a given `check` and its `params`.
- """
- def tags_for_check(check, params)
-
- def tags_for_check(check, nil), do: check.tags
- def tags_for_check(check, []), do: check.tags
-
- def tags_for_check(check, params) when is_list(params) do
- params
- |> Credo.Check.Params.tags(check)
- |> Enum.flat_map(fn
- :__initial__ -> check.tags
- tag -> [tag]
- end)
- end
-
- @doc """
- Sets the exec values which `strict` implies (if applicable).
- """
- def set_strict(exec)
-
- def set_strict(%__MODULE__{strict: true} = exec) do
- %__MODULE__{exec | all: true, min_priority: -99}
- end
-
- def set_strict(%__MODULE__{strict: false} = exec) do
- %__MODULE__{exec | min_priority: 0}
- end
-
- def set_strict(exec), do: exec
-
- @doc false
- @deprecated "Use `Execution.working_dir/1` instead"
- def get_path(exec) do
- exec.cli_options.path
- end
-
- @doc false
- def working_dir(exec) do
- Path.expand(exec.cli_options.path)
- end
-
- # Commands
-
- @doc """
- Returns the name of the command, which should be run by the given execution.
-
- Credo.Execution.get_command_name(exec)
- # => "suggest"
- """
- def get_command_name(exec) do
- exec.cli_options.command
- end
-
- @doc """
- Returns all valid command names.
-
- Credo.Execution.get_valid_command_names(exec)
- # => ["categories", "diff", "explain", "gen.check", "gen.config", "help", "info",
- # "list", "suggest", "version"]
- """
- def get_valid_command_names(exec) do
- Map.keys(exec.commands)
- end
-
- @doc """
- Returns the `Credo.CLI.Command` module for the given `name`.
-
- Credo.Execution.get_command(exec, "explain")
- # => Credo.CLI.Command.Explain.ExplainCommand
- """
- def get_command(exec, name) do
- Map.get(exec.commands, name) ||
- raise """
- Command not found: "#{inspect(name)}"
-
- Registered commands: #{inspect(exec.commands, pretty: true)}
- """
- end
-
- @doc false
- def put_command(exec, _plugin_mod, name, command_mod) do
- commands = Map.put(exec.commands, name, command_mod)
-
- %__MODULE__{exec | commands: commands}
- |> command_mod.init()
- end
-
- @doc false
- def set_initializing_plugin(%__MODULE__{initializing_plugin: nil} = exec, plugin_mod) do
- %__MODULE__{exec | initializing_plugin: plugin_mod}
- end
-
- def set_initializing_plugin(exec, nil) do
- %__MODULE__{exec | initializing_plugin: nil}
- end
-
- def set_initializing_plugin(%__MODULE__{initializing_plugin: mod1}, mod2) do
- raise "Attempting to initialize plugin #{inspect(mod2)}, " <>
- "while already initializing plugin #{mod1}"
- end
-
- # Plugin params
-
- @doc """
- Returns the `Credo.Plugin` module's param value.
-
- Credo.Execution.get_command(exec, CredoDemoPlugin, "foo")
- # => nil
-
- Credo.Execution.get_command(exec, CredoDemoPlugin, "foo", 42)
- # => 42
- """
- def get_plugin_param(exec, plugin_mod, param_name) do
- exec.plugins[plugin_mod][param_name]
- end
-
- @doc false
- def put_plugin_param(exec, plugin_mod, param_name, param_value) do
- plugins =
- Keyword.update(exec.plugins, plugin_mod, [], fn list ->
- Keyword.update(list, param_name, param_value, fn _ -> param_value end)
- end)
-
- %__MODULE__{exec | plugins: plugins}
- end
-
- # CLI switches
-
- @doc """
- Returns the value for the given `switch_name`.
-
- Credo.Execution.get_given_cli_switch(exec, "foo")
- # => "bar"
- """
- def get_given_cli_switch(exec, switch_name) do
- if Map.has_key?(exec.cli_options.switches, switch_name) do
- {:ok, exec.cli_options.switches[switch_name]}
- else
- :error
- end
- end
-
- @doc false
- def put_cli_switch(exec, _plugin_mod, name, type) do
- %__MODULE__{exec | cli_switches: exec.cli_switches ++ [{name, type}]}
- end
-
- @doc false
- def put_cli_switch_alias(exec, _plugin_mod, _name, nil), do: exec
-
- def put_cli_switch_alias(exec, _plugin_mod, name, alias_name) do
- %__MODULE__{exec | cli_aliases: exec.cli_aliases ++ [{alias_name, name}]}
- end
-
- @doc false
- def put_cli_switch_plugin_param_converter(exec, plugin_mod, cli_switch_name, plugin_param_name) do
- converter_tuple = {cli_switch_name, plugin_mod, plugin_param_name}
-
- %__MODULE__{
- exec
- | cli_switch_plugin_param_converters:
- exec.cli_switch_plugin_param_converters ++ [converter_tuple]
- }
- end
-
- # Assigns
-
- @doc """
- Returns the assign with the given `name` for the given `exec` struct (or return the given `default` value).
-
- Credo.Execution.get_assign(exec, "foo")
- # => nil
-
- Credo.Execution.get_assign(exec, "foo", 42)
- # => 42
- """
- def get_assign(exec, name_or_list, default \\ nil)
-
- def get_assign(exec, path, default) when is_list(path) do
- case get_in(exec.assigns, path) do
- nil -> default
- value -> value
- end
- end
-
- def get_assign(exec, name, default) do
- Map.get(exec.assigns, name, default)
- end
-
- @doc """
- Puts the given `value` with the given `name` as assign into the given `exec` struct and returns the struct.
-
- Credo.Execution.put_assign(exec, "foo", 42)
- # => %Credo.Execution{...}
- """
- def put_assign(exec, name_or_list, value)
-
- def put_assign(exec, path, value) when is_list(path) do
- %__MODULE__{exec | assigns: do_put_nested_assign(exec.assigns, path, value)}
- end
-
- def put_assign(exec, name, value) do
- %__MODULE__{exec | assigns: Map.put(exec.assigns, name, value)}
- end
-
- defp do_put_nested_assign(map, [last_key], value) do
- Map.put(map, last_key, value)
- end
-
- defp do_put_nested_assign(map, [next_key | rest], value) do
- new_map =
- map
- |> Map.get(next_key, %{})
- |> do_put_nested_assign(rest, value)
-
- Map.put(map, next_key, new_map)
- end
-
- # Config Files
-
- @doc false
- def get_config_files(exec) do
- Credo.Execution.ExecutionConfigFiles.get(exec)
- end
-
- @doc false
- def append_config_file(exec, {_, _, _} = config_file) do
- config_files = get_config_files(exec) ++ [config_file]
-
- ExecutionConfigFiles.put(exec, config_files)
-
- exec
- end
-
- # Source Files
-
- @doc """
- Returns all source files for the given `exec` struct.
-
- Credo.Execution.get_source_files(exec)
- # => [%SourceFile,
- # %SourceFile]
- """
- def get_source_files(exec) do
- Credo.Execution.ExecutionSourceFiles.get(exec)
- end
-
- @doc false
- def put_source_files(exec, source_files) do
- ExecutionSourceFiles.put(exec, source_files)
-
- exec
- end
-
- # Issues
-
- @doc """
- Returns all issues for the given `exec` struct.
- """
- def get_issues(exec) do
- exec
- |> ExecutionIssues.to_map()
- |> Map.values()
- |> List.flatten()
- end
-
- @doc """
- Returns all issues grouped by filename for the given `exec` struct.
- """
- def get_issues_grouped_by_filename(exec) do
- ExecutionIssues.to_map(exec)
- end
-
- @doc """
- Returns all issues for the given `exec` struct that relate to the given `filename`.
- """
- def get_issues(exec, filename) do
- exec
- |> ExecutionIssues.to_map()
- |> Map.get(filename, [])
- end
-
- @doc """
- Sets the issues for the given `exec` struct, overwriting any existing issues.
- """
- def put_issues(exec, issues) do
- ExecutionIssues.set(exec, issues)
-
- exec
- end
-
- @doc false
- @deprecated "Use put_issues/2 instead"
- def set_issues(exec, issues) do
- put_issues(exec, issues)
- end
-
- # Results
-
- @doc """
- Returns the result with the given `name` for the given `exec` struct (or return the given `default` value).
-
- Credo.Execution.get_result(exec, "foo")
- # => nil
-
- Credo.Execution.get_result(exec, "foo", 42)
- # => 42
- """
- def get_result(exec, name, default \\ nil) do
- Map.get(exec.results, name, default)
- end
-
- @doc """
- Puts the given `value` with the given `name` as result into the given `exec` struct.
-
- Credo.Execution.put_result(exec, "foo", 42)
- # => %Credo.Execution{...}
- """
- def put_result(exec, name, value) do
- %__MODULE__{exec | results: Map.put(exec.results, name, value)}
- end
-
- @doc false
- def put_exit_status(exec, exit_status) do
- put_assign(exec, "credo.exit_status", exit_status)
- end
-
- @doc false
- def get_exit_status(exec) do
- get_assign(exec, "credo.exit_status", 0)
- end
-
- # Halt
-
- @doc """
- Halts further execution of the pipeline meaning all subsequent steps are skipped.
-
- The `error` callback is called for the current Task.
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def call(exec) do
- Execution.halt(exec)
- end
-
- def error(exec) do
- IO.puts("Execution has been halted!")
-
- exec
- end
- end
- """
- def halt(exec) do
- %__MODULE__{exec | halted: true}
- end
-
- @doc """
- Halts further execution of the pipeline using the given `halt_message`.
-
- The `error` callback is called for the current Task.
- If the callback is not implemented, Credo outputs the given `halt_message`.
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def call(exec) do
- Execution.halt(exec, "Execution has been halted!")
- end
- end
- """
- def halt(exec, halt_message) do
- %__MODULE__{exec | halted: true}
- |> put_halt_message(halt_message)
- end
-
- @doc false
- def get_halt_message(exec) do
- get_assign(exec, "credo.halt_message")
- end
-
- @doc false
- def put_halt_message(exec, halt_message) do
- put_assign(exec, "credo.halt_message", halt_message)
- end
-
- # Task tracking
-
- @doc false
- def set_parent_and_current_task(exec, parent_task, current_task) do
- %__MODULE__{exec | parent_task: parent_task, current_task: current_task}
- end
-
- # Running tasks
-
- @doc false
- def run(exec) do
- run_pipeline(exec, __MODULE__)
- end
-
- # Pipelines
-
- @doc false
- defp get_pipeline(exec, pipeline_key) do
- case exec.pipeline_map[get_pipeline_key(exec, pipeline_key)] do
- nil -> raise "Could not find execution pipeline for '#{pipeline_key}'"
- pipeline -> pipeline
- end
- end
-
- @doc false
- defp get_pipeline_key(exec, pipeline_key) do
- case exec.pipeline_map[pipeline_key] do
- nil -> @execution_pipeline_key_backwards_compatibility_map[pipeline_key]
- _ -> pipeline_key
- end
- end
-
- @doc """
- Puts a given `pipeline` in `exec` under `pipeline_key`.
-
- A pipeline is a keyword list of named groups. Each named group is a list of `Credo.Execution.Task` modules:
-
- Execution.put_pipeline(exec, :my_pipeline_key,
- load_things: [ MyProject.LoadThings ],
- run_analysis: [ MyProject.Run ],
- print_results: [ MyProject.PrintResults ]
- )
-
- A named group can also be a list of two-element tuples, consisting of a `Credo.Execution.Task` module and a
- keyword list of options, which are passed to the Task module's `call/2` function:
-
- Execution.put_pipeline(exec, :my_pipeline_key,
- load_things: [ {MyProject.LoadThings, []} ],
- run_analysis: [ {MyProject.Run, [foo: "bar"]} ],
- print_results: [ {MyProject.PrintResults, []} ]
- )
- """
- def put_pipeline(exec, pipeline_key, pipeline) do
- new_pipelines = Map.put(exec.pipeline_map, pipeline_key, pipeline)
-
- %__MODULE__{exec | pipeline_map: new_pipelines}
- end
-
- @doc """
- Runs the pipeline with the given `pipeline_key` and returns the result `Credo.Execution` struct.
-
- Execution.run_pipeline(exec, :my_pipeline_key)
- # => %Credo.Execution{...}
- """
- def run_pipeline(%__MODULE__{} = initial_exec, pipeline_key)
- when is_atom(pipeline_key) and not is_nil(pipeline_key) do
- initial_pipeline = get_pipeline(initial_exec, pipeline_key)
-
- Enum.reduce(initial_pipeline, initial_exec, fn {group_name, _list}, exec_inside_pipeline ->
- outer_pipeline = get_pipeline(exec_inside_pipeline, pipeline_key)
-
- task_group = outer_pipeline[group_name]
-
- Enum.reduce(task_group, exec_inside_pipeline, fn
- {task_mod, opts}, exec_inside_task_group ->
- Credo.Execution.Task.run(task_mod, exec_inside_task_group, opts)
-
- task_mod, exec_inside_task_group when is_atom(task_mod) ->
- Credo.Execution.Task.run(task_mod, exec_inside_task_group, [])
- end)
- end)
- end
-
- @doc false
- def prepend_task(exec, plugin_mod, pipeline_key, group_name, task_tuple)
-
- def prepend_task(exec, plugin_mod, nil, group_name, task_tuple) do
- prepend_task(exec, plugin_mod, @execution_pipeline_key, group_name, task_tuple)
- end
-
- def prepend_task(exec, plugin_mod, pipeline_key, group_name, task_mod) when is_atom(task_mod) do
- prepend_task(exec, plugin_mod, pipeline_key, group_name, {task_mod, []})
- end
-
- def prepend_task(exec, _plugin_mod, pipeline_key, group_name, task_tuple) do
- pipeline =
- exec
- |> get_pipeline(pipeline_key)
- |> Enum.map(fn
- {^group_name, list} -> {group_name, [task_tuple] ++ list}
- value -> value
- end)
-
- put_pipeline(exec, get_pipeline_key(exec, pipeline_key), pipeline)
- end
-
- @doc false
- def append_task(exec, plugin_mod, pipeline_key, group_name, task_tuple)
-
- def append_task(exec, plugin_mod, nil, group_name, task_tuple) do
- append_task(exec, plugin_mod, __MODULE__, group_name, task_tuple)
- end
-
- def append_task(exec, plugin_mod, pipeline_key, group_name, task_mod) when is_atom(task_mod) do
- append_task(exec, plugin_mod, pipeline_key, group_name, {task_mod, []})
- end
-
- def append_task(exec, _plugin_mod, pipeline_key, group_name, task_tuple) do
- pipeline =
- exec
- |> get_pipeline(pipeline_key)
- |> Enum.map(fn
- {^group_name, list} -> {group_name, list ++ [task_tuple]}
- value -> value
- end)
-
- put_pipeline(exec, get_pipeline_key(exec, pipeline_key), pipeline)
- end
-
- @doc false
- defp put_builtin_command(exec, name, command_mod) do
- exec
- |> command_mod.init()
- |> put_command(Credo, name, command_mod)
- end
-
- @doc ~S"""
- Ensures that the given `value` is a `%Credo.Execution{}` struct, raises an error otherwise.
-
- Example:
-
- exec
- |> mod.init()
- |> Credo.Execution.ensure_execution_struct("#{mod}.init/1")
- """
- def ensure_execution_struct(value, fun_name)
-
- def ensure_execution_struct(%__MODULE__{} = exec, _fun_name), do: exec
-
- def ensure_execution_struct(value, fun_name) do
- raise("Expected #{fun_name} to return %Credo.Execution{}, got: #{inspect(value)}")
- end
-
- @doc false
- def get_rerun(exec) do
- case get_assign(exec, "credo.rerun.previous_execution") do
- nil -> :notfound
- previous_exec -> {previous_exec, get_assign(exec, "credo.rerun.files_that_changed")}
- end
- end
-
- defp put_rerun(exec, previous_exec, files_that_changed) do
- exec
- |> put_assign("credo.rerun.previous_execution", previous_exec)
- |> put_assign(
- "credo.rerun.files_that_changed",
- Enum.map(files_that_changed, fn filename ->
- filename
- |> Path.expand()
- |> Path.relative_to_cwd()
- end)
- )
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_config_files.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_config_files.ex
deleted file mode 100644
index c74d1d88..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_config_files.ex
+++ /dev/null
@@ -1,35 +0,0 @@
-defmodule Credo.Execution.ExecutionConfigFiles do
- @moduledoc false
-
- use GenServer
-
- alias Credo.Execution
-
- def start_server(exec) do
- {:ok, pid} = GenServer.start_link(__MODULE__, [])
-
- %Execution{exec | config_files_pid: pid}
- end
-
- def put(%Execution{config_files_pid: pid}, list) do
- GenServer.call(pid, {:put, list})
- end
-
- def get(%Execution{config_files_pid: pid}) do
- GenServer.call(pid, :get)
- end
-
- # callbacks
-
- def init(_) do
- {:ok, []}
- end
-
- def handle_call({:put, new_state}, _from, _current_state) do
- {:reply, new_state, new_state}
- end
-
- def handle_call(:get, _from, current_state) do
- {:reply, current_state, current_state}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_issues.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_issues.ex
deleted file mode 100644
index 0b9ab32f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_issues.ex
+++ /dev/null
@@ -1,76 +0,0 @@
-defmodule Credo.Execution.ExecutionIssues do
- @moduledoc false
-
- use GenServer
-
- alias Credo.Execution
- alias Credo.Issue
- alias Credo.SourceFile
-
- def start_server(exec) do
- {:ok, pid} = GenServer.start_link(__MODULE__, [])
-
- %Execution{exec | issues_pid: pid}
- end
-
- @doc "Appends an `issue` for the specified `filename`."
- def append(%Execution{issues_pid: pid}, issues) when is_list(issues) do
- issues
- |> Enum.group_by(& &1.filename)
- |> Enum.each(fn {filename, issues} ->
- GenServer.call(pid, {:append, filename, issues})
- end)
- end
-
- def append(%Execution{issues_pid: pid}, %Issue{} = issue) do
- GenServer.call(pid, {:append, issue.filename, issue})
- end
-
- @doc "Appends an `issue` for the specified `filename`."
- def append(%Execution{issues_pid: pid}, %SourceFile{filename: filename}, issue) do
- GenServer.call(pid, {:append, filename, issue})
- end
-
- @doc "Returns the issues for the specified `filename`."
- def get(%Execution{issues_pid: pid}, %SourceFile{filename: filename}) do
- GenServer.call(pid, {:get, filename})
- end
-
- @doc "Sets/overwrites all `issues` for the given Execution struct."
- def set(%Execution{issues_pid: pid}, issues) do
- GenServer.call(pid, {:set, issues})
- end
-
- @doc "Returns all `issues` for the given Execution struct."
- def to_map(%Execution{issues_pid: pid}) do
- GenServer.call(pid, :to_map)
- end
-
- # callbacks
-
- def init(_) do
- {:ok, %{}}
- end
-
- def handle_call({:append, filename, issue_or_issue_list}, _from, current_state) do
- existing_issues = List.wrap(current_state[filename])
- new_issue_list = List.wrap(issue_or_issue_list) ++ existing_issues
- new_current_state = Map.put(current_state, filename, new_issue_list)
-
- {:reply, new_issue_list, new_current_state}
- end
-
- def handle_call({:get, filename}, _from, current_state) do
- {:reply, List.wrap(current_state[filename]), current_state}
- end
-
- def handle_call({:set, issues}, _from, _current_state) do
- new_current_state = Enum.group_by(issues, fn issue -> issue.filename end)
-
- {:reply, new_current_state, new_current_state}
- end
-
- def handle_call(:to_map, _from, current_state) do
- {:reply, current_state, current_state}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_source_files.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_source_files.ex
deleted file mode 100644
index e4a743b7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_source_files.ex
+++ /dev/null
@@ -1,35 +0,0 @@
-defmodule Credo.Execution.ExecutionSourceFiles do
- @moduledoc false
-
- use GenServer
-
- alias Credo.Execution
-
- def start_server(exec) do
- {:ok, pid} = GenServer.start_link(__MODULE__, [])
-
- %Execution{exec | source_files_pid: pid}
- end
-
- def put(%Execution{source_files_pid: pid}, list) do
- GenServer.call(pid, {:put, list})
- end
-
- def get(%Execution{source_files_pid: pid}) do
- GenServer.call(pid, :get)
- end
-
- # callbacks
-
- def init(_) do
- {:ok, []}
- end
-
- def handle_call({:put, new_state}, _from, _current_state) do
- {:reply, new_state, new_state}
- end
-
- def handle_call(:get, _from, current_state) do
- {:reply, current_state, current_state}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_timing.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_timing.ex
deleted file mode 100644
index 6ae82107..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/execution_timing.ex
+++ /dev/null
@@ -1,184 +0,0 @@
-defmodule Credo.Execution.ExecutionTiming do
- @moduledoc """
- The `ExecutionTiming` module can help in timing the execution of code parts and
- storing those timing inside the `Credo.Execution` struct.
- """
-
- use GenServer
-
- alias Credo.Execution
-
- @doc """
- Runs the given `fun` and prints the time it took with the given `label`.
-
- iex> Credo.Execution.ExecutionTiming.inspect("foo", fn -> some_complicated_stuff() end)
- foo: 51284
-
- """
- def inspect(label, fun) do
- {duration, result} = :timer.tc(fun)
-
- # credo:disable-for-lines:3 Credo.Check.Warning.IoInspect
- duration
- |> format_time()
- |> IO.inspect(label: label)
-
- result
- end
-
- @doc """
- Returns the current timestamp in the same format (microseconds) as the returned starting times of `run/1`.
- """
- def now, do: :os.system_time(:microsecond)
-
- @doc """
- Runs the given `fun` and returns a tuple of `{started_at, duration, result}`.
-
- iex> Credo.Execution.ExecutionTiming.run(fn -> some_complicated_stuff() end)
- {1540540119448181, 51284, [:whatever, :fun, :returned]}
-
- """
- def run(fun) do
- started_at = now()
- {duration, result} = :timer.tc(fun)
-
- {started_at, duration, result}
- end
-
- @doc "Same as `run/1` but takes `fun` and `args` separately."
- def run(fun, args) do
- started_at = now()
- {duration, result} = :timer.tc(fun, args)
-
- {started_at, duration, result}
- end
-
- @doc """
- Adds a timing to the given `exec` using the given values of `tags`, `started_at` and `duration`.
- """
- def append(%Execution{timing_pid: pid}, tags, started_at, duration) do
- spawn(fn ->
- GenServer.call(pid, {:append, tags, started_at, duration})
- end)
- end
-
- @doc """
- Adds a timing piped from `run/2` to the given `exec` (using the given values of `tags`, `started_at` and `duration`).
- """
- def append({started_at, duration, _result}, %Execution{timing_pid: pid}, tags) do
- spawn(fn ->
- GenServer.call(pid, {:append, tags, started_at, duration})
- end)
- end
-
- @doc """
- Returns all timings for the given `exec`.
- """
- def all(%Execution{timing_pid: pid}) do
- GenServer.call(pid, :all)
- end
-
- @doc """
- Groups all timings for the given `exec` and `tag_name`.
- """
- def grouped_by_tag(exec, tag_name) do
- map =
- exec
- |> all()
- |> Enum.filter(fn {tags, _started_at, _time} -> tags[tag_name] end)
- |> Enum.group_by(fn {tags, _started_at, _time} -> tags[tag_name] end)
-
- map
- |> Map.keys()
- |> Enum.map(fn map_key ->
- sum = Enum.reduce(map[map_key], 0, fn {_tags, _, time}, acc -> time + acc end)
-
- {[{tag_name, map_key}, {:accumulated, true}], nil, sum}
- end)
- end
-
- @doc """
- Returns all timings for the given `exec` and `tag_name`.
- """
- def by_tag(exec, tag_name) do
- exec
- |> all()
- |> Enum.filter(fn {tags, _started_at, _time} -> tags[tag_name] end)
- end
-
- @doc """
- Returns all timings for the given `exec` and `tag_name` where the tag's value also matches the given `regex`.
- """
- def by_tag(exec, tag_name, regex) do
- exec
- |> all()
- |> Enum.filter(fn {tags, _started_at, _time} ->
- tags[tag_name] && to_string(tags[tag_name]) =~ regex
- end)
- end
-
- @doc """
- Returns the earliest timestamp for the given `exec`.
- """
- def started_at(exec) do
- {_, started_at, _} =
- exec
- |> all()
- |> List.first()
-
- started_at
- end
-
- @doc """
- Returns the latest timestamp plus its duration for the given `exec`.
- """
- def ended_at(exec) do
- {_, started_at, duration} =
- exec
- |> all()
- |> List.last()
-
- started_at + duration
- end
-
- defp format_time(time) do
- cond do
- time > 1_000_000 ->
- "#{div(time, 1_000_000)}s"
-
- time > 1_000 ->
- "#{div(time, 1_000)}ms"
-
- true ->
- "#{time}μs"
- end
- end
-
- # callbacks
-
- @doc false
- def start_server(exec) do
- {:ok, pid} = GenServer.start_link(__MODULE__, [])
-
- %Execution{exec | timing_pid: pid}
- end
-
- @doc false
- def init(_) do
- {:ok, []}
- end
-
- @doc false
- def handle_call({:append, tags, started_at, time}, _from, current_state) do
- new_current_state = [{tags, started_at, time} | current_state]
-
- {:reply, :ok, new_current_state}
- end
-
- @doc false
- def handle_call(:all, _from, current_state) do
- list = Enum.sort_by(current_state, fn {_, started_at, _} -> started_at end)
-
- {:reply, list, current_state}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task.ex
deleted file mode 100644
index 59281f7c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task.ex
+++ /dev/null
@@ -1,184 +0,0 @@
-defmodule Credo.Execution.Task do
- @moduledoc """
- A Task is a step in a pipeline, which is given an `Credo.Execution` struct and must return one as well.
-
- Tasks in a pipeline are only called if they are not "halted" (see `Credo.Execution.halt/2`).
-
- It implements a `call/1` or `call/2` callback, which is called with the `Credo.Execution` struct
- as first parameter (and the Task's options as the second in case of `call/2`).
- """
-
- @typedoc false
- @type t :: module
-
- @doc """
- Is called by the pipeline and contains the Task's actual code.
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def call(exec) do
- IO.inspect(exec)
- end
- end
-
- The `call/1` functions receives an `exec` struct and must return a (modified) `Credo.Execution`.
- """
- @callback call(exec :: Credo.Execution.t()) :: Credo.Execution.t()
-
- @doc """
- Works like `call/1`, but receives the options, which are optional when registering the Task, as second argument.
-
- defmodule FooTask do
- use Credo.Execution.Task
-
- def call(exec, opts) do
- IO.inspect(opts)
-
- exec
- end
- end
-
- """
- @callback call(exec :: Credo.Execution.t(), opts :: Keyword.t()) :: Credo.Execution.t()
-
- @doc """
- Gets called if `call` holds the execution via `Credo.Execution.halt/1` or `Credo.Execution.halt/2`.
- """
- @callback error(exec :: Credo.Execution.t()) :: Credo.Execution.t()
-
- @doc """
- Works like `error/1`, but receives the options, which were given during pipeline registration, as second argument.
- """
- @callback error(exec :: Credo.Execution.t(), opts :: Keyword.t()) :: Credo.Execution.t()
-
- require Logger
-
- alias Credo.Execution
- alias Credo.Execution.ExecutionTiming
-
- defmacro __using__(_opts \\ []) do
- quote do
- @behaviour Credo.Execution.Task
-
- import Credo.Execution
-
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- @impl true
- def call(%Execution{halted: false} = exec) do
- exec
- end
-
- @impl true
- def call(%Execution{halted: false} = exec, opts) do
- call(exec)
- end
-
- @impl true
- def error(exec) do
- case Execution.get_halt_message(exec) do
- "" <> halt_message ->
- command_name = Execution.get_command_name(exec) || "credo"
-
- UI.warn([:red, "** (#{command_name}) ", halt_message])
-
- _ ->
- IO.warn("Execution halted during #{__MODULE__}!")
- end
-
- exec
- end
-
- @impl true
- def error(exec, _opts) do
- error(exec)
- end
-
- defoverridable call: 1
- defoverridable call: 2
- defoverridable error: 1
- defoverridable error: 2
- end
- end
-
- @doc false
- def run(task, exec, opts \\ [])
-
- def run(task, %Credo.Execution{debug: true} = exec, opts) do
- run_with_timing(task, exec, opts)
- end
-
- def run(task, %Execution{} = exec, opts) do
- do_run(task, exec, opts)
- end
-
- def run(_task, exec, _opts) do
- IO.warn(
- "Expected second parameter of Task.run/3 to match %Credo.Execution{}, " <>
- "got: #{inspect(exec)}"
- )
-
- exec
- end
-
- defp do_run(task, %Credo.Execution{halted: false} = exec, opts) do
- old_parent_task = exec.parent_task
- old_current_task = exec.current_task
-
- exec =
- exec
- |> Execution.set_parent_and_current_task(exec.current_task, task)
- |> task.call(opts)
- |> Execution.ensure_execution_struct("#{task}.call/2")
-
- if exec.halted do
- exec
- |> task.error(opts)
- |> Execution.set_parent_and_current_task(old_parent_task, old_current_task)
- else
- Execution.set_parent_and_current_task(exec, old_parent_task, old_current_task)
- end
- end
-
- defp do_run(_task, exec, _opts) do
- exec
- end
-
- #
-
- defp run_with_timing(task, exec, opts) do
- context_tuple = {:task, exec, task, opts}
- log(:call_start, context_tuple)
-
- {started_at, time, exec} = ExecutionTiming.run(&do_run/3, [task, exec, opts])
-
- log(:call_end, context_tuple, time)
-
- ExecutionTiming.append(exec, [task: task, parent_task: exec.parent_task], started_at, time)
-
- exec
- end
-
- defp log(:call_start, {:task, _exec, task, _opts}) do
- Logger.info("Calling #{task} ...")
- end
-
- defp log(:call_end, {:task, _exec, task, _opts}, time) do
- Logger.info("Finished #{task} in #{format_time(time)} ...")
- end
-
- defp format_time(time) do
- cond do
- time > 1_000_000 ->
- "#{div(time, 1_000_000)}s"
-
- time > 1_000 ->
- "#{div(time, 1_000)}ms"
-
- true ->
- "#{time}μs"
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_default_config.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_default_config.ex
deleted file mode 100644
index e34f1bee..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_default_config.ex
+++ /dev/null
@@ -1,15 +0,0 @@
-defmodule Credo.Execution.Task.AppendDefaultConfig do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Execution
-
- @default_config_filename ".credo.exs"
- @default_config_file_content File.read!(@default_config_filename)
- @origin_credo :credo
-
- def call(exec, _opts) do
- Execution.append_config_file(exec, {@origin_credo, nil, @default_config_file_content})
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_extra_config.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_extra_config.ex
deleted file mode 100644
index 3402b35f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/append_extra_config.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule Credo.Execution.Task.AppendExtraConfig do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Execution
-
- @extra_config_env_name "CREDO_EXTRA_CONFIG"
- @origin_extra_config :env
-
- def call(exec, _opts) do
- case System.get_env(@extra_config_env_name) do
- nil -> exec
- "" -> exec
- value -> Execution.append_config_file(exec, {@origin_extra_config, nil, value})
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/assign_exit_status_for_issues.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/assign_exit_status_for_issues.ex
deleted file mode 100644
index 4a1b10c7..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/assign_exit_status_for_issues.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-defmodule Credo.Execution.Task.AssignExitStatusForIssues do
- @moduledoc false
-
- use Credo.Execution.Task
-
- import Bitwise
-
- def call(exec, _opts) do
- exit_status =
- exec
- |> get_issues()
- |> to_exit_status()
-
- put_exit_status(exec, exit_status)
- end
-
- # Converts the return value of a Command.run() call into an exit_status
- defp to_exit_status([]), do: 0
-
- defp to_exit_status(issues) do
- issues
- |> Enum.map(& &1.exit_status)
- |> Enum.reduce(0, &(&1 ||| &2))
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/convert_cli_options_to_config.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/convert_cli_options_to_config.ex
deleted file mode 100644
index c30edefa..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/convert_cli_options_to_config.ex
+++ /dev/null
@@ -1,79 +0,0 @@
-defmodule Credo.Execution.Task.ConvertCLIOptionsToConfig do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Output.UI
- alias Credo.ConfigBuilder
-
- @exit_status Credo.CLI.ExitStatus.config_parser_error()
-
- def call(exec, _opts) do
- exec
- |> ConfigBuilder.parse()
- |> halt_on_error(exec)
- end
-
- def error(exec, _opts) do
- exec
- |> Execution.get_halt_message()
- |> puts_error_message()
-
- put_exit_status(exec, @exit_status)
- end
-
- defp halt_on_error({:error, error}, exec) do
- Execution.halt(exec, error)
- end
-
- defp halt_on_error(exec, _) do
- exec
- end
-
- defp puts_error_message({:badconfig, filename, line_no, description, trigger})
- when not is_nil(filename) do
- lines =
- filename
- |> File.read!()
- |> Credo.Code.to_lines()
- |> Enum.filter(fn {line_no2, _line} ->
- line_no2 >= line_no - 2 and line_no2 <= line_no + 2
- end)
-
- UI.warn([:red, "** (config) Error while loading config file!"])
- UI.warn("")
-
- UI.warn([:cyan, " file: ", :reset, filename])
- UI.warn([:cyan, " line: ", :reset, "#{line_no}"])
- UI.warn("")
-
- UI.warn([" ", description, :reset, :cyan, :bright, trigger])
-
- UI.warn("")
-
- Enum.each(lines, fn {line_no2, line} ->
- color = color_list(line_no, line_no2)
-
- UI.warn([color, String.pad_leading("#{line_no2}", 5), :reset, " ", color, line])
- end)
-
- UI.warn("")
- end
-
- defp puts_error_message({:notfound, message}) do
- UI.warn([:red, "** (config) #{message}"])
- UI.warn("")
- end
-
- defp puts_error_message({:config_name_not_found, message}) do
- UI.warn([:red, "** (config) #{message}"])
- UI.warn("")
- end
-
- defp puts_error_message(error) do
- IO.warn("Execution halted during #{__MODULE__}! Unrecognized error: #{inspect(error)}")
- end
-
- defp color_list(line_no, line_no2) when line_no == line_no2, do: [:bright, :cyan]
- defp color_list(_, _), do: [:faint]
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/determine_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/determine_command.ex
deleted file mode 100644
index c6bfaa09..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/determine_command.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule Credo.Execution.Task.DetermineCommand do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
- alias Credo.Execution
-
- def call(exec, _opts) do
- determine_command(exec, exec.cli_options)
- end
-
- # `--help` given
- defp determine_command(
- exec,
- %Options{command: nil, switches: %{help: true}} = options
- ) do
- set_command_and_path(exec, options, "help", options.path)
- end
-
- # `--version` given
- defp determine_command(
- exec,
- %Options{command: nil, switches: %{version: true}} = options
- ) do
- set_command_and_path(exec, options, "version", options.path)
- end
-
- defp determine_command(exec, options) do
- command_name =
- case exec.cli_options.args do
- [potential_command_name | _] ->
- command_names = Execution.get_valid_command_names(exec)
-
- if Enum.member?(command_names, potential_command_name) do
- potential_command_name
- end
-
- _ ->
- nil
- end
-
- set_command_and_path(exec, options, command_name, options.path)
- end
-
- defp set_command_and_path(exec, _options, nil, _path), do: exec
-
- defp set_command_and_path(exec, options, command, path) do
- %Execution{
- exec
- | cli_options: %Options{
- options
- | command: command,
- path: path
- }
- }
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_command.ex
deleted file mode 100644
index a8e4bdbb..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_command.ex
+++ /dev/null
@@ -1,43 +0,0 @@
-defmodule Credo.Execution.Task.InitializeCommand do
- @moduledoc false
-
- alias Credo.Execution
-
- def call(%Execution{} = exec, _opts) do
- command_name = Execution.get_command_name(exec)
- command_mod = Execution.get_command(exec, command_name)
-
- exec =
- command_mod
- |> cli_options_switches()
- |> Enum.reduce(exec, fn {switch_name, switch_type}, exec ->
- Execution.put_cli_switch(exec, command_mod, switch_name, switch_type)
- end)
-
- command_mod
- |> cli_options_aliases()
- |> Enum.reduce(exec, fn {switch_alias, switch_name}, exec ->
- Execution.put_cli_switch_alias(exec, command_mod, switch_name, switch_alias)
- end)
- end
-
- defp cli_options_switches(command_mod) do
- command_mod.cli_switches
- |> List.wrap()
- |> Enum.map(fn
- %{name: name, type: type} when is_binary(name) -> {String.to_atom(name), type}
- %{name: name, type: type} when is_atom(name) -> {name, type}
- end)
- end
-
- defp cli_options_aliases(command_mod) do
- command_mod.cli_switches
- |> List.wrap()
- |> Enum.map(fn
- %{name: name, alias: alias} when is_binary(name) -> {alias, String.to_atom(name)}
- %{name: name, alias: alias} when is_atom(name) -> {alias, name}
- _ -> nil
- end)
- |> Enum.reject(&is_nil/1)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_plugins.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_plugins.ex
deleted file mode 100644
index a1b35bc9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/initialize_plugins.ex
+++ /dev/null
@@ -1,35 +0,0 @@
-defmodule Credo.Execution.Task.InitializePlugins do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Execution
-
- def call(exec, _opts) do
- Enum.reduce(exec.plugins, exec, &init_plugin(&2, &1))
- end
-
- defp init_plugin(exec, {_mod, false}), do: exec
-
- defp init_plugin(exec, {mod, _params}) do
- if Code.ensure_loaded?(mod) do
- if function_exported?(mod, :init, 1) do
- exec
- |> Execution.set_initializing_plugin(mod)
- |> mod.init()
- |> Execution.ensure_execution_struct("#{mod}.init/1")
- |> Execution.set_initializing_plugin(nil)
- else
- Execution.halt(
- exec,
- "Plugin module `#{Credo.Code.Module.name(mod)}` is not a valid plugin: does not implement expected behavior."
- )
- end
- else
- Execution.halt(
- exec,
- "Plugin module `#{Credo.Code.Module.name(mod)}` is not available and could not be initialized."
- )
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/parse_options.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/parse_options.ex
deleted file mode 100644
index b81be9ec..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/parse_options.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule Credo.Execution.Task.ParseOptions do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- def call(exec, opts) do
- add_common_aliases? = opts[:parser_mode] == :preliminary
- use_strict_parser? = opts[:parser_mode] == :strict
-
- command_names = Execution.get_valid_command_names(exec)
-
- given_command_name =
- if exec.cli_options do
- exec.cli_options.command
- end
-
- cli_aliases =
- if add_common_aliases? do
- exec.cli_aliases ++ [h: :help, v: :version]
- else
- exec.cli_aliases
- end
-
- treat_unknown_args_as_files? =
- if exec.cli_options && exec.cli_options.command do
- command_name = Execution.get_command_name(exec)
- command_mod = Execution.get_command(exec, command_name)
-
- command_mod.treat_unknown_args_as_files?
- else
- false
- end
-
- cli_options =
- Options.parse(
- use_strict_parser?,
- exec.argv,
- File.cwd!(),
- command_names,
- given_command_name,
- [UI.edge()],
- exec.cli_switches,
- cli_aliases,
- treat_unknown_args_as_files?
- )
-
- %Execution{exec | cli_options: cli_options}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/require_requires.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/require_requires.ex
deleted file mode 100644
index f3123d9d..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/require_requires.ex
+++ /dev/null
@@ -1,15 +0,0 @@
-defmodule Credo.Execution.Task.RequireRequires do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Sources
-
- def call(%Execution{requires: requires} = exec, _opts) do
- requires
- |> Sources.find()
- |> Enum.each(&Code.require_file/1)
-
- exec
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/run_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/run_command.ex
deleted file mode 100644
index 7e640961..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/run_command.ex
+++ /dev/null
@@ -1,23 +0,0 @@
-defmodule Credo.Execution.Task.RunCommand do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Execution
-
- @exit_status Credo.CLI.ExitStatus.generic_error()
-
- def call(exec, opts) do
- command_name = Execution.get_command_name(exec)
- command_mod = Execution.get_command(exec, command_name)
-
- command_mod.call(exec, opts)
- end
-
- def error(exec, _opts) do
- case get_exit_status(exec) do
- 0 -> put_exit_status(exec, @exit_status)
- _ -> exec
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/set_default_command.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/set_default_command.ex
deleted file mode 100644
index f58ecdec..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/set_default_command.ex
+++ /dev/null
@@ -1,38 +0,0 @@
-defmodule Credo.Execution.Task.SetDefaultCommand do
- @moduledoc false
-
- @default_command_name "suggest"
- @explain_command_name "explain"
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Filename
- alias Credo.CLI.Options
-
- def call(exec, _opts) do
- determine_command(exec, exec.cli_options)
- end
-
- defp determine_command(exec, %Options{command: nil, args: args} = options) do
- potential_path = List.first(args)
-
- if Filename.contains_line_no?(potential_path) do
- set_command_and_path(exec, options, @explain_command_name, potential_path)
- else
- set_command_and_path(exec, options, @default_command_name, options.path)
- end
- end
-
- defp determine_command(exec, _options), do: exec
-
- defp set_command_and_path(exec, options, command, path) do
- %Execution{
- exec
- | cli_options: %Options{
- options
- | command: command,
- path: path
- }
- }
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/use_colors.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/use_colors.ex
deleted file mode 100644
index bae54f1a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/use_colors.ex
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule Credo.Execution.Task.UseColors do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Output.UI
-
- def call(exec, _opts) do
- UI.use_colors(exec)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_config.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_config.ex
deleted file mode 100644
index 88430925..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_config.ex
+++ /dev/null
@@ -1,144 +0,0 @@
-defmodule Credo.Execution.Task.ValidateConfig do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.Check
- alias Credo.Check.Params
- alias Credo.CLI.Output.UI
-
- def call(exec, _opts) do
- exec
- |> validate_checks()
- |> validate_only_checks()
- |> validate_ignore_checks()
- |> remove_missing_checks()
- |> inspect_config_if_debug()
- end
-
- defp validate_only_checks(%Execution{only_checks: only_checks} = exec)
- when is_list(only_checks) do
- if Enum.any?(only_checks, &(&1 == "")) do
- UI.warn([
- :red,
- "** (config) Including all checks, since an empty string was given as a pattern: #{inspect(only_checks)}"
- ])
- end
-
- exec
- end
-
- defp validate_only_checks(exec) do
- exec
- end
-
- defp validate_ignore_checks(%Execution{ignore_checks: ignore_checks} = exec)
- when is_list(ignore_checks) do
- if Enum.any?(ignore_checks, &(&1 == "")) do
- UI.warn([
- :red,
- "** (config) Ignoring all checks, since an empty string was given as a pattern: #{inspect(ignore_checks)}"
- ])
- end
-
- exec
- end
-
- defp validate_ignore_checks(exec) do
- exec
- end
-
- defp validate_checks(%Execution{checks: %{enabled: checks}} = exec) do
- Enum.each(checks, fn check_tuple ->
- warn_if_check_missing(check_tuple)
- warn_if_check_params_invalid(check_tuple)
- end)
-
- exec
- end
-
- defp warn_if_check_params_invalid({_check, false}), do: nil
- defp warn_if_check_params_invalid({_check, []}), do: nil
-
- defp warn_if_check_params_invalid({check, params}) do
- if Check.defined?(check) do
- do_warn_if_check_params_invalid({check, params})
- end
- end
-
- defp do_warn_if_check_params_invalid({check, params}) do
- valid_param_names = check.param_names ++ Params.builtin_param_names()
- check = check |> to_string |> String.to_existing_atom()
-
- Enum.each(params, fn {param_name, _param_value} ->
- unless Enum.member?(valid_param_names, param_name) do
- candidate = find_best_match(valid_param_names, param_name)
- warning = warning_message_for(check, param_name, candidate)
-
- UI.warn([:red, warning])
- end
- end)
- end
-
- defp warning_message_for(check, param_name, candidate) do
- if candidate do
- "** (config) #{check_name(check)}: unknown param `#{param_name}`. Did you mean `#{candidate}`?"
- else
- "** (config) #{check_name(check)}: unknown param `#{param_name}`."
- end
- end
-
- defp find_best_match(candidates, given, threshold \\ 0.8) do
- given_string = to_string(given)
-
- {jaro_distance, candidate} =
- candidates
- |> Enum.map(fn candidate_name ->
- distance = String.jaro_distance(given_string, to_string(candidate_name))
- {distance, candidate_name}
- end)
- |> Enum.sort()
- |> List.last()
-
- if jaro_distance > threshold do
- candidate
- end
- end
-
- defp warn_if_check_missing({check, _params}) do
- unless Check.defined?(check) do
- UI.warn([:red, "** (config) Ignoring an undefined check: #{check_name(check)}"])
- end
- end
-
- defp check_name(atom) do
- atom
- |> to_string()
- |> String.replace(~r/^Elixir\./, "")
- end
-
- defp inspect_config_if_debug(%Execution{debug: true} = exec) do
- require Logger
-
- Logger.debug(fn ->
- """
- Execution struct after #{__MODULE__}:
-
- #{inspect(exec, pretty: true)}
- """
- end)
-
- exec
- end
-
- defp inspect_config_if_debug(exec), do: exec
-
- defp remove_missing_checks(
- %Execution{checks: %{enabled: enabled_checks, disabled: disabled_checks}} = exec
- ) do
- enabled_checks = Enum.filter(enabled_checks, &Check.defined?/1)
- disabled_checks = Enum.filter(disabled_checks, &Check.defined?/1)
-
- %Execution{exec | checks: %{enabled: enabled_checks, disabled: disabled_checks}}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_options.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_options.ex
deleted file mode 100644
index 75bf4ee3..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/validate_options.ex
+++ /dev/null
@@ -1,43 +0,0 @@
-defmodule Credo.Execution.Task.ValidateOptions do
- @moduledoc false
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
- alias Credo.CLI.Output.UI
-
- @exit_status Credo.CLI.ExitStatus.config_loaded_but_invalid()
-
- def call(exec, _opts) do
- case exec.cli_options do
- %Options{unknown_args: [], unknown_switches: []} ->
- exec
-
- _ ->
- Execution.halt(exec)
- end
- end
-
- @spec error(Credo.Execution.t(), keyword()) :: no_return
- def error(exec, _opts) do
- UI.use_colors(exec)
-
- Enum.each(exec.cli_options.unknown_args, &print_argument(exec, &1))
- Enum.each(exec.cli_options.unknown_switches, &print_switch(exec, &1))
-
- put_exit_status(exec, @exit_status)
- end
-
- defp print_argument(exec, name) do
- UI.warn([
- :red,
- "** (credo) Unknown argument for `#{exec.cli_options.command}` command: #{name}"
- ])
- end
-
- defp print_switch(exec, {name, _value}), do: print_switch(exec, name)
-
- defp print_switch(exec, name) do
- UI.warn([:red, "** (credo) Unknown switch for `#{exec.cli_options.command}` command: #{name}"])
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/write_debug_report.ex b/apps/plataforma_digital/deps/credo/lib/credo/execution/task/write_debug_report.ex
deleted file mode 100644
index 9f74b2ba..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/execution/task/write_debug_report.ex
+++ /dev/null
@@ -1,95 +0,0 @@
-defmodule Credo.Execution.Task.WriteDebugReport do
- @moduledoc false
-
- @debug_template File.read!(".template.debug.html")
- @debug_output_filename "credo-debug-log.html"
-
- use Credo.Execution.Task
-
- alias Credo.CLI.Output.UI
- alias Credo.Execution.ExecutionTiming
-
- def call(%Credo.Execution{debug: true} = exec, _opts) do
- Logger.flush()
-
- time_load = exec |> get_assign("credo.time.source_files", 0) |> div(1000)
- time_run = exec |> get_assign("credo.time.run_checks", 0) |> div(1000)
- time_total = time_load + time_run
-
- all_timings = ExecutionTiming.all(exec)
- started_at = ExecutionTiming.started_at(exec)
- ended_at = ExecutionTiming.ended_at(exec)
- all_timings = timings_to_map(all_timings)
-
- file_timings =
- all_timings
- |> Enum.reduce(%{}, fn element, acc ->
- if filename = element.tags[:filename] do
- Map.put(acc, filename, (acc[filename] || 0) + element.duration)
- else
- acc
- end
- end)
- |> Enum.sort_by(&elem(&1, 1))
- |> Enum.reverse()
-
- check_timings =
- all_timings
- |> Enum.reduce(%{}, fn element, acc ->
- if check = element.tags[:check] do
- Map.put(acc, check, (acc[check] || 0) + element.duration)
- else
- acc
- end
- end)
- |> Enum.sort_by(&elem(&1, 1))
- |> Enum.reverse()
-
- check_file_timings =
- all_timings
- |> Enum.reduce(%{}, fn element, acc ->
- filename = element.tags[:filename]
- check = element.tags[:check]
-
- if filename && check do
- Map.put(acc, {check, filename}, (acc[{check, filename}] || 0) + element.duration)
- else
- acc
- end
- end)
- |> Enum.sort_by(&elem(&1, 1))
- |> Enum.reverse()
-
- assigns = [
- exec: exec,
- started_at: started_at,
- ended_at: ended_at,
- duration: ended_at - started_at,
- time_total: time_total,
- time_load: time_load,
- time_run: time_run,
- all_timings: all_timings,
- file_timings: file_timings,
- check_timings: check_timings,
- check_file_timings: check_file_timings
- ]
-
- content = EEx.eval_string(@debug_template, assigns: assigns)
-
- File.write!(@debug_output_filename, content)
-
- UI.puts([:green, "Debug log written to ", :reset, @debug_output_filename])
-
- exec
- end
-
- def call(exec, _opts) do
- exec
- end
-
- def timings_to_map(list) do
- Enum.map(list, fn {tags, started_at, duration} ->
- %{tags: Enum.into(tags, %{}), started_at: started_at, duration: duration}
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/exs_loader.ex b/apps/plataforma_digital/deps/credo/lib/credo/exs_loader.ex
deleted file mode 100644
index 11070c33..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/exs_loader.ex
+++ /dev/null
@@ -1,113 +0,0 @@
-defmodule Credo.ExsLoader do
- @moduledoc false
-
- def parse(exs_string, filename, exec, safe \\ false)
-
- def parse(exs_string, filename, _exec, true) do
- case Code.string_to_quoted(exs_string, file: filename) do
- {:ok, ast} ->
- {:ok, process_exs(ast)}
-
- {:error, {line_meta, message, trigger}} when is_list(line_meta) ->
- {:error, {line_meta[:line], message, trigger}}
-
- {:error, value} ->
- {:error, value}
- end
- end
-
- def parse(exs_string, filename, exec, false) when is_atom(filename) do
- parse(exs_string, "mod:#{filename}", exec, false)
- end
-
- def parse(exs_string, filename, exec, false) when is_binary(filename) do
- {result, _binding} =
- Code.eval_string(exs_string, [exec: exec], file: to_string(filename) || "nofile")
-
- {:ok, result}
- rescue
- error ->
- case error do
- %SyntaxError{description: "syntax error before: " <> trigger, line: line_meta}
- when is_list(line_meta) ->
- {:error, {line_meta[:line], "syntax error before: ", trigger}}
-
- %SyntaxError{description: "syntax error before: " <> trigger, line: line_no} ->
- {:error, {line_no, "syntax error before: ", trigger}}
-
- error ->
- {:error, error}
- end
- end
-
- @doc false
- def parse_safe(exs_string) do
- case Code.string_to_quoted(exs_string) do
- {:ok, ast} ->
- process_exs(ast)
-
- _ ->
- %{}
- end
- end
-
- defp process_exs(v)
- when is_atom(v) or is_binary(v) or is_float(v) or is_integer(v),
- do: v
-
- defp process_exs(list) when is_list(list) do
- Enum.map(list, &process_exs/1)
- end
-
- defp process_exs({:sigil_w, _, [{:<<>>, _, [list_as_string]}, []]}) do
- String.split(list_as_string, ~r/\s+/)
- end
-
- # TODO: support regex modifiers
- defp process_exs({:sigil_r, _, [{:<<>>, _, [regex_as_string]}, []]}) do
- Regex.compile!(regex_as_string)
- end
-
- defp process_exs({:%{}, _meta, body}) do
- process_map(body, %{})
- end
-
- defp process_exs({:{}, _meta, body}) do
- process_tuple(body, {})
- end
-
- defp process_exs({:__aliases__, _meta, name_list}) do
- Module.safe_concat(name_list)
- end
-
- defp process_exs({{:__aliases__, _meta, name_list}, options}) do
- {Module.safe_concat(name_list), process_exs(options)}
- end
-
- defp process_exs({key, value}) when is_atom(key) or is_binary(key) do
- {process_exs(key), process_exs(value)}
- end
-
- defp process_tuple([], acc), do: acc
-
- defp process_tuple([head | tail], acc) do
- acc = process_tuple_item(head, acc)
- process_tuple(tail, acc)
- end
-
- defp process_tuple_item(value, acc) do
- Tuple.append(acc, process_exs(value))
- end
-
- defp process_map([], acc), do: acc
-
- defp process_map([head | tail], acc) do
- acc = process_map_item(head, acc)
- process_map(tail, acc)
- end
-
- defp process_map_item({key, value}, acc)
- when is_atom(key) or is_binary(key) do
- Map.put(acc, key, process_exs(value))
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/issue.ex b/apps/plataforma_digital/deps/credo/lib/credo/issue.ex
deleted file mode 100644
index 28da2dad..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/issue.ex
+++ /dev/null
@@ -1,26 +0,0 @@
-defmodule Credo.Issue do
- @moduledoc """
- `Issue` structs represent all issues found during the code analysis.
- """
-
- @type t :: %__MODULE__{}
-
- defstruct check: nil,
- category: nil,
- priority: 0,
- severity: nil,
- message: nil,
- filename: nil,
- line_no: nil,
- column: nil,
- exit_status: 0,
- # optional: the String that triggered the check to fail
- trigger: nil,
- # optional: whether the issue is old, new or fixed
- diff_marker: nil,
- # optional: metadata filled in by the check
- meta: [],
- # optional: the name of the module, macro or
- # function where the issue was found
- scope: nil
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/issue_meta.ex b/apps/plataforma_digital/deps/credo/lib/credo/issue_meta.ex
deleted file mode 100644
index 507ca4b1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/issue_meta.ex
+++ /dev/null
@@ -1,33 +0,0 @@
-defmodule Credo.IssueMeta do
- @moduledoc """
- IssueMeta provides helper functions for meta information which a check wants
- to pass to the `issue_for(...)` function, i.e. the current SourceFile and check
- params (by default).
- """
-
- @type t :: {__MODULE__, Credo.SourceFile.t(), Keyword.t()}
-
- alias Credo.SourceFile
-
- @doc "Returns an issue meta tuple for the given `source_file` and `check_params`."
- def for(source_file, check_params) do
- {__MODULE__, source_file, check_params}
- end
-
- @doc "Returns the source file for the given `issue_meta`."
- def source_file(issue_meta)
-
- def source_file({__MODULE__, source_file, _params}) do
- source_file
- end
-
- def source_file(%SourceFile{} = source_file) do
- source_file
- end
-
- @doc "Returns the check params for the given `issue_meta`."
- def params(issue_meta)
-
- def params({__MODULE__, _source_file, check_params}), do: check_params
- def params(%SourceFile{}), do: []
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/plugin.ex b/apps/plataforma_digital/deps/credo/lib/credo/plugin.ex
deleted file mode 100644
index a17e8ead..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/plugin.ex
+++ /dev/null
@@ -1,450 +0,0 @@
-defmodule Credo.Plugin do
- @moduledoc """
- Plugins are module which can provide additional functionality to Credo.
-
- A plugin is basically just a module that provides an `init/1` callback.
-
- defmodule CredoDemoPlugin do
- def init(exec) do
- # but what do we do here??
- exec
- end
- end
-
- The `Credo.Plugin` module provides a number of functions for extending Credo's core features.
-
- defmodule CredoDemoPlugin do
- @config_file File.read!(".credo.exs")
-
- import Credo.Plugin
-
- def init(exec) do
- exec
- |> register_default_config(@config_file)
- |> register_command("demo", CredoDemoPlugin.DemoCommand)
- |> register_cli_switch(:castle, :string, :X)
- |> prepend_task(:set_default_command, CredoDemoPlugin.SetDemoAsDefaultCommand)
- end
- end
-
- """
-
- require Credo.Execution
-
- pipeline_main_group_names_as_bullet_list = """
- - `:parse_cli_options`
- - `:initialize_plugins`
- - `:determine_command`
- - `:set_default_command`
- - `:initialize_command`
- - `:parse_cli_options_final`
- - `:validate_cli_options`
- - `:convert_cli_options_to_config`
- - `:resolve_config`
- - `:validate_config`
- - `:run_command`
- - `:halt_execution`
- """
-
- pipeline_existing_commands_group_names_as_bullet_list = """
- - `Credo.CLI.Command.Suggest.SuggestCommand` (run via `mix credo suggest`)
- - `:load_and_validate_source_files`
- - `:prepare_analysis`
- - `:print_before_analysis`
- - `:run_analysis`
- - `:filter_issues`
- - `:print_after_analysis`
-
- - `Credo.CLI.Command.List.ListCommand` (run via `mix credo list`)
- - `:load_and_validate_source_files`
- - `:prepare_analysis`
- - `:print_before_analysis`
- - `:run_analysis`
- - `:filter_issues`
- - `:print_after_analysis`
-
- - `Credo.CLI.Command.Diff.DiffCommand` (run via `mix credo diff`)
- - `:load_and_validate_source_files`
- - `:prepare_analysis`
- - `:print_previous_analysis`
- - `:run_analysis`
- - `:filter_issues`
- - `:print_after_analysis`
- - `:filter_issues_for_exit_status`
-
- - `Credo.CLI.Command.Info.InfoCommand` (run via `mix credo info`)
- - `:load_and_validate_source_files`
- - `:prepare_analysis`
- - `:print_info`
- """
-
- alias Credo.Execution
-
- @doc """
- Appends a `Credo.Execution.Task` module to Credo's main execution pipeline.
-
- Credo's execution pipeline consists of several steps, each with a group of tasks, which you can hook into.
-
- Appending tasks to these steps is easy:
-
- # credo_demo_plugin.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- append_task(exec, :set_default_command, CredoDemoPlugin.SetDemoAsDefaultCommand)
- end
- end
-
- Note how `Credo.Plugin.append_task/3` takes two arguments after the `Credo.Execution` struct: the name of the group to be modified and the module that should be executed.
-
- The group names of Credo's main pipeline are:
-
- #{pipeline_main_group_names_as_bullet_list}
-
- The module appended to these groups should use `Credo.Execution.Task`:
-
- # credo_demo_plugin/set_demo_as_default_command.ex
- defmodule CredoDemoPlugin.SetDemoAsDefaultCommand do
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
-
- def call(exec, _opts) do
- set_command(exec, exec.cli_options.command || "demo")
- end
-
- defp set_command(exec, command) do
- %Execution{exec | cli_options: %Options{exec.cli_options | command: command}}
- end
- end
-
- This example would have the effect that typing `mix credo` would no longer run the built-in `Suggest` command, but rather our plugin's `Demo` command.
- """
- def append_task(%Execution{initializing_plugin: plugin_mod} = exec, group_name, task_mod) do
- Execution.append_task(exec, plugin_mod, nil, group_name, task_mod)
- end
-
- @doc """
- Appends a `Credo.Execution.Task` module to the execution pipeline of an existing Command.
-
- Credo's commands can also have an execution pipeline of their own, which is executed when the command is used and which you can hook into as well.
-
- Appending tasks to these steps is easy:
-
- # credo_demo_plugin.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- append_task(exec, Credo.CLI.Command.Suggest.SuggestCommand, :print_after_analysis, CredoDemoPlugin.WriteFile)
- end
- end
-
- Note how `Credo.Plugin.append_task/4` takes three arguments after the `Credo.Execution` struct: the pipeline and the name of the group to be modified and the module that should be executed.
-
- Here are the pipeline keys and group names:
-
- #{pipeline_existing_commands_group_names_as_bullet_list}
-
- The module appended to these groups should use `Credo.Execution.Task`:
-
- # credo_demo_plugin/write_file.ex
- defmodule CredoDemoPlugin.WriteFile do
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
-
- def call(exec, _opts) do
- issue_count = exec |> Execution.get_issues() |> Enum.count
- File.write!("demo.json", ~q({"issue_count": \#{issue_count}}))
-
- exec
- end
- end
-
- This example would have the effect that running `mix credo suggest` would write the issue count in a JSON file.
- """
- def append_task(
- %Execution{initializing_plugin: plugin_mod} = exec,
- pipeline_key,
- group_name,
- task_mod
- ) do
- Execution.append_task(exec, plugin_mod, pipeline_key, group_name, task_mod)
- end
-
- @doc """
- Prepends a `Credo.Execution.Task` module to Credo's main execution pipeline.
-
- Credo's execution pipeline consists of several steps, each with a group of tasks, which you can hook into.
-
- Prepending tasks to these steps is easy:
-
- # credo_demo_plugin.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- prepend_task(exec, :set_default_command, CredoDemoPlugin.SetDemoAsDefaultCommand)
- end
- end
-
- Note how `Credo.Plugin.prepend_task/3` takes two arguments after the `Credo.Execution` struct: the name of the group to be modified and the module that should be executed.
-
- The group names of Credo's main pipeline are:
-
- #{pipeline_main_group_names_as_bullet_list}
-
- The module prepended to these groups should use `Credo.Execution.Task`:
-
- # credo_demo_plugin/set_demo_as_default_command.ex
- defmodule CredoDemoPlugin.SetDemoAsDefaultCommand do
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
-
- def call(exec, _opts) do
- set_command(exec, exec.cli_options.command || "demo")
- end
-
- defp set_command(exec, command) do
- %Execution{exec | cli_options: %Options{exec.cli_options | command: command}}
- end
- end
-
- This example would have the effect that typing `mix credo` would no longer run the built-in `Suggest` command, but rather our plugin's `Demo` command.
- """
- def prepend_task(%Execution{initializing_plugin: plugin_mod} = exec, group_name, task_mod) do
- Execution.prepend_task(exec, plugin_mod, nil, group_name, task_mod)
- end
-
- @doc """
- Prepends a `Credo.Execution.Task` module to the execution pipeline of an existing Command.
-
- Credo's commands can also have an execution pipeline of their own, which is executed when the command is used and which you can hook into as well.
-
- Prepending tasks to these steps is easy:
-
- # credo_demo_plugin.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- prepend_task(exec, Credo.CLI.Command.Suggest.SuggestCommand, :print_after_analysis, CredoDemoPlugin.WriteFile)
- end
- end
-
- Note how `Credo.Plugin.prepend_task/4` takes three arguments after the `Credo.Execution` struct: the pipeline and the name of the group to be modified and the module that should be executed.
-
- Here are the pipeline keys and group names:
-
- #{pipeline_existing_commands_group_names_as_bullet_list}
-
- The module prepended to these groups should use `Credo.Execution.Task`:
-
- # credo_demo_plugin/write_file.ex
- defmodule CredoDemoPlugin.WriteFile do
- use Credo.Execution.Task
-
- alias Credo.CLI.Options
-
- def call(exec, _opts) do
- issue_count = exec |> Execution.get_issues() |> Enum.count
- File.write!("demo.json", ~q({"issue_count": \#{issue_count}}))
-
- exec
- end
- end
-
- This example would have the effect that running `mix credo suggest` would write the issue count in a JSON file.
- """
- def prepend_task(
- %Execution{initializing_plugin: plugin_mod} = exec,
- pipeline_key,
- group_name,
- task_mod
- ) do
- Execution.prepend_task(exec, plugin_mod, pipeline_key, group_name, task_mod)
- end
-
- @doc """
- Adds a CLI switch to Credo.
-
- For demo purposes, we are writing a command called `demo` (see `register_command/3`):
-
- # credo_demo_plugin/demo_command.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- exec
- |> register_command("demo", CredoDemoPlugin.DemoCommand)
- end
- end
-
- # credo_demo_plugin/demo_command.ex
- defmodule CredoDemoPlugin.DemoCommand do
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- def call(exec, _) do
- castle = Execution.get_plugin_param(exec, CredoDemoPlugin, :castle)
-
- UI.puts("By the power of \#{castle}!")
-
- exec
- end
- end
-
- Since Plugins can be configured by params in `.credo.exs`, we can add the `:castle` param:
-
- # .credo.exs
- {CredoDemoPlugin, [castle: "Grayskull"]}
-
- And get the following output:
-
- ```bash
- $ mix credo demo
- By the power of Grayskull!
- ```
-
- Plugins can provide custom CLI options as well, so we can do something like:
-
- ```bash
- $ mix credo demo --castle Winterfell
- Unknown switch: --castle
- ```
-
- Registering a custom CLI switch for this is easy:
-
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- exec
- |> register_command("demo", CredoDemoPlugin.DemoCommand)
- |> register_cli_switch(:castle, :string, :X)
- end
- end
-
- Every registered CLI switch is automatically converted into a plugin param of the same name, which is why we get the following output:
-
- ```bash
- $ mix credo demo --castle Winterfell
- By the power of Winterfell!
-
- $ mix credo demo -X Camelot
- By the power of Camelot!
- ```
-
- Plugin authors can also provide a function to control the plugin param's name and value more granularly:
-
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- register_cli_switch(exec, :kastle, :string, :X, fn(switch_value) ->
- {:castle, String.upcase(switch_value)}
- end)
- end
- end
-
- And get the following output:
-
- ```bash
- $ mix credo demo --kastle Winterfell
- By the power of WINTERFELL!
- ```
-
- """
- def register_cli_switch(
- %Execution{initializing_plugin: plugin_mod} = exec,
- name,
- type,
- alias_name \\ nil,
- convert_to_param \\ true
- ) do
- exec
- |> Execution.put_cli_switch(plugin_mod, name, type)
- |> Execution.put_cli_switch_alias(plugin_mod, name, alias_name)
- |> Execution.put_cli_switch_plugin_param_converter(plugin_mod, name, convert_to_param)
- end
-
- @doc ~S"""
- Registers and initializes a Command module with a given `name`.
-
- ## Add new commands
-
- Commands are just modules with a call function and adding new commands is easy.
-
- # credo_demo_plugin.ex
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- register_command(exec, "demo", CredoDemoPlugin.DemoCommand)
- end
- end
-
- # credo_demo_plugin/demo_command.ex
- defmodule CredoDemoPlugin.DemoCommand do
- alias Credo.CLI.Output.UI
- alias Credo.Execution
-
- def call(exec, _) do
- castle = Execution.get_plugin_param(exec, CredoDemoPlugin, :castle)
-
- UI.puts("By the power of #{castle}!")
-
- exec
- end
- end
-
- Users can use this command by typing
-
- ```bash
- $ mix credo demo
- By the power of !
- ```
-
- ## Override an existing command
-
- Since commands are just modules with a call function, overriding existing commands is easy.
-
- defmodule CredoDemoPlugin do
- import Credo.Plugin
-
- def init(exec) do
- register_command(exec, "explain", CredoDemoPlugin.MyBetterExplainCommand)
- end
- end
-
- This example would have the effect that typing `mix credo lib/my_file.ex:42` would no longer run the built-in `Explain` command, but rather our plugin's `MyBetterExplain` command.
- """
- def register_command(%Execution{initializing_plugin: plugin_mod} = exec, name, command_mod) do
- Execution.put_command(exec, plugin_mod, name, command_mod)
- end
-
- @doc """
- Registers the contents of a config file.
-
- This registers the contents of a config file as default config, loading it after Credo's own default config but before the [config files loaded from the current working directory](config_file.html#transitive-configuration-files).
-
- defmodule CredoDemoPlugin do
- @config_file File.read!(".credo.exs")
-
- import Credo.Plugin
-
- def init(exec) do
- register_default_config(exec, @config_file)
- end
- end
- """
- def register_default_config(
- %Execution{initializing_plugin: plugin_mod} = exec,
- config_file_string
- ) do
- Execution.append_config_file(exec, {:plugin, plugin_mod, config_file_string})
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/priority.ex b/apps/plataforma_digital/deps/credo/lib/credo/priority.ex
deleted file mode 100644
index 856112c1..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/priority.ex
+++ /dev/null
@@ -1,155 +0,0 @@
-defmodule Credo.Priority do
- @moduledoc false
-
- # In Credo each Issue is given a priority to differentiate issues by a second
- # dimension next to their Category.
-
- alias Credo.Code.Module
- alias Credo.Code.Parameters
- alias Credo.Code.Scope
- alias Credo.SourceFile
-
- @def_ops [:def, :defp, :defmacro]
- @many_functions_count 5
-
- @priority_names_map %{
- "ignore" => -100,
- "low" => -10,
- "normal" => 1,
- "high" => +10,
- "higher" => +20
- }
-
- @doc "Converts a given priority name to a numerical priority"
- def to_integer(nil), do: 0
-
- def to_integer(value) when is_number(value), do: value
-
- def to_integer(string) when is_binary(string) do
- case Integer.parse(string) do
- :error -> string |> String.to_atom() |> to_integer()
- {value, ""} -> value
- {_value, _rest} -> raise "Got an invalid priority: #{inspect(string)}"
- end
- end
-
- def to_integer(key) when is_atom(key) do
- @priority_names_map[to_string(key)] || raise "Got an invalid priority: #{inspect(key)}"
- end
-
- def to_atom(priority)
-
- def to_atom(priority) when is_number(priority) do
- cond do
- priority > 19 -> :higher
- priority in 10..19 -> :high
- priority in 0..9 -> :normal
- priority in -10..-1 -> :low
- priority < -10 -> :ignore
- end
- end
-
- def to_atom(%{priority: priority}), do: to_atom(priority)
-
- def to_atom(priority) when is_atom(priority), do: priority
-
- def to_atom(_), do: nil
-
- def scope_priorities(%SourceFile{} = source_file) do
- line_count =
- source_file
- |> SourceFile.lines()
- |> length()
-
- empty_priorities = Enum.map(1..line_count, fn _ -> [] end)
-
- priority_list = Credo.Code.prewalk(source_file, &traverse/2, empty_priorities)
-
- base_map = make_base_map(priority_list, source_file)
-
- lookup = Enum.into(base_map, %{})
-
- Enum.into(base_map, %{}, fn {scope_name, prio} ->
- names = String.split(scope_name, ".")
-
- if names |> List.last() |> String.match?(~r/^[a-z]/) do
- mod_name =
- names
- |> Enum.slice(0..(length(names) - 2))
- |> Enum.join(".")
-
- mod_prio = lookup[mod_name] || 0
-
- {scope_name, prio + mod_prio}
- else
- {scope_name, prio}
- end
- end)
- end
-
- defp make_base_map(priority_list, %SourceFile{} = source_file) do
- ast = SourceFile.ast(source_file)
- scope_info_list = Scope.scope_info_list(ast)
-
- priority_list
- |> Enum.with_index()
- |> Enum.map(fn {list, index} ->
- case list do
- [] ->
- nil
-
- _ ->
- {_, scope_name} = Scope.name_from_scope_info_list(scope_info_list, index + 1)
- {scope_name, Enum.sum(list)}
- end
- end)
- |> Enum.reject(&is_nil/1)
- end
-
- defp traverse({:defmodule, meta, _} = ast, acc) do
- added_prio = priority_for(ast)
-
- {ast, List.update_at(acc, meta[:line] - 1, &(&1 ++ [added_prio]))}
- end
-
- for op <- @def_ops do
- defp traverse({unquote(op), meta, arguments} = ast, acc)
- when is_list(arguments) do
- added_prio = priority_for(ast)
-
- case arguments do
- [{_func_name, _meta, _func_arguments}, _do_block] ->
- {ast, List.update_at(acc, meta[:line] - 1, &(&1 ++ [added_prio]))}
-
- _ ->
- {ast, acc}
- end
- end
- end
-
- defp traverse(ast, acc) do
- {ast, acc}
- end
-
- defp priority_for({:defmodule, _, _} = ast) do
- if Module.def_count(ast) >= @many_functions_count do
- 2
- else
- 1
- end
- end
-
- for op <- @def_ops do
- defp priority_for({unquote(op), _, arguments} = ast)
- when is_list(arguments) do
- count = Parameters.count(ast)
-
- cond do
- count == 0 -> 0
- count in 1..2 -> 1
- count in 3..4 -> 2
- true -> 3
- end
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/config_files.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/config_files.ex
deleted file mode 100644
index b95ce9f4..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/config_files.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule Credo.Service.ConfigFiles do
- @moduledoc false
-
- use Credo.Service.ETSTableHelper
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/ets_table_helper.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/ets_table_helper.ex
deleted file mode 100644
index 20866447..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/ets_table_helper.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule Credo.Service.ETSTableHelper do
- @moduledoc false
-
- defmacro __using__(_opts \\ []) do
- quote do
- use GenServer
-
- @timeout 60_000
-
- alias Credo.Service.ETSTableHelper
-
- @table_name __MODULE__
-
- def start_link(opts \\ []) do
- {:ok, _pid} = GenServer.start_link(__MODULE__, opts, name: __MODULE__)
- end
-
- def get(source_file) do
- hash = source_file.hash
-
- case :ets.lookup(@table_name, hash) do
- [{^hash, value}] ->
- {:ok, value}
-
- [] ->
- :notfound
- end
- end
-
- def put(source_file, value) do
- GenServer.call(__MODULE__, {:put, source_file.hash, value}, @timeout)
- end
-
- # callbacks
-
- def init(opts), do: ETSTableHelper.init(@table_name, opts)
-
- def handle_call(msg, from, current_state),
- do: ETSTableHelper.handle_call(@table_name, msg, from, current_state)
- end
- end
-
- def init(table_name, _) do
- ets = :ets.new(table_name, [:named_table, read_concurrency: true])
-
- {:ok, ets}
- end
-
- def handle_call(table_name, {:put, hash, value}, _from, current_state) do
- :ets.insert(table_name, {hash, value})
-
- {:reply, value, current_state}
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_ast.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_ast.ex
deleted file mode 100644
index 62986100..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_ast.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule Credo.Service.SourceFileAST do
- @moduledoc false
-
- use Credo.Service.ETSTableHelper
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_lines.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_lines.ex
deleted file mode 100644
index 114532d9..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_lines.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule Credo.Service.SourceFileLines do
- @moduledoc false
-
- use Credo.Service.ETSTableHelper
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_scopes.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_scopes.ex
deleted file mode 100644
index 0d202b8b..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_scopes.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule Credo.Service.SourceFileScopes do
- @moduledoc false
-
- use Credo.Service.ETSTableHelper
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_source.ex b/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_source.ex
deleted file mode 100644
index d8ea057a..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/service/source_file_source.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule Credo.Service.SourceFileSource do
- @moduledoc false
-
- use Credo.Service.ETSTableHelper
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/severity.ex b/apps/plataforma_digital/deps/credo/lib/credo/severity.ex
deleted file mode 100644
index 10a27a66..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/severity.ex
+++ /dev/null
@@ -1,8 +0,0 @@
-defmodule Credo.Severity do
- @moduledoc false
-
- def default_value, do: 1
-
- def compute(_, 0), do: 65_536
- def compute(value, max_value), do: value / max_value
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/source_file.ex b/apps/plataforma_digital/deps/credo/lib/credo/source_file.ex
deleted file mode 100644
index 057f68c6..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/source_file.ex
+++ /dev/null
@@ -1,173 +0,0 @@
-defmodule Credo.SourceFile do
- @moduledoc """
- `SourceFile` structs represent a source file in the codebase.
- """
-
- @type t :: %__MODULE__{
- filename: nil | String.t(),
- hash: String.t(),
- status: :valid | :invalid | :timed_out
- }
-
- alias Credo.Service.SourceFileAST
- alias Credo.Service.SourceFileLines
- alias Credo.Service.SourceFileSource
-
- defstruct filename: nil,
- hash: nil,
- status: nil
-
- defimpl Inspect, for: __MODULE__ do
- def inspect(source_file, _opts) do
- "%SourceFile<#{source_file.filename}>"
- end
- end
-
- @doc """
- Returns a `SourceFile` struct for the given `source` code and `filename`.
- """
- def parse(source, filename) do
- filename = Path.relative_to_cwd(filename)
-
- lines = Credo.Code.to_lines(source)
-
- {valid, ast} =
- case Credo.Code.ast(source) do
- {:ok, ast} ->
- {true, ast}
-
- {:error, _errors} ->
- {false, []}
- end
-
- hash =
- :sha256
- |> :crypto.hash(source)
- |> Base.encode16()
-
- source_file = %Credo.SourceFile{
- filename: filename,
- hash: hash,
- status: if(valid, do: :valid, else: :invalid)
- }
-
- SourceFileAST.put(source_file, ast)
- SourceFileLines.put(source_file, lines)
- SourceFileSource.put(source_file, source)
-
- source_file
- end
-
- @spec timed_out(String.t()) :: t
- def timed_out(filename) do
- filename = Path.relative_to_cwd(filename)
-
- %Credo.SourceFile{
- filename: filename,
- hash: "timed_out:#{filename}",
- status: :timed_out
- }
- end
-
- @doc "Returns the AST for the given `source_file`."
- def ast(source_file)
-
- def ast(%__MODULE__{} = source_file) do
- case SourceFileAST.get(source_file) do
- {:ok, ast} ->
- ast
-
- _ ->
- raise "Could not get source from ETS: #{source_file.filename}"
- end
- end
-
- @doc "Returns the lines of source code for the given `source_file`."
- def lines(source_file)
-
- def lines(%__MODULE__{} = source_file) do
- case SourceFileLines.get(source_file) do
- {:ok, lines} ->
- lines
-
- _ ->
- raise "Could not get source from ETS: #{source_file.filename}"
- end
- end
-
- @doc "Returns the source code for the given `source_file`."
- def source(source_file)
-
- def source(%__MODULE__{} = source_file) do
- case SourceFileSource.get(source_file) do
- {:ok, source} ->
- source
-
- _ ->
- raise "Could not get source from ETS: #{source_file.filename}"
- end
- end
-
- @doc "Returns the source code and filename for the given `source_file_or_source`."
- def source_and_filename(source_file_or_source, default_filename \\ "nofilename")
-
- def source_and_filename(%__MODULE__{filename: filename} = source_file, _default_filename) do
- {source(source_file), filename}
- end
-
- def source_and_filename(source, default_filename) when is_binary(source) do
- {source, default_filename}
- end
-
- @doc """
- Returns the line at the given `line_no`.
-
- NOTE: `line_no` is a 1-based index.
- """
- def line_at(%__MODULE__{} = source_file, line_no) do
- source_file
- |> lines()
- |> Enum.find_value(&find_line_at(&1, line_no))
- end
-
- defp find_line_at({line_no, text}, line_no), do: text
- defp find_line_at(_, _), do: nil
-
- @doc """
- Returns the snippet at the given `line_no` between `column1` and `column2`.
-
- NOTE: `line_no` is a 1-based index.
- """
- def line_at(%__MODULE__{} = source_file, line_no, column1, column2) do
- source_file
- |> line_at(line_no)
- |> String.slice(column1 - 1, column2 - column1)
- end
-
- @doc """
- Returns the column of the given `trigger` inside the given line.
-
- NOTE: Both `line_no` and the returned index are 1-based.
- """
- def column(source_file, line_no, trigger)
-
- def column(%__MODULE__{} = source_file, line_no, trigger)
- when is_binary(trigger) or is_atom(trigger) do
- line = line_at(source_file, line_no)
-
- regexed =
- trigger
- |> to_string
- |> Regex.escape()
-
- case Regex.run(~r/(\b|\(|\)|\,)(#{regexed})(\b|\(|\)|\,)/, line, return: :index) do
- nil ->
- nil
-
- [_, _, {regexed_col, _regexed_length}, _] ->
- regexed_col + 1
- end
- end
-
- def column(_, _, _), do: nil
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/sources.ex b/apps/plataforma_digital/deps/credo/lib/credo/sources.ex
deleted file mode 100644
index 860976dd..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/sources.ex
+++ /dev/null
@@ -1,222 +0,0 @@
-defmodule Credo.Sources do
- @moduledoc """
- This module is used to find and read all source files for analysis.
- """
-
- alias Credo.Execution
- alias Credo.SourceFile
-
- @default_sources_glob ~w(** *.{ex,exs})
- @stdin_filename "stdin"
-
- @doc """
- Finds sources for a given `Credo.Execution`.
-
- Through the `files` key, configs may contain a list of `included` and `excluded`
- patterns. For `included`, patterns can be file paths, directory paths and globs.
- For `excluded`, patterns can also be specified as regular expressions.
-
- iex> Sources.find(%Credo.Execution{files: %{excluded: ["not_me.ex"], included: ["*.ex"]}})
-
- iex> Sources.find(%Credo.Execution{files: %{excluded: [~r/messy/], included: ["lib/mix", "root.ex"]}})
- """
- def find(exec)
-
- def find(%Execution{read_from_stdin: true, files: %{included: [filename]}}) do
- filename
- |> source_file_from_stdin()
- |> List.wrap()
- end
-
- def find(%Execution{read_from_stdin: true}) do
- @stdin_filename
- |> source_file_from_stdin()
- |> List.wrap()
- end
-
- def find(%Execution{files: files, parse_timeout: parse_timeout} = exec) do
- parse_timeout =
- if is_nil(parse_timeout) do
- :infinity
- else
- parse_timeout
- end
-
- working_dir = Execution.working_dir(exec)
-
- included_patterns = convert_globs_to_local_paths(working_dir, files.included)
- excluded_patterns = convert_globs_to_local_paths(working_dir, files.excluded)
-
- MapSet.new()
- |> include(included_patterns)
- |> exclude(excluded_patterns)
- |> Enum.sort()
- |> Enum.take(max_file_count())
- |> read_files(parse_timeout)
- end
-
- def find(nil) do
- []
- end
-
- def find(paths) when is_list(paths) do
- Enum.flat_map(paths, &find/1)
- end
-
- def find(path) when is_binary(path) do
- recurse_path(path)
- end
-
- @doc """
- Finds sources in a given `directory` using a list of `included` and `excluded`
- patterns. For `included`, patterns can be file paths, directory paths and globs.
- For `excluded`, patterns can also be specified as regular expressions.
-
- iex> Sources.find_in_dir("/home/rrrene/elixir", ["*.ex"], ["not_me.ex"])
-
- iex> Sources.find_in_dir("/home/rrrene/elixir", ["*.ex"], [~r/messy/])
- """
- def find_in_dir(working_dir, included, excluded)
-
- def find_in_dir(working_dir, [], excluded),
- do: find_in_dir(working_dir, [Path.join(@default_sources_glob)], excluded)
-
- def find_in_dir(working_dir, included, excluded) do
- included_patterns = convert_globs_to_local_paths(working_dir, included)
- excluded_patterns = convert_globs_to_local_paths(working_dir, excluded)
-
- MapSet.new()
- |> include(included_patterns)
- |> exclude(excluded_patterns)
- |> Enum.sort()
- |> Enum.take(max_file_count())
- end
-
- defp convert_globs_to_local_paths(working_dir, patterns) do
- patterns
- |> List.wrap()
- |> Enum.map(fn
- pattern when is_binary(pattern) -> Path.expand(pattern, working_dir)
- pattern -> pattern
- end)
- end
-
- defp max_file_count do
- max_files = System.get_env("MAX_FILES")
-
- if max_files do
- String.to_integer(max_files)
- else
- 1_000_000
- end
- end
-
- defp include(files, []), do: files
-
- defp include(files, [path | remaining_paths]) do
- include_paths =
- path
- |> recurse_path()
- |> Enum.into(MapSet.new())
-
- files
- |> MapSet.union(include_paths)
- |> include(remaining_paths)
- end
-
- defp exclude(files, []), do: files
-
- defp exclude(files, [pattern | remaining_patterns]) when is_list(files) do
- files
- |> Enum.into(MapSet.new())
- |> exclude([pattern | remaining_patterns])
- end
-
- defp exclude(files, [pattern | remaining_patterns]) when is_binary(pattern) do
- exclude_paths =
- pattern
- |> recurse_path
- |> Enum.into(MapSet.new())
-
- files
- |> MapSet.difference(exclude_paths)
- |> exclude(remaining_patterns)
- end
-
- defp exclude(files, [pattern | remaining_patterns]) do
- files
- |> Enum.reject(&String.match?(&1, pattern))
- |> exclude(remaining_patterns)
- end
-
- defp recurse_path(path) do
- paths =
- cond do
- File.regular?(path) ->
- [path]
-
- File.dir?(path) ->
- [path | @default_sources_glob]
- |> Path.join()
- |> Path.wildcard()
-
- true ->
- path
- |> Path.wildcard()
- |> Enum.flat_map(&recurse_path/1)
- end
-
- Enum.map(paths, &Path.expand/1)
- end
-
- defp read_files(filenames, parse_timeout) do
- tasks = Enum.map(filenames, &Task.async(fn -> to_source_file(&1) end))
-
- task_dictionary =
- tasks
- |> Enum.zip(filenames)
- |> Enum.into(%{})
-
- tasks_with_results = Task.yield_many(tasks, parse_timeout)
-
- results =
- Enum.map(tasks_with_results, fn {task, res} ->
- # Shutdown the tasks that did not reply nor exit
- {task, res || Task.shutdown(task, :brutal_kill)}
- end)
-
- Enum.map(results, fn
- {_task, {:ok, value}} -> value
- {task, nil} -> SourceFile.timed_out(task_dictionary[task])
- end)
- end
-
- defp to_source_file(filename) do
- filename
- |> File.read!()
- |> SourceFile.parse(filename)
- end
-
- defp source_file_from_stdin(filename) do
- SourceFile.parse(read_from_stdin!(), filename)
- end
-
- defp read_from_stdin! do
- {:ok, source} = read_from_stdin()
- source
- end
-
- defp read_from_stdin(source \\ "") do
- case IO.read(:stdio, :line) do
- {:error, reason} ->
- {:error, reason}
-
- :eof ->
- {:ok, source}
-
- data ->
- source = source <> data
- read_from_stdin(source)
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/test/assertions.ex b/apps/plataforma_digital/deps/credo/lib/credo/test/assertions.ex
deleted file mode 100644
index c331483f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/test/assertions.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule Credo.Test.Assertions do
- @moduledoc false
-
- import ExUnit.Assertions
-
- def assert_trigger(issue, trigger)
-
- def assert_trigger([issue], trigger), do: [assert_trigger(issue, trigger)]
-
- def assert_trigger(issue, trigger) do
- assert trigger == issue.trigger
-
- issue
- end
-
- def refute_issues(issues) do
- assert [] == issues,
- "There should be no issues, got #{Enum.count(issues)}: #{to_inspected(issues)}"
-
- issues
- end
-
- def assert_issue(issues, callback \\ nil) do
- refute Enum.empty?(issues), "There should be one issue, got none."
-
- assert Enum.count(issues) == 1,
- "There should be only 1 issue, got #{Enum.count(issues)}: #{to_inspected(issues)}"
-
- if callback do
- issues |> List.first() |> callback.()
- end
-
- issues
- end
-
- def assert_issues(issues, callback \\ nil) do
- assert Enum.count(issues) > 0, "There should be multiple issues, got none."
-
- assert Enum.count(issues) > 1,
- "There should be more than one issue, got: #{to_inspected(issues)}"
-
- if callback, do: callback.(issues)
-
- issues
- end
-
- def to_inspected(value) do
- value
- |> Inspect.Algebra.to_doc(%Inspect.Opts{})
- |> Inspect.Algebra.format(50)
- |> Enum.join("")
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/test/case.ex b/apps/plataforma_digital/deps/credo/lib/credo/test/case.ex
deleted file mode 100644
index 1b1067f2..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/test/case.ex
+++ /dev/null
@@ -1,210 +0,0 @@
-defmodule Credo.Test.Case do
- @moduledoc """
- Conveniences for testing Credo custom checks and plugins.
-
- This module can be used in your test cases, like this:
-
- use Credo.Test.Case
-
- Using this module will:
-
- * import all the functions from this module
- * make the test case `:async` by default (use `use Credo.Test.Case, async: false` to opt out)
-
- ## Testing custom checks
-
- Suppose we have a custom check in our project that checks whether or not
- the "FooBar rules" are applied (one of those *very* project-specific things).
-
- defmodule MyProject.MyCustomChecks.FooBar do
- use Credo.Check, category: :warning, base_priority: :high
-
- def run(%SourceFile{} = source_file, params) do
- # ... implement all the "FooBar rules" ...
- end
- end
-
- When we want to test this check, we can use `Credo.Test.Case` for convenience:
-
- defmodule MyProject.MyCustomChecks.FooBarTest do
- use Credo.Test.Case
-
- alias MyProject.MyCustomChecks.FooBar
-
- test "it should NOT report expected code" do
- \"\"\"
- defmodule CredoSampleModule do
- # ... some good Elixir code ...
- end
- \"\"\"
- |> to_source_file()
- |> run_check(FooBar)
- |> refute_issues()
- end
-
- test "it should report code that violates the FooBar rule" do
- \"\"\"
- defmodule CredoSampleModule do
- # ... some Elixir code that violates the FooBar rule ...
- end
- \"\"\"
- |> to_source_file()
- |> run_check(FooBar)
- |> assert_issues()
- end
- end
-
- This is as simple and mundane as it looks (which is a good thing):
- We have two tests: one for the good case, one for the bad case.
- In each, we create a source file representation from a heredoc, run our custom check and assert/refute the issues
- we expect.
-
- ## Asserting found issues
-
- Once we get to know domain a little better, we can add more tests, typically testing for other bad cases in which
- our check should produce issues.
-
- Note that there are two assertion functions for this: `assert_issue/2` and `assert_issues/2`, where the first one
- ensures that there is a single issue and the second asserts that there are at least two issues.
-
- Both functions take an optional `callback` as their second parameter, which is called with the `issue` or the
- list of `issues` found, which makes it convenient to check for the issues properties ...
-
- \"\"\"
- # ... any Elixir code ...
- \"\"\"
- |> to_source_file()
- |> run_check(FooBar)
- |> assert_issue(fn issue -> assert issue.trigger == "foo" end)
-
- ... or properties of the list of issues:
-
- \"\"\"
- # ... any Elixir code ...
- \"\"\"
- |> to_source_file()
- |> run_check(FooBar)
- |> assert_issue(fn issues -> assert Enum.count(issues) == 3 end)
-
- ## Testing checks that analyse multiple source files
-
- For checks that analyse multiple source files, like Credo's consistency checks, we can use `to_source_files/1` to
- create
-
- [
- \"\"\"
- # source file 1
- \"\"\",
- \"\"\"
- # source file 2
- \"\"\"
- ]
- |> to_source_files()
- |> run_check(FooBar)
- |> refute_issues()
-
- If our check needs named source files, we can always use `to_source_file/2` to create individually named source
- files and combine them into a list:
-
- source_file1 =
- \"\"\"
- # source file 1
- \"\"\"
- |> to_source_file("foo.ex")
-
- source_file2 =
- \"\"\"
- # source file 2
- \"\"\"
- |> to_source_file("bar.ex")
-
- [source_file1, source_file2]
- |> run_check(FooBar)
- |> assert_issue(fn issue -> assert issue.filename == "foo.ex" end)
- """
- defmacro __using__(opts) do
- async = opts[:async] != false
-
- quote do
- use ExUnit.Case, async: unquote(async)
-
- import Credo.Test.Case
- end
- end
-
- alias Credo.Test.Assertions
- alias Credo.Test.CheckRunner
- alias Credo.Test.SourceFiles
-
- @doc """
- Refutes the presence of any issues.
- """
- def refute_issues(issues) do
- Assertions.refute_issues(issues)
- end
-
- @doc """
- Asserts the presence of a single issue.
- """
- def assert_issue(issues, callback \\ nil) do
- Assertions.assert_issue(issues, callback)
- end
-
- @doc """
- Asserts the presence of more than one issue.
- """
- def assert_issues(issues, callback \\ nil) do
- Assertions.assert_issues(issues, callback)
- end
-
- @doc false
- # TODO: remove this
- def assert_trigger(issue, trigger) do
- Assertions.assert_trigger(issue, trigger)
- end
-
- #
-
- @doc """
- Runs the given `check` on the given `source_file` using the given `params`.
-
- "x = 5"
- |> to_source_file()
- |> run_check(MyProject.MyCheck, foo_parameter: "bar")
- """
- def run_check(source_file, check, params \\ []) do
- CheckRunner.run_check(source_file, check, params)
- end
-
- #
-
- @doc """
- Converts the given `source` string to a `%SourceFile{}`.
-
- "x = 5"
- |> to_source_file()
- """
- def to_source_file(source) when is_binary(source) do
- SourceFiles.to_source_file(source)
- end
-
- @doc """
- Converts the given `source` string to a `%SourceFile{}` with the given `filename`.
-
- "x = 5"
- |> to_source_file("simple.ex")
- """
- def to_source_file(source, filename) when is_binary(source) and is_binary(filename) do
- SourceFiles.to_source_file(source, filename)
- end
-
- @doc """
- Converts the given `list` of source code strings to a list of `%SourceFile{}` structs.
-
- ["x = 5", "y = 6"]
- |> to_source_files()
- """
- def to_source_files(list) when is_list(list) do
- Enum.map(list, &to_source_file/1)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/test/check_runner.ex b/apps/plataforma_digital/deps/credo/lib/credo/test/check_runner.ex
deleted file mode 100644
index 1aee1555..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/test/check_runner.ex
+++ /dev/null
@@ -1,23 +0,0 @@
-defmodule Credo.Test.CheckRunner do
- alias Credo.Execution
- alias Credo.Execution.ExecutionIssues
-
- def run_check(source_files, check, params \\ []) do
- exec = Execution.build()
-
- source_files
- |> List.wrap()
- |> issues_for(check, exec, params)
- end
-
- defp issues_for(source_files, check, exec, params)
- when is_list(source_files) do
- :ok = check.run_on_all_source_files(exec, source_files, params)
-
- Enum.flat_map(source_files, &get_issues_from_source_file(&1, exec))
- end
-
- defp get_issues_from_source_file(source_file, exec) do
- ExecutionIssues.get(exec, source_file)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/test/source_files.ex b/apps/plataforma_digital/deps/credo/lib/credo/test/source_files.ex
deleted file mode 100644
index 036ccdbc..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/test/source_files.ex
+++ /dev/null
@@ -1,21 +0,0 @@
-defmodule Credo.Test.SourceFiles do
- def to_source_file(source) do
- filename = "test-untitled#{System.unique_integer()}.ex"
-
- to_source_file(source, filename)
- end
-
- def to_source_file(source, filename) do
- case Credo.SourceFile.parse(source, filename) do
- %{status: :valid} = source_file ->
- source_file
-
- _ ->
- raise "Source could not be parsed!"
- end
- end
-
- def to_source_files(list) do
- Enum.map(list, &to_source_file/1)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/credo/watcher.ex b/apps/plataforma_digital/deps/credo/lib/credo/watcher.ex
deleted file mode 100644
index 4be0755c..00000000
--- a/apps/plataforma_digital/deps/credo/lib/credo/watcher.ex
+++ /dev/null
@@ -1,64 +0,0 @@
-defmodule Credo.Watcher do
- alias Credo.CLI.Output.UI
-
- @default_watch_path "."
-
- def run(argv) do
- spawn(fn ->
- path = get_path(argv)
-
- UI.puts([
- :bright,
- :magenta,
- "watch: ",
- :reset,
- :faint,
- "Now watching for changes in '#{path}' ...\n"
- ])
-
- start_watcher_process(path)
-
- watch_loop(argv, nil)
- end)
- end
-
- defp start_watcher_process(path) do
- {:ok, pid} = FileSystem.start_link(dirs: [path])
-
- FileSystem.subscribe(pid)
- end
-
- defp watch_loop(argv, exec_from_last_run) do
- receive do
- {:file_event, _worker_pid, {file_path, events}} ->
- elixir_file? = file_path =~ ~r/\.exs?$/
- in_ignored_directory? = file_path =~ ~r/\/deps\/$/
- relative_path = Path.relative_to_cwd(file_path)
-
- exec =
- if Enum.member?(events, :closed) && elixir_file? && !in_ignored_directory? do
- UI.puts([:bright, :magenta, "watch: ", :reset, :faint, relative_path, "\n"])
-
- file_that_changed = Path.relative_to_cwd(relative_path)
-
- Credo.run(exec_from_last_run || argv, [file_that_changed])
- else
- # data = inspect({System.os_time(:milliseconds), events, relative_path})
- # UI.puts([:bright, :magenta, "changes: ", :reset, :faint, data])
- exec_from_last_run
- end
-
- watch_loop(argv, exec)
- end
- end
-
- defp get_path([]), do: @default_watch_path
-
- defp get_path(argv) do
- {_options, argv_rest, _errors} = OptionParser.parse(argv, strict: [watch: :boolean])
-
- path = Enum.find(argv_rest, fn path -> File.exists?(path) or path =~ ~r/[\?\*]/ end)
-
- path || @default_watch_path
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.ex b/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.ex
deleted file mode 100644
index e3b6c096..00000000
--- a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.ex
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule Mix.Tasks.Credo do
- use Mix.Task
-
- @shortdoc "Run code analysis (use `--help` for options)"
- @moduledoc @shortdoc
-
- @doc false
- def run(argv) do
- Credo.CLI.main(argv)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.check.ex b/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.check.ex
deleted file mode 100644
index 7dd57cb3..00000000
--- a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.check.ex
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule Mix.Tasks.Credo.Gen.Check do
- use Mix.Task
-
- @shortdoc "Generate a new custom check for Credo"
- @moduledoc @shortdoc
-
- @doc false
- def run(argv) do
- Credo.CLI.main(["gen.check"] ++ argv)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.config.ex b/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.config.ex
deleted file mode 100644
index 89b5cc7f..00000000
--- a/apps/plataforma_digital/deps/credo/lib/mix/tasks/credo.gen.config.ex
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule Mix.Tasks.Credo.Gen.Config do
- use Mix.Task
-
- @shortdoc "Generate a new config for Credo"
- @moduledoc @shortdoc
-
- @doc false
- def run(argv) do
- Credo.CLI.main(["gen.config"] ++ argv)
- end
-end
diff --git a/apps/plataforma_digital/deps/credo/mix.exs b/apps/plataforma_digital/deps/credo/mix.exs
deleted file mode 100644
index c5189437..00000000
--- a/apps/plataforma_digital/deps/credo/mix.exs
+++ /dev/null
@@ -1,166 +0,0 @@
-defmodule Credo.Mixfile do
- use Mix.Project
-
- @version "1.7.0"
-
- def project do
- [
- app: :credo,
- version: @version,
- elixir: ">= 1.10.0",
- escript: [main_module: Credo.CLI],
- build_embedded: Mix.env() == :prod,
- start_permanent: Mix.env() == :prod,
- deps: deps(),
- test_coverage: [tool: ExCoveralls],
- preferred_cli_env: [
- coveralls: :test,
- "coveralls.html": :test,
- "test.fast": :test,
- "test.slow": :test
- ],
- name: "Credo",
- description: "A static code analysis tool with a focus on code consistency and teaching.",
- package: package(),
- source_url: "https://github.com/rrrene/credo",
- docs: docs(),
- aliases: aliases()
- ]
- end
-
- defp docs do
- [
- source_ref: "v#{@version}",
- main: "overview",
- logo: "assets/credo-logo-with-trail.png",
- extra_section: "GUIDES",
- assets: "guides/assets",
- formatters: ["html"],
- nest_modules_by_prefix: nest_modules_by_prefix(),
- groups_for_modules: groups_for_modules(),
- extras: extras(),
- groups_for_extras: groups_for_extras()
- ]
- end
-
- defp nest_modules_by_prefix do
- [
- Credo.Check.Design,
- Credo.Check.Readability,
- Credo.Check.Refactor,
- Credo.Check.Warning,
- Credo.Check.Consistency
- ]
- end
-
- defp extras do
- [
- "CHANGELOG.md",
-
- # Introduction
-
- "guides/introduction/overview.md",
- "guides/introduction/installation.md",
- "guides/introduction/basic_usage.md",
- "guides/introduction/exit_statuses.md",
- "guides/introduction/mix_tasks.md",
-
- # Commands
-
- "guides/commands/suggest_command.md",
- "guides/commands/diff_command.md",
- "guides/commands/explain_command.md",
- "guides/commands/list_command.md",
-
- # Checks
-
- "guides/custom_checks/adding_checks.md",
- "guides/custom_checks/testing_checks.md",
-
- # Configuration
-
- "guides/configuration/config_file.md",
- "guides/configuration/cli_switches.md",
- "guides/configuration/config_comments.md",
- "guides/configuration/check_params.md",
-
- # Plugins
-
- "guides/plugins/using_plugins.md",
- "guides/plugins/creating_plugins.md"
- ]
- end
-
- defp groups_for_extras do
- [
- Introduction: ~r/guides\/introduction\/.?/,
- Configuration: ~r/guides\/configuration\//,
- Commands: ~r/guides\/commands\//,
- "Custom Checks": ~r/guides\/custom_checks\//,
- Plugins: ~r/guides\/plugins\//
- ]
- end
-
- defp groups_for_modules do
- [
- "Essential Behaviours": ~r/^Credo\.(Check|Plugin)$/,
- "Essential Structs": ~r/^Credo\.(Execution|Issue|IssueMeta|SourceFile)$/,
- "Code Analysis": ~r/^Credo\.Code(\.[^\.]+|)$/,
- "Testing Utilities": ~r/^Credo\.Test\./,
- "Check Utilities": ~r/^Credo\.Check(\.[^\.]+|)$/,
- "Checks: Software Design": ~r/^Credo\.Check\.Design\./,
- "Checks: Code Readability": ~r/^Credo\.Check\.Readability\./,
- "Checks: Refactoring Opportunities": ~r/^Credo\.Check\.Refactor\./,
- "Checks: Warnings": ~r/^Credo\.Check\.Warning\./,
- "Checks: Consistency": ~r/^Credo\.Check\.Consistency\./,
- "Commands & CLI": ~r/^Credo\.CLI(\.[^\.]+|)$/,
- Internal: ~r/^Credo\..+/
- ]
- end
-
- defp package do
- [
- files: [
- ".credo.exs",
- ".template.check.ex",
- ".template.debug.html",
- "lib",
- "LICENSE",
- "mix.exs",
- "README.md"
- ],
- maintainers: ["René Föhring"],
- licenses: ["MIT"],
- links: %{
- "GitHub" => "https://github.com/rrrene/credo",
- "Changelog" => "https://github.com/rrrene/credo/blob/master/CHANGELOG.md"
- }
- ]
- end
-
- def application do
- [
- mod: {Credo.Application, []},
- extra_applications: [:bunt, :crypto, :eex, :ex_unit, :file_system, :inets, :jason, :logger]
- ]
- end
-
- defp deps do
- [
- {:file_system, "~> 0.2.8"},
- {:bunt, "~> 0.2.1"},
- {:jason, "~> 1.0"},
- {:ex_doc, "~> 0.25", only: :dev, runtime: false},
- {:excoveralls, "~> 0.10", only: :test},
- {:inch_ex, "~> 2.0", only: [:dev, :test], runtime: false}
- ]
- end
-
- defp aliases do
- [
- test: "test --exclude slow --include slow:disk_io",
- "test.fast": "test --exclude slow",
- "test.slow": "test --include slow"
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/.fetch b/apps/plataforma_digital/deps/dialyxir/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/dialyxir/.hex b/apps/plataforma_digital/deps/dialyxir/.hex
deleted file mode 100644
index 41b4eebd..00000000
Binary files a/apps/plataforma_digital/deps/dialyxir/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/dialyxir/LICENSE b/apps/plataforma_digital/deps/dialyxir/LICENSE
deleted file mode 100644
index d9a10c0d..00000000
--- a/apps/plataforma_digital/deps/dialyxir/LICENSE
+++ /dev/null
@@ -1,176 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
diff --git a/apps/plataforma_digital/deps/dialyxir/README.md b/apps/plataforma_digital/deps/dialyxir/README.md
deleted file mode 100644
index bd9f66e1..00000000
--- a/apps/plataforma_digital/deps/dialyxir/README.md
+++ /dev/null
@@ -1,366 +0,0 @@
-# Dialyxir
-
-[![Module Version](https://img.shields.io/hexpm/v/dialyxir.svg)](https://hex.pm/packages/dialyxir)
-[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/dialyxir/)
-[![Total Download](https://img.shields.io/hexpm/dt/dialyxir.svg)](https://hex.pm/packages/dialyxir)
-[![License](https://img.shields.io/hexpm/l/dialyxir.svg)](https://github.com/jeremyjh/dialyxir/blob/master/LICENSE)
-[![Last Updated](https://img.shields.io/github/last-commit/jeremyjh/dialyxir.svg)](https://github.com/jeremyjh/dialyxir/commits/master)
-
-Mix tasks to simplify use of Dialyzer in Elixir projects.
-
-## Installation
-
-Dialyxir is available on [hex.pm](https://hex.pm/packages/dialyxir).
-
-To add it to a mix project, just add a line like this in your deps function in mix.exs:
-
-```elixir
-defp deps do
- [
- {:dialyxir, "~> 1.3", only: [:dev], runtime: false},
- ]
-end
-```
-
-```console
-mix do deps.get, deps.compile
-```
-
-## Usage
-
-Use dialyxir from the directory of the mix project you want to analyze; a PLT file will be created or updated if required and the project will be automatically compiled.
-
-```console
-mix dialyzer
-```
-
-### Command line options
-
- * `--no-compile` - do not compile even if needed.
- * `--no-check` - do not perform (quick) check to see if PLT needs to be updated.
- * `--ignore-exit-status` - display warnings but do not halt the VM or return an exit status code.
- * `--format short` - format the warnings in a compact format, suitable for ignore file using Elixir term format.
- * `--format raw` - format the warnings in format returned before Dialyzer formatting.
- * `--format dialyxir` - format the warnings in a pretty printed format. (default)
- * `--format dialyzer` - format the warnings in the original Dialyzer format, suitable for ignore file using simple string matches.
- * `--format github` - format the warnings in the Github Actions message format.
- * `--format ignore_file` - format the warnings in {file, warning} format for Elixir Format ignore file.
- * `--format ignore_file_strict` - format the warnings in {file, short_description} format for Elixir Format ignore file.
- * `--quiet` - suppress all informational messages.
-
-Warning flags passed to this task are passed on to `:dialyzer` - e.g.
-
-```console
-mix dialyzer --unmatched_returns
-```
-
-There is information available about the warnings via the explain task - e.g.
-
-```console
-mix dialyzer.explain unmatched_return
-```
-
-If invoked without arguments, `mix dialyzer.explain` will list all the known warnings.
-
-## Continuous Integration
-
-To use Dialyzer in CI, you must be aware of several things:
-
-1. Building the project-level PLT file may take a while if a project has many dependencies.
-2. The project-level PLT should be cached using the CI caching system.
- 1. Optional: The core Erlang/Elixir PLT could also be cached in CI.
-3. The PLT will need to be rebuilt whenever adding a new Erlang or Elixir version to your build.
-
-```elixir
-# mix.exs
-def project do
- [
- ...
- dialyzer: [
- # Put the project-level PLT in the priv/ directory (instead of the default _build/ location)
- plt_file: {:no_warn, "priv/plts/project.plt"}
-
- # The above is equivalent to:
- # plt_local_path: "priv/plts/project.plt"
-
- # You could also put the core Erlang/Elixir PLT into the priv/ directory like so:
- # plt_core_path: "priv/plts/core.plt"
- ]
- ]
-end
-```
-
-```shell
-# .gitignore
-/priv/plts/*.plt
-/priv/plts/*.plt.hash
-```
-
-### Example CI Configs
-
-- [CircleCI](./docs/circleci.md)
-- [GitHub Actions](./docs/github_actions.md)
-- [GitLab CI](./docs/gitlab_ci.md)
-
-## With Explaining Stuff
-
-[Dialyzer](http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.html) is a static analysis tool for Erlang and other languages that compile to BEAM bytecode for the Erlang VM. It can analyze the BEAM files and provide warnings about problems in your code including type mismatches and other issues that are commonly detected by static language compilers. The analysis can be improved by inclusion of type hints (called [specs](https://hexdocs.pm/elixir/typespecs.html)) but it can be useful even without those. For more information I highly recommend the [Success Typings](http://user.it.uu.se/~kostis/Papers/succ_types.pdf) paper that describes the theory behind the tool.
-
-
-Usage is straightforward but you should be aware of the available configuration settings you may wish to add to your mix.exs file.
-
-### PLT
-
-The Persistent Lookup Table (PLT) is basically a cached output of the analysis. This is important because you'd probably stab yourself in the eye with
-a fork if you had to wait for Dialyzer to analyze all the standard library and OTP modules you are using every time you ran it.
-Running the mix task `dialyzer` by default builds several PLT files:
-
- * A core Erlang file in `$MIX_HOME/dialyxir_erlang-$OTP_VERSION.plt`
- * A core Elixir file in `$MIX_HOME/dialyxir_erlang-$OTP_VERSION-$ELIXIR_VERSION.plt`
- * A project environment specific file in `_build/$MIX_ENV/dialyze_erlang-$OTP_VERSION_elixir-$ELIXIR_VERSION_deps-$MIX_ENV.plt`
-
-The core files are simply copied to your project folder when you run `dialyxir` for the first time with a given version of Erlang and Elixir. By default, all the modules in the project PLT are checked against your dependencies to be sure they are up to date. If you do not want to use MIX_HOME to store your core Erlang and Elixir files, you can provide a `:plt_core_path` key with a file path. You can specify a different directory for the project PLT file with the `:plt_local_path` keyword.
-
-You can also specify a different filename for the project PLT file with the `:plt_file` keyword option. This is deprecated for local use, but fine to use in CI. The reason for the local deprecation is that people were using it with older versions of `dialyxir` to have project-specific PLTs, which are now the default. To silence the deprecation warning in CI, specify this value as `plt_file: {:no_warn, "/myproject/mypltfile"}`.
-
-The core PLTs include a basic set of OTP applications, as well as all of the Elixir standard libraries. The apps included by default are `[:erts, :kernel, :stdlib, :crypto]`.
-
-If you don't want to include the default apps you can specify a `:plt_apps` key and list there only the apps you want in the PLT. Using this option will mean dependencies are not added automatically (see below). If you want to just add an application to the list of defaults and dependencies you can use the `:plt_add_apps` key.
-
-If you want to ignore a specific dependency, you can specify it in the `:plt_ignore_apps` key.
-
-#### Dependencies
-
-OTP application dependencies are (transitively) added to your PLT by default. The applications added are the same as you would see displayed with the command `mix app.tree`. There is also a `:plt_add_deps` option you can set to control the dependencies added. The following options are supported:
-
- * `:apps_direct` - Only Direct OTP runtime application dependencies - not the entire tree
- * `:app_tree` - Transitive OTP runtime application dependencies e.g. `mix app.tree` (default)
-
-
-The example below changes the default to include only direct OTP dependencies, adds another specific dependency, and removes a dependency from the list. This can be helpful if a large dependency tree is creating memory issues and only some of the transitive dependencies are required for analysis.
-
-```elixir
-def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [
- plt_add_deps: :apps_direct,
- plt_add_apps: [:wx],
- plt_ignore_apps: [:mnesia]
- ]
- ]
-end
-```
-
-#### Explanations
-
-Explanations are available for classes of warnings by executing `mix dialyzer.explain warning_name`. It will include a description about the type of warning, as well as a small example that would also cause that warning. Poor explanations and examples should be considered issues in this library, and pull requests are very welcome! The warning name is returned from the `--format short` and `--format dialyzer` flags. List available warnings with `mix dialyzer.explain`.
-
-#### Formats
-
-Dialyxir supports formatting the errors in several different ways:
-
- * Short - By passing `--format short`, the structs and other spec/type information will be dropped from the error message, with a minimal message. This is useful for CI environments. Includes `warning_name ` for use in explanations.
- * Dialyzer - By passing `--format dialyzer`, the messages will be printed in the default Dialyzer format. This format is used in [legacy string matching](#simple-string-matches) ignore files.
- * Raw - By passing `--format raw`, messages will be printed in their form before being pretty printed by Dialyzer or Dialyxir.
- * Dialyxir (default) -- By passing `--format dialyxir`, messages will be converted to Elixir style messages then pretty printed and formatted. Includes `warning_name ` for use in explanations.
-
-### Flags
-
-Dialyzer supports a number of warning flags used to enable or disable certain kinds of analysis features. Until version 0.4, `dialyxir` used by default the additional warning flags shown in the example below. However some of these create warnings that are often more confusing than helpful, particularly to new users of Dialyzer. As of 0.4, there are no longer any flags used by default. To get the old behavior, specify them in your Mix project file. For compatibility reasons you can use either the `-Wwarning` convention of the dialyzer CLI, or (preferred) the `WarnOpts` atoms supported by the [API](http://erlang.org/doc/man/dialyzer.html#gui-1). e.g.
-
-```elixir
-def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [flags: ["-Wunmatched_returns", :error_handling, :underspecs]]
- ]
-end
-```
-
-### Paths
-
-By default only the ebin in the `_build` directory for the current mix environment of your project is included in paths to search for BEAM files to perform analysis on. You can specify a list of locations to find BEAMS for analysis with :paths keyword.
-
-```elixir
-def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [
- plt_add_apps: [:mnesia],
- flags: [:unmatched_returns, :error_handling, :no_opaque],
- paths: ["_build/dev/lib/my_app/ebin", "_build/dev/lib/foo/ebin"]
- ]
- ]
-end
-```
-
-### Ignore Warnings
-#### Dialyxir defaults
-
-By default `dialyxir` has always included the `:unknown` warning option so that warnings about unknown functions are returned. This is usually a clue that the PLT is not complete and it may be best to leave it on, but it can be disabled entirely by specifying `remove_defaults: [:unknown]` in your config.
-
-A better option is to ignore the specific warnings you can't fix (maybe due to a bug upstream, or a dependency you just don't want to include in your PLT due to time/memory in building the PLT file.)
-
-#### Module attribute
-
-Dialyzer has a built-in support for ignoring warnings through a `@dialyzer` module attribute. For example:
-
-```elixir
-defmodule Myapp.Repo do
- use Ecto.Repo, otp_app: :myapp
- @dialyzer {:nowarn_function, rollback: 1}
-end
-```
-
-More details can be found in the [erlang documentation](http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files)
-
-#### Ignore file
-
-If you want to ignore well-known warnings, you can specify a file path in `:ignore_warnings`.
-
-```elixir
-def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [ignore_warnings: "dialyzer.ignore-warnings"]
- ]
-end
-```
-
-This file comes in two formats: `--format dialyzer` string matches (compatible with `<= 0.5.1` ignore files), and the [term format](#elixir-term-format).
-
-Dialyzer will look for an ignore file using the term format with the name `.dialyzer_ignore.exs` by default if you don't specify something otherwise.
-
-#### Simple String Matches
-
-Any line of dialyzer format output (partially) matching a line in `"dialyzer.ignore-warnings"` is filtered.
-
-Note that copying output in the default format will not work! Run `mix dialyzer --format dialyzer` to produce output suitable for the ignore file.
-
-For example, in a project where `mix dialyzer --format dialyzer` outputs:
-
-```
- Proceeding with analysis...
-config.ex:64: The call ets:insert('Elixir.MyApp.Config',{'Elixir.MyApp.Config',_}) might have an unintended effect due to a possible race condition caused by its combination with the ets:lookup('Elixir.MyApp.Config','Elixir.MyApp.Config') call in config.ex on line 26
-config.ex:79: Guard test is_binary(_@5::#{'__exception__':='true', '__struct__':=_, _=>_}) can never succeed
-config.ex:79: Guard test is_atom(_@6::#{'__exception__':='true', '__struct__':=_, _=>_}) can never succeed
- done in 0m1.32s
-done (warnings were emitted)
-```
-
-If you wanted to ignore the last two warnings about guard tests, you could add to `dialyzer.ignore-warnings`:
-
-```
-Guard test is_binary(_@5::#{'__exception__':='true', '__struct__':=_, _=>_}) can never succeed
-Guard test is_atom(_@6::#{'__exception__':='true', '__struct__':=_, _=>_}) can never succeed
-```
-
-And then run `mix dialyzer` would output:
-
-```
- Proceeding with analysis...
-config.ex:64: The call ets:insert('Elixir.MyApp.Config',{'Elixir.MyApp.Config',_}) might have an unintended effect due to a possible race condition caused by its combination with the ets:lookup('Elixir.MyApp.Config','Elixir.MyApp.Config') call in config.ex on line 26
- done in 0m1.32s
-done (warnings were emitted)
-```
-
-#### Elixir Term Format
-
-Dialyxir also recognizes an Elixir format of the ignore file. If your ignore file is an `exs` file, Dialyxir will evaluate it and process its data structure. A line may be either a tuple or an arbitrary Regex
-applied to the *short-description* format of Dialyzer output (`mix dialyzer --format short`). The file looks like the following:
-
-```elixir
-# .dialyzer_ignore.exs
-[
- # {short_description}
- {":0:unknown_function Function :erl_types.t_is_opaque/1/1 does not exist."},
- # {short_description, warning_type}
- {":0:unknown_function Function :erl_types.t_to_string/1 does not exist.", :unknown_function},
- # {short_description, warning_type, line}
- {":0:unknown_function Function :erl_types.t_to_string/1 does not exist.", :unknown_function, 0},
- # {file, warning_type, line}
- {"lib/dialyxir/pretty_print.ex", :no_return, 100},
- # {file, warning_description}
- {"lib/dialyxir/warning_helpers.ex", "Function :erl_types.t_to_string/1 does not exist."},
- # {file, warning_type}
- {"lib/dialyxir/warning_helpers.ex", :no_return},
- # {file}
- {"lib/dialyxir/warnings/app_call.ex"},
- # regex
- ~r/my_file\.ex.*my_function.*no local return/
-]
-```
-
-_Note that `short_description` contains additional information that `warning_description` does not._
-
-Entries for existing warnings can be generated with one of the following:
-- `mix dialyzer --format ignore_file`
-- `mix dialyzer --format ignore_file_strict` (recommended)
-
-For example, if `mix dialyzer --format short` gives you a result like:
-```
-lib/something.ex:15:no_return Function init/1 has no local return.
-lib/something.ex:36:no_return Function refresh/0 has no local return.
-lib/something.ex:45:no_return Function create/2 has no local return.
-lib/something.ex:26:no_return Function update/2 has no local return.
-lib/something.ex:49:no_return Function delete/1 has no local return.
-```
-
-If you had used `--format ignore_file`, you'd be given a single file ignore line for all five warnings:
-```elixir
-# .dialyzer_ignore.exs
-[
- # {file, warning_type}
- {"lib/something.ex", :no_return},
-]
-```
-
-If you had used `--format ignore_file_strict`, you'd be given more granular ignore lines:
-```elixir
-# .dialyzer_ignore.exs
-[
- # {file, warning_description}
- {"lib/something.ex", "Function init/1 has no local return."},
- {"lib/something.ex", "Function refresh/0 has no local return."},
- {"lib/something.ex", "Function create/2 has no local return."},
- {"lib/something.ex", "Function update/2 has no local return."},
- {"lib/something.ex", "Function delete/1 has no local return."},
-]
-```
-
-#### List unused Filters
-
-As filters tend to become obsolete (either because a discrepancy was fixed, or because the location
-for which a filter is needed changes), listing unused filters might be useful. This can be done by
-setting the `:list_unused_filters` option to `true` in `mix.exs`. For example:
-
-```elixir
-dialyzer: [
- ignore_warnings: "ignore_test.exs",
- list_unused_filters: true
-]
-```
-
-This option can also be set on the command line with `--list-unused-filters`. When used without
-`--ignore-exit-status`, this option will result in an error status code.
-
-#### `no_umbrella` flag
-
-Projects with lockfiles at a parent folder are treated as umbrella projects. In some cases however
-you may wish to have the lockfile on a parent folder without having an umbrella. By setting the
-`no_umbrella` flag to `true` your project will be treated as a non umbrella project:
-
-```elixir
-dialyzer: [
- no_umbrella: true
-]
-```
diff --git a/apps/plataforma_digital/deps/dialyxir/hex_metadata.config b/apps/plataforma_digital/deps/dialyxir/hex_metadata.config
deleted file mode 100644
index 3c03c3a6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/hex_metadata.config
+++ /dev/null
@@ -1,80 +0,0 @@
-{<<"links">>,
- [{<<"Changelog">>,<<"https://hexdocs.pm/dialyxir/changelog.html">>},
- {<<"GitHub">>,<<"https://github.com/jeremyjh/dialyxir">>}]}.
-{<<"name">>,<<"dialyxir">>}.
-{<<"version">>,<<"1.4.1">>}.
-{<<"description">>,
- <<"Mix tasks to simplify use of Dialyzer in Elixir projects.">>}.
-{<<"elixir">>,<<">= 1.12.0">>}.
-{<<"app">>,<<"dialyxir">>}.
-{<<"files">>,
- [<<"lib">>,<<"lib/mix">>,<<"lib/mix/tasks">>,<<"lib/mix/tasks/dialyzer">>,
- <<"lib/mix/tasks/dialyzer/explain.ex">>,<<"lib/mix/tasks/dialyzer.ex">>,
- <<"lib/dialyxir">>,<<"lib/dialyxir/warnings.ex">>,
- <<"lib/dialyxir/warning.ex">>,<<"lib/dialyxir/warning_helpers.ex">>,
- <<"lib/dialyxir/formatter.ex">>,<<"lib/dialyxir/dialyzer.ex">>,
- <<"lib/dialyxir/formatter">>,<<"lib/dialyxir/formatter/raw.ex">>,
- <<"lib/dialyxir/formatter/github.ex">>,
- <<"lib/dialyxir/formatter/dialyzer.ex">>,
- <<"lib/dialyxir/formatter/short.ex">>,
- <<"lib/dialyxir/formatter/ignore_file_strict.ex">>,
- <<"lib/dialyxir/formatter/ignore_file.ex">>,
- <<"lib/dialyxir/formatter/dialyxir.ex">>,
- <<"lib/dialyxir/formatter/utils.ex">>,<<"lib/dialyxir/filter_map.ex">>,
- <<"lib/dialyxir/plt.ex">>,<<"lib/dialyxir/output.ex">>,
- <<"lib/dialyxir/project.ex">>,<<"lib/dialyxir/warnings">>,
- <<"lib/dialyxir/warnings/contract_diff.ex">>,
- <<"lib/dialyxir/warnings/missing_range.ex">>,
- <<"lib/dialyxir/warnings/guard_fail.ex">>,
- <<"lib/dialyxir/warnings/negative_guard_fail.ex">>,
- <<"lib/dialyxir/warnings/binary_construction.ex">>,
- <<"lib/dialyxir/warnings/function_application_no_function.ex">>,
- <<"lib/dialyxir/warnings/unknown_behaviour.ex">>,
- <<"lib/dialyxir/warnings/opaque_equality.ex">>,
- <<"lib/dialyxir/warnings/callback_spec_argument_type_mismatch.ex">>,
- <<"lib/dialyxir/warnings/no_return.ex">>,
- <<"lib/dialyxir/warnings/contract_range.ex">>,
- <<"lib/dialyxir/warnings/call_with_opaque.ex">>,
- <<"lib/dialyxir/warnings/unknown_type.ex">>,
- <<"lib/dialyxir/warnings/callback_not_exported.ex">>,
- <<"lib/dialyxir/warnings/opaque_type_test.ex">>,
- <<"lib/dialyxir/warnings/callback_info_missing.ex">>,
- <<"lib/dialyxir/warnings/guard_fail_pattern.ex">>,
- <<"lib/dialyxir/warnings/call_without_opaque.ex">>,
- <<"lib/dialyxir/warnings/contract_supertype.ex">>,
- <<"lib/dialyxir/warnings/opaque_nonequality.ex">>,
- <<"lib/dialyxir/warnings/invalid_contract.ex">>,
- <<"lib/dialyxir/warnings/record_construction.ex">>,
- <<"lib/dialyxir/warnings/pattern_match.ex">>,
- <<"lib/dialyxir/warnings/call.ex">>,
- <<"lib/dialyxir/warnings/opaque_match.ex">>,
- <<"lib/dialyxir/warnings/unused_function.ex">>,
- <<"lib/dialyxir/warnings/unmatched_return.ex">>,
- <<"lib/dialyxir/warnings/overlapping_contract.ex">>,
- <<"lib/dialyxir/warnings/improper_list_construction.ex">>,
- <<"lib/dialyxir/warnings/callback_missing.ex">>,
- <<"lib/dialyxir/warnings/callback_type_mismatch.ex">>,
- <<"lib/dialyxir/warnings/extra_range.ex">>,
- <<"lib/dialyxir/warnings/apply.ex">>,
- <<"lib/dialyxir/warnings/unknown_function.ex">>,
- <<"lib/dialyxir/warnings/exact_equality.ex">>,
- <<"lib/dialyxir/warnings/pattern_match_covered.ex">>,
- <<"lib/dialyxir/warnings/app_call.ex">>,
- <<"lib/dialyxir/warnings/contract_with_opaque.ex">>,
- <<"lib/dialyxir/warnings/function_application_arguments.ex">>,
- <<"lib/dialyxir/warnings/callback_spec_type_mismatch.ex">>,
- <<"lib/dialyxir/warnings/call_to_missing_function.ex">>,
- <<"lib/dialyxir/warnings/opaque_guard.ex">>,
- <<"lib/dialyxir/warnings/record_matching.ex">>,
- <<"lib/dialyxir/warnings/map_update.ex">>,
- <<"lib/dialyxir/warnings/callback_argument_type_mismatch.ex">>,
- <<"lib/dialyxir/warnings/contract_subtype.ex">>,<<"lib/dialyxir.ex">>,
- <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}.
-{<<"licenses">>,[<<"Apache-2.0">>]}.
-{<<"requirements">>,
- [[{<<"name">>,<<"erlex">>},
- {<<"app">>,<<"erlex">>},
- {<<"optional">>,false},
- {<<"requirement">>,<<">= 0.2.6">>},
- {<<"repository">>,<<"hexpm">>}]]}.
-{<<"build_tools">>,[<<"mix">>]}.
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir.ex
deleted file mode 100644
index 4b2a1fdb..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule Dialyxir do
- @moduledoc false
- use Application
- alias Dialyxir.Output
-
- def start(_, _) do
- Output.info("""
- Warning: the `dialyxir` application's start function was called, which likely means you
- did not add the dependency with the `runtime: false` flag. This is not recommended because
- it will mean that unnecessary applications are started, and unnecessary applications are most
- likely being added to your PLT file, increasing build time.
- Please add `runtime: false` in your `mix.exs` dependency section e.g.:
- {:dialyxir, "~> 0.5", only: [:dev], runtime: false}
- """)
-
- Supervisor.start_link([], strategy: :one_for_one)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/dialyzer.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/dialyzer.ex
deleted file mode 100644
index 90e1cc10..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/dialyzer.ex
+++ /dev/null
@@ -1,120 +0,0 @@
-defmodule Dialyxir.Dialyzer do
- import Dialyxir.Output
- alias String.Chars
- alias Dialyxir.Formatter
- alias Dialyxir.Project
- alias Dialyxir.FilterMap
-
- defmodule Runner do
- @dialyxir_args [
- :raw,
- :format,
- :list_unused_filters,
- :ignore_exit_status,
- :quiet_with_result
- ]
-
- def run(args, filterer) do
- try do
- {split, args} = Keyword.split(args, @dialyxir_args)
-
- quiet_with_result? = split[:quiet_with_result]
-
- formatter =
- cond do
- split[:format] == "dialyzer" ->
- Dialyxir.Formatter.Dialyzer
-
- split[:format] == "dialyxir" ->
- Dialyxir.Formatter.Dialyxir
-
- split[:format] == "github" ->
- Dialyxir.Formatter.Github
-
- split[:format] == "ignore_file" ->
- Dialyxir.Formatter.IgnoreFile
-
- split[:format] == "ignore_file_strict" ->
- Dialyxir.Formatter.IgnoreFileStrict
-
- split[:format] == "raw" ->
- Dialyxir.Formatter.Raw
-
- split[:format] == "short" ->
- Dialyxir.Formatter.Short
-
- split[:raw] ->
- Dialyxir.Formatter.Raw
-
- true ->
- Dialyxir.Formatter.Dialyxir
- end
-
- info("Starting Dialyzer")
-
- args
- |> inspect(label: "dialyzer args", pretty: true, limit: 8)
- |> info
-
- {duration_us, result} = :timer.tc(&:dialyzer.run/1, [args])
-
- formatted_time_elapsed = Formatter.formatted_time(duration_us)
-
- filter_map_args = FilterMap.to_args(split)
-
- case Formatter.format_and_filter(
- result,
- filterer,
- filter_map_args,
- formatter,
- quiet_with_result?
- ) do
- {:ok, formatted_warnings, :no_unused_filters} ->
- {:ok, {formatted_time_elapsed, formatted_warnings, ""}}
-
- {:warn, formatted_warnings, {:unused_filters_present, formatted_unnecessary_skips}} ->
- {:ok, {formatted_time_elapsed, formatted_warnings, formatted_unnecessary_skips}}
-
- {:error, _formatted_warnings, {:unused_filters_present, formatted_unnecessary_skips}} ->
- {:error, {"unused filters present", formatted_unnecessary_skips}}
- end
- catch
- {:dialyzer_error, msg} ->
- {:error, ":dialyzer.run error: " <> Chars.to_string(msg)}
- end
- end
- end
-
- @success_return_code 0
- @warning_return_code 2
- @error_return_code 1
-
- def dialyze(args, runner \\ Runner, filterer \\ Project) do
- case runner.run(args, filterer) do
- {:ok, {time, [], formatted_unnecessary_skips}} ->
- {:ok, @success_return_code, [time, formatted_unnecessary_skips, success_msg()]}
-
- {:ok, {time, result, formatted_unnecessary_skips}} ->
- warnings = Enum.map(result, &color(&1, :red))
-
- {:warn, @warning_return_code,
- [time] ++ warnings ++ [formatted_unnecessary_skips, warnings_msg()]}
-
- {:warn, {time, result, formatted_unnecessary_skips}} ->
- warnings = Enum.map(result, &color(&1, :red))
-
- {:warn, @warning_return_code,
- [time] ++ warnings ++ [formatted_unnecessary_skips, warnings_msg()]}
-
- {:error, {msg, formatted_unnecessary_skips}} ->
- {:error, @error_return_code, [color(formatted_unnecessary_skips, :red), color(msg, :red)]}
-
- {:error, msg} ->
- {:error, @error_return_code, [color(msg, :red)]}
- end
- end
-
- defp success_msg, do: color("done (passed successfully)", :green)
-
- defp warnings_msg, do: color("done (warnings were emitted)", :yellow)
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/filter_map.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/filter_map.ex
deleted file mode 100644
index 6b6035f2..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/filter_map.ex
+++ /dev/null
@@ -1,71 +0,0 @@
-defmodule Dialyxir.FilterMap do
- @moduledoc """
- A counters holding warnings to be skipped.
-
- `:counters` points to a `Map` where the keys are warnings to be skipped and the value indicates
- how often the warning was skipped.
- """
- defstruct list_unused_filters?: false, unused_filters_as_errors?: false, counters: %{}
-
- @doc """
- Fill a `FilterMap` from an ignore file.
- """
- def from_file(ignore_file, list_unused_filters?, ignore_exit_status?) do
- filter_map = %__MODULE__{
- list_unused_filters?: list_unused_filters?,
- unused_filters_as_errors?: list_unused_filters? && !ignore_exit_status?
- }
-
- {ignore, _} =
- ignore_file
- |> File.read!()
- |> Code.eval_string()
-
- Enum.reduce(ignore, filter_map, fn skip, filter_map ->
- put_in(filter_map.counters[skip], 0)
- end)
- end
-
- @doc """
- Remove all non-allowed arguments from `args`.
- """
- def to_args(args) do
- Keyword.take(args, [:list_unused_filters, :ignore_exit_status])
- end
-
- @doc """
- Retrieve the filters from a `FilterMap`.
- """
- def filters(filter_map) do
- Map.keys(filter_map.counters)
- end
-
- @doc """
- Increase usage count of a filter in `FilterMap`.
- """
- def inc(filter_map, filter) do
- update_in(filter_map.counters[filter], &(&1 + 1))
- end
-
- @doc """
- List unused filters.
- """
- def unused_filters(filter_map) do
- filter_map.counters
- |> Enum.filter(&unused?/1)
- |> Enum.unzip()
- |> elem(0)
- end
-
- @doc """
- Determine if any filters were not used.
- """
- def unused_filters?(filter_map) do
- Enum.any?(filter_map.counters, &unused?/1)
- end
-
- @doc """
- Check if a `FilterMap` entry is unused.
- """
- def unused?({_filter, count}), do: count < 1
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter.ex
deleted file mode 100644
index f5a61404..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter.ex
+++ /dev/null
@@ -1,150 +0,0 @@
-defmodule Dialyxir.Formatter do
- @moduledoc """
- Elixir-friendly dialyzer formatter.
-
- Wrapper around normal Dialyzer warning messages that provides
- example output for error messages.
- """
- import Dialyxir.Output
-
- alias Dialyxir.FilterMap
-
- @type warning() :: {tag :: term(), {file :: Path.t(), line :: pos_integer()}, {atom(), list()}}
-
- @type t() :: module()
-
- @callback format(warning()) :: String.t()
-
- def formatted_time(duration_us) do
- minutes = div(duration_us, 60_000_000)
- seconds = (rem(duration_us, 60_000_000) / 1_000_000) |> Float.round(2)
- "done in #{minutes}m#{seconds}s"
- end
-
- @spec format_and_filter([tuple], module, Keyword.t(), t(), boolean()) :: tuple
- def format_and_filter(
- warnings,
- filterer,
- filter_map_args,
- formatter,
- quiet_with_result? \\ false
- )
-
- def format_and_filter(warnings, filterer, filter_map_args, formatter, quiet_with_result?) do
- filter_map = filterer.filter_map(filter_map_args)
-
- {filtered_warnings, filter_map} = filter_warnings(warnings, filterer, filter_map)
-
- formatted_warnings =
- filtered_warnings
- |> filter_legacy_warnings(filterer)
- |> Enum.map(&formatter.format/1)
- |> Enum.uniq()
-
- show_count_skipped(warnings, formatted_warnings, filter_map, quiet_with_result?)
- formatted_unnecessary_skips = format_unnecessary_skips(filter_map)
-
- result(formatted_warnings, filter_map, formatted_unnecessary_skips)
- end
-
- defp result(formatted_warnings, filter_map, formatted_unnecessary_skips) do
- cond do
- FilterMap.unused_filters?(filter_map) && filter_map.unused_filters_as_errors? ->
- {:error, formatted_warnings, {:unused_filters_present, formatted_unnecessary_skips}}
-
- FilterMap.unused_filters?(filter_map) ->
- {:warn, formatted_warnings, {:unused_filters_present, formatted_unnecessary_skips}}
-
- true ->
- {:ok, formatted_warnings, :no_unused_filters}
- end
- end
-
- defp show_count_skipped(warnings, filtered_warnings, filter_map, quiet_with_result?) do
- warnings_count = Enum.count(warnings)
- filtered_warnings_count = Enum.count(filtered_warnings)
- skipped_count = warnings_count - filtered_warnings_count
- unnecessary_skips_count = count_unnecessary_skips(filter_map)
-
- message =
- "Total errors: #{warnings_count}, Skipped: #{skipped_count}, Unnecessary Skips: #{unnecessary_skips_count}"
-
- if quiet_with_result? do
- Mix.shell(Mix.Shell.IO)
- info(message)
- Mix.shell(Mix.Shell.Quiet)
- else
- info(message)
- end
-
- :ok
- end
-
- defp format_unnecessary_skips(filter_map = %FilterMap{list_unused_filters?: true}) do
- unused_filters = FilterMap.unused_filters(filter_map)
-
- if Enum.empty?(unused_filters) do
- ""
- else
- unused_filters = Enum.map_join(unused_filters, "\n", &inspect/1)
- "Unused filters:\n#{unused_filters}"
- end
- end
-
- defp format_unnecessary_skips(_) do
- ""
- end
-
- defp count_unnecessary_skips(filter_map) do
- filter_map.counters
- |> Enum.filter(&FilterMap.unused?/1)
- |> Enum.count()
- end
-
- defp filter_warnings(warnings, filterer, filter_map) do
- {warnings, filter_map} =
- Enum.map_reduce(warnings, filter_map, &filter_warning(filterer, &1, &2))
-
- warnings = Enum.reject(warnings, &is_nil/1)
- {warnings, filter_map}
- end
-
- defp filter_warning(filterer, {_, {_file, _line}, {warning_type, _args}} = warning, filter_map) do
- if Map.has_key?(Dialyxir.Warnings.warnings(), warning_type) do
- {skip?, matching_filters} =
- try do
- filterer.filter_warning?(warning, filter_map)
- rescue
- _ ->
- {false, []}
- catch
- _ ->
- {false, []}
- end
-
- filter_map =
- Enum.reduce(matching_filters, filter_map, fn filter, filter_map ->
- FilterMap.inc(filter_map, filter)
- end)
-
- if skip? do
- {nil, filter_map}
- else
- {warning, filter_map}
- end
- else
- {warning, filter_map}
- end
- end
-
- defp filter_legacy_warnings(warnings, filterer) do
- Enum.reject(warnings, fn warning ->
- formatted_warnings =
- warning
- |> Dialyxir.Formatter.Dialyzer.format()
- |> List.wrap()
-
- Enum.empty?(filterer.filter_legacy_warnings(formatted_warnings))
- end)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyxir.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyxir.ex
deleted file mode 100644
index 241a9368..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyxir.ex
+++ /dev/null
@@ -1,84 +0,0 @@
-defmodule Dialyxir.Formatter.Dialyxir do
- @moduledoc false
-
- alias Dialyxir.Formatter.Utils
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format(dialyzer_warning = {_tag, {file, line}, message}) do
- {warning_name, arguments} = message
- base_name = Path.relative_to_cwd(file)
-
- formatted =
- try do
- warning = Utils.warning(warning_name)
- string = warning.format_long(arguments)
-
- """
- #{base_name}:#{line}:#{warning_name}
- #{string}
- """
- rescue
- e ->
- message = """
- Unknown error occurred: #{inspect(e)}
- """
-
- wrap_error_message(message, dialyzer_warning)
- catch
- {:error, :unknown_warning, warning_name} ->
- message = """
- Unknown warning:
- #{inspect(warning_name)}
- """
-
- wrap_error_message(message, dialyzer_warning)
-
- {:error, :lexing, warning} ->
- message = """
- Failed to lex warning:
- #{inspect(warning)}
- """
-
- wrap_error_message(message, dialyzer_warning)
-
- {:error, :parsing, failing_string} ->
- message = """
- Failed to parse warning:
- #{inspect(failing_string)}
- """
-
- wrap_error_message(message, dialyzer_warning)
-
- {:error, :pretty_printing, failing_string} ->
- message = """
- Failed to pretty print warning:
- #{inspect(failing_string)}
- """
-
- wrap_error_message(message, dialyzer_warning)
-
- {:error, :formatting, code} ->
- message = """
- Failed to format warning:
- #{inspect(code)}
- """
-
- wrap_error_message(message, dialyzer_warning)
- end
-
- formatted <> String.duplicate("_", 80)
- end
-
- defp wrap_error_message(message, warning) do
- """
- Please file a bug in https://github.com/jeremyjh/dialyxir/issues with this message.
-
- #{message}
-
- Legacy warning:
- #{Dialyxir.Formatter.Dialyzer.format(warning)}
- """
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyzer.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyzer.ex
deleted file mode 100644
index 934eabd7..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/dialyzer.ex
+++ /dev/null
@@ -1,20 +0,0 @@
-defmodule Dialyxir.Formatter.Dialyzer do
- @moduledoc false
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format(warning) do
- # OTP 22 uses indented output, but that's incompatible with dialyzer.ignore-warnings format.
- # Can be disabled, but OTP 21 and older only accept an atom, so only disable on OTP 22+.
- opts =
- if String.to_integer(System.otp_release()) < 22,
- do: :fullpath,
- else: [{:filename_opt, :fullpath}, {:indent_opt, false}]
-
- warning
- |> :dialyzer.format_warning(opts)
- |> String.Chars.to_string()
- |> String.replace_trailing("\n", "")
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/github.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/github.ex
deleted file mode 100644
index da306d6d..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/github.ex
+++ /dev/null
@@ -1,17 +0,0 @@
-defmodule Dialyxir.Formatter.Github do
- @moduledoc false
-
- alias Dialyxir.Formatter.Utils
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format({_tag, {file, line}, {warning_name, arguments}}) do
- base_name = Path.relative_to_cwd(file)
-
- warning = Utils.warning(warning_name)
- string = warning.format_short(arguments)
-
- "::warning file=#{base_name},line=#{line},title=#{warning_name}::#{string}"
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file.ex
deleted file mode 100644
index b1bf6cc1..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file.ex
+++ /dev/null
@@ -1,10 +0,0 @@
-defmodule Dialyxir.Formatter.IgnoreFile do
- @moduledoc false
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format({_tag, {file, _line}, {warning_name, _arguments}}) do
- ~s({"#{file}", :#{warning_name}},)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file_strict.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file_strict.ex
deleted file mode 100644
index 49aeb109..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/ignore_file_strict.ex
+++ /dev/null
@@ -1,15 +0,0 @@
-defmodule Dialyxir.Formatter.IgnoreFileStrict do
- @moduledoc false
-
- alias Dialyxir.Formatter.Utils
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format({_tag, {file, _line}, {warning_name, arguments}}) do
- warning = Utils.warning(warning_name)
- string = warning.format_short(arguments)
-
- ~s({"#{file}", "#{string}"},)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/raw.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/raw.ex
deleted file mode 100644
index c18a221a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/raw.ex
+++ /dev/null
@@ -1,10 +0,0 @@
-defmodule Dialyxir.Formatter.Raw do
- @moduledoc false
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format(warning) do
- inspect(warning, limit: :infinity)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/short.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/short.ex
deleted file mode 100644
index 5c5691c1..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/short.ex
+++ /dev/null
@@ -1,17 +0,0 @@
-defmodule Dialyxir.Formatter.Short do
- @moduledoc false
-
- alias Dialyxir.Formatter.Utils
-
- @behaviour Dialyxir.Formatter
-
- @impl Dialyxir.Formatter
- def format({_tag, {file, line}, {warning_name, arguments}}) do
- base_name = Path.relative_to_cwd(file)
-
- warning = Utils.warning(warning_name)
- string = warning.format_short(arguments)
-
- "#{base_name}:#{line}:#{warning_name} #{string}"
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/utils.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/utils.ex
deleted file mode 100644
index 8f3fd541..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/formatter/utils.ex
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule Dialyxir.Formatter.Utils do
- def warning(warning_name) do
- warnings = Dialyxir.Warnings.warnings()
-
- if Map.has_key?(warnings, warning_name) do
- Map.get(warnings, warning_name)
- else
- throw({:error, :unknown_warning, warning_name})
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/output.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/output.ex
deleted file mode 100644
index 4276df2e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/output.ex
+++ /dev/null
@@ -1,16 +0,0 @@
-defmodule Dialyxir.Output do
- alias IO.ANSI
-
- def color(text, color) when is_binary(text) do
- ANSI.format([color, text])
- end
-
- def info(""), do: :ok
- def info(text), do: Mix.shell().info(text)
-
- def warning(""), do: :ok
- def warning(text), do: Mix.shell().info(color(text, :yellow))
-
- def error(""), do: :ok
- def error(text), do: Mix.shell().error(text)
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/plt.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/plt.ex
deleted file mode 100644
index a345c249..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/plt.ex
+++ /dev/null
@@ -1,255 +0,0 @@
-# Credits: this code was originally part of the `dialyze` task
-# Copyright by James Fish
-# https://github.com/fishcakez/dialyze
-
-defmodule Dialyxir.Plt do
- @moduledoc false
-
- import Dialyxir.Output
- alias Dialyxir.Formatter
-
- def check(plts, fun \\ &check_plt/4) do
- find_plts(plts, [], fun)
- end
-
- defp find_plts([{plt, apps} | plts], acc, fun) do
- case plt_files(plt) do
- nil ->
- find_plts(plts, [{plt, apps, nil} | acc], fun)
-
- beams ->
- apps_rest = Enum.flat_map(plts, fn {_plt2, apps2} -> apps2 end)
- apps = Enum.uniq(apps ++ apps_rest)
- check_plts([{plt, apps, beams} | acc], fun)
- end
- end
-
- defp find_plts([], acc, fun) do
- check_plts(acc, fun)
- end
-
- defp check_plts(plts, fun) do
- _ =
- Enum.reduce(plts, {nil, MapSet.new(), %{}}, fn {plt, apps, beams}, acc ->
- fun.(plt, apps, beams, acc)
- end)
- end
-
- defp check_plt(plt, apps, old_beams, {prev_plt, prev_beams, prev_cache}) do
- info("Finding applications for #{Path.basename(plt)}")
- cache = resolve_apps(apps, prev_cache)
- mods = cache_mod_diff(cache, prev_cache)
- info("Finding modules for #{Path.basename(plt)}")
- beams = resolve_modules(mods, prev_beams)
- check_beams(plt, beams, old_beams, prev_plt)
- {plt, beams, cache}
- end
-
- defp cache_mod_diff(new, old) do
- Enum.flat_map(new, fn {app, {mods, _deps}} ->
- case Map.has_key?(old, app) do
- true -> []
- false -> mods
- end
- end)
- end
-
- defp resolve_apps(apps, cache) do
- apps
- |> Enum.uniq()
- |> Enum.filter(&(not Map.has_key?(cache, &1)))
- |> Enum.map(&app_info/1)
- |> Enum.into(cache)
- end
-
- defp app_info(app) do
- app_file = Atom.to_charlist(app) ++ ~c".app"
-
- case :code.where_is_file(app_file) do
- :non_existing ->
- error("Unknown application #{inspect(app)}")
- {app, {[], []}}
-
- app_file ->
- Path.expand(app_file)
- |> read_app_info(app)
- end
- end
-
- defp read_app_info(app_file, app) do
- case :file.consult(app_file) do
- {:ok, [{:application, ^app, info}]} ->
- parse_app_info(info, app)
-
- {:error, reason} ->
- Mix.raise("Could not read #{app_file}: #{:file.format_error(reason)}")
- end
- end
-
- defp parse_app_info(info, app) do
- mods = Keyword.get(info, :modules, [])
- apps = Keyword.get(info, :applications, [])
- inc_apps = Keyword.get(info, :included_applications, [])
- runtime_deps = get_runtime_deps(info)
- {app, {mods, runtime_deps ++ inc_apps ++ apps}}
- end
-
- defp get_runtime_deps(info) do
- Keyword.get(info, :runtime_dependencies, [])
- |> Enum.map(&parse_runtime_dep/1)
- end
-
- defp parse_runtime_dep(runtime_dep) do
- runtime_dep = IO.chardata_to_string(runtime_dep)
- regex = ~r/^(.+)\-\d+(?|\.\d+)*$/
- [app] = Regex.run(regex, runtime_dep, capture: :all_but_first)
- String.to_atom(app)
- end
-
- defp resolve_modules(modules, beams) do
- Enum.reduce(modules, beams, &resolve_module/2)
- end
-
- defp resolve_module(module, beams) do
- beam = Atom.to_charlist(module) ++ ~c".beam"
-
- case :code.where_is_file(beam) do
- path when is_list(path) ->
- path = Path.expand(path)
- MapSet.put(beams, path)
-
- :non_existing ->
- error("Unknown module #{inspect(module)}")
- beams
- end
- end
-
- defp check_beams(plt, beams, nil, prev_plt) do
- plt_ensure(plt, prev_plt)
-
- case plt_files(plt) do
- nil ->
- Mix.raise("Could not open #{plt}: #{:file.format_error(:enoent)}")
-
- old_beams ->
- check_beams(plt, beams, old_beams)
- end
- end
-
- defp check_beams(plt, beams, old_beams, _prev_plt) do
- check_beams(plt, beams, old_beams)
- end
-
- defp check_beams(plt, beams, old_beams) do
- remove = MapSet.difference(old_beams, beams)
- plt_remove(plt, remove)
- check = MapSet.intersection(beams, old_beams)
- plt_check(plt, check)
- add = MapSet.difference(beams, old_beams)
- plt_add(plt, add)
- end
-
- defp plt_ensure(plt, nil), do: plt_new(plt)
- defp plt_ensure(plt, prev_plt), do: plt_copy(prev_plt, plt)
-
- defp plt_new(plt) do
- info("Creating #{Path.basename(plt)}")
- plt = erl_path(plt)
- _ = plt_run(analysis_type: :plt_build, output_plt: plt, apps: [:erts])
- :ok
- end
-
- defp plt_copy(plt, new_plt) do
- info("Copying #{Path.basename(plt)} to #{Path.basename(new_plt)}")
-
- new_plt
- |> Path.dirname()
- |> File.mkdir_p!()
-
- File.cp!(plt, new_plt)
- end
-
- defp plt_add(plt, files) do
- case MapSet.size(files) do
- 0 ->
- :ok
-
- n ->
- Mix.shell().info("Adding #{n} modules to #{Path.basename(plt)}")
- plt = erl_path(plt)
- files = erl_files(files)
-
- {duration_us, _} =
- :timer.tc(fn -> plt_run(analysis_type: :plt_add, init_plt: plt, files: files) end)
-
- Mix.shell().info(Formatter.formatted_time(duration_us))
- :ok
- end
- end
-
- defp plt_remove(plt, files) do
- case MapSet.size(files) do
- 0 ->
- :ok
-
- n ->
- info("Removing #{n} modules from #{Path.basename(plt)}")
- plt = erl_path(plt)
- files = erl_files(files)
- _ = plt_run(analysis_type: :plt_remove, init_plt: plt, files: files)
- :ok
- end
- end
-
- defp plt_check(plt, files) do
- case MapSet.size(files) do
- 0 ->
- :ok
-
- n ->
- Mix.shell().info("Checking #{n} modules in #{Path.basename(plt)}")
- plt = erl_path(plt)
- _ = plt_run(analysis_type: :plt_check, init_plt: plt)
- :ok
- end
- end
-
- defp plt_run(opts) do
- try do
- :dialyzer.run([check_plt: false] ++ opts)
- catch
- {:dialyzer_error, msg} ->
- error(color(":dialyzer.run error: #{msg}", :red))
- end
- end
-
- defp plt_info(plt) do
- erl_path(plt)
- |> :dialyzer.plt_info()
- end
-
- defp erl_files(files) do
- Enum.reduce(files, [], &[erl_path(&1) | &2])
- end
-
- defp erl_path(path) do
- encoding = :file.native_name_encoding()
- :unicode.characters_to_list(path, encoding)
- end
-
- defp plt_files(plt) do
- info("Looking up modules in #{Path.basename(plt)}")
-
- case plt_info(plt) do
- {:ok, info} ->
- Keyword.fetch!(info, :files)
- |> Enum.reduce(MapSet.new(), &MapSet.put(&2, Path.expand(&1)))
-
- {:error, :no_such_file} ->
- nil
-
- {:error, reason} ->
- Mix.raise("Could not open #{plt}: #{:file.format_error(reason)}")
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/project.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/project.ex
deleted file mode 100644
index cabfea72..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/project.ex
+++ /dev/null
@@ -1,471 +0,0 @@
-defmodule Dialyxir.Project do
- @moduledoc false
- import Dialyxir.Output
-
- alias Dialyxir.FilterMap
- alias Dialyxir.Formatter.Short
- alias Dialyxir.Formatter.Utils
-
- def plts_list(deps, include_project \\ true, exclude_core \\ false) do
- elixir_apps = [:elixir]
- erlang_apps = [:erts, :kernel, :stdlib, :crypto]
-
- core_plts =
- if exclude_core do
- []
- else
- [{elixir_plt(), elixir_apps}, {erlang_plt(), erlang_apps}]
- end
-
- if include_project do
- [{plt_file(), deps ++ elixir_apps ++ erlang_apps} | core_plts]
- else
- core_plts
- end
- end
-
- def plt_file() do
- plt_path(dialyzer_config()[:plt_file]) || deps_plt()
- end
-
- defp plt_path(file) when is_binary(file), do: Path.expand(file)
- defp plt_path({:no_warn, file}) when is_binary(file), do: Path.expand(file)
- defp plt_path(_), do: false
-
- def check_config do
- if is_binary(dialyzer_config()[:plt_file]) do
- warning("""
- Notice: :plt_file is deprecated as Dialyxir now uses project-private PLT files by default.
- If you want to use this setting without seeing this warning, provide it in a pair
- with the :no_warn key e.g. `dialyzer: plt_file: {:no_warn, "~/mypltfile"}`
- """)
- end
- end
-
- def cons_apps do
- # compile & load all deps paths
- _ = Mix.Tasks.Deps.Loadpaths.run([])
- # compile & load current project paths
- Mix.Task.run("compile")
- apps = plt_apps() || plt_add_apps() ++ include_deps()
-
- apps
- |> Enum.sort()
- |> Enum.uniq()
- |> Kernel.--(plt_ignore_apps())
- end
-
- def dialyzer_files do
- beam_files =
- dialyzer_paths()
- |> Enum.flat_map(&beam_files_with_paths/1)
- |> Map.new()
-
- consolidated_files =
- Mix.Project.consolidation_path()
- |> beam_files_with_paths()
- |> Enum.filter(fn {file_name, _path} -> beam_files |> Map.has_key?(file_name) end)
- |> Map.new()
-
- beam_files
- |> Map.merge(consolidated_files)
- |> Enum.map(fn {_file, path} -> path end)
- |> reject_exclude_files()
- |> Enum.map(&to_charlist(&1))
- end
-
- defp reject_exclude_files(files) do
- file_exclusions = dialyzer_config()[:exclude_files] || []
-
- Enum.reject(files, fn file ->
- :lists.any(
- fn reject_file_pattern ->
- re = <>
- result = :re.run(file, re)
-
- case result do
- {:match, _captured} -> true
- :nomatch -> false
- end
- end,
- file_exclusions
- )
- end)
- end
-
- defp dialyzer_paths do
- paths = dialyzer_config()[:paths] || default_paths()
- excluded_paths = dialyzer_config()[:excluded_paths] || []
- Enum.map(paths -- excluded_paths, &String.to_charlist/1)
- end
-
- defp beam_files_with_paths(path) do
- path |> Path.join("*.beam") |> Path.wildcard() |> Enum.map(&{Path.basename(&1), &1})
- end
-
- def dialyzer_removed_defaults do
- dialyzer_config()[:remove_defaults] || []
- end
-
- def dialyzer_flags do
- Mix.Project.config()[:dialyzer][:flags] || []
- end
-
- def no_umbrella? do
- case dialyzer_config()[:no_umbrella] do
- true -> true
- _other -> false
- end
- end
-
- defp skip?({file, warning, line}, {file, warning, line, _, _}), do: true
-
- defp skip?({file, warning_description}, {file, _, _, _, warning_description})
- when is_binary(warning_description),
- do: true
-
- defp skip?({file, warning}, {file, warning, _, _, _}) when is_atom(warning), do: true
- defp skip?({file}, {file, _, _, _, _}), do: true
-
- defp skip?({short_description, warning, line}, {_, warning, line, short_description, _}),
- do: true
-
- defp skip?({short_description, warning}, {_, warning, _, short_description, _}), do: true
- defp skip?({short_description}, {_, _, _, short_description, _}), do: true
-
- defp skip?(%Regex{} = pattern, {_, _, _, short_description, _}) do
- Regex.match?(pattern, short_description)
- end
-
- defp skip?(_, _), do: false
-
- def filter_warning?(
- {_, {file, line}, {warning_type, args}} = warning,
- filter_map = %FilterMap{}
- ) do
- short_description = Short.format(warning)
- warning_description = Utils.warning(warning_type).format_short(args)
-
- {matching_filters, _non_matching_filters} =
- filter_map
- |> FilterMap.filters()
- |> Enum.split_with(
- &skip?(&1, {to_string(file), warning_type, line, short_description, warning_description})
- )
-
- {not Enum.empty?(matching_filters), matching_filters}
- end
-
- def filter_map(args) do
- cond do
- legacy_ignore_warnings?() ->
- %FilterMap{}
-
- dialyzer_ignore_warnings() == nil && !File.exists?(default_ignore_warnings()) ->
- %FilterMap{}
-
- true ->
- ignore_file = dialyzer_ignore_warnings() || default_ignore_warnings()
-
- FilterMap.from_file(ignore_file, list_unused_filters?(args), ignore_exit_status?(args))
- end
- end
-
- def filter_legacy_warnings(output) do
- ignore_file = dialyzer_ignore_warnings()
-
- if legacy_ignore_warnings?() do
- pattern = File.read!(ignore_file)
- filter_legacy_warnings(output, pattern)
- else
- output
- end
- end
-
- def filter_legacy_warnings(output, nil), do: output
- def filter_legacy_warnings(output, ""), do: output
-
- def filter_legacy_warnings(output, pattern) do
- lines = Enum.map(output, &String.trim_trailing/1)
-
- patterns =
- pattern
- |> String.trim_trailing("\n")
- |> String.split("\n")
- |> Enum.reject(&(&1 == ""))
-
- try do
- Enum.reject(lines, fn line ->
- Enum.any?(patterns, &String.contains?(line, &1))
- end)
- rescue
- _ ->
- output
- end
- end
-
- @spec legacy_ignore_warnings?() :: boolean
- defp legacy_ignore_warnings?() do
- case dialyzer_ignore_warnings() do
- nil ->
- false
-
- ignore_file ->
- !String.ends_with?(ignore_file, ".exs")
- end
- end
-
- def default_ignore_warnings() do
- ".dialyzer_ignore.exs"
- end
-
- def dialyzer_ignore_warnings() do
- dialyzer_config()[:ignore_warnings]
- end
-
- def list_unused_filters?(args) do
- case Keyword.fetch(args, :list_unused_filters) do
- {:ok, list_unused_filters} when not is_nil(list_unused_filters) ->
- list_unused_filters
-
- _else ->
- dialyzer_config()[:list_unused_filters]
- end
- end
-
- defp ignore_exit_status?(args) do
- args[:ignore_exit_status]
- end
-
- def elixir_plt() do
- global_plt("erlang-#{otp_vsn()}_elixir-#{System.version()}")
- end
-
- def erlang_plt(), do: global_plt("erlang-" <> otp_vsn())
-
- defp otp_vsn() do
- major = :erlang.system_info(:otp_release) |> List.to_string()
- vsn_file = Path.join([:code.root_dir(), "releases", major, "OTP_VERSION"])
-
- try do
- {:ok, contents} = File.read(vsn_file)
- String.split(contents, "\n", trim: true)
- else
- [full] ->
- full
-
- _ ->
- major
- catch
- :error, _ ->
- major
- end
- end
-
- def deps_plt() do
- name = "erlang-#{otp_vsn()}_elixir-#{System.version()}_deps-#{build_env()}"
- local_plt(name)
- end
-
- defp build_env() do
- config = Mix.Project.config()
-
- case Keyword.fetch!(config, :build_per_environment) do
- true -> Atom.to_string(Mix.env())
- false -> "shared"
- end
- end
-
- defp global_plt(name) do
- Path.join(core_path(), "dialyxir_" <> name <> ".plt")
- end
-
- defp core_path(), do: dialyzer_config()[:plt_core_path] || Mix.Utils.mix_home()
-
- defp local_plt(name) do
- Path.join(local_path(), "dialyxir_" <> name <> ".plt")
- end
-
- defp local_path(), do: dialyzer_config()[:plt_local_path] || Mix.Project.build_path()
-
- defp default_paths() do
- reduce_umbrella_children([], fn paths ->
- [Mix.Project.compile_path() | paths]
- end)
- end
-
- defp plt_apps, do: dialyzer_config()[:plt_apps] |> load_apps()
- defp plt_add_apps, do: dialyzer_config()[:plt_add_apps] || [] |> load_apps()
- defp plt_ignore_apps, do: dialyzer_config()[:plt_ignore_apps] || []
-
- defp load_apps(nil), do: nil
-
- defp load_apps(apps) do
- Enum.each(apps, &Application.load/1)
- apps
- end
-
- defp include_deps do
- method = dialyzer_config()[:plt_add_deps]
-
- reduce_umbrella_children([], fn deps ->
- deps ++
- case method do
- false ->
- []
-
- # compatibility
- true ->
- warning(
- "Dialyxir has deprecated plt_add_deps: true in favor of apps_direct, which includes only runtime dependencies."
- )
-
- deps_project() ++ deps_app(false)
-
- :project ->
- warning(
- "Dialyxir has deprecated plt_add_deps: :project in favor of apps_direct, which includes only runtime dependencies."
- )
-
- deps_project() ++ deps_app(false)
-
- :apps_direct ->
- deps_app(false)
-
- :transitive ->
- warning(
- "Dialyxir has deprecated plt_add_deps: :transitive in favor of app_tree, which includes only runtime dependencies."
- )
-
- deps_transitive() ++ deps_app(true)
-
- _app_tree ->
- deps_app(true)
- end
- end)
- end
-
- defp deps_project do
- Mix.Project.config()[:deps]
- |> Enum.filter(&env_dep(&1))
- |> Enum.map(&elem(&1, 0))
- end
-
- defp deps_transitive do
- Mix.Project.deps_paths()
- |> Map.keys()
- end
-
- @spec deps_app(boolean()) :: [atom]
- defp deps_app(recursive) do
- app = Mix.Project.config()[:app]
- deps_app(app, recursive)
- end
-
- if System.version() |> Version.parse!() |> then(&(&1.major >= 1 and &1.minor >= 15)) do
- @spec deps_app(atom(), boolean()) :: [atom()]
- defp deps_app(app, recursive) do
- case do_load_app(app) do
- :ok ->
- with_each =
- if recursive do
- &deps_app(&1, true)
- else
- fn _ -> [] end
- end
-
- # Identify the optional applications which can't be loaded and thus not available
- missing_apps =
- Application.spec(app, :optional_applications)
- |> List.wrap()
- |> Enum.reject(&(do_load_app(&1) == :ok))
-
- # Remove the optional applications which are not available from all the applications
- required_apps =
- Application.spec(app, :applications)
- |> List.wrap()
- |> Enum.reject(&(&1 in missing_apps))
-
- required_apps |> Stream.flat_map(&with_each.(&1)) |> Enum.concat(required_apps)
-
- {:error, err} ->
- error("Error loading #{app}, dependency list may be incomplete.\n #{inspect(err)}")
-
- []
- end
- end
- else
- @spec deps_app(atom(), boolean()) :: [atom()]
- defp deps_app(app, recursive) do
- with_each =
- if recursive do
- &deps_app(&1, true)
- else
- fn _ -> [] end
- end
-
- case do_load_app(app) do
- :ok ->
- nil
-
- {:error, err} ->
- error("Error loading #{app}, dependency list may be incomplete.\n #{inspect(err)}")
-
- nil
- end
-
- case Application.spec(app, :applications) do
- [] ->
- []
-
- nil ->
- []
-
- this_apps ->
- Enum.map(this_apps, with_each)
- |> List.flatten()
- |> Enum.concat(this_apps)
- end
- end
- end
-
- @spec do_load_app(atom()) :: :ok | {:error, term()}
- defp do_load_app(app) do
- case Application.load(app) do
- :ok ->
- :ok
-
- {:error, {:already_loaded, _}} ->
- :ok
-
- {:error, err} ->
- {:error, err}
- end
- end
-
- defp env_dep(dep) do
- only_envs = dep_only(dep)
- only_envs == nil || Mix.env() in List.wrap(only_envs)
- end
-
- defp dep_only({_, opts}) when is_list(opts), do: opts[:only]
- defp dep_only({_, _, opts}) when is_list(opts), do: opts[:only]
- defp dep_only(_), do: nil
-
- @spec reduce_umbrella_children(list(), (list() -> list())) :: list()
- defp reduce_umbrella_children(acc, f) do
- if Mix.Project.umbrella?() do
- children = Mix.Dep.Umbrella.loaded()
-
- Enum.reduce(children, acc, fn child, acc ->
- Mix.Project.in_project(child.app, child.opts[:path], fn _ ->
- reduce_umbrella_children(acc, f)
- end)
- end)
- else
- f.(acc)
- end
- end
-
- defp dialyzer_config(), do: Mix.Project.config()[:dialyzer]
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning.ex
deleted file mode 100644
index b3e7a79f..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Dialyxir.Warning do
- @moduledoc """
- Behaviour for defining warning semantics.
-
- Contains callbacks for various warnings
- """
-
- @doc """
- By expressing the warning that is to be matched on, error handling
- and dispatching can be avoided in format functions.
- """
- @callback warning() :: atom
-
- @doc """
- The default documentation when seeing an error without the user
- otherwise overriding the format.
- """
- @callback format_long([String.t()] | {String.t(), String.t(), String.t()} | String.t()) ::
- String.t()
-
- @doc """
- A short message, often missing things like success types and expected types for space.
- """
- @callback format_short([String.t()] | {String.t(), String.t(), String.t()} | String.t()) ::
- String.t()
-
- @doc """
- Explanation for a warning of this type. Should include a simple example of how to trigger it.
- """
- @callback explain() :: String.t()
-
- @spec default_explain() :: String.t()
- def default_explain() do
- """
- This warning type does not have an explanation yet. If you have
- code that causes it, please file an issue or pull request in
- https://github.com/jeremyjh/dialyxir/issues
- """
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning_helpers.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning_helpers.ex
deleted file mode 100644
index c40f55a6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warning_helpers.ex
+++ /dev/null
@@ -1,86 +0,0 @@
-defmodule Dialyxir.WarningHelpers do
- @spec ordinal(non_neg_integer) :: String.t()
- def ordinal(1), do: "1st"
- def ordinal(2), do: "2nd"
- def ordinal(3), do: "3rd"
- def ordinal(n) when is_integer(n), do: "#{n}th"
-
- def call_or_apply_to_string(
- arg_positions,
- :only_sig,
- signature_args,
- _signature_return,
- {_overloaded?, _contract}
- ) do
- pretty_signature_args = Erlex.pretty_print_args(signature_args)
-
- if Enum.empty?(arg_positions) do
- # We do not know which argument(s) caused the failure
- """
- will never return since the success typing arguments are
- #{pretty_signature_args}
- """
- else
- positions = form_position_string(arg_positions)
-
- """
- will never return since the #{positions} arguments differ
- from the success typing arguments:
-
- #{pretty_signature_args}
- """
- end
- end
-
- def call_or_apply_to_string(
- arg_positions,
- :only_contract,
- _signature_args,
- _signature_return,
- {overloaded?, contract}
- ) do
- pretty_contract = Erlex.pretty_print_contract(contract)
-
- if Enum.empty?(arg_positions) || overloaded? do
- # We do not know which arguments caused the failure
- """
- breaks the contract
- #{pretty_contract}
- """
- else
- position_string = form_position_string(arg_positions)
-
- """
- breaks the contract
- #{pretty_contract}
-
- in #{position_string} argument
- """
- end
- end
-
- def call_or_apply_to_string(
- _arg_positions,
- :both,
- signature_args,
- signature_return,
- {_overloaded?, contract}
- ) do
- pretty_contract = Erlex.pretty_print_contract(contract)
-
- pretty_print_signature =
- Erlex.pretty_print_contract("#{signature_args} -> #{signature_return}")
-
- """
- will never return since the success typing is:
- #{pretty_print_signature}
-
- and the contract is
- #{pretty_contract}
- """
- end
-
- def form_position_string(arg_positions) do
- Enum.map_join(arg_positions, " and ", &ordinal/1)
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings.ex
deleted file mode 100644
index 9e1b2216..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-defmodule Dialyxir.Warnings do
- @warnings Enum.into(
- [
- Dialyxir.Warnings.AppCall,
- Dialyxir.Warnings.Apply,
- Dialyxir.Warnings.BinaryConstruction,
- Dialyxir.Warnings.Call,
- Dialyxir.Warnings.CallToMissingFunction,
- Dialyxir.Warnings.CallWithOpaque,
- Dialyxir.Warnings.CallWithoutOpaque,
- Dialyxir.Warnings.CallbackArgumentTypeMismatch,
- Dialyxir.Warnings.CallbackInfoMissing,
- Dialyxir.Warnings.CallbackMissing,
- Dialyxir.Warnings.CallbackNotExported,
- Dialyxir.Warnings.CallbackSpecArgumentTypeMismatch,
- Dialyxir.Warnings.CallbackSpecTypeMismatch,
- Dialyxir.Warnings.CallbackTypeMismatch,
- Dialyxir.Warnings.ContractDiff,
- Dialyxir.Warnings.ContractRange,
- Dialyxir.Warnings.ContractSubtype,
- Dialyxir.Warnings.ContractSupertype,
- Dialyxir.Warnings.ContractWithOpaque,
- Dialyxir.Warnings.ExactEquality,
- Dialyxir.Warnings.ExtraRange,
- Dialyxir.Warnings.FunctionApplicationArguments,
- Dialyxir.Warnings.FunctionApplicationNoFunction,
- Dialyxir.Warnings.GuardFail,
- Dialyxir.Warnings.GuardFailPattern,
- Dialyxir.Warnings.ImproperListConstruction,
- Dialyxir.Warnings.InvalidContract,
- Dialyxir.Warnings.MapUpdate,
- Dialyxir.Warnings.MissingRange,
- Dialyxir.Warnings.NegativeGuardFail,
- Dialyxir.Warnings.NoReturn,
- Dialyxir.Warnings.OpaqueGuard,
- Dialyxir.Warnings.OpaqueEquality,
- Dialyxir.Warnings.OpaqueMatch,
- Dialyxir.Warnings.OpaqueNonequality,
- Dialyxir.Warnings.OpaqueTypeTest,
- Dialyxir.Warnings.OverlappingContract,
- Dialyxir.Warnings.PatternMatch,
- Dialyxir.Warnings.PatternMatchCovered,
- Dialyxir.Warnings.RecordConstruction,
- Dialyxir.Warnings.RecordMatching,
- Dialyxir.Warnings.UnknownBehaviour,
- Dialyxir.Warnings.UnknownFunction,
- Dialyxir.Warnings.UnknownType,
- Dialyxir.Warnings.UnmatchedReturn,
- Dialyxir.Warnings.UnusedFunction
- ],
- %{},
- fn warning -> {warning.warning(), warning} end
- )
-
- @doc """
- Returns a mapping of the warning to the warning module.
- """
- def warnings(), do: @warnings
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/app_call.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/app_call.ex
deleted file mode 100644
index 9b4bdf5a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/app_call.ex
+++ /dev/null
@@ -1,30 +0,0 @@
-defmodule Dialyxir.Warnings.AppCall do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :app_call
- def warning(), do: :app_call
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Module or function to apply is not an atom in #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, culprit, expected_type, actual_type]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_expected_type = Erlex.pretty_print_type(expected_type)
- pretty_actual_type = Erlex.pretty_print_type(actual_type)
-
- "The call #{pretty_module}.#{function}/#{arity} requires that " <>
- "#{culprit} is of type #{pretty_expected_type}, not #{pretty_actual_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/apply.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/apply.ex
deleted file mode 100644
index 49bd6c51..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/apply.ex
+++ /dev/null
@@ -1,51 +0,0 @@
-defmodule Dialyxir.Warnings.Apply do
- @moduledoc """
- The function being invoked exists, and has the correct arity, but
- will not succeed.
-
- ## Example
-
- defmodule Example do
- def ok() do
- fun = fn :ok -> :ok end
- fun.(:error)
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :apply
- def warning(), do: :apply
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([args | _]) do
- pretty_args = Erlex.pretty_print_args(args)
- "Function application with args #{pretty_args} will not succeed."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([args, arg_positions, fail_reason, signature_args, signature_return, contract]) do
- pretty_args = Erlex.pretty_print_args(args)
-
- call_string =
- Dialyxir.WarningHelpers.call_or_apply_to_string(
- arg_positions,
- fail_reason,
- signature_args,
- signature_return,
- contract
- )
-
- "Function application with arguments #{pretty_args} #{call_string}"
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/binary_construction.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/binary_construction.ex
deleted file mode 100644
index 1553aa5e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/binary_construction.ex
+++ /dev/null
@@ -1,28 +0,0 @@
-defmodule Dialyxir.Warnings.BinaryConstruction do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :bin_construction
- def warning(), do: :bin_construction
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([culprit | _]) do
- "Binary construction with #{culprit} will fail."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([culprit, size, segment, type]) do
- pretty_type = Erlex.pretty_print_type(type)
-
- "Binary construction will fail since the #{culprit} field #{size} in " <>
- "segment #{segment} has type #{pretty_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call.ex
deleted file mode 100644
index d318cbc6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call.ex
+++ /dev/null
@@ -1,68 +0,0 @@
-defmodule Dialyxir.Warnings.Call do
- @moduledoc """
- The function call will not succeed.
-
- ## Example
-
- defmodule Example do
- def ok() do
- ok(:error)
- end
-
- def ok(:ok) do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :call
- def warning(), do: :call
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "The function call #{function} will not succeed."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([
- module,
- function,
- args,
- arg_positions,
- fail_reason,
- signature_args,
- signature_return,
- contract
- ]) do
- pretty_args = Erlex.pretty_print_args(args)
- pretty_module = Erlex.pretty_print(module)
-
- call_string =
- Dialyxir.WarningHelpers.call_or_apply_to_string(
- arg_positions,
- fail_reason,
- signature_args,
- signature_return,
- contract
- )
-
- """
- The function call will not succeed.
-
- #{pretty_module}.#{function}#{pretty_args}
-
- #{String.trim_trailing(call_string)}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_to_missing_function.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_to_missing_function.ex
deleted file mode 100644
index 69b7b9c2..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_to_missing_function.ex
+++ /dev/null
@@ -1,47 +0,0 @@
-defmodule Dialyxir.Warnings.CallToMissingFunction do
- @moduledoc """
- Function calls a missing or private function. This may be caused by
- a typo or incorrect arity. This is also a compiler warning.
-
- ## Example
-
- defmodule Missing do
- def missing(:ok) do
- :ok
- end
-
- defp missing() do
- :ok
- end
- end
-
- defmodule Example do
- def error() do
- Missing.missing()
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :call_to_missing
- def warning(), do: :call_to_missing
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity]) do
- pretty_module = Erlex.pretty_print(module)
- "Call to missing or private function #{pretty_module}.#{function}/#{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_with_opaque.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_with_opaque.ex
deleted file mode 100644
index 411b9ab2..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_with_opaque.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Dialyxir.Warnings.CallWithOpaque do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :call_with_opaque
- def warning(), do: :call_with_opaque
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Type mismatch in call with opaque term in #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, args, arg_positions, expected_args]) do
- pretty_module = Erlex.pretty_print(module)
-
- "The call #{pretty_module}.#{function}#{args} contains #{form_positions(arg_positions)} " <>
- "when #{form_expected(expected_args)}}."
- end
-
- defp form_positions(arg_positions = [_]) do
- form_position_string = Dialyxir.WarningHelpers.form_position_string(arg_positions)
- "an opaque term in #{form_position_string} argument"
- end
-
- defp form_positions(arg_positions) do
- form_position_string = Dialyxir.WarningHelpers.form_position_string(arg_positions)
- "opaque terms in #{form_position_string} arguments"
- end
-
- defp form_expected([type]) do
- type_string = :erl_types.t_to_string(type)
-
- if :erl_types.t_is_opaque(type) do
- "an opaque term of type #{type_string} is expected"
- else
- "a structured term of type #{type_string} is expected"
- end
- end
-
- defp form_expected(_expected_args) do
- "terms of different types are expected in these positions"
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_without_opaque.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_without_opaque.ex
deleted file mode 100644
index fb5f434a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/call_without_opaque.ex
+++ /dev/null
@@ -1,79 +0,0 @@
-defmodule Dialyxir.Warnings.CallWithoutOpaque do
- @moduledoc """
- Function call without opaqueness type mismatch.
-
- ## Example
-
- defmodule OpaqueStruct do
- defstruct [:opaque]
-
- @opaque t :: %OpaqueStruct{}
- end
-
- defmodule Example do
- @spec error(OpaqueStruct.t()) :: :error
- def error(struct = %OpaqueStruct{}) do
- do_error(struct)
- end
-
- @spec do_error(OpaqueStruct.t()) :: :error
- defp do_error(_) do
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :call_without_opaque
- def warning(), do: :call_without_opaque
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Type mismatch in call without opaque term in #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, args, expected_triples]) do
- expected = form_expected_without_opaque(expected_triples)
- pretty_module = Erlex.pretty_print(module)
- pretty_args = Erlex.pretty_print_args(args)
-
- """
- Function call without opaqueness type mismatch.
-
- Call does not have expected #{expected}.
-
- #{pretty_module}.#{function}#{pretty_args}
- """
- end
-
- # We know which positions N are to blame;
- # the list of triples will never be empty.
- defp form_expected_without_opaque([{position, type, type_string}]) do
- pretty_type = Erlex.pretty_print_type(type_string)
- form_position_string = Dialyxir.WarningHelpers.form_position_string([position])
-
- if :erl_types.t_is_opaque(type) do
- "opaque term of type #{pretty_type} in the #{form_position_string} position"
- else
- "term of type #{pretty_type} (with opaque subterms) in the #{form_position_string} position"
- end
- end
-
- # TODO: can do much better here
- defp form_expected_without_opaque(expected_triples) do
- {arg_positions, _typess, _type_strings} = :lists.unzip3(expected_triples)
- form_position_string = Dialyxir.WarningHelpers.form_position_string(arg_positions)
- "opaque terms in the #{form_position_string} position"
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_argument_type_mismatch.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_argument_type_mismatch.ex
deleted file mode 100644
index 2fb4c592..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_argument_type_mismatch.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackArgumentTypeMismatch do
- @moduledoc """
- Type of argument does not match the callback's expected type.
-
- ## Example
-
- defmodule ExampleBehaviour do
- @callback ok(:ok) :: :ok
- end
-
- defmodule Example do
-
- @behaviour ExampleBehaviour
-
- def ok(:error) do
- :ok
- end
- end
- """
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_arg_type_mismatch
- def warning(), do: :callback_arg_type_mismatch
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_behaviour, function, arity | _]) do
- "Type mismatch with behaviour callback to #{function}/#{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour, function, arity, position, success_type, callback_type]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
- pretty_success_type = Erlex.pretty_print_type(success_type)
- pretty_callback_type = Erlex.pretty_print_type(callback_type)
- ordinal_position = Dialyxir.WarningHelpers.ordinal(position)
-
- """
- The inferred type for the #{ordinal_position} argument is not a
- supertype of the expected type for the #{function}/#{arity} callback
- in the #{pretty_behaviour} behaviour.
-
- Success type:
- #{pretty_success_type}
-
- Behaviour callback type:
- #{pretty_callback_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_info_missing.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_info_missing.ex
deleted file mode 100644
index c09ca904..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_info_missing.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackInfoMissing do
- @moduledoc """
- The module is using a behaviour that does not exist or is not a
- behaviour. This is also a compiler warning.
-
- ## Example
-
- defmodule Example do
- @behaviour BehaviourThatDoesNotExist
-
- def ok() do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_info_missing
- def warning(), do: :callback_info_missing
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
-
- "Callback info about the #{pretty_behaviour} behaviour is not available."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_missing.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_missing.ex
deleted file mode 100644
index 322e137f..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_missing.ex
+++ /dev/null
@@ -1,45 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackMissing do
- @moduledoc """
- Module implements a behaviour, but does not have all of its
- callbacks. This is also a compiler warning.
-
- ## Example
-
- defmodule ExampleBehaviour do
- @callback ok() :: :ok
- @callback missing() :: :ok
- end
-
- defmodule Example do
- @behaviour ExampleBehaviour
-
- def ok() do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_missing
- def warning(), do: :callback_missing
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour, function, arity]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
-
- "Undefined callback function #{function}/#{arity} (behaviour #{pretty_behaviour})."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_not_exported.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_not_exported.ex
deleted file mode 100644
index c1f8da3f..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_not_exported.ex
+++ /dev/null
@@ -1,57 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackNotExported do
- @moduledoc """
- Module implements a behaviour, but does not export some of its
- callbacks.
-
- ## Example
- defmodule Example do
- @behaviour GenServer
-
- def init(_) do
- :ok
- end
-
- # OK. No warning.
- def handle_all(_request, _from, state) do
- {:noreply, state}
- end
-
- # Not exported. Should be a warning.
- @spec handle_cast(any(), any()) :: binary()
- defp handle_cast(_request, _state) do
- "abc"
- end
-
- # Not exported and conflicting arguments and return value. No warning
- # since format_status/1 is an optional callback.
- @spec format_status(binary()) :: binary()
- def format_status(bin) when is_binary(bin) do
- bin
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_not_exported
- def warning(), do: :callback_not_exported
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour, function, arity]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
-
- "Callback function #{function}/#{arity} exists but is not exported (behaviour #{pretty_behaviour})."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_argument_type_mismatch.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_argument_type_mismatch.ex
deleted file mode 100644
index bf124f16..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_argument_type_mismatch.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackSpecArgumentTypeMismatch do
- @moduledoc """
- Spec type of argument does not match the callback's expected type.
-
- ## Example
-
- defmodule ExampleBehaviour do
- @callback ok(:ok) :: :ok
- end
-
- defmodule Example do
- @behaviour ExampleBehaviour
-
- @spec ok(:error) :: :ok
- def ok(:ok) do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_spec_arg_type_mismatch
- def warning(), do: :callback_spec_arg_type_mismatch
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_behaviour, function | _]) do
- "Spec type mismatch in argument to callback #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour, function, arity, position, success_type, callback_type]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
- pretty_success_type = Erlex.pretty_print_type(success_type)
- pretty_callback_type = Erlex.pretty_print_type(callback_type)
- ordinal_position = Dialyxir.WarningHelpers.ordinal(position)
-
- """
- The @spec type for the #{ordinal_position} argument is not a
- supertype of the expected type for the #{function}/#{arity} callback
- in the #{pretty_behaviour} behaviour.
-
- Success type:
- #{pretty_success_type}
-
- Behaviour callback type:
- #{pretty_callback_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_type_mismatch.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_type_mismatch.ex
deleted file mode 100644
index c9eac9f6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_spec_type_mismatch.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackSpecTypeMismatch do
- @moduledoc """
- The return type in the @spec does not match the
- expected return type of the behaviour.
-
- ## Example
-
- defmodule ExampleBehaviour do
- @callback ok(:ok) :: :ok
- end
-
- defmodule Example do
- @behaviour ExampleBehaviour
-
- @spec ok(:ok) :: :error
- def ok(:ok) do
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_spec_type_mismatch
- def warning(), do: :callback_spec_type_mismatch
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_behaviour, function | _]) do
- "The @spec return type does not match the expected return type for #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([behaviour, function, arity, success_type, callback_type]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
- pretty_success_type = Erlex.pretty_print_type(success_type)
- pretty_callback_type = Erlex.pretty_print_type(callback_type)
-
- """
- The @spec return type does not match the expected return type
- for #{function}/#{arity} callback in #{pretty_behaviour} behaviour.
-
- Actual:
- @spec #{function}(...) :: #{pretty_success_type}
-
- Expected:
- @spec #{function}(...) :: #{pretty_callback_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_type_mismatch.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_type_mismatch.ex
deleted file mode 100644
index 34ff6b7e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/callback_type_mismatch.ex
+++ /dev/null
@@ -1,56 +0,0 @@
-defmodule Dialyxir.Warnings.CallbackTypeMismatch do
- @moduledoc """
- The success type of the function does not match the callback type in
- the behaviour.
-
- ## Example
-
- defmodule ExampleBehaviour do
- @callback ok() :: :ok
- end
-
- defmodule Example do
- @behaviour ExampleBehaviour
-
- def ok() do
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :callback_type_mismatch
- def warning(), do: :callback_type_mismatch
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_behaviour, function | _]) do
- "Type mismatch for @callback #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t() | non_neg_integer]) :: String.t()
- def format_long([behaviour, function, arity, fail_type, success_type]) do
- pretty_behaviour = Erlex.pretty_print(behaviour)
- pretty_fail_type = Erlex.pretty_print_type(fail_type)
- pretty_success_type = Erlex.pretty_print_type(success_type)
-
- """
- Type mismatch for @callback #{function}/#{arity} in #{pretty_behaviour} behaviour.
-
- Expected type:
- #{pretty_success_type}
-
- Actual type:
- #{pretty_fail_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_diff.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_diff.ex
deleted file mode 100644
index 804529a6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_diff.ex
+++ /dev/null
@@ -1,40 +0,0 @@
-defmodule Dialyxir.Warnings.ContractDiff do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :contract_diff
- def warning(), do: :contract_diff
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Type specification is not equal to the success typing for #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, contract, signature]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_contract = Erlex.pretty_print_contract(contract)
- pretty_signature = Erlex.pretty_print_contract(signature)
-
- """
- Type specification is not equal to the success typing.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Type specification:
- #{pretty_contract}
-
- Success typing:
- #{pretty_signature}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_range.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_range.ex
deleted file mode 100644
index 10c3b4ae..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_range.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Dialyxir.Warnings.ContractRange do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :contract_range
- def warning(), do: :contract_range
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_, _, function | _]) do
- "Contract cannot be correct because return type for #{function} is mismatched."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([contract, module, function, arg_strings, line, contract_return]) do
- pretty_contract = Erlex.pretty_print_contract(contract)
- pretty_module = Erlex.pretty_print(module)
- pretty_contract_return = Erlex.pretty_print_type(contract_return)
- pretty_args = Erlex.pretty_print_args(arg_strings)
-
- """
- Contract cannot be correct because return type on line number #{line} is mismatched.
-
- Function:
- #{pretty_module}.#{function}#{pretty_args}
-
- Type specification:
- #{pretty_contract}
-
- Success typing (line #{line}):
- #{pretty_contract_return}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_subtype.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_subtype.ex
deleted file mode 100644
index 30f4d660..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_subtype.ex
+++ /dev/null
@@ -1,59 +0,0 @@
-defmodule Dialyxir.Warnings.ContractSubtype do
- # TODO: could not create warning with this example (and --overspecs)
- @moduledoc """
- The type in the @spec does not completely cover the types returned
- by function.
-
- ## Example
-
- defmodule Example do
- @spec ok(:ok | :error) :: :ok
- def ok(:ok) do
- :ok
- end
-
- def ok(:error) do
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :contract_subtype
- def warning(), do: :contract_subtype
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Type specification for #{function} is a subtype of the success typing."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, contract, signature]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_signature = Erlex.pretty_print_contract(signature)
- pretty_contract = Erlex.pretty_print_contract(contract, module, function)
-
- """
- Type specification is a subtype of the success typing.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Type specification:
- @spec #{function}#{pretty_contract}
-
- Success typing:
- @spec #{function}#{pretty_signature}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_supertype.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_supertype.ex
deleted file mode 100644
index ff711bc2..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_supertype.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule Dialyxir.Warnings.ContractSupertype do
- @moduledoc """
- The @spec, while not incorrect, is more general than the type
- returned by the function.
-
- ## Example
-
- defmodule Example do
- @spec ok() :: any
- def ok() do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :contract_supertype
- def warning(), do: :contract_supertype
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Type specification for #{function} is a supertype of the success typing."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, contract, signature]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_contract = Erlex.pretty_print_contract(contract)
- pretty_signature = Erlex.pretty_print_contract(signature)
-
- """
- Type specification is a supertype of the success typing.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Type specification:
- @spec #{function}#{pretty_contract}
-
- Success typing:
- @spec #{function}#{pretty_signature}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_with_opaque.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_with_opaque.ex
deleted file mode 100644
index a517b996..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/contract_with_opaque.ex
+++ /dev/null
@@ -1,53 +0,0 @@
-defmodule Dialyxir.Warnings.ContractWithOpaque do
- @moduledoc """
- The @spec says the function is returning an opaque type, but it is
- returning a different type.
-
- ## Example
-
- defmodule Types do
- @opaque type :: :ok
- end
-
- defmodule Example do
- @spec ok() :: Types.type()
- def ok() do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :contract_with_opaque
- def warning(), do: :contract_with_opaque
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "The @spec for #{function} has an opaque subtype which is violated by the success typing."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, type, signature_type]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_type = Erlex.pretty_print_type(type)
- pretty_success_type = Erlex.pretty_print_contract(signature_type)
-
- """
- The @spec for #{pretty_module}.#{function}/#{arity} has an opaque
- subtype #{pretty_type} which is violated by the success typing.
-
- Success typing:
- #{pretty_success_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/exact_equality.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/exact_equality.ex
deleted file mode 100644
index 6b6331ee..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/exact_equality.ex
+++ /dev/null
@@ -1,38 +0,0 @@
-defmodule Dialyxir.Warnings.ExactEquality do
- @moduledoc """
- The expression can never evaluate to true.
-
- ## Example
-
- defmodule Example do
- def ok() do
- :ok == :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :exact_eq
- def warning(), do: :exact_eq
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([type1, op, type2]) do
- pretty_type1 = Erlex.pretty_print_type(type1)
- pretty_type2 = Erlex.pretty_print_type(type2)
-
- "The test #{pretty_type1} #{op} #{pretty_type2} can never evaluate to 'true'."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/extra_range.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/extra_range.ex
deleted file mode 100644
index 6764b21a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/extra_range.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule Dialyxir.Warnings.ExtraRange do
- @moduledoc """
- The @spec says the function returns more types than the function
- actually returns.
-
- ## Example
-
- defmodule Example do
- @spec ok() :: :ok | :error
- def ok() do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :extra_range
- def warning(), do: :extra_range
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "@spec for #{function} has more types than are returned by the function."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, extra_ranges, signature_range]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_extra = Erlex.pretty_print_type(extra_ranges)
- pretty_signature = Erlex.pretty_print_type(signature_range)
-
- """
- The type specification has too many types for the function.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Extra type:
- #{pretty_extra}
-
- Success typing:
- #{pretty_signature}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_arguments.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_arguments.ex
deleted file mode 100644
index d6cc101c..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_arguments.ex
+++ /dev/null
@@ -1,56 +0,0 @@
-defmodule Dialyxir.Warnings.FunctionApplicationArguments do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :fun_app_args
- def warning(), do: :fun_app_args
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([args, _type]) do
- pretty_args = Erlex.pretty_print_args(args)
- "Function application with #{pretty_args} will fail."
- end
-
- # OTP 22+ format
- def format_short([_arg_positions, args, type]) do
- format_short([args, type])
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([args, type]) do
- pretty_args = Erlex.pretty_print_args(args)
- pretty_type = Erlex.pretty_print(type)
-
- "Function application with arguments #{pretty_args} will fail, " <>
- "because the function has type #{pretty_type}."
- end
-
- # OTP 22+ format
- def format_long([arg_positions, args, type]) do
- pretty_arg_positions = form_positions(arg_positions)
- pretty_args = Erlex.pretty_print_args(args)
- pretty_type = Erlex.pretty_print(type)
-
- "Function application with arguments #{pretty_args} will fail, " <>
- "because the function has type #{pretty_type}, " <>
- "which differs in #{pretty_arg_positions}."
- end
-
- defp form_positions(arg_positions = [_]) do
- form_position_string = Dialyxir.WarningHelpers.form_position_string(arg_positions)
- "the #{form_position_string} argument"
- end
-
- defp form_positions(arg_positions) do
- form_position_string = Dialyxir.WarningHelpers.form_position_string(arg_positions)
- "the #{form_position_string} arguments"
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_no_function.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_no_function.ex
deleted file mode 100644
index f776f5b1..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/function_application_no_function.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Dialyxir.Warnings.FunctionApplicationNoFunction do
- @moduledoc """
- The function being invoked exists, but has an arity mismatch.
-
- ## Example
-
- defmodule Example do
- def ok() do
- fun = fn _ -> :ok end
- fun.()
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :fun_app_no_fun
- def warning(), do: :fun_app_no_fun
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_, _, arity]) do
- "Function application will fail, because anonymous function has arity of #{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([op, type, arity]) do
- pretty_op = Erlex.pretty_print(op)
- pretty_type = Erlex.pretty_print_type(type)
-
- "Function application will fail, because #{pretty_op} :: #{pretty_type} is not a function of arity #{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail.ex
deleted file mode 100644
index 1860acc6..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail.ex
+++ /dev/null
@@ -1,76 +0,0 @@
-defmodule Dialyxir.Warnings.GuardFail do
- @moduledoc """
- The function guard either presents an impossible guard or the only
- calls will never succeed against the guards.
-
- ## Example
-
- defmodule Example do
- def ok() do
- ok(0)
- end
-
- defp ok(n) when n > 1 do
- :ok
- end
- end
-
- or
-
- defmodule Example do
- def ok() when 0 > 1 do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :guard_fail
- def warning(), do: :guard_fail
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(_) do
- "The guard clause can never succeed."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([]) do
- "The guard clause can never succeed."
- end
-
- def format_long([guard, args]) do
- pretty_args = Erlex.pretty_print_args(args)
-
- """
- The guard test:
-
- #{guard}#{pretty_args}
-
- can never succeed.
- """
- end
-
- def format_long([arg, infix, guard]) do
- pretty_arg = Erlex.pretty_print_args(arg)
- pretty_infix = Erlex.pretty_print_infix(infix)
- pretty_guard = Erlex.pretty_print(guard)
-
- """
- The guard clause:
-
- when #{pretty_arg} #{pretty_infix} #{pretty_guard}
-
- can never succeed.
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail_pattern.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail_pattern.ex
deleted file mode 100644
index ef9bccb5..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/guard_fail_pattern.ex
+++ /dev/null
@@ -1,42 +0,0 @@
-defmodule Dialyxir.Warnings.GuardFailPattern do
- @moduledoc """
- The clause guard describes a condition of literals that fails the pattern
- given in the function head.
-
- ## Example
-
- defmodule Example do
- def ok(n = 0) when not n < 1 do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :guard_fail_pat
- def warning(), do: :guard_fail_pat
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([pattern, _]) do
- "The clause guard #{pattern} cannot succeed."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([pattern, type]) do
- pretty_type = Erlex.pretty_print_type(type)
- pretty_pattern = Erlex.pretty_print_pattern(pattern)
-
- "The clause guard cannot succeed. The pattern #{pretty_pattern} " <>
- "was matched against the type #{pretty_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/improper_list_construction.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/improper_list_construction.ex
deleted file mode 100644
index 5692418e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/improper_list_construction.ex
+++ /dev/null
@@ -1,26 +0,0 @@
-defmodule Dialyxir.Warnings.ImproperListConstruction do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :improper_list_constr
- def warning(), do: :improper_list_constr
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([tl_type]) do
- pretty_type = Erlex.pretty_print_type(tl_type)
-
- "List construction (cons) will produce an improper list, " <>
- "because its second argument is #{pretty_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/invalid_contract.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/invalid_contract.ex
deleted file mode 100644
index c16e68c9..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/invalid_contract.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule Dialyxir.Warnings.InvalidContract do
- @moduledoc """
- The @spec for the function does not match the success typing of the
- function.
-
- ## Example
-
- defmodule Example do
- @spec process(:error) :: :ok
- def process(:ok) do
- :ok
- end
- end
-
- The @spec in this case claims that the function accepts a parameter
- :error but the function head only accepts :ok, resulting in the
- mismatch.
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :invalid_contract
- def warning(), do: :invalid_contract
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function | _]) do
- "Invalid type specification for function #{function}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, signature]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_signature = Erlex.pretty_print_contract(signature)
-
- """
- The @spec for the function does not match the success typing of the function.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Success typing:
- @spec #{function}#{pretty_signature}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/map_update.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/map_update.ex
deleted file mode 100644
index 5b52af8e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/map_update.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Dialyxir.Warnings.MapUpdate do
- @moduledoc """
- Elixir can only use the map update syntax to update a key that is in
- the map.
-
- ## Example
-
- defmodule Example do
- @spec error() :: map
- def error() do
- map = %{exists: :exists}
- %{map | does_not_exist: :fail}
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :map_update
- def warning(), do: :map_update
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_map, key]) do
- pretty_key = Erlex.pretty_print(key)
- "Attempted to update key #{pretty_key} in a map that does not have that key."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([map, key]) do
- pretty_key = Erlex.pretty_print(key)
- pretty_map = Erlex.pretty_print(map)
-
- """
- Attempted to update a key in a map that does not have that key.
-
- Key:
- #{pretty_key}
-
- Map:
- #{pretty_map}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/missing_range.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/missing_range.ex
deleted file mode 100644
index 93fd55cc..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/missing_range.ex
+++ /dev/null
@@ -1,62 +0,0 @@
-defmodule Dialyxir.Warnings.MissingRange do
- @moduledoc """
- Function spec declares a list of types, but function returns value
- outside stated range.
-
- This error only appears with the :overspecs flag.
-
- ## Example
-
- defmodule Example do
- @spec foo(any()) :: :ok
- def foo(:ok) do
- :ok
- end
-
- def foo(_) do
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :missing_range
- def warning(), do: :missing_range
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([module, function, arity | _]) do
- pretty_module = Erlex.pretty_print(module)
-
- "The type specification is missing types returned by #{pretty_module}.#{function}/#{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity, extra_ranges, contract_range]) do
- pretty_module = Erlex.pretty_print(module)
- pretty_contract_range = Erlex.pretty_print_type(contract_range)
- pretty_extra_ranges = Erlex.pretty_print_type(extra_ranges)
-
- """
- The type specification is missing types returned by function.
-
- Function:
- #{pretty_module}.#{function}/#{arity}
-
- Type specification return types:
- #{pretty_contract_range}
-
- Missing from spec:
- #{pretty_extra_ranges}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/negative_guard_fail.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/negative_guard_fail.ex
deleted file mode 100644
index 7ad51d01..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/negative_guard_fail.ex
+++ /dev/null
@@ -1,68 +0,0 @@
-defmodule Dialyxir.Warnings.NegativeGuardFail do
- @moduledoc """
- The function guard either presents an impossible guard or the only
- calls will never succeed against the guards.
-
- ## Example
-
- defmodule Example do
- def ok(ok = "ok") when not is_bitstring(ok) do
- :ok
- end
- end
-
- or
-
- defmodule Example do
- def ok() do
- ok(:ok)
- end
-
- defp ok(ok) when not is_atom(ok) do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :neg_guard_fail
- def warning(), do: :neg_guard_fail
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(_) do
- "The guard test can never succeed."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([guard, args]) do
- pretty_args = Erlex.pretty_print_args(args)
-
- """
- Guard test:
- not #{guard}#{pretty_args}
-
- can never succeed.
- """
- end
-
- def format_long([arg1, infix, arg2]) do
- pretty_infix = Erlex.pretty_print_infix(infix)
-
- """
- Guard test:
- not #{arg1} #{pretty_infix} #{arg2}
-
- can never succeed.
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/no_return.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/no_return.ex
deleted file mode 100644
index 966e6ac3..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/no_return.ex
+++ /dev/null
@@ -1,78 +0,0 @@
-defmodule Dialyxir.Warnings.NoReturn do
- @moduledoc """
- The function has no return. This is usually due to an issue later on
- in the call stack causing it to not be recognized as returning for
- some reason. It is often helpful to cross reference the complete
- list of warnings with the call stack in the function and fix the
- deepest part of the call stack, which will usually fix many of the
- other no_return errors.
-
- ## Example
-
- defmodule Example do
- def ok() do
- Enum.each([1, 2, 3], fn _ -> raise "error" end)
- end
- end
-
- or
-
- defmodule Example do
- def ok() do
- raise "error"
-
- :ok
- end
-
- def ok(:ok) do
- ok()
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :no_return
- def warning(), do: :no_return
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t() | atom]) :: String.t()
- def format_long([type | name]) do
- name_string =
- case name do
- [] ->
- "The created anonymous function"
-
- [function, arity] ->
- "Function #{function}/#{arity}"
- end
-
- type_string =
- case type do
- :no_match ->
- "has no clauses that will ever match."
-
- :only_explicit ->
- "only terminates with explicit exception."
-
- :only_normal ->
- "has no local return."
-
- :both ->
- "has no local return."
- end
-
- "#{name_string} #{type_string}"
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_equality.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_equality.ex
deleted file mode 100644
index 1fd1ae77..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_equality.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Dialyxir.Warnings.OpaqueEquality do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :opaque_eq
- def warning(), do: :opaque_eq
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_type, _op, opaque_type]) do
- pretty_opaque_type = opaque_type |> Erlex.pretty_print() |> unqualify_module()
- "Attempt to test for equality with an opaque type #{pretty_opaque_type}."
- end
-
- defp unqualify_module(name) when is_binary(name) do
- case String.split(name, ".") do
- [only] ->
- only
-
- multiple ->
- multiple
- |> Enum.take(-2)
- |> Enum.join(".")
- end
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([type, _op, opaque_type]) do
- pretty_opaque_type = Erlex.pretty_print_type(opaque_type)
-
- "Attempt to test for equality between a term of type #{type} " <>
- "and a term of opaque type #{pretty_opaque_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_guard.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_guard.ex
deleted file mode 100644
index a198bf2e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_guard.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-defmodule Dialyxir.Warnings.OpaqueGuard do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :opaque_guard
- def warning(), do: :opaque_guard
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([guard | _]) do
- "The guard test #{guard} breaks the opaqueness of its argument."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([guard, args]) do
- "The guard test #{guard}#{args} breaks the opaqueness of its argument."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_match.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_match.ex
deleted file mode 100644
index fb6f9a0e..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_match.ex
+++ /dev/null
@@ -1,74 +0,0 @@
-defmodule Dialyxir.Warnings.OpaqueMatch do
- @moduledoc """
- Attempted to pattern match against the internal structure of an
- opaque term.
-
- ## Example
-
- defmodule OpaqueStruct do
- defstruct [:opaque]
-
- @opaque t :: %__MODULE__{}
-
- @spec opaque() :: t
- def opaque() do
- %__MODULE__{}
- end
- end
-
- defmodule Example do
- @spec error() :: :error
- def error() do
- %{opaque: _} = OpaqueStruct.opaque()
- :error
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :opaque_match
- def warning(), do: :opaque_match
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_pattern, type | _]) do
- pretty_type = Erlex.pretty_print_type(type)
-
- "Attempted to pattern match against the internal structure of an opaque term of type #{pretty_type}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([pattern, opaque_type, opaque_term]) do
- pretty_opaque_term = Erlex.pretty_print(opaque_term)
-
- term =
- if opaque_type == opaque_term do
- "the term"
- else
- pretty_opaque_term
- end
-
- pretty_pattern = Erlex.pretty_print_pattern(pattern)
-
- """
- Attempted to pattern match against the internal structure of an opaque term.
-
- Type:
- #{pretty_opaque_term}
-
- Pattern:
- #{pretty_pattern}
-
- This breaks the opaqueness of #{term}.
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_nonequality.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_nonequality.ex
deleted file mode 100644
index ba9c70f8..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_nonequality.ex
+++ /dev/null
@@ -1,26 +0,0 @@
-defmodule Dialyxir.Warnings.OpaqueNonequality do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :opaque_neq
- def warning(), do: :opaque_neq
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([type, _op, opaque_type]) do
- "Attempted to test for inequality between #{type} and opaque type #{opaque_type}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([type, _op, opaque_type]) do
- "Attempt to test for inequality between a term of type #{type} " <>
- "and a term of opaque type #{opaque_type}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_type_test.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_type_test.ex
deleted file mode 100644
index 384f20a2..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/opaque_type_test.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-defmodule Dialyxir.Warnings.OpaqueTypeTest do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :opaque_type_test
- def warning(), do: :opaque_type_test
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([function, _opaque]) do
- "The type test in #{function} breaks the opaqueness of the term."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([function, opaque]) do
- "The type test #{function}(#{opaque}) breaks the opaqueness of the term #{opaque}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/overlapping_contract.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/overlapping_contract.ex
deleted file mode 100644
index e7642b25..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/overlapping_contract.ex
+++ /dev/null
@@ -1,49 +0,0 @@
-defmodule Dialyxir.Warnings.OverlappingContract do
- @moduledoc """
- The function has an additional @spec that is already covered more
- generally by a higher @spec.
-
- ## Example
-
- defmodule Example do
- @spec ok(atom) :: :ok
- def ok(:ok) do
- :ok
- end
-
- @spec ok(:error) :: :ok
- def ok(:error) do
- :ok
- end
- end
- """
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :overlapping_contract
- def warning(), do: :overlapping_contract
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_module, function, arity]) do
- "The contract for #{function}/#{arity} is overloaded."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([module, function, arity]) do
- pretty_module = Erlex.pretty_print(module)
-
- """
- Overloaded contract for #{pretty_module}.#{function}/#{arity} has
- overlapping domains; such contracts are currently unsupported and
- are simply ignored.
- """
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match.ex
deleted file mode 100644
index c1708536..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule Dialyxir.Warnings.PatternMatch do
- @moduledoc """
- The pattern matching is never given a value that satisfies all of
- its clauses.
-
- ## Example
-
- defmodule Example do
- def ok() do
- unmatched(:ok)
- end
-
- defp unmatched(:ok), do: :ok
-
- defp unmatched(:error), do: :error
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :pattern_match
- def warning(), do: :pattern_match
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_pattern, type]) do
- pretty_type = Erlex.pretty_print_type(type)
- "The pattern can never match the type #{pretty_type}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([pattern, type]) do
- pretty_pattern = Erlex.pretty_print_pattern(pattern)
- pretty_type = Erlex.pretty_print_type(type)
-
- """
- The pattern can never match the type.
-
- Pattern:
- #{pretty_pattern}
-
- Type:
- #{pretty_type}
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match_covered.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match_covered.ex
deleted file mode 100644
index 231802bc..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/pattern_match_covered.ex
+++ /dev/null
@@ -1,52 +0,0 @@
-defmodule Dialyxir.Warnings.PatternMatchCovered do
- @moduledoc """
- The pattern match has a later clause that will never be executed,
- because a more general clause is higher in the matching order.
-
- ## Example
-
- defmodule Example do
- def ok() do
- unmatched(:error)
- end
-
- defp unmatched(_), do: :ok
-
- defp unmatched(:error), do: :error
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :pattern_match_cov
- def warning(), do: :pattern_match_cov
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([pattern, _]) do
- "The pattern #{pattern} can never match the type, " <>
- "because it is covered by previous clauses."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([pattern, type]) do
- pretty_pattern = Erlex.pretty_print_pattern(pattern)
- pretty_type = Erlex.pretty_print_type(type)
-
- """
- The pattern
- #{pretty_pattern}
-
- can never match, because previous clauses completely cover the type
- #{pretty_type}.
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_construction.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_construction.ex
deleted file mode 100644
index d992eec0..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_construction.ex
+++ /dev/null
@@ -1,34 +0,0 @@
-defmodule Dialyxir.Warnings.RecordConstruction do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :record_constr
- def warning(), do: :record_constr
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short([_types, name]) do
- "Record construction violates the declared type for #{name}."
- end
-
- def format_short([name, _field, _type]) do
- "Record construction violates the declared type for #{name}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([types, name]) do
- "Record construction #{types} violates the declared type for ##{name}{}."
- end
-
- def format_long([name, field, type]) do
- "Record construction violates the declared type for ##{name}{}, " <>
- "because #{field} cannot be of type #{type}."
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_matching.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_matching.ex
deleted file mode 100644
index 1a81c442..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/record_matching.ex
+++ /dev/null
@@ -1,23 +0,0 @@
-defmodule Dialyxir.Warnings.RecordMatching do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :record_matching
- def warning(), do: :record_matching
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([string, name]) do
- "The #{string} violates the declared type for ##{name}{}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_behaviour.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_behaviour.ex
deleted file mode 100644
index 5fd1075a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_behaviour.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-defmodule Dialyxir.Warnings.UnknownBehaviour do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :unknown_behaviour
- def warning(), do: :unknown_behaviour
-
- @impl Dialyxir.Warning
- @spec format_short(String.t()) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long(String.t()) :: String.t()
- def format_long(behaviour) do
- pretty_module = Erlex.pretty_print(behaviour)
-
- "Unknown behaviour: #{pretty_module}."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_function.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_function.ex
deleted file mode 100644
index 5095865a..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_function.ex
+++ /dev/null
@@ -1,27 +0,0 @@
-defmodule Dialyxir.Warnings.UnknownFunction do
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :unknown_function
- def warning(), do: :unknown_function
-
- @impl Dialyxir.Warning
- @spec format_short({String.t(), String.t(), String.t()}) :: String.t()
- def format_short({module, function, arity}) do
- pretty_module = Erlex.pretty_print(module)
- "Function #{pretty_module}.#{function}/#{arity} does not exist."
- end
-
- @impl Dialyxir.Warning
- @spec format_long({String.t(), String.t(), String.t()}) :: String.t()
- def format_long({module, function, arity}) do
- pretty_module = Erlex.pretty_print(module)
- "Function #{pretty_module}.#{function}/#{arity} does not exist."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- Dialyxir.Warning.default_explain()
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_type.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_type.ex
deleted file mode 100644
index f851a01c..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unknown_type.ex
+++ /dev/null
@@ -1,43 +0,0 @@
-defmodule Dialyxir.Warnings.UnknownType do
- @moduledoc """
- Spec references a missing @type.
-
- ## Example
-
- defmodule Missing do
- end
-
- defmodule Example do
- @spec ok(Missing.t()) :: :ok
- def ok(_) do
- :ok
- end
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :unknown_type
- def warning(), do: :unknown_type
-
- @impl Dialyxir.Warning
- @spec format_short({String.t(), String.t(), String.t()}) :: String.t()
- def format_short({module, function, arity}) do
- pretty_module = Erlex.pretty_print(module)
-
- "Unknown type: #{pretty_module}.#{function}/#{arity}."
- end
-
- @impl Dialyxir.Warning
- @spec format_long({String.t(), String.t(), String.t()}) :: String.t()
- def format_long({module, function, arity}) do
- format_short({module, function, arity})
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unmatched_return.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unmatched_return.ex
deleted file mode 100644
index f7d08f4d..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unmatched_return.ex
+++ /dev/null
@@ -1,81 +0,0 @@
-defmodule Dialyxir.Warnings.UnmatchedReturn do
- @moduledoc """
- The invoked expression returns a union of types and the call does
- not match on its return types using e.g. a case or wildcard.
-
- ## Example
-
- defmodule Example do
- require Integer
-
- def ok() do
- n = :rand.uniform(100)
-
- multiple_returns(n)
-
- :ok
- end
-
- defp multiple_returns(n) do
- if Integer.is_even(n) do
- :ok
- else
- {:error, "error"}
- end
- end
- end
-
- This would NOT result in a warning:
-
- defmodule Example do
- require Integer
-
- def ok() do
- n = :rand.uniform(100)
-
- multiple_returns(n)
-
- :ok
- end
-
- defp multiple_returns(n) do
- if Integer.is_even(n) do
- :ok
- else
- :error
- end
- end
- end
- """
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :unmatched_return
- def warning(), do: :unmatched_return
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(_) do
- "The expression produces multiple types, but none are matched."
- end
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([type]) do
- pretty_type = Erlex.pretty_print_type(type)
-
- """
- The expression produces a value of type:
-
- #{pretty_type}
-
- but this value is unmatched.
- """
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unused_function.ex b/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unused_function.ex
deleted file mode 100644
index 7a6d14cb..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/dialyxir/warnings/unused_function.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule Dialyxir.Warnings.UnusedFunction do
- @moduledoc """
- Due to issues higher in the function or call stack, while the
- function is recognized as used by the compiler, it will never be
- recognized as having been called until the other error is resolved.
-
- ## Example
-
- defmodule Example do
- def ok() do
- raise "error"
-
- unused()
- end
-
- defp unused(), do: :ok
- end
- """
-
- @behaviour Dialyxir.Warning
-
- @impl Dialyxir.Warning
- @spec warning() :: :unused_fun
- def warning(), do: :unused_fun
-
- @impl Dialyxir.Warning
- @spec format_short([String.t()]) :: String.t()
- def format_short(args), do: format_long(args)
-
- @impl Dialyxir.Warning
- @spec format_long([String.t()]) :: String.t()
- def format_long([function, arity]) do
- "Function #{function}/#{arity} will never be called."
- end
-
- @impl Dialyxir.Warning
- @spec explain() :: String.t()
- def explain() do
- @moduledoc
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer.ex b/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer.ex
deleted file mode 100644
index 5b4eedaa..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer.ex
+++ /dev/null
@@ -1,438 +0,0 @@
-defmodule Mix.Tasks.Dialyzer do
- @shortdoc "Runs dialyzer with default or project-defined flags."
-
- @moduledoc """
- This task compiles the mix project, creates a PLT with dependencies if needed and runs `dialyzer`. Much of its behavior can be managed in configuration as described below.
-
- If executed outside of a mix project, it will build the core PLT files and exit.
-
- ## Command line options
-
- * `--no-compile` - do not compile even if needed
- * `--no-check` - do not perform (quick) check to see if PLT needs update
- * `--force-check` - force PLT check also if lock file is unchanged useful
- when dealing with local deps.
- * `--ignore-exit-status` - display warnings but do not halt the VM or
- return an exit status code
- * `--list-unused-filters` - list unused ignore filters useful for CI. do
- not use with `mix do`.
- * `--plt` - only build the required PLT(s) and exit
- * `--format short` - format the warnings in a compact format
- * `--format raw` - format the warnings in format returned before Dialyzer formatting
- * `--format dialyxir` - format the warnings in a pretty printed format
- * `--format dialyzer` - format the warnings in the original Dialyzer format
- * `--format github` - format the warnings in the Github Actions message format
- * `--format ignore_file` - format the warnings to be suitable for adding to Elixir Format ignore file
- * `--quiet` - suppress all informational messages
- * `--quiet-with-result` - suppress all informational messages except for the final result message
-
- Warning flags passed to this task are passed on to `:dialyzer` - e.g.
-
- mix dialyzer --unmatched_returns
-
- ## Configuration
-
- All configuration is included under a dialyzer key in the mix project keyword list.
-
- ### Flags
-
- You can specify any `dialyzer` command line argument with the :flags keyword.
-
- Dialyzer supports a number of warning flags used to enable or disable certain kinds of analysis features. Until version 0.4, `dialyxir` used by default the additional warning flags shown in the example below. However some of these create warnings that are often more confusing than helpful, particularly to new users of Dialyzer. As of 0.4, there are no longer any flags used by default. To get the old behavior, specify them in your Mix project file. For compatibility reasons you can use either the `-Wwarning` convention of the dialyzer CLI, or (preferred) the `WarnOpts` atoms supported by the [API](http://erlang.org/doc/man/dialyzer.html#gui-1). e.g.
-
- ```elixir
- def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [flags: ["-Wunmatched_returns", :error_handling, :underspecs]]
- ]
- end
- ```
-
- ### PLT Configuration
-
- The task will build a PLT with default core Erlang applications: `:erts :kernel :stdlib :crypto` and re-use this core file in multiple projects - another core file is created for Elixir.
-
- OTP application dependencies are (transitively) added to your project's PLT by default. The applications added are the same as you would see displayed with the command `mix app.tree`. There is also a `:plt_add_deps` option you can set to control the dependencies added. The following options are supported:
-
- * `:apps_direct` - Only Direct OTP runtime application dependencies - not the entire tree
- * `:app_tree` - Transitive OTP runtime application dependencies e.g. `mix app.tree` (default)
-
- ```
- def project do
- [
- app: :my_app,
- version: "0.0.1",
- deps: deps,
- dialyzer: [plt_add_deps: :apps_direct, plt_add_apps: [:wx]]
- ]
- end
- ```
-
- You can also configure applications to include in the PLT more directly:
-
- * `dialyzer: :plt_add_apps` - applications to include
- *in addition* to the core applications and project dependencies.
-
- * `dialyzer: :plt_ignore_apps` - applications to ignore from the list of core
- applications and dependencies.
-
- * `dialyzer: :plt_apps` - a list of applications to include that will replace the default,
- include all the apps you need e.g.
-
- ### Other Configuration
-
- * `dialyzer: :plt_file` - Deprecated - specify the PLT file name to create and use - default is to create one in the project's current build environment (e.g. _build/dev/) specific to the Erlang/Elixir version used. Note that use of this key in version 0.4 or later will produce a deprecation warning - you can silence the warning by providing a pair with key :no_warn e.g. `plt_file: {:no_warn,"filename"}`.
-
- * `dialyzer: :plt_local_path` - specify the PLT directory name to create and use - default is the project's current build environment (e.g. `_build/dev/`).
-
- * `dialyzer: :plt_core_path` - specify an alternative to `MIX_HOME` to use to store the Erlang and Elixir core files.
-
- * `dialyzer: :ignore_warnings` - specify file path to filter well-known warnings.
- """
-
- use Mix.Task
- import System, only: [user_home!: 0]
- import Dialyxir.Output
- alias Dialyxir.Project
- alias Dialyxir.Plt
- alias Dialyxir.Dialyzer
-
- defmodule Build do
- @shortdoc "Build the required PLT(s) and exit."
-
- @moduledoc """
- This task compiles the mix project and creates a PLT with dependencies if needed.
- It is equivalent to running `mix dialyzer --plt`
-
- ## Command line options
-
- * `--no-compile` - do not compile even if needed.
- """
- use Mix.Task
-
- def run(args) do
- Mix.Tasks.Dialyzer.run(["--plt" | args])
- end
- end
-
- defmodule Clean do
- @shortdoc "Delete PLT(s) and exit."
-
- @moduledoc """
- This task deletes PLT files and hash files.
-
- ## Command line options
-
- * `--all` - delete also core PLTs.
- """
- use Mix.Task
-
- @command_options [all: :boolean]
- def run(args) do
- {opts, _, _dargs} = OptionParser.parse(args, strict: @command_options)
- Mix.Tasks.Dialyzer.clean(opts)
- end
- end
-
- @default_warnings [:unknown]
-
- @old_options [
- halt_exit_status: :boolean
- ]
-
- @command_options Keyword.merge(@old_options,
- force_check: :boolean,
- ignore_exit_status: :boolean,
- list_unused_filters: :boolean,
- no_check: :boolean,
- no_compile: :boolean,
- plt: :boolean,
- quiet: :boolean,
- quiet_with_result: :boolean,
- raw: :boolean,
- format: :string
- )
-
- def run(args) do
- {opts, _, dargs} = OptionParser.parse(args, strict: @command_options)
- original_shell = Mix.shell()
- if opts[:quiet] || opts[:quiet_with_result], do: Mix.shell(Mix.Shell.Quiet)
- opts = Keyword.delete(opts, :quiet)
- check_dialyzer()
- compatibility_notice()
-
- if Mix.Project.get() do
- Project.check_config()
-
- unless opts[:no_compile], do: Mix.Task.run("compile")
-
- _ =
- unless no_check?(opts) do
- info("Finding suitable PLTs")
- force_check? = Keyword.get(opts, :force_check, false)
- check_plt(force_check?)
- end
-
- default = Dialyxir.Project.default_ignore_warnings()
- ignore_warnings = Dialyxir.Project.dialyzer_ignore_warnings()
-
- cond do
- !ignore_warnings && File.exists?(default) ->
- info("""
- No :ignore_warnings opt specified in mix.exs. Using default: #{default}.
- """)
-
- ignore_warnings && File.exists?(ignore_warnings) ->
- info("""
- ignore_warnings: #{ignore_warnings}
- """)
-
- ignore_warnings ->
- info("""
- :ignore_warnings opt specified in mix.exs: #{ignore_warnings}, but file does not exist.
- """)
-
- true ->
- info("""
- No :ignore_warnings opt specified in mix.exs and default does not exist.
- """)
- end
-
- warn_old_options(opts)
- unless opts[:plt], do: run_dialyzer(opts, dargs)
- else
- info("No mix project found - checking core PLTs...")
- Project.plts_list([], false) |> Plt.check()
- end
-
- Mix.shell(original_shell)
- end
-
- def clean(opts, fun \\ &delete_plt/4) do
- check_dialyzer()
- compatibility_notice()
- if opts[:all], do: Project.plts_list([], false) |> Plt.check(fun)
-
- if Mix.Project.get() do
- {apps, _hash} = dependency_hash()
- info("Deleting PLTs")
- Project.plts_list(apps, true, true) |> Plt.check(fun)
- info("About to delete PLT hash file: #{plt_hash_file()}")
- File.rm(plt_hash_file())
- end
- end
-
- def delete_plt(plt, _, _, _) do
- info("About to delete PLT file: #{plt}")
- File.rm(plt)
- end
-
- defp no_check?(opts) do
- case {in_child?(), no_plt?()} do
- {true, true} ->
- info("In an Umbrella child and no PLT found - building that first.")
- build_parent_plt()
- true
-
- {true, false} ->
- info("In an Umbrella child, not checking PLT...")
- true
-
- _ ->
- opts[:no_check]
- end
- end
-
- defp check_plt(force_check?) do
- info("Checking PLT...")
- {apps, hash} = dependency_hash()
-
- if not force_check? and check_hash?(hash) do
- info("PLT is up to date!")
- else
- Project.plts_list(apps) |> Plt.check()
- File.write(plt_hash_file(), hash)
- end
- end
-
- defp run_dialyzer(opts, dargs) do
- args = [
- {:check_plt, opts[:force_check] || false},
- {:init_plt, String.to_charlist(Project.plt_file())},
- {:files, Project.dialyzer_files()},
- {:warnings, dialyzer_warnings(dargs)},
- {:format, opts[:format]},
- {:raw, opts[:raw]},
- {:list_unused_filters, opts[:list_unused_filters]},
- {:ignore_exit_status, opts[:ignore_exit_status]},
- {:quiet_with_result, opts[:quiet_with_result]}
- ]
-
- {status, exit_status, [time | result]} = Dialyzer.dialyze(args)
- info(time)
-
- quiet_with_result? = opts[:quiet_with_result]
-
- report =
- cond do
- status == :ok && quiet_with_result? ->
- fn text ->
- Mix.shell(Mix.Shell.IO)
- info(text)
- Mix.shell(Mix.Shell.Quiet)
- end
-
- status == :ok ->
- &info/1
-
- true ->
- &error/1
- end
-
- Enum.each(result, report)
-
- unless exit_status == 0 || opts[:ignore_exit_status] do
- error("Halting VM with exit status #{exit_status}")
- System.halt(exit_status)
- end
- end
-
- defp dialyzer_warnings(dargs) do
- raw_opts = Project.dialyzer_flags() ++ Enum.map(dargs, &elem(&1, 0))
- transform(raw_opts) ++ (@default_warnings -- Project.dialyzer_removed_defaults())
- end
-
- defp transform(options) when is_list(options), do: Enum.map(options, &transform/1)
- defp transform(option) when is_atom(option), do: option
-
- defp transform(option) when is_binary(option) do
- option
- |> String.replace_leading("-W", "")
- |> String.replace("--", "")
- |> String.to_atom()
- end
-
- defp in_child? do
- case Project.no_umbrella?() do
- true -> false
- false -> String.contains?(Mix.Project.config()[:lockfile], "..")
- end
- end
-
- defp no_plt? do
- not File.exists?(Project.deps_plt())
- end
-
- defp build_parent_plt() do
- parent = Mix.Project.config()[:lockfile] |> Path.expand() |> Path.dirname()
- opts = [into: IO.stream(:stdio, :line), stderr_to_stdout: true, cd: parent]
- # It would seem more natural to use Mix.in_project here to start in our parent project.
- # However part of the app.tree resolution includes loading all sub apps, and we will
- # hit an exception when we try to do that for *this* child, which is already loaded.
- {out, rc} = System.cmd("mix", ["dialyzer", "--plt"], opts)
-
- unless rc == 0 do
- info("Error building parent PLT, process returned code: #{rc}\n#{out}")
- end
- end
-
- if Version.match?(System.version(), ">= 1.15.0") do
- defp check_dialyzer do
- Mix.ensure_application!(:dialyzer)
- end
- else
- defp check_dialyzer do
- if not Code.ensure_loaded?(:dialyzer) do
- error("""
- DEPENDENCY MISSING
- ------------------------
- If you are reading this message, then Elixir and Erlang are installed but the
- Erlang Dialyzer is not available. Probably this is because you installed Erlang
- with your OS package manager and the Dialyzer package is separate.
-
- On Debian/Ubuntu:
-
- `apt-get install erlang-dialyzer`
-
- Fedora:
-
- `yum install erlang-dialyzer`
-
- Arch and Homebrew include Dialyzer in their base erlang packages. Please report a Github
- issue to add or correct distribution-specific information.
- """)
-
- :erlang.halt(3)
- end
- end
- end
-
- defp warn_old_options(opts) do
- for {opt, _} <- opts, @old_options[opt] do
- error("#{opt} is no longer a valid CLI argument.")
- end
-
- nil
- end
-
- defp compatibility_notice do
- old_plt = "#{user_home!()}/.dialyxir_core_*.plt"
-
- if File.exists?(old_plt) &&
- (!File.exists?(Project.erlang_plt()) || !File.exists?(Project.elixir_plt())) do
- info("""
- COMPATIBILITY NOTICE
- ------------------------
- Previous usage of a pre-0.4 version of Dialyxir detected. Please be aware that the 0.4 release
- makes a number of changes to previous defaults. Among other things, the PLT task is automatically
- run when dialyzer is run, PLT paths have changed,
- transitive dependencies are included by default in the PLT, and no additional warning flags
- beyond the dialyzer defaults are included. All these properties can be changed in configuration.
- (see `mix help dialyzer`).
-
- If you no longer use the older Dialyxir in any projects and do not want to see this notice each time you upgrade your Erlang/Elixir distribution, you can delete your old pre-0.4 PLT files. (`rm ~/.dialyxir_core_*.plt`)
- """)
- end
- end
-
- @spec check_hash?(binary()) :: boolean()
- defp check_hash?(hash) do
- case File.read(plt_hash_file()) do
- {:ok, stored_hash} -> hash == stored_hash
- _ -> false
- end
- end
-
- defp plt_hash_file, do: Project.plt_file() <> ".hash"
-
- @spec dependency_hash :: {[atom()], binary()}
- def dependency_hash do
- apps = Project.cons_apps()
- apps |> inspect() |> info()
- hash = :crypto.hash(:sha, lock_file() <> :erlang.term_to_binary(apps))
- {apps, hash}
- end
-
- defp lock_file() do
- lockfile = Mix.Project.config()[:lockfile]
- read_res = File.read(lockfile)
-
- case read_res do
- {:ok, data} ->
- data
-
- {:error, :enoent} ->
- # If there is no lock file, an empty bitstring will do to indicate there is none there
- <<>>
-
- {:error, reason} ->
- raise File.Error,
- reason: reason,
- action: "read file",
- path: lockfile
- end
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer/explain.ex b/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer/explain.ex
deleted file mode 100644
index 282099cf..00000000
--- a/apps/plataforma_digital/deps/dialyxir/lib/mix/tasks/dialyzer/explain.ex
+++ /dev/null
@@ -1,61 +0,0 @@
-defmodule Mix.Tasks.Dialyzer.Explain do
- @shortdoc "Display information about Dialyzer warnings."
-
- @moduledoc """
- This task provides background information about Dialyzer warnings.
- If invoked without any arguments it will list all warning atoms.
- When invoked with the name of a particular warning, it will display
- information regarding it.
-
- ## Command line options
-
- * `[warning]` - display information regarding warning
-
- ```
- mix dialyzer.explain pattern_match
- ```
- """
- use Mix.Task
- alias Dialyxir.Output
-
- def run(args) do
- case OptionParser.parse(args, strict: []) do
- {_, [warning], _} ->
- warning |> explanation_text() |> Output.info()
-
- {_, [], _} ->
- list_warnings() |> Output.info()
-
- _ ->
- Mix.Task.run("help", ["dialyzer.explain"])
- end
- end
-
- defp explanation_text(warning_name) do
- warning = String.to_atom(warning_name)
-
- case Map.get(Dialyxir.Warnings.warnings(), warning) do
- nil ->
- "Unknown warning named: #{warning_name}"
-
- module ->
- module.explain()
- end
- end
-
- defp list_warnings do
- warnings =
- Dialyxir.Warnings.warnings()
- |> Map.keys()
- |> Enum.sort()
- |> Enum.map_join("\n", &Atom.to_string/1)
-
- [
- """
- Explain warning with mix dialyzer.explain
-
- #{warnings}
- """
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/dialyxir/mix.exs b/apps/plataforma_digital/deps/dialyxir/mix.exs
deleted file mode 100644
index 27def633..00000000
--- a/apps/plataforma_digital/deps/dialyxir/mix.exs
+++ /dev/null
@@ -1,71 +0,0 @@
-defmodule Dialyxir.Mixfile do
- use Mix.Project
-
- @source_url "https://github.com/jeremyjh/dialyxir"
- @version "1.4.1"
-
- def project do
- [
- app: :dialyxir,
- version: @version,
- elixir: ">= 1.12.0",
- elixirc_paths: elixirc_paths(Mix.env()),
- description: description(),
- package: package(),
- deps: deps(),
- aliases: [test: "test --no-start"],
- dialyzer: [
- plt_apps: [:dialyzer, :elixir, :kernel, :mix, :stdlib, :erlex],
- ignore_warnings: ".dialyzer_ignore.exs",
- flags: [:unmatched_returns, :error_handling, :underspecs]
- ],
- # Docs
- name: "Dialyxir",
- homepage_url: @source_url,
- # The main page in the docs
- docs: [
- main: "readme",
- source_url: @source_url,
- source_ref: @version,
- extras: ["CHANGELOG.md", "README.md"]
- ]
- ]
- end
-
- def application do
- [mod: {Dialyxir, []}, extra_applications: [:dialyzer, :crypto, :mix, :erts, :syntax_tools]]
- end
-
- defp description do
- """
- Mix tasks to simplify use of Dialyzer in Elixir projects.
- """
- end
-
- defp elixirc_paths(:examples), do: ["lib", "test/examples"]
- defp elixirc_paths(_), do: ["lib"]
-
- defp deps do
- [
- {:erlex, ">= 0.2.6"},
- {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
- ]
- end
-
- defp package do
- [
- files: [
- "lib",
- "mix.exs",
- "README.md",
- "LICENSE"
- ],
- maintainers: ["Jeremy Huffman"],
- licenses: ["Apache-2.0"],
- links: %{
- "Changelog" => "https://hexdocs.pm/dialyxir/changelog.html",
- "GitHub" => @source_url
- }
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/earmark_parser/.fetch b/apps/plataforma_digital/deps/earmark_parser/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/earmark_parser/.hex b/apps/plataforma_digital/deps/earmark_parser/.hex
deleted file mode 100644
index bef36a14..00000000
Binary files a/apps/plataforma_digital/deps/earmark_parser/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/earmark_parser/LICENSE b/apps/plataforma_digital/deps/earmark_parser/LICENSE
deleted file mode 100644
index 261eeb9e..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/apps/plataforma_digital/deps/earmark_parser/README.md b/apps/plataforma_digital/deps/earmark_parser/README.md
deleted file mode 100644
index cc0e7fec..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/README.md
+++ /dev/null
@@ -1,747 +0,0 @@
-
-# EarmarkParser A Pure Elixir Markdown Parser
-
-[![CI](https://github.com/robertdober/earmark_parser/actions/workflows/elixir.yml/badge.svg)](https://github.com/robertdober/earmark_parser/actions/workflows/elixir.yml)
-[![Coverage Status](https://coveralls.io/repos/github/RobertDober/earmark_parser/badge.svg?branch=master)](https://coveralls.io/github/RobertDober/earmark_parser?branch=master)
-[![Hex.pm](https://img.shields.io/hexpm/v/earmark_parser.svg)](https://hex.pm/packages/earmark_parser)
-[![Hex.pm](https://img.shields.io/hexpm/dw/earmark_parser.svg)](https://hex.pm/packages/earmark_parser)
-[![Hex.pm](https://img.shields.io/hexpm/dt/earmark_parser.svg)](https://hex.pm/packages/earmark_parser)
-
-
-## Table Of Contents
-
-- [Table Of Contents](#table-of-contents)
-- [Usage](#usage)
- - [EarmarkParser](#earmarkparser)
- - [API](#api)
- - [EarmarkParser.as_ast](#earmarkparseras_ast)
- - [Options](#options)
-- [Supports](#supports)
-- [Extensions](#extensions)
- - [Links](#links)
- - [Links supported by default](#links-supported-by-default)
- - [Autolinks](#autolinks)
- - [Additional link parsing via options](#additional-link-parsing-via-options)
- - [Pure links](#pure-links)
- - [Wikilinks...](#wikilinks)
- - [Sub and Sup HTML Elements](#sub-and-sup-html-elements)
- - [Github Flavored Markdown](#github-flavored-markdown)
- - [Strike Through](#strike-through)
- - [GFM Tables](#gfm-tables)
- - [Syntax Highlighting](#syntax-highlighting)
- - [Footnotes](#footnotes)
- - [Breaks](#breaks)
- - [Enabling **all** options that are disabled by default](#enabling-all-options-that-are-disabled-by-default)
- - [Tables](#tables)
- - [HTML Blocks](#html-blocks)
- - [HTML Comments](#html-comments)
- - [Lists](#lists)
- - [Adding Attributes with the IAL extension](#adding-attributes-with-the-ial-extension)
- - [To block elements](#to-block-elements)
- - [To links or images](#to-links-or-images)
-- [Limitations](#limitations)
-- [Annotations](#annotations)
- - [Annotated Paragraphs](#annotated-paragraphs)
- - [Annotated HTML elements](#annotated-html-elements)
- - [Commenting your Markdown](#commenting-your-markdown)
- - [EarmarkParser.as_ast/2](#earmarkparseras_ast2)
- - [EarmarkParser.version/0](#earmarkparserversion0)
-- [Contributing](#contributing)
-- [Author](#author)
-- [LICENSE](#license)
-
-## Usage
-
-### EarmarkParser
-
-
-### API
-
-#### EarmarkParser.as_ast
-
-This is the structure of the result of `as_ast`.
-
- {:ok, ast, []} = EarmarkParser.as_ast(markdown)
- {:ok, ast, deprecation_messages} = EarmarkParser.as_ast(markdown)
- {:error, ast, error_messages} = EarmarkParser.as_ast(markdown)
-
-For examples see the functiondoc below.
-
-#### Options
-
-Options can be passed into `as_ast/2` according to the documentation of `EarmarkParser.Options`.
-
- {status, ast, errors} = EarmarkParser.as_ast(markdown, options)
-
-## Supports
-
-Standard [Gruber markdown][gruber].
-
-[gruber]:
-
-## Extensions
-
-### Links
-
-#### Links supported by default
-
-##### Oneline HTML Link tags
-
-```elixir
- iex(1)> EarmarkParser.as_ast(~s{link})
- {:ok, [{"a", [{"href", "href"}], ["link"], %{verbatim: true}}], []}
-```
-
-##### Markdown links
-
-New style ...
-
-```elixir
- iex(2)> EarmarkParser.as_ast(~s{[title](destination)})
- {:ok, [{"p", [], [{"a", [{"href", "destination"}], ["title"], %{}}], %{}}], []}
-```
-
-and old style
-
-```elixir
- iex(3)> EarmarkParser.as_ast("[foo]: /url \"title\"\n\n[foo]\n")
- {:ok, [{"p", [], [{"a", [{"href", "/url"}, {"title", "title"}], ["foo"], %{}}], %{}}], []}
-```
-
-#### Autolinks
-
-```elixir
- iex(4)> EarmarkParser.as_ast("")
- {:ok, [{"p", [], [{"a", [{"href", "https://elixir-lang.com"}], ["https://elixir-lang.com"], %{}}], %{}}], []}
-```
-
-#### Additional link parsing via options
-
-
-#### Pure links
-
-**N.B.** that the `pure_links` option is `true` by default
-
-```elixir
- iex(5)> EarmarkParser.as_ast("https://github.com")
- {:ok, [{"p", [], [{"a", [{"href", "https://github.com"}], ["https://github.com"], %{}}], %{}}], []}
-```
-
-But can be deactivated
-
-```elixir
- iex(6)> EarmarkParser.as_ast("https://github.com", pure_links: false)
- {:ok, [{"p", [], ["https://github.com"], %{}}], []}
-```
-
-
- #### Wikilinks...
-
- are disabled by default
-
-```elixir
- iex(7)> EarmarkParser.as_ast("[[page]]")
- {:ok, [{"p", [], ["[[page]]"], %{}}], []}
-```
-
- and can be enabled
-
-```elixir
- iex(8)> EarmarkParser.as_ast("[[page]]", wikilinks: true)
- {:ok, [{"p", [], [{"a", [{"href", "page"}], ["page"], %{wikilink: true}}], %{}}], []}
-```
-
-
-### Sub and Sup HTML Elements
-
-This feature is not enabled by default but can be enabled with the option `sub_sup: true`
-
-Therefore we will get
-
-```elixir
- iex(9)> EarmarkParser.as_ast("H~2~O or a^n^ + b^n^ = c^n^")
- {:ok, [{"p", [], ["H~2~O or a^n^ + b^n^ = c^n^"], %{}}], []}
-```
-
-But by specifying `sub_sup: true`
-
-```elixir
- iex(10)> EarmarkParser.as_ast("H~2~O or a^n^ + b^n^ = c^n^", sub_sup: true)
- {:ok, [{"p", [], ["H", {"sub", [], ["2"], %{}}, "O or a", {"sup", [], ["n"], %{}}, " + b", {"sup", [], ["n"], %{}}, " = c", {"sup", [], ["n"], %{}}], %{}}], []}
-```
-
-### Github Flavored Markdown
-
-GFM is supported by default, however as GFM is a moving target and all GFM extension do not make sense in a general context, EarmarkParser does not support all of it, here is a list of what is supported:
-
-#### Strike Through
-
-```elixir
- iex(11)> EarmarkParser.as_ast("~~hello~~")
- {:ok, [{"p", [], [{"del", [], ["hello"], %{}}], %{}}], []}
-```
-
-#### GFM Tables
-
-Are not enabled by default
-
-```elixir
- iex(12)> as_ast("a|b\\n-|-\\nc|d\\n")
- {:ok, [{"p", [], ["a|b\\n-|-\\nc|d\\n"], %{}}], []}
-```
-
-But can be enabled with `gfm_tables: true`
-
-```elixir
- iex(13)> as_ast("a|b\n-|-\nc|d\n", gfm_tables: true)
- {:ok,
- [
- {
- "table",
- [],
- [
- {"thead", [], [{"tr", [], [{"th", [{"style", "text-align: left;"}], ["a"], %{}}, {"th", [{"style", "text-align: left;"}], ["b"], %{}}], %{}}], %{}},
- {"tbody", [], [{"tr", [], [{"td", [{"style", "text-align: left;"}], ["c"], %{}}, {"td", [{"style", "text-align: left;"}], ["d"], %{}}], %{}}], %{}}
- ],
- %{}
- }
- ],
- []}
-```
-
-#### Syntax Highlighting
-
-All backquoted or fenced code blocks with a language string are rendered with the given
-language as a _class_ attribute of the _code_ tag.
-
-For example:
-
-```elixir
- iex(14)> [
- ...(14)> "```elixir",
- ...(14)> " @tag :hello",
- ...(14)> "```"
- ...(14)> ] |> as_ast()
- {:ok, [{"pre", [], [{"code", [{"class", "elixir"}], [" @tag :hello"], %{}}], %{}}], []}
-```
-
-will be rendered as shown in the doctest above.
-
-If you want to integrate with a syntax highlighter with different conventions you can add more classes by specifying prefixes that will be
-put before the language string.
-
-Prism.js for example needs a class `language-elixir`. In order to achieve that goal you can add `language-`
-as a `code_class_prefix` to `EarmarkParser.Options`.
-
-In the following example we want more than one additional class, so we add more prefixes.
-
-```elixir
- iex(15)> [
- ...(15)> "```elixir",
- ...(15)> " @tag :hello",
- ...(15)> "```"
- ...(15)> ] |> as_ast(%EarmarkParser.Options{code_class_prefix: "lang- language-"})
- {:ok, [{"pre", [], [{"code", [{"class", "elixir lang-elixir language-elixir"}], [" @tag :hello"], %{}}], %{}}], []}
-```
-
-
-#### Footnotes
-
-**N.B.** Footnotes are disabled by default, use `as_ast(..., footnotes: true)` to enable them
-
-Footnotes are now a **superset** of GFM Footnotes. This implies some changes
-
- - Footnote definitions (`[^footnote_id]`) must come at the end of your document (_GFM_)
- - Footnotes that are not referenced are not rendered anymore (_GFM_)
- - Footnote definitions can contain any markup with the exception of footnote definitions
-
- # iex(16)> markdown = [
- # ...(16)> "My reference[^to_footnote]",
- # ...(16)> "",
- # ...(16)> "[^1]: I am not rendered",
- # ...(16)> "[^to_footnote]: Important information"]
- # ...(16)> {:ok, ast, []} = as_ast(markdown, footnotes: true)
- # ...(16)> ast
- # [
- # {"p", [], ["My reference",
- # {"a",
- # [{"href", "#fn:to_footnote"}, {"id", "fnref:to_footnote"}, {"class", "footnote"}, {"title", "see footnote"}],
- # ["to_footnote"], %{}}
- # ], %{}},
- # {"div",
- # [{"class", "footnotes"}],
- # [{"hr", [], [], %{}},
- # {"ol", [],
- # [{"li", [{"id", "fn:to_footnote"}],
- # [{"a", [{"title", "return to article"}, {"class", "reversefootnote"}, {"href", "#fnref:to_footnote"}], ["↩"], %{}},
- # {"p", [], ["Important information"], %{}}], %{}}
- # ], %{}}], %{}}
- # ]
-
- For more complex examples of footnotes, please refer to
- [these tests](https://github.com/RobertDober/earmark_parser/tree/master/test/acceptance/ast/footnotes/multiple_fn_test.exs)
-
-#### Breaks
-
- Hard linebreaks are disabled by default
-
-```elixir
- iex(17)> ["* a"," b", "c"]
- ...(17)> |> as_ast()
- {:ok,
- [{"ul", [], [{"li", [], ["a\nb\nc"], %{}}], %{}}],
- []}
-```
-
- But can be enabled with `breaks: true`
-
-```elixir
- iex(18)> ["* a"," b", "c"]
- ...(18)> |> as_ast(breaks: true)
- {:ok, [{"ul", [], [{"li", [], ["a", {"br", [], [], %{}}, "b", {"br", [], [], %{}}, "c"], %{}}], %{}}], []}
-```
-
-#### Enabling **all** options that are disabled by default
-
- Can be achieved with the `all: true` option
-
-```elixir
- iex(19)> [
- ...(19)> "a^n^",
- ...(19)> "b~2~",
- ...(19)> "[[wikilink]]"]
- ...(19)> |> as_ast(all: true)
- {:ok, [
- {"p", [], ["a", {"sup", [], ["n"], %{}}, {"br", [], [], %{}}, "b", {"sub", [], ["2"], %{}}, {"br", [], [], %{}}, {"a", [{"href", "wikilink"}], ["wikilink"], %{wikilink: true}}], %{}}
- ],
- []}
-```
-
-#### Tables
-
-Are supported as long as they are preceded by an empty line.
-
- State | Abbrev | Capital
- ----: | :----: | -------
- Texas | TX | Austin
- Maine | ME | Augusta
-
-Tables may have leading and trailing vertical bars on each line
-
- | State | Abbrev | Capital |
- | ----: | :----: | ------- |
- | Texas | TX | Austin |
- | Maine | ME | Augusta |
-
-Tables need not have headers, in which case all column alignments
-default to left.
-
- | Texas | TX | Austin |
- | Maine | ME | Augusta |
-
-Currently we assume there are always spaces around interior vertical unless
-there are exterior bars.
-
-However in order to be more GFM compatible the `gfm_tables: true` option
-can be used to interpret only interior vertical bars as a table if a separation
-line is given, therefore
-
- Language|Rating
- --------|------
- Elixir | awesome
-
-is a table (if and only if `gfm_tables: true`) while
-
- Language|Rating
- Elixir | awesome
-
-never is.
-
-#### HTML Blocks
-
-HTML is not parsed recursively or detected in all conditions right now, though GFM compliance
-is a goal.
-
-But for now the following holds:
-
-A HTML Block defined by a tag starting a line and the same tag starting a different line is parsed
-as one HTML AST node, marked with %{verbatim: true}
-
-E.g.
-
-```elixir
- iex(20)> lines = [ "
", "some", "
more text" ]
- ...(20)> EarmarkParser.as_ast(lines)
- {:ok, [{"div", [], ["", "some"], %{verbatim: true}}, "more text"], []}
-```
-
-And a line starting with an opening tag and ending with the corresponding closing tag is parsed in similar
-fashion
-
-```elixir
- iex(21)> EarmarkParser.as_ast(["spaniel"])
- {:ok, [{"span", [{"class", "superspan"}], ["spaniel"], %{verbatim: true}}], []}
-```
-
-What is HTML?
-
-We differ from strict GFM by allowing **all** tags not only HTML5 tags this holds for one liners....
-
-```elixir
- iex(22)> {:ok, ast, []} = EarmarkParser.as_ast(["", "better"])
- ...(22)> ast
- [
- {"stupid", [], [], %{verbatim: true}},
- {"not", [], ["better"], %{verbatim: true}}]
-```
-
-and for multi line blocks
-
-```elixir
- iex(23)> {:ok, ast, []} = EarmarkParser.as_ast([ "", "world", ""])
- ...(23)> ast
- [{"hello", [], ["world"], %{verbatim: true}}]
-```
-
-#### HTML Comments
-
-Are recognized if they start a line (after ws and are parsed until the next `-->` is found
-all text after the next '-->' is ignored
-
-E.g.
-
-```elixir
- iex(24)> EarmarkParser.as_ast(" text -->\nafter")
- {:ok, [{:comment, [], [" Comment", "comment line", "comment "], %{comment: true}}, {"p", [], ["after"], %{}}], []}
-```
-
-
-#### Lists
-
-Lists are pretty much GFM compliant, but some behaviors concerning the interpreation of the markdown inside a List Item's first
-paragraph seem not worth to be interpreted, examples are blockquote in a tight [list item](ttps://babelmark.github.io/?text=*+aa%0A++%3E+Second)
-which we can only have in a [loose one](https://babelmark.github.io/?text=*+aa%0A++%0A++%3E+Second)
-
-Or a headline in a [tight list item](https://babelmark.github.io/?text=*+bb%0A++%23+Headline) which, again is only available in the
-[loose version](https://babelmark.github.io/?text=*+bb%0A%0A++%23+Headline) in EarmarkParser.
-
-furthermore [this example](https://babelmark.github.io/?text=*+aa%0A++%60%60%60%0ASecond%0A++%60%60%60) demonstrates how weird
-and definitely not useful GFM's own interpretation can get.
-
-Therefore we stick to a more predictable approach.
-
-```elixir
- iex(25)> markdown = [
- ...(25)> "* aa",
- ...(25)> " ```",
- ...(25)> "Second",
- ...(25)> " ```" ]
- ...(25)> as_ast(markdown)
- {:ok, [{"ul", [], [{"li", [], ["aa", {"pre", [], [{"code", [], ["Second"], %{}}], %{}}], %{}}], %{}}], []}
-```
-
-Also we do support the immediate style of block content inside lists
-
-```elixir
- iex(26)> as_ast("* > Nota Bene!")
- {:ok, [{"ul", [], [{"li", [], [{"blockquote", [], [{"p", [], ["Nota Bene!"], %{}}], %{}}], %{}}], %{}}], []}
-```
-
-or
-
-```elixir
- iex(27)> as_ast("1. # Breaking...")
- {:ok, [{"ol", [], [{"li", [], [{"h1", [], ["Breaking..."], %{}}], %{}}], %{}}], []}
-```
-
-
-### Adding Attributes with the IAL extension
-
-#### To block elements
-
-HTML attributes can be added to any block-level element. We use
-the Kramdown syntax: add the line `{:` _attrs_ `}` following the block.
-
-```elixir
- iex(28)> markdown = ["# Headline", "{:.from-next-line}"]
- ...(28)> as_ast(markdown)
- {:ok, [{"h1", [{"class", "from-next-line"}], ["Headline"], %{}}], []}
-```
-
-Headers can also have the IAL string at the end of the line
-
-```elixir
- iex(29)> markdown = ["# Headline{:.from-same-line}"]
- ...(29)> as_ast(markdown)
- {:ok, [{"h1", [{"class", "from-same-line"}], ["Headline"], %{}}], []}
-```
-
-A special use case is headers inside blockquotes which allow for some nifty styling in `ex_doc`*
-see [this PR](https://github.com/elixir-lang/ex_doc/pull/1400) if you are interested in the technical
-details
-
-```elixir
- iex(30)> markdown = ["> # Headline{:.warning}"]
- ...(30)> as_ast(markdown)
- {:ok, [{"blockquote", [], [{"h1", [{"class", "warning"}], ["Headline"], %{}}], %{}}], []}
-```
-
-This also works for headers inside lists
-
-```elixir
- iex(31)> markdown = ["- # Headline{:.warning}"]
- ...(31)> as_ast(markdown)
- {:ok, [{"ul", [], [{"li", [], [{"h1", [{"class", "warning"}], ["Headline"], %{}}], %{}}], %{}}], []}
-```
-
-It still works for inline code, as it did before
-
-```elixir
- iex(32)> markdown = "`Enum.map`{:lang=elixir}"
- ...(32)> as_ast(markdown)
- {:ok, [{"p", [], [{"code", [{"class", "inline"}, {"lang", "elixir"}], ["Enum.map"], %{}}], %{}}], []}
-```
-
-
-_attrs_ can be one or more of:
-
- * `.className`
- * `#id`
- * name=value, name="value", or name='value'
-
-For example:
-
- # Warning
- {: .red}
-
- Do not turn off the engine
- if you are at altitude.
- {: .boxed #warning spellcheck="true"}
-
-#### To links or images
-
-It is possible to add IAL attributes to generated links or images in the following
-format.
-
-```elixir
- iex(33)> markdown = "[link](url) {: .classy}"
- ...(33)> EarmarkParser.as_ast(markdown)
- { :ok, [{"p", [], [{"a", [{"class", "classy"}, {"href", "url"}], ["link"], %{}}], %{}}], []}
-```
-
-For both cases, malformed attributes are ignored and warnings are issued.
-
-```elixir
- iex(34)> [ "Some text", "{:hello}" ] |> Enum.join("\n") |> EarmarkParser.as_ast()
- {:error, [{"p", [], ["Some text"], %{}}], [{:warning, 2,"Illegal attributes [\"hello\"] ignored in IAL"}]}
-```
-
-It is possible to escape the IAL in both forms if necessary
-
-```elixir
- iex(35)> markdown = "[link](url)\\{: .classy}"
- ...(35)> EarmarkParser.as_ast(markdown)
- {:ok, [{"p", [], [{"a", [{"href", "url"}], ["link"], %{}}, "{: .classy}"], %{}}], []}
-```
-
-This of course is not necessary in code blocks or text lines
-containing an IAL-like string, as in the following example
-
-```elixir
- iex(36)> markdown = "hello {:world}"
- ...(36)> EarmarkParser.as_ast(markdown)
- {:ok, [{"p", [], ["hello {:world}"], %{}}], []}
-```
-
-## Limitations
-
- * Block-level HTML is correctly handled only if each HTML
- tag appears on its own line. So
-
-
-
- hello
-
-
-
- will work. However. the following won't
-
-
- hello
-
- * John Gruber's tests contain an ambiguity when it comes to
- lines that might be the start of a list inside paragraphs.
-
- One test says that
-
- This is the text
- * of a paragraph
- that I wrote
-
- is a single paragraph. The "*" is not significant. However, another
- test has
-
- * A list item
- * an another
-
- and expects this to be a nested list. But, in reality, the second could just
- be the continuation of a paragraph.
-
- I've chosen always to use the second interpretation—a line that looks like
- a list item will always be a list item.
-
- * Rendering of block and inline elements.
-
- Block or void HTML elements that are at the absolute beginning of a line end
- the preceding paragraph.
-
- Thusly
-
- mypara
-
-
- Becomes
-
-
mypara
-
-
- While
-
- mypara
-
-
- will be transformed into
-
-
mypara
-
-
-## Annotations
-
-**N.B.** this is an experimental feature from v1.4.16-pre on and might change or be removed again
-
-The idea is that each markdown line can be annotated, as such annotations change the semantics of Markdown
-they have to be enabled with the `annotations` option.
-
-If the `annotations` option is set to a string (only one string is supported right now, but a list might
-be implemented later on, hence the name), the last occurrence of that string in a line and all text following
-it will be added to the line as an annotation.
-
-Depending on how that line will eventually be parsed, this annotation will be added to the meta map (the 4th element
-in an AST quadruple) with the key `:annotation`
-
-In the current version the annotation will only be applied to verbatim HTML tags and paragraphs
-
-Let us show some examples now:
-
-### Annotated Paragraphs
-
-```elixir
- iex(37)> as_ast("hello %> annotated", annotations: "%>")
- {:ok, [{"p", [], ["hello "], %{annotation: "%> annotated"}}], []}
-```
-
-If we annotate more than one line in a para the first annotation takes precedence
-
-```elixir
- iex(38)> as_ast("hello %> annotated\nworld %> discarded", annotations: "%>")
- {:ok, [{"p", [], ["hello \nworld "], %{annotation: "%> annotated"}}], []}
-```
-
-### Annotated HTML elements
-
-In one line
-
-```elixir
- iex(39)> as_ast("One Line // a span", annotations: "//")
- {:ok, [{"span", [], ["One Line"], %{annotation: "// a span", verbatim: true}}], []}
-```
-
-or block elements
-
-```elixir
- iex(40)> [
- ...(40)> "
` tags](https://github.com/RobertDober/earmark_parser/pull/112)
-
- Kudos to [Ben Olive](https://github.com/sionide21)
-
-- Add option `all: true` enabling all options which are disabled by default, which are:
- `breaks`, `footnotes`, `gfm_tables`, `sub_sup`, `wikilinks`
-
-- Fix bug for `a^n^` not being parsed as sup
-
-## 1.4.27 2022-09-30
-
-- [Nice addition of sub and sup elements](https://github.com/RobertDober/earmark_parser/tree/i108-sub-and-sup)
-
- Needs to be enabled with the option `sub_sup: true` renders `~x~` inside `` and `^x^` inside ``
-
- Kudos to [manuel-rubio](https://github.com/manuel-rubio)
-
-- Optimisation in the inline renderer
-
-- Removal of compiler warnings
-
-## 1.4.26 2022-06-15
-
-- Allow unquoted values for HTML attributes
-
-- [Accept valueless HTML attributes](https://github.com/RobertDober/earmark_parser/pull/106)
-
- Kudos to [Tom Conroy](https://github.com/tomconroy)
-
-## 1.4.25 2022-03-24
-
-- [Two PRs to assure lookahead scanning is applied on the top level, where needed most](https://github.com/robertdober/earmark_parser/issues/100)
- [and corresponding performance test](https://github.com/robertdober/earmark_parser/issues/101)
-
- Kudos to [jonatanklosko](https://github.com/jonatanklosko)
-
-
-## 1.4.24 2022-03-20
-
-- Single worded footnote definitions where shadowed by ID Definitions, the tiebreak was resolved in favor of
- Footnotes as ID Definitions do not need, and might as a matter of fact almost never, to start with a `^`
- [Related Issue](https://github.com/RobertDober/earmark_parser/issues/99)
-
-- Unused import warning removed
-
-## 1.4.23 2022-03-16
-
-Two more list regressions fixed
-
-- multi line inline code was ignored in the body parts of lists
-
-- spaced lists with inline code in their bodies (single and multiline) were rendered tightly (no surrounding `
...
`
-
-## 1.4.22 2022-03-14
-
-Fixes all List Regressions introduced in 1.4.19
-
-GFM support for lists remain limited (spaced and tight lists are not 100% compliant) but is better than in 1.4.18
-
-## 1.4.21 2022-03-13
-
-- [Paragraph context lost after indented code blocks](https://github.com/robertdober/earmark_parser/issues/98)
-
-## 1.4.20 2022-02-21
-
-- [Preserve newlines inside HTML code](https://github.com/RobertDober/earmark_parser/pull/97)
-
- Kudos to [José Valim](https://github.com/josevalim)
-
-- [Do not remove ial on blockquote inside triple quoted](https://github.com/RobertDober/earmark_parser/pull/96)
-
- Kudos to [José Valim](https://github.com/josevalim)
-
-- Removed support for Elixir 1.10 (following `ex_doc`'s lead)
-
-- [Correct pure link regex to reject invalid characters](https://github.com/RobertDober/earmark_parser/pull/91)
-
- Kudos to [Akash Hiremath](https://github.com/akash-akya)
-
-- [Intensive work to make pure links GFM Spec compliant](https://github.com/RobertDober/earmark_parser/pull/92)
-
- Kudos to [Akash Hiremath](https://github.com/akash-akya)
-
-## 1.4.19 2022-01-07
-
-- [Fix stop condition on closing HTML in scanners lookup algo](https://github.com/robertdober/earmark_parser/pull/79)
-
- Kudos to [José Valim](https://github.com/josevalim)
-
-- [Typos](https://github.com/robertdober/earmark_parser/pull/78)
- Kudos to [kianmeng](https://github.com/kianmeng)
-
-- [Footnotes fixed and upgraded(#26)](https://github.com/robertdober/earmark_parser/pull/76)
-
- Footnotes are now a **superset** of GFM Footnotes. This implies some changes
-
- - Footnote definitions (`[^footnote_id]`) must come at the end of your document (_GFM_)
- - Footnotes that are not referenced are not rendered anymore (_GFM_)
- - Footnote definitions can contain any markup with the exception of footnote definitions
-
-## 1.4.18 2021-12-04
-
-- [Deprecate options not useful anymore after the removal of parallel scanning (#72)](https://github.com/robertdober/earmark_parser/pull/72)
-
-- [Do not turn off lookahead on indented fences and check for indent only once (#71)](https://github.com/robertdober/earmark_parser/pull/71)
-
- Kudos to [José Valim](https://github.com/josevalim)
-
-- [Add lookahead for fenced code blocks (#70)](https://github.com/robertdober/earmark_parser/pull/70)
-
- * Do lookaheads for fenced code blocks
-
- Prior to this commit, we were trying to parse
- all lines between fenced code blocks, which
- could be very expensive. Therefore we lookahead
- fences and convert them to text.
-
- * Do not scan lines in parallel anymore
-
- * Remove unused code blocks
-
- * Handle fenced blocks wrapped in tags
-
- * Clean up regex
-
- * More corner cases
-
- * Optimize text creation
-
- * Optimize length checks
-
- Kudos to [José Valim](https://github.com/josevalim)
-
-
-- [5 Whitespace after closing ATX Headers](https://github.com/robertdober/earmark_parser/issues/5)
-
-- [40 Footnotes in lists](https://github.com/robertdober/earmark_parser/issues/40)
-
-- [65 Bad line numbers in spaced lists](https://github.com/robertdober/earmark_parser/issues/65)
-
-- [61 Fixes some double URI encoding in links](https://github.com/robertdober/earmark_parser/issues/61)
-
-- [Deprecate Pedantic Option](https://github.com/robertdober/earmark_parser/pull/60)
-
-## 1.4.17 2021-10-29
-
-- [44 Multiple Query Params in pure links](https://github.com/robertdober/earmark_parser/issues/44)
-
-- [28 Side By Side Reference Style Links fixed](https://github.com/robertdober/earmark_parser/issues/28)
-
-- [52 Deprecate Smartypants Options](https://github.com/robertdober/earmark_parser/issues/52)
-
-## 1.4.16 2021/10/07
-
-- [Inline IALs for headers, rulers and blockquotes](https://github.com/robertdober/earmark_parser/pull/56)
-
-- [Use Extractly instead of homemade readme task → Syntax Highlightening for iex> code blocks](https://github.com/robertdober/earmark_parser/pull/51)
-
-- [Refactoring and Dead Code Elimination in Context](https://github.com/robertdober/earmark_parser/pull/50)
-
-- [Annotations for Paragraphs and verbatim HTML](https://github.com/robertdober/earmark_parser/issues/47)
-
-- [46-fixing-typos](https://github.com/RobertDober/earmark_parser/pull/46)
- Kudos to [kianmeng](https://github.com/kianmeng)
-
-## 1.4.15 2021/08/12
-
-- [43-add-option-to-disable-inline-parsing](https://github.com/RobertDober/earmark_parser/pull/43)
- Kudos to [jonatanklosko](https://github.com/jonatanklosko)
-
-## 1.4.13 2021/04/18
-
-- [37-ial-in-li-raised-key-error](https://github.com/RobertDober/earmark_parser/pull/37)
-
-- [35-clearer-doc-iff-replacement](https://github.com/RobertDober/earmark_parser/pull/35)
- Kudos to [ream88](https://github.com/ream88)
-
-- [33-fix-for-bad-multiclass-ial-rendering](https://github.com/RobertDober/earmark_parser/pull/33)
- Kudos to [myrrlyn](https://github.com/myrrlyn)
-
-## 1.4.12 2020/11/27
-
-- [29-broken-changelog-link](https://github.com/robertdober/earmark_parser/pull/29)
- Kudos to [optikfluffel](https://github.com/optikfluffel)
-
-- [18-support-wikilinks](https://github.com/robertdober/earmark_parser/pull/18)
- Kudos to [sionide21](https://github.com/sionide21)
-
-
-## 1.4.11 2020/11/26
-
-- [24-treat-single-dash-as-text](https://github.com/robertdober/earmark_parser/issues/24)
- Kudos to [Ben Olive](https://github.com/sionide21)
-
-- [22-missing-ws-before-links](https://github.com/robertdober/earmark_parser/issues/22)
- Kudos to [Ben Olive](https://github.com/sionide21)
-
-## 1.4.10 2020/07/18
-
-- [1-text-of-footnote-definitions-not-converted](https://github.com/robertdober/earmark_parser/issues/1)
-
-- [19-use-spdx-in-hex](https://github.com/robertdober/earmark_parser/issues/19)
- Kudos to [Chulki Lee](https://github.com/chulkilee)
-
-- [10-Missing-space-between-whitspace-separated-items](https://github.com/robertdober/earmark_parser/issues/10)
-
-- [15-hide-private-module](https://github.com/robertdober/earmark_parser/issues/15)
- Kudos to [Wojtek Mach](https://github.com/wojtekmach)
-
-- [14-remove-application-from-mix.exs](https://github.com/robertdober/earmark_parser/issues/14)
- Kudos to [Wojtek Mach](https://github.com/wojtekmach)
-
-- [13-fix-github-link](https://githuhttps://github.com/RobertDober/earmark_parser/issues?q=is%3Apr+author%3Awojtekmachb.com/robertdober/earmark_parser/issues/13)
- Kudos to [Wojtek Mach](https://github.com/wojtekmach)
-
-
-## 1.4.9 2020/07/01
-
-
-- [2-accept-any-struct-as-option](https://github.com/pragdave/earmark/issues/2)
- Allow client code of Earmark to replace their calls to `Earmark.as_ast` with `EarmarkParser.as_ast` w/o any
- changes
-
-## 1.4.8 2020/06/29
-
-This marks the first release of the parser isolated from the rest of Earmark.
-
-It is feature identical to the 1.4.7 release of Earmark.
-
-All releases below were Earmark, all releases above are only EarmarkParser.
-
-# Earmark
-
-## 1.4.7 2020/06/29
-
-- [371-still-spurious-ws-after-inline-tags](https://github.com/pragdave/earmark/issues/371)
-
-## 1.4.6 2020/06/28
-
-- [350-some-complicated-autolinks-cut](https://github.com/pragdave/earmark/issues/350)
-
-- [359-unexpected-ws-in-html](https://github.com/pragdave/earmark/issues/359)
-
-- [337-quadruple-ast-format](https://github.com/pragdave/earmark/issues/337)
-
-- [366-simplify-transform](https://github.com/pragdave/earmark/issues/366)
- Kudos to [Eksperimental](https://github.com/eksperimental)
-
-- [353-oneline-html-tags](https://github.com/pragdave/earmark/issues/353)
-
-- [351-html-tags-without-newlines](https://github.com/pragdave/earmark/issues/351)
-
-- [335-content-inside-table-cells-reversed](https://github.com/pragdave/earmark/issues/335)
-
-- [348-no-crashes-for-invalid-URIs](https://github.com/pragdave/earmark/issues/348)
- Kudos to José Valim
-
-- [347-dialyxir-errors](https://github.com/pragdave/earmark/issues/347)
- Fixed some of them, alas not all
-
-## 1.4.5 2020/06/06
-
-This is mostly a bugfix release, as there were edge cases that resulted in
-Earmark crashing, notably
-
- - Bare IAL
- - unquoted attributes in html tags
-
-Also autolinks (GFM extension) delivered incorrect URLS where parenthesis were involved,
-for better GFM compatibility we therefore
-
- - Fixed broken parenthesis links (99% of all cases)
- - introduced the same URL encoding/decoding in links and link names of autolinks as GFM does
-
-And last but not least all numeric options in the CLI can now be written with
-underlines for readability.
-
-- [343-error-parsing-unquoted-atts](https://github.com/pragdave/earmark/issues/343)
-
-- [342 parens in pure links](https://github.com/pragdave/earmark/issues/342)
-
-- [340 IAL might cause error](https://github.com/pragdave/earmark/issues/340)
-
-- [339 Typos fix](ihttps://github.com/pragdave/earmark/pull/339)
- Kudos to [Ondrej Pinka](https://github.com/onpikono)
-
-- [336 Smartypants: Convert three hyphens to em dash](https://github.com/pragdave/earmark/pull/336)
- Kudos to [Jony Stoten](https://github.com/jonnystoten)
-
-- [324 Fix AST for links with nested elements](https://github.com/pragdave/earmark/pull/324)
- Kudos to [Wojtek Mach](https://github.com/wojtekmach)
-
-- [320 Nested Blockquotes](https://github.com/pragdave/earmark/issues/320)
-
-## 1.4.4 2020/05/01
-
-- [338 Deprecation warnings in mixfile removed](https://github.com/pragdave/earmark/issues/338)
-
-## 1.4.3 2019/11/23
-
-- [309 fenced code allows for more than 3 backticks/tildes now](https://github.com/pragdave/earmark/issues/309)
-
-- [302 Earmark.version returned a charlist, now a string](https://github.com/pragdave/earmark/issues/302)
-
-- [298 Blockquotes nested in lists only work with an indentation of 2 spaces](https://github.com/pragdave/earmark/issues/298)
-
-
-## 1.4.2 2019/10/14
-
-- [296 code for tasks removed from package](https://github.com/pragdave/earmark/issues/296)
- The additional tasks are only needed for dev and have been removed from the hex package. **Finally**
-- [PR#293 Nice fix for broken TOC links in README](https://github.com/pragdave/earmark/pull/293)
- Kudos to Ray Gesualdo [raygesualdo](https://github.com/raygesualdo)
-- [291 Transformer whitespace inside / around <code> <pre> tags](https://github.com/pragdave/earmark/issues/291)
- The spurious whitespace has been removed
-- [289 HTML Problem](https://github.com/pragdave/earmark/issues/289)
- The AST parser can now correctly distinguish between _generated_ AST (from md) and _parsed_ AST (from HTML)
-- [288 Metadata allowed to be added to the AST](https://github.com/pragdave/earmark/issues/288)
- The default HTML Transformer ignores metadata in the form of a map with the exception of `%{meta: ...}`
-
-## 1.4.1 2019/09/24
-
-- [282 Always create a `` in tables](https://github.com/pragdave/earmark/issues/282)
- Although strictly speaking a `` is only needed when there is a ``, semantic
- HTML suggests the presence of `` anyway.
-
-- [281 Urls in links were URL endoded, that is actually a bug ](https://github.com/pragdave/earmark/issues/281)
- It is the markdown author's responsibility to url encode her urls, if she does so correctly
- we double encoded the url before this fix.
-
-- [279 Languages in code blocks were limited to alphanum names, thus excluding, e.g. C# ](https://github.com/pragdave/earmark/issues/279)
-
-- [278 Implementing better GFM Table support ](https://github.com/pragdave/earmark/issues/278)
- Because of compatility issues we use a new option `gfm_tables` defaulting to `false` for this.
- Using this option `Earmark` will implement its own table extension **+** GFM tables at the same
- time.
-
-- [277 Expose an AST to HTML Transformer](https://github.com/pragdave/earmark/issues/277)
- While it should be faster to call `to_ast|>transform` it cannot be used instead of `as_html` yet
- as the API is not yet stable and some subtle differences in the output need to be addressed.
-
-
-## 1.4.0 2019/09/05
-
-- [145 Expose AST for output manipulation]( https://github.com/pragdave/earmark/issues/145)
-
-- [238 Pure Links are default now]( https://github.com/pragdave/earmark/issues/238)
-
-- [256 Align needed Elixir Version with ex_doc (>= 1.7)]( https://github.com/pragdave/earmark/issues/256)
-
-- [259 Deprecated option `sanitize` removed]( https://github.com/pragdave/earmark/issues/259)
-
-- [261 Deprecated Plugins removed]( https://github.com/pragdave/earmark/issues/261)
-
-- [265 Make deprecated `Earmark.parse/2` private]( https://github.com/pragdave/earmark/issues/265)
-
-
-## 1.3.6 2019/08/30
-
-Hopefully the last patch release of 1.3 before the structural changes of 1.4.
-
-- [#270]( https://github.com/pragdave/earmark/issues/270)
- Error messages during parsing of table cells were duplicated in a number, exponential to the number of table cells.
-
-- [#268]( https://github.com/pragdave/earmark/issues/268)
- Deprecation warnings concerning pure links showed fixed link to https://github.com/pragdave/earmark, at least a reasonable choice ;),
- instead of the text of the link.
-
-- [#266]( https://github.com/pragdave/earmark/issues/266)
- According to HTML5 Style Guide better XHTML compatibility by closing void tags e.g. `` --> ``
-
-
-## 1.3.5 2019/08/01
-
-- [#264]( https://github.com/pragdave/earmark/issues/264)
- Expose `Earmark.parse/2` but deprecate it.
-
-- [#262]( https://github.com/pragdave/earmark/issues/262)
- Remove non XHTML tags
and
-
-
-- [#236]( https://github.com/pragdave/earmark/issues/236)
- Deprecation of plugins.
-
-- [#257]( https://github.com/pragdave/earmark/issues/257)
- Deprecation of `sanitize` option.
-
-## 1.3.4 2019/07/29
-
-
-- [#254 pure links inside links](https://github.com/pragdave/earmark/issues/254)
-
-## 1.3.3 2019/07/23
-
-### Bugs
-- [#240 code blocks in lists](https://github.com/pragdave/earmark/issues/240)
- Bad reindentation inside list items led to code blocks not being verabtim =&rt; Badly formatted hexdoc for Earmark
-
-- [#243 errors in unicode link names](https://github.com/pragdave/earmark/issues/243)
- Regexpression was not UTF, thus some links were not correctly parsed
- Fixed in PR [244](https://github.com/pragdave/earmark/pull/244)
- Thank you [Stéphane ROBINO](https://github.com/StephaneRob)
-
-### Features
-
-- [#158 some pure links implemented](https://github.com/pragdave/earmark/issues/158)
- This GFM like behavior is more and more expected, I will issue a PR for `ex_doc` on this as discussed with
- [José Valim](https://github.com/josevalim)
- Deprecation Warnings are issued by default, but will be suppressed for `ex_doc` in said PR.
-
-- Minor improvements on documentation
- In PR [235](https://github.com/pragdave/earmark/pull/235)
- Thank you - [Jason Axelson](https://github.com/axelson)
-
-### Other
-
-- Refactoring c.f. PR [246](https://github.com/pragdave/earmark/pull/246)
-- Added Elixir version 1.9.0 for Travis c.f. PR #248
-
-### Minor improvements on documentation
-
-### PRs
-
-
- - [244](https://github.com/pragdave/earmark/pull/244)
- - [235](https://github.com/pragdave/earmark/pull/235)
-
-### Kudos:
-
- - [Jason Axelson](https://github.com/axelson)
- - [Stéphane ROBINO](https://github.com/StephaneRob)
-
-
-## 1.3.2 2019/03/23
-
-* Fix for issues
-
- - [#224 titles might be extracted from outside link]( https://github.com/pragdave/earmark/issues/224 )
- - [#220 render only first link title always correctly]( https://github.com/pragdave/earmark/issues/220 )
- - [#218 replaced iff with longer but clearer if and only if ]( https://github.com/pragdave/earmark/issues/218 )
-
-### Kudos:
- [niku](https://github.com/niku) for #218
- [Rich Morin](https://github.com/RichMorin) for #220 & #224 as well as discussions
-
-## 1.3.1 2018/12/21
-
- - [#212 spaces at line end force line break]( https://github.com/pragdave/earmark/issues/212 )
- - [#211 documentation explaining error messages]( https://github.com/pragdave/earmark/issues/211 )
-
-## 1.3.0 2018/11/15
-
-* Fix for issues
- - [#208 Inline code made Commonmark compatible]( https://github.com/pragdave/earmark/issues/208 )
- - [#203 escript does not report filename in error messages]( https://github.com/pragdave/earmark/issues/203 )
- - [#90 Parsing "...' or '..." as link titles removed]( https://github.com/pragdave/earmark/issues/90 )
-
-### Dev dependencies updated
-
-* credo -> 0.10
-
-## 1.2.7 Not released Milestone merged into 1.3
-
- Special KUDOS for [pareehonos](https://github.com/pareeohnos) for a huge PR concerning the major Feature Request [#145](https://github.com/pragdave/earmark/issues/145)
-
- This cannot be merged yet but certainly is a great contribution to our codebase.
-
-
-## 1.2.6 2018/08/21
-
-* Fix for issues
- - [#198 Escapes inside link texts are ignored]( https://github.com/pragdave/earmark/issues/198 )
- - [#197 README task broken in Elixir 1.7]( https://github.com/pragdave/earmark/issues/197 )
- - [#191 Allow configurable timeout for parallel map]( https://github.com/pragdave/earmark/issues/191 )
- - [#190 do not include generated src/*.erl in the package]( https://github.com/pragdave/earmark/issues/190 )
-
-* [#195 incorrect HTML for inline code blocks and IAL specified classes](https://github.com/pragdave/earmark/issues/195) from [Benjamin Milde]( https://github.com/LostKobrakai )
-
-## 1.2.5 2018/04/02
-
-* Fix for issues
- - [#161]( https://github.com/pragdave/earmark/issues/161 )
- - [#168]( https://github.com/pragdave/earmark/issues/168 )
- - [#172]( https://github.com/pragdave/earmark/issues/172 )
- - [#175]( https://github.com/pragdave/earmark/issues/175 )
- - [#181]( https://github.com/pragdave/earmark/issues/181 )
-
-* [#178](https://github.com/pragdave/earmark/pull/178) from [jwworth](https://github.com/jwworth)
-
-### Kudos:
- [jwworth](https://github.com/jwworth)
-
-## 1.2.4 2017/11/28
-
-* Fix for issue
- - [#166]( https://github.com/pragdave/earmark/issues/166 )
-
-* [PR160](https://github.com/pragdave/earmark/pull/160) from [simonwebdesign](https://github.com/simonewebdesign)
-* [PR163](https://github.com/pragdave/earmark/pull/163) from [nscyclone](https://github.com/nscyclone)
-* [PR164](https://github.com/pragdave/earmark/pull/164) from [joshsmith](https://github.com/joshsmith)
-* [PR165](https://github.com/pragdave/earmark/pull/165) from [asummers](https://github.com/asummers)
-
-### Kudos:
- [simonwebdesign](https://github.com/simonewebdesign), [nscyclone](https://github.com/nscyclone),
- [joshsmith](https://github.com/joshsmith), [asummers](https://github.com/asummers)
-
-
-## 1.2.3 2017/07/26
-
-* [PR151](https://github.com/pragdave/earmark/pull/151) from [joshuawscott](https://github.com/joshuawscott)
-
-* Fixes for issues
- - [#150](https://github.com/pragdave/earmark/issues/150)
- - [#147](https://github.com/pragdave/earmark/issues/147)
-
-### Kudos:
-
- [joshuawscott](https://github.com/joshuawscott)
-
-## 1.2.2 2017/05/11
-
-* [PR #144](https://github.com/pragdave/earmark/pull/144) from [KronicDeth](https://github.com/KronicDeth)
-
-### Kudos:
-
- [KronicDeth](https://github.com/KronicDeth)
-
-## 1.2.1 2017/05/03
-
-* [PR #136](https://github.com/pragdave/earmark/pull/136) from [chrisalley](https://github.com/chrisalley)
-
-* Fixes for issues
- - [#139](https://github.com/pragdave/earmark/issues/139)
-
-### Kudos:
-
- [chrisalley](https://github.com/chrisalley)
-
-## 1.2 2017/03/10
-
-* [PR #130](https://github.com/pragdave/earmark/pull/130) from [eksperimental](https://github.com/eksperimental)
-* [PR #129](https://github.com/pragdave/earmark/pull/129) from [Alekx](https://github.com/alkx)
-* [PR #125](//https://github.com/pragdave/earmark/pull/125) from [vyachkonovalov](https://github.com/vyachkonovalov)
-
-* Fixes for issues
- - #127
- - #131
-
-### Kudos:
-
- [vyachkonovalov](https://github.com/vyachkonovalov), [Alekx](https://github.com/alkx), [eksperimental](https://github.com/eksperimental)
-
-## 1.1.1 2017/02/03
-
-* PR from Natronium pointing out issue #123
-
-* Fixes for issues
- - #123
-
-### Kudos:
-
- [Natronium](https://github.com/Natronium)
-
-## 1.1.0 2017/01/22
-
-* PR from Michael Pope
-* PR from Pragdave
-* PR from christopheradams
-* PR from [AndrewDryga](https://github.com/AndrewDryga)
-
-* Fixes for issues
- - #106
- - #110
- - #114
-
-### Kudos:
- [AndrewDryga](https://github.com/AndrewDryga), [Christopher Adams](https://github.com/christopheradams),
- [Michael Pope](https://github.com/amorphid)
-
-
-## 1.0.3 2016/11/02
-
-* PR from TBK145 with some dead code elimination.
-* Implementation of command line switches for the `earmark` executable. Now any `%Earmark.Options{}` key can be
- passed in.
-
-* Fixes for issues
- - #99
- - #96
- - #95
- - #103
-
-### Kudos:
- Thijs Klaver (TBK145)
-
-## 1.0.2 2016/10/10
-
-* PR from pdebelak with a fix of #55
-* PR from jonnystorm with a fix for a special case in issue #85
-* test coverage at 100%
-* PR from michalmuskala
-* Fixed remaining compiler warnings from 1.0.1 (Elixir 1.3)
-* PR from pdebelak to fix a factual error in the README
-* Fixes for issues
- - #55
- - #86
- - #88
- - #89
- - #93
-
-### Kudos:
- Jonathan Storm (jonnystorm), Michal Muskala (michalmuskala) & Peter Debelak (pdebelak)
-
-## 1.0.1 2016/06/07
-
-* fixing issue #81 by pushing this updated Changelog.md :)
-* PR from mschae fixing issue #80 broken hex package
-
-### Kudos:
- Michael Schaefermeyer (mschae) & Tobias Pfeiffer (PragTob)
-
-## 1.0.0 2016/06/07
-
-* --version | -v switch for `earmark` escript.
-* added security notice about XSS to docs thanks to remiq
-* PR from alakra (issue #59) to allow Hyphens and Unicode in fenced code block names
-* PR from sntran to fix unsafe conditional variables from PR
-* PR from riacataquian to use maps instead of dicts
-* PR from gmile to remove duplicate tests
-* PR from gmile to upgrade poison dependency
-* PR from whatyouhide to fix warnings for Elixir 1.4 with additional help from milmazz
-* Travis for 1.2.x and 1.3.1 as well as OTP 19
-* Fixes for issues:
- - #61
- - #66
- - #70
- - #71
- - #72
- - #77
- - #78
-
-### Kudos:
-Remigiusz Jackowski (remiq), Angelo Lakra (alakra), Son Tran-Nguyen (sntran), Mike Kreuzer (mikekreuzer),
-Ria Cataquian (riacataquian), Eugene Pirogov (gmile), Andrea Leopardi (whatyouhide) & Milton Mazzarri (milmazz)
-
-## 0.2.1 2016/01/15
-
-* Added 1.2 for Travis
-* PR from mneudert to fix HTMLOneLine detection
-
-### Kudos:
-
-Marc Neudert (mneudert)
-
-
-## 0.2.0 2015/12/28
-
-* PR from eksperimental guaranteeing 100% HTML5
-* PR from imbriaco to decouple parsing and html generation and whitespace removal
-* Fixes for issues:
- - #40
- - #41
- - #43
- - #48
- - #50
- - #51
-* Explicit LICENSE change to Apache 2.0 (#42)
-* Loading of test support files only in test environment thanks to José Valim
-* IO Capture done correctly thanks to whatyouhide
-* Warning for Elixir 1.2 fixed by mschae
-
-### Kudos:
-
-Eksperimental (eksperimental), Mark Imbriaco (imbriaco), Andrea Leopardi(whatyouhide), José Valim &
-Michael Schaefermeyer (mschae)
-
-## 0.1.19 2015/10/27
-
-* Fix | in implicit lists, and restructur the parse a little.
- Many thanks to Robert Dober
-
-## 0.1.17 2015/05/18
-
-* Add strikethrough support to the HTML renderer. Thanks to
- Michael Schaefermeyer (mschae)
-
-
-## 0.1.16 2015/05/08
-
-* Another fix from José, this time for & in code blocks.
-
-
-## 0.1.15 2015/03/25
-
-* Allow numbered lists to start anywhere in the first four columns.
- (This was previously allowed for unnumbered lists). Fixes #13.
-
-
-## 0.1.14 2015/03/25
-
-* Fixed a problem where a malformed text heading caused a crash.
- We now report what appears to be malformed Markdown and
- continue, processing the line as text. Fixes #17.
-
-
-## 0.1.13 2015/01/31
-
-* José fixed a bug in Regex that revealed a problem with some
- Earmark replacement strings. As he's a true gentleman, he then
- fixed Earmark.
-
-
-## 0.1.11 2014/08/18
-
-* Matthew Lyon contributed footnote support.
-
- the answer is clearly 42.[^fn-why] In this case
- we need to…
-
- [^fn-why]: 42 is the only two digit number with
- the digits 4 and 2 that starts with a 4.
-
- For now, consider it experimental. For that reason, you have
- to enable it by passing the `footnotes: true` option.
-
-
-## 0.1.10 2014/08/13
-
-* The spec is ambiguous when it comes to setext headings. I assumed
- that they needed a blank line after them, but common practice says
- no. Changed the parser to treat them as headings if there's no
- blank.
-
-
-## 0.1.9 2014/08/05
-
-* Bug fix—extra blank lines could be appended to code blocks.
-* Tidied up code block HTML
-
-
-## 0.1.7 2014/07/26
-
-* Block rendering is now performed in parallel
-
-
-## 0.1.6 07/25/14
-
-* Added support for Kramdown-style attribute annotators for all block
- elements, so you can write
-
- # Warning
- {: .red}
-
- Do not turn off the engine
- if you are at altitude.
- {: .boxed #warning spellcheck="true"}
-
- and generate
-
-
Warning
-
Do not turn
- off the engine if you are at altitude.
-
-
-## 0.1.5 07/20/14
-
-* Merged two performance improvements from José Valim
-* Support escaping of pipes in tables, so
-
- a | b
- c | d \| e
-
- has two columns, not three.
-
-
-## 0.1.4 07/14/14
-
-* Allow list bullets to be indented, and deal with potential subsequent
- additional indentation of the body of an item.
-
-
-## 0.1.3 07/14/14
-
-* Added tasks to the Hex file list
-
-
-## 0.1.2 07/14/14
-
-* Add support for GFM tables
-
-
-## 0.1.1 07/09/14
-
-* Move readme generation task out of mix.exs and into tasks/
-* Fix bug if setext heading started on first line
-
-
-## 0.1.0 07/09/14
-
-* Initial Release
diff --git a/apps/plataforma_digital/deps/earmark_parser/hex_metadata.config b/apps/plataforma_digital/deps/earmark_parser/hex_metadata.config
deleted file mode 100644
index 624c6fc4..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/hex_metadata.config
+++ /dev/null
@@ -1,62 +0,0 @@
-{<<"links">>,
- [{<<"Changelog">>,
- <<"https://github.com/RobertDober/earmark_parser/blob/master/RELEASE.md">>},
- {<<"GitHub">>,<<"https://github.com/RobertDober/earmark_parser">>}]}.
-{<<"name">>,<<"earmark_parser">>}.
-{<<"version">>,<<"1.4.36">>}.
-{<<"description">>,
- <<"Earmark AST the parser and AST Generator for\nDave Thomas' Earmark.\n\nThe parser generates\nan Abstract Syntax Tree from Markdown.\n\nThe original Earmark will still provide the HTML Transformation and\nthe CLI, however its Scanner, Parser and AST Renderer have been\nextracted into this library.">>}.
-{<<"elixir">>,<<"~> 1.11">>}.
-{<<"app">>,<<"earmark_parser">>}.
-{<<"files">>,
- [<<"lib">>,<<"lib/earmark_parser">>,<<"lib/earmark_parser/line.ex">>,
- <<"lib/earmark_parser/message.ex">>,<<"lib/earmark_parser/options.ex">>,
- <<"lib/earmark_parser/enum">>,<<"lib/earmark_parser/enum/ext.ex">>,
- <<"lib/earmark_parser/parser">>,
- <<"lib/earmark_parser/parser/footnote_parser.ex">>,
- <<"lib/earmark_parser/parser/list_info.ex">>,
- <<"lib/earmark_parser/parser/list_parser.ex">>,
- <<"lib/earmark_parser/parser/link_parser.ex">>,
- <<"lib/earmark_parser/helpers.ex">>,<<"lib/earmark_parser/ast">>,
- <<"lib/earmark_parser/ast/renderer">>,
- <<"lib/earmark_parser/ast/renderer/table_renderer.ex">>,
- <<"lib/earmark_parser/ast/renderer/html_renderer.ex">>,
- <<"lib/earmark_parser/ast/renderer/footnote_renderer.ex">>,
- <<"lib/earmark_parser/ast/renderer/ast_walker.ex">>,
- <<"lib/earmark_parser/ast/emitter.ex">>,
- <<"lib/earmark_parser/ast/inline.ex">>,<<"lib/earmark_parser/parser.ex">>,
- <<"lib/earmark_parser/context.ex">>,
- <<"lib/earmark_parser/line_scanner.ex">>,
- <<"lib/earmark_parser/ast_renderer.ex">>,<<"lib/earmark_parser/helpers">>,
- <<"lib/earmark_parser/helpers/yecc_helpers.ex">>,
- <<"lib/earmark_parser/helpers/line_helpers.ex">>,
- <<"lib/earmark_parser/helpers/ast_helpers.ex">>,
- <<"lib/earmark_parser/helpers/string_helpers.ex">>,
- <<"lib/earmark_parser/helpers/reparse_helpers.ex">>,
- <<"lib/earmark_parser/helpers/html_parser.ex">>,
- <<"lib/earmark_parser/helpers/leex_helpers.ex">>,
- <<"lib/earmark_parser/helpers/attr_parser.ex">>,
- <<"lib/earmark_parser/helpers/lookahead_helpers.ex">>,
- <<"lib/earmark_parser/helpers/pure_link_helpers.ex">>,
- <<"lib/earmark_parser/block">>,<<"lib/earmark_parser/block/list_item.ex">>,
- <<"lib/earmark_parser/block/html.ex">>,
- <<"lib/earmark_parser/block/ruler.ex">>,
- <<"lib/earmark_parser/block/html_oneline.ex">>,
- <<"lib/earmark_parser/block/code.ex">>,
- <<"lib/earmark_parser/block/id_def.ex">>,
- <<"lib/earmark_parser/block/para.ex">>,
- <<"lib/earmark_parser/block/fn_list.ex">>,
- <<"lib/earmark_parser/block/ial.ex">>,
- <<"lib/earmark_parser/block/list.ex">>,
- <<"lib/earmark_parser/block/table.ex">>,
- <<"lib/earmark_parser/block/heading.ex">>,
- <<"lib/earmark_parser/block/fn_def.ex">>,
- <<"lib/earmark_parser/block/html_comment.ex">>,
- <<"lib/earmark_parser/block/text.ex">>,
- <<"lib/earmark_parser/block/block_quote.ex">>,<<"lib/earmark_parser.ex">>,
- <<"src/link_text_lexer.xrl">>,<<"src/string_lexer.xrl">>,
- <<"src/link_text_parser.yrl">>,<<"mix.exs">>,<<"README.md">>,
- <<"RELEASE.md">>,<<"LICENSE">>]}.
-{<<"licenses">>,[<<"Apache-2.0">>]}.
-{<<"requirements">>,[]}.
-{<<"build_tools">>,[<<"mix">>]}.
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser.ex
deleted file mode 100644
index cbbfe3c8..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser.ex
+++ /dev/null
@@ -1,641 +0,0 @@
-defmodule EarmarkParser do
- @type ast_meta :: map()
- @type ast_tag :: binary()
- @type ast_attribute_name :: binary()
- @type ast_attribute_value :: binary()
- @type ast_attribute :: {ast_attribute_name(), ast_attribute_value()}
- @type ast_attributes :: list(ast_attribute())
- @type ast_tuple :: {ast_tag(), ast_attributes(), ast(), ast_meta()}
- @type ast_node :: binary() | ast_tuple()
- @type ast :: list(ast_node())
-
- @type error :: {atom(), non_neg_integer(), binary()}
- @type errors :: list(error())
-
- @type t :: {:ok, ast(), []} | {:error, ast(), errors()}
-
- @moduledoc ~S"""
-
- ### API
-
- #### EarmarkParser.as_ast
-
- This is the structure of the result of `as_ast`.
-
- {:ok, ast, []} = EarmarkParser.as_ast(markdown)
- {:ok, ast, deprecation_messages} = EarmarkParser.as_ast(markdown)
- {:error, ast, error_messages} = EarmarkParser.as_ast(markdown)
-
- For examples see the functiondoc below.
-
- #### Options
-
- Options can be passed into `as_ast/2` according to the documentation of `EarmarkParser.Options`.
-
- {status, ast, errors} = EarmarkParser.as_ast(markdown, options)
-
- ## Supports
-
- Standard [Gruber markdown][gruber].
-
- [gruber]:
-
- ## Extensions
-
- ### Links
-
- #### Links supported by default
-
- ##### Oneline HTML Link tags
-
- iex(1)> EarmarkParser.as_ast(~s{link})
- {:ok, [{"a", [{"href", "href"}], ["link"], %{verbatim: true}}], []}
-
- ##### Markdown links
-
- New style ...
-
- iex(2)> EarmarkParser.as_ast(~s{[title](destination)})
- {:ok, [{"p", [], [{"a", [{"href", "destination"}], ["title"], %{}}], %{}}], []}
-
- and old style
-
- iex(3)> EarmarkParser.as_ast("[foo]: /url \"title\"\n\n[foo]\n")
- {:ok, [{"p", [], [{"a", [{"href", "/url"}, {"title", "title"}], ["foo"], %{}}], %{}}], []}
-
- #### Autolinks
-
- iex(4)> EarmarkParser.as_ast("")
- {:ok, [{"p", [], [{"a", [{"href", "https://elixir-lang.com"}], ["https://elixir-lang.com"], %{}}], %{}}], []}
-
- #### Additional link parsing via options
-
-
- #### Pure links
-
- **N.B.** that the `pure_links` option is `true` by default
-
- iex(5)> EarmarkParser.as_ast("https://github.com")
- {:ok, [{"p", [], [{"a", [{"href", "https://github.com"}], ["https://github.com"], %{}}], %{}}], []}
-
- But can be deactivated
-
- iex(6)> EarmarkParser.as_ast("https://github.com", pure_links: false)
- {:ok, [{"p", [], ["https://github.com"], %{}}], []}
-
-
- #### Wikilinks...
-
- are disabled by default
-
- iex(7)> EarmarkParser.as_ast("[[page]]")
- {:ok, [{"p", [], ["[[page]]"], %{}}], []}
-
- and can be enabled
-
- iex(8)> EarmarkParser.as_ast("[[page]]", wikilinks: true)
- {:ok, [{"p", [], [{"a", [{"href", "page"}], ["page"], %{wikilink: true}}], %{}}], []}
-
-
- ### Sub and Sup HTML Elements
-
- This feature is not enabled by default but can be enabled with the option `sub_sup: true`
-
- Therefore we will get
-
- iex(9)> EarmarkParser.as_ast("H~2~O or a^n^ + b^n^ = c^n^")
- {:ok, [{"p", [], ["H~2~O or a^n^ + b^n^ = c^n^"], %{}}], []}
-
- But by specifying `sub_sup: true`
-
- iex(10)> EarmarkParser.as_ast("H~2~O or a^n^ + b^n^ = c^n^", sub_sup: true)
- {:ok, [{"p", [], ["H", {"sub", [], ["2"], %{}}, "O or a", {"sup", [], ["n"], %{}}, " + b", {"sup", [], ["n"], %{}}, " = c", {"sup", [], ["n"], %{}}], %{}}], []}
-
- ### Github Flavored Markdown
-
- GFM is supported by default, however as GFM is a moving target and all GFM extension do not make sense in a general context, EarmarkParser does not support all of it, here is a list of what is supported:
-
- #### Strike Through
-
- iex(11)> EarmarkParser.as_ast("~~hello~~")
- {:ok, [{"p", [], [{"del", [], ["hello"], %{}}], %{}}], []}
-
- #### GFM Tables
-
- Are not enabled by default
-
- iex(12)> as_ast("a|b\\n-|-\\nc|d\\n")
- {:ok, [{"p", [], ["a|b\\n-|-\\nc|d\\n"], %{}}], []}
-
- But can be enabled with `gfm_tables: true`
-
- iex(13)> as_ast("a|b\n-|-\nc|d\n", gfm_tables: true)
- {:ok,
- [
- {
- "table",
- [],
- [
- {"thead", [], [{"tr", [], [{"th", [{"style", "text-align: left;"}], ["a"], %{}}, {"th", [{"style", "text-align: left;"}], ["b"], %{}}], %{}}], %{}},
- {"tbody", [], [{"tr", [], [{"td", [{"style", "text-align: left;"}], ["c"], %{}}, {"td", [{"style", "text-align: left;"}], ["d"], %{}}], %{}}], %{}}
- ],
- %{}
- }
- ],
- []}
-
- #### Syntax Highlighting
-
- All backquoted or fenced code blocks with a language string are rendered with the given
- language as a _class_ attribute of the _code_ tag.
-
- For example:
-
- iex(14)> [
- ...(14)> "```elixir",
- ...(14)> " @tag :hello",
- ...(14)> "```"
- ...(14)> ] |> as_ast()
- {:ok, [{"pre", [], [{"code", [{"class", "elixir"}], [" @tag :hello"], %{}}], %{}}], []}
-
- will be rendered as shown in the doctest above.
-
- If you want to integrate with a syntax highlighter with different conventions you can add more classes by specifying prefixes that will be
- put before the language string.
-
- Prism.js for example needs a class `language-elixir`. In order to achieve that goal you can add `language-`
- as a `code_class_prefix` to `EarmarkParser.Options`.
-
- In the following example we want more than one additional class, so we add more prefixes.
-
- iex(15)> [
- ...(15)> "```elixir",
- ...(15)> " @tag :hello",
- ...(15)> "```"
- ...(15)> ] |> as_ast(%EarmarkParser.Options{code_class_prefix: "lang- language-"})
- {:ok, [{"pre", [], [{"code", [{"class", "elixir lang-elixir language-elixir"}], [" @tag :hello"], %{}}], %{}}], []}
-
-
- #### Footnotes
-
- **N.B.** Footnotes are disabled by default, use `as_ast(..., footnotes: true)` to enable them
-
- Footnotes are now a **superset** of GFM Footnotes. This implies some changes
-
- - Footnote definitions (`[^footnote_id]`) must come at the end of your document (_GFM_)
- - Footnotes that are not referenced are not rendered anymore (_GFM_)
- - Footnote definitions can contain any markup with the exception of footnote definitions
-
- # iex(16)> markdown = [
- # ...(16)> "My reference[^to_footnote]",
- # ...(16)> "",
- # ...(16)> "[^1]: I am not rendered",
- # ...(16)> "[^to_footnote]: Important information"]
- # ...(16)> {:ok, ast, []} = as_ast(markdown, footnotes: true)
- # ...(16)> ast
- # [
- # {"p", [], ["My reference",
- # {"a",
- # [{"href", "#fn:to_footnote"}, {"id", "fnref:to_footnote"}, {"class", "footnote"}, {"title", "see footnote"}],
- # ["to_footnote"], %{}}
- # ], %{}},
- # {"div",
- # [{"class", "footnotes"}],
- # [{"hr", [], [], %{}},
- # {"ol", [],
- # [{"li", [{"id", "fn:to_footnote"}],
- # [{"a", [{"title", "return to article"}, {"class", "reversefootnote"}, {"href", "#fnref:to_footnote"}], ["↩"], %{}},
- # {"p", [], ["Important information"], %{}}], %{}}
- # ], %{}}], %{}}
- # ]
-
- For more complex examples of footnotes, please refer to
- [these tests](https://github.com/RobertDober/earmark_parser/tree/master/test/acceptance/ast/footnotes/multiple_fn_test.exs)
-
- #### Breaks
-
- Hard linebreaks are disabled by default
-
- iex(17)> ["* a"," b", "c"]
- ...(17)> |> as_ast()
- {:ok,
- [{"ul", [], [{"li", [], ["a\nb\nc"], %{}}], %{}}],
- []}
-
- But can be enabled with `breaks: true`
-
- iex(18)> ["* a"," b", "c"]
- ...(18)> |> as_ast(breaks: true)
- {:ok, [{"ul", [], [{"li", [], ["a", {"br", [], [], %{}}, "b", {"br", [], [], %{}}, "c"], %{}}], %{}}], []}
-
- #### Enabling **all** options that are disabled by default
-
- Can be achieved with the `all: true` option
-
- iex(19)> [
- ...(19)> "a^n^",
- ...(19)> "b~2~",
- ...(19)> "[[wikilink]]"]
- ...(19)> |> as_ast(all: true)
- {:ok, [
- {"p", [], ["a", {"sup", [], ["n"], %{}}, {"br", [], [], %{}}, "b", {"sub", [], ["2"], %{}}, {"br", [], [], %{}}, {"a", [{"href", "wikilink"}], ["wikilink"], %{wikilink: true}}], %{}}
- ],
- []}
-
- #### Tables
-
- Are supported as long as they are preceded by an empty line.
-
- State | Abbrev | Capital
- ----: | :----: | -------
- Texas | TX | Austin
- Maine | ME | Augusta
-
- Tables may have leading and trailing vertical bars on each line
-
- | State | Abbrev | Capital |
- | ----: | :----: | ------- |
- | Texas | TX | Austin |
- | Maine | ME | Augusta |
-
- Tables need not have headers, in which case all column alignments
- default to left.
-
- | Texas | TX | Austin |
- | Maine | ME | Augusta |
-
- Currently we assume there are always spaces around interior vertical unless
- there are exterior bars.
-
- However in order to be more GFM compatible the `gfm_tables: true` option
- can be used to interpret only interior vertical bars as a table if a separation
- line is given, therefore
-
- Language|Rating
- --------|------
- Elixir | awesome
-
- is a table (if and only if `gfm_tables: true`) while
-
- Language|Rating
- Elixir | awesome
-
- never is.
-
- #### HTML Blocks
-
- HTML is not parsed recursively or detected in all conditions right now, though GFM compliance
- is a goal.
-
- But for now the following holds:
-
- A HTML Block defined by a tag starting a line and the same tag starting a different line is parsed
- as one HTML AST node, marked with %{verbatim: true}
-
- E.g.
-
- iex(20)> lines = [ "
", "some", "
more text" ]
- ...(20)> EarmarkParser.as_ast(lines)
- {:ok, [{"div", [], ["", "some"], %{verbatim: true}}, "more text"], []}
-
- And a line starting with an opening tag and ending with the corresponding closing tag is parsed in similar
- fashion
-
- iex(21)> EarmarkParser.as_ast(["spaniel"])
- {:ok, [{"span", [{"class", "superspan"}], ["spaniel"], %{verbatim: true}}], []}
-
- What is HTML?
-
- We differ from strict GFM by allowing **all** tags not only HTML5 tags this holds for one liners....
-
- iex(22)> {:ok, ast, []} = EarmarkParser.as_ast(["", "better"])
- ...(22)> ast
- [
- {"stupid", [], [], %{verbatim: true}},
- {"not", [], ["better"], %{verbatim: true}}]
-
- and for multi line blocks
-
- iex(23)> {:ok, ast, []} = EarmarkParser.as_ast([ "", "world", ""])
- ...(23)> ast
- [{"hello", [], ["world"], %{verbatim: true}}]
-
- #### HTML Comments
-
- Are recognized if they start a line (after ws and are parsed until the next `-->` is found
- all text after the next '-->' is ignored
-
- E.g.
-
- iex(24)> EarmarkParser.as_ast(" text -->\nafter")
- {:ok, [{:comment, [], [" Comment", "comment line", "comment "], %{comment: true}}, {"p", [], ["after"], %{}}], []}
-
-
- #### Lists
-
- Lists are pretty much GFM compliant, but some behaviors concerning the interpreation of the markdown inside a List Item's first
- paragraph seem not worth to be interpreted, examples are blockquote in a tight [list item](ttps://babelmark.github.io/?text=*+aa%0A++%3E+Second)
- which we can only have in a [loose one](https://babelmark.github.io/?text=*+aa%0A++%0A++%3E+Second)
-
- Or a headline in a [tight list item](https://babelmark.github.io/?text=*+bb%0A++%23+Headline) which, again is only available in the
- [loose version](https://babelmark.github.io/?text=*+bb%0A%0A++%23+Headline) in EarmarkParser.
-
- furthermore [this example](https://babelmark.github.io/?text=*+aa%0A++%60%60%60%0ASecond%0A++%60%60%60) demonstrates how weird
- and definitely not useful GFM's own interpretation can get.
-
- Therefore we stick to a more predictable approach.
-
- iex(25)> markdown = [
- ...(25)> "* aa",
- ...(25)> " ```",
- ...(25)> "Second",
- ...(25)> " ```" ]
- ...(25)> as_ast(markdown)
- {:ok, [{"ul", [], [{"li", [], ["aa", {"pre", [], [{"code", [], ["Second"], %{}}], %{}}], %{}}], %{}}], []}
-
- Also we do support the immediate style of block content inside lists
-
- iex(26)> as_ast("* > Nota Bene!")
- {:ok, [{"ul", [], [{"li", [], [{"blockquote", [], [{"p", [], ["Nota Bene!"], %{}}], %{}}], %{}}], %{}}], []}
-
- or
-
- iex(27)> as_ast("1. # Breaking...")
- {:ok, [{"ol", [], [{"li", [], [{"h1", [], ["Breaking..."], %{}}], %{}}], %{}}], []}
-
-
- ### Adding Attributes with the IAL extension
-
- #### To block elements
-
- HTML attributes can be added to any block-level element. We use
- the Kramdown syntax: add the line `{:` _attrs_ `}` following the block.
-
- iex(28)> markdown = ["# Headline", "{:.from-next-line}"]
- ...(28)> as_ast(markdown)
- {:ok, [{"h1", [{"class", "from-next-line"}], ["Headline"], %{}}], []}
-
- Headers can also have the IAL string at the end of the line
-
- iex(29)> markdown = ["# Headline{:.from-same-line}"]
- ...(29)> as_ast(markdown)
- {:ok, [{"h1", [{"class", "from-same-line"}], ["Headline"], %{}}], []}
-
- A special use case is headers inside blockquotes which allow for some nifty styling in `ex_doc`*
- see [this PR](https://github.com/elixir-lang/ex_doc/pull/1400) if you are interested in the technical
- details
-
- iex(30)> markdown = ["> # Headline{:.warning}"]
- ...(30)> as_ast(markdown)
- {:ok, [{"blockquote", [], [{"h1", [{"class", "warning"}], ["Headline"], %{}}], %{}}], []}
-
- This also works for headers inside lists
-
- iex(31)> markdown = ["- # Headline{:.warning}"]
- ...(31)> as_ast(markdown)
- {:ok, [{"ul", [], [{"li", [], [{"h1", [{"class", "warning"}], ["Headline"], %{}}], %{}}], %{}}], []}
-
- It still works for inline code, as it did before
-
- iex(32)> markdown = "`Enum.map`{:lang=elixir}"
- ...(32)> as_ast(markdown)
- {:ok, [{"p", [], [{"code", [{"class", "inline"}, {"lang", "elixir"}], ["Enum.map"], %{}}], %{}}], []}
-
-
- _attrs_ can be one or more of:
-
- * `.className`
- * `#id`
- * name=value, name="value", or name='value'
-
- For example:
-
- # Warning
- {: .red}
-
- Do not turn off the engine
- if you are at altitude.
- {: .boxed #warning spellcheck="true"}
-
- #### To links or images
-
- It is possible to add IAL attributes to generated links or images in the following
- format.
-
- iex(33)> markdown = "[link](url) {: .classy}"
- ...(33)> EarmarkParser.as_ast(markdown)
- { :ok, [{"p", [], [{"a", [{"class", "classy"}, {"href", "url"}], ["link"], %{}}], %{}}], []}
-
- For both cases, malformed attributes are ignored and warnings are issued.
-
- iex(34)> [ "Some text", "{:hello}" ] |> Enum.join("\n") |> EarmarkParser.as_ast()
- {:error, [{"p", [], ["Some text"], %{}}], [{:warning, 2,"Illegal attributes [\"hello\"] ignored in IAL"}]}
-
- It is possible to escape the IAL in both forms if necessary
-
- iex(35)> markdown = "[link](url)\\{: .classy}"
- ...(35)> EarmarkParser.as_ast(markdown)
- {:ok, [{"p", [], [{"a", [{"href", "url"}], ["link"], %{}}, "{: .classy}"], %{}}], []}
-
- This of course is not necessary in code blocks or text lines
- containing an IAL-like string, as in the following example
-
- iex(36)> markdown = "hello {:world}"
- ...(36)> EarmarkParser.as_ast(markdown)
- {:ok, [{"p", [], ["hello {:world}"], %{}}], []}
-
- ## Limitations
-
- * Block-level HTML is correctly handled only if each HTML
- tag appears on its own line. So
-
-
-
- hello
-
-
-
- will work. However. the following won't
-
-
- hello
-
- * John Gruber's tests contain an ambiguity when it comes to
- lines that might be the start of a list inside paragraphs.
-
- One test says that
-
- This is the text
- * of a paragraph
- that I wrote
-
- is a single paragraph. The "*" is not significant. However, another
- test has
-
- * A list item
- * an another
-
- and expects this to be a nested list. But, in reality, the second could just
- be the continuation of a paragraph.
-
- I've chosen always to use the second interpretation—a line that looks like
- a list item will always be a list item.
-
- * Rendering of block and inline elements.
-
- Block or void HTML elements that are at the absolute beginning of a line end
- the preceding paragraph.
-
- Thusly
-
- mypara
-
-
- Becomes
-
-
mypara
-
-
- While
-
- mypara
-
-
- will be transformed into
-
-
mypara
-
-
- ## Annotations
-
- **N.B.** this is an experimental feature from v1.4.16-pre on and might change or be removed again
-
- The idea is that each markdown line can be annotated, as such annotations change the semantics of Markdown
- they have to be enabled with the `annotations` option.
-
- If the `annotations` option is set to a string (only one string is supported right now, but a list might
- be implemented later on, hence the name), the last occurrence of that string in a line and all text following
- it will be added to the line as an annotation.
-
- Depending on how that line will eventually be parsed, this annotation will be added to the meta map (the 4th element
- in an AST quadruple) with the key `:annotation`
-
- In the current version the annotation will only be applied to verbatim HTML tags and paragraphs
-
- Let us show some examples now:
-
- ### Annotated Paragraphs
-
- iex(37)> as_ast("hello %> annotated", annotations: "%>")
- {:ok, [{"p", [], ["hello "], %{annotation: "%> annotated"}}], []}
-
- If we annotate more than one line in a para the first annotation takes precedence
-
- iex(38)> as_ast("hello %> annotated\nworld %> discarded", annotations: "%>")
- {:ok, [{"p", [], ["hello \nworld "], %{annotation: "%> annotated"}}], []}
-
- ### Annotated HTML elements
-
- In one line
-
- iex(39)> as_ast("One Line // a span", annotations: "//")
- {:ok, [{"span", [], ["One Line"], %{annotation: "// a span", verbatim: true}}], []}
-
- or block elements
-
- iex(40)> [
- ...(40)> "
: annotation",
- ...(40)> " text",
- ...(40)> "
: discarded"
- ...(40)> ] |> as_ast(annotations: " : ")
- {:ok, [{"div", [], [" text"], %{annotation: " : annotation", verbatim: true}}], []}
-
- ### Commenting your Markdown
-
- Although many markdown elements do not support annotations yet, they can be used to comment your markdown, w/o cluttering
- the generated AST with comments
-
- iex(41)> [
- ...(41)> "# Headline --> first line",
- ...(41)> "- item1 --> a list item",
- ...(41)> "- item2 --> another list item",
- ...(41)> "",
- ...(41)> " --> do not go there"
- ...(41)> ] |> as_ast(annotations: "-->")
- {:ok, [
- {"h1", [], ["Headline"], %{}},
- {"ul", [], [{"li", [], ["item1 "], %{}}, {"li", [], ["item2 "], %{}}], %{}},
- {"p", [], [{"a", [{"href", "http://somewhere/to/go"}], ["http://somewhere/to/go"], %{}}, " "], %{annotation: "--> do not go there"}}
- ], []
- }
-
- """
-
- alias EarmarkParser.Options
- import EarmarkParser.Message, only: [sort_messages: 1]
-
- @doc """
- iex(42)> markdown = "My `code` is **best**"
- ...(42)> {:ok, ast, []} = EarmarkParser.as_ast(markdown)
- ...(42)> ast
- [{"p", [], ["My ", {"code", [{"class", "inline"}], ["code"], %{}}, " is ", {"strong", [], ["best"], %{}}], %{}}]
-
-
-
- iex(43)> markdown = "```elixir\\nIO.puts 42\\n```"
- ...(43)> {:ok, ast, []} = EarmarkParser.as_ast(markdown, code_class_prefix: "lang-")
- ...(43)> ast
- [{"pre", [], [{"code", [{"class", "elixir lang-elixir"}], ["IO.puts 42"], %{}}], %{}}]
-
- **Rationale**:
-
- The AST is exposed in the spirit of [Floki's](https://hex.pm/packages/floki).
- """
- @spec as_ast(binary()|list(binary()), any()) :: t()
- def as_ast(lines, options \\ %Options{})
-
- def as_ast(lines, %Options{} = options) do
- context = _as_ast(lines, options)
-
- messages = sort_messages(context)
- messages1 = Options.add_deprecations(options, messages)
-
- status =
- case Enum.any?(messages1, fn {severity, _, _} ->
- severity == :error || severity == :warning
- end) do
- true -> :error
- _ -> :ok
- end
-
- {status, context.value, messages1}
- end
-
- def as_ast(lines, options) when is_list(options) do
- as_ast(lines, struct(Options, options))
- end
-
- def as_ast(lines, options) when is_map(options) do
- as_ast(lines, struct(Options, options |> Map.delete(:__struct__) |> Enum.into([])))
- end
-
- def as_ast(_, options) do
- raise ArgumentError, "#{inspect options} not a legal options map or keyword list"
- end
-
- defp _as_ast(lines, options) do
- {blocks, context} = EarmarkParser.Parser.parse_markdown(lines, Options.normalize(options))
- EarmarkParser.AstRenderer.render(blocks, context)
- end
-
- @doc """
- Accesses current hex version of the `EarmarkParser` application. Convenience for
- `iex` usage.
- """
- def version() do
- with {:ok, version} = :application.get_key(:earmark_parser, :vsn),
- do: to_string(version)
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/emitter.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/emitter.ex
deleted file mode 100644
index f71b7105..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/emitter.ex
+++ /dev/null
@@ -1,29 +0,0 @@
-defmodule EarmarkParser.Ast.Emitter do
- @moduledoc false
-
- def emit(tag, content \\ [], atts \\ [], meta \\ %{})
- def emit(tag, content, atts, meta) when is_binary(content) or is_tuple(content) do
- {tag, _to_atts(atts), [content], meta}
- end
- def emit(tag, content, atts, meta) do
- {tag, _to_atts(atts), content, meta}
- end
-
-
- defp _to_atts(atts)
- defp _to_atts(nil), do: []
- defp _to_atts(atts) when is_map(atts) do
- atts
- |> Enum.into([])
- |> Enum.map(fn {name, value} -> {to_string(name), _to_string(value)} end)
- end
- defp _to_atts(atts) do
- atts
- |> Enum.map(fn {name, value} -> {to_string(name), _to_string(value)} end)
- end
-
- defp _to_string(value)
- defp _to_string(value) when is_list(value), do: Enum.join(value, " ")
- defp _to_string(value), do: to_string(value)
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/inline.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/inline.ex
deleted file mode 100644
index ee90f193..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/inline.ex
+++ /dev/null
@@ -1,421 +0,0 @@
-defmodule EarmarkParser.Ast.Inline do
- @moduledoc false
-
- alias EarmarkParser.{Context, Message, Parser}
- alias EarmarkParser.Helpers.PureLinkHelpers
- alias Parser.LinkParser
-
- import EarmarkParser.Ast.Emitter
- import EarmarkParser.Ast.Renderer.AstWalker
- import EarmarkParser.Helpers
- import EarmarkParser.Helpers.AttrParser
- import EarmarkParser.Helpers.StringHelpers, only: [behead: 2]
- import EarmarkParser.Helpers.AstHelpers
- import Context, only: [set_value: 2]
-
- @typep conversion_data :: {String.t(), non_neg_integer(), EarmarkParser.Context.t(), boolean()}
- def convert(src, lnb, context)
-
- def convert(list, lnb, context) when is_list(list) do
- _convert(Enum.join(list, "\n"), lnb, context, true)
- end
-
- def convert(src, lnb, context) do
- _convert(src, lnb, context, true)
- end
-
- defp _convert(src, current_lnb, context, use_linky?)
-
- defp _convert(src, _, %{options: %{parse_inline: false}} = context, _) do
- prepend(context, src)
- end
-
- defp _convert("", _, context, _), do: context
-
- defp _convert(src, current_lnb, context, use_linky?) do
- {src1, lnb1, context1, use_linky1?} = _convert_next(src, current_lnb, context, use_linky?)
- _convert(src1, lnb1, context1, use_linky1?)
- end
-
- defp all_converters do
- [
- converter_for_escape: &converter_for_escape/1,
- converter_for_autolink: &converter_for_autolink/1,
- # only if use_linky?
- converter_for_link_and_image: &converter_for_link_and_image/1,
- converter_for_reflink: &converter_for_reflink/1,
- converter_for_footnote: &converter_for_footnote/1,
- converter_for_nolink: &converter_for_nolink/1,
- #
- converter_for_strikethrough_gfm: &converter_for_strikethrough_gfm/1,
- converter_for_strong: &converter_for_strong/1,
- converter_for_em: &converter_for_em/1,
- # only for option sub_sup
- converter_for_sub: &converter_for_sub/1,
- converter_for_sup: &converter_for_sup/1,
- #
- converter_for_code: &converter_for_code/1,
- converter_for_br: &converter_for_br/1,
- converter_for_inline_ial: &converter_for_inline_ial/1,
- converter_for_pure_link: &converter_for_pure_link/1,
- converter_for_text: &converter_for_text/1
- ]
- end
-
- defp _convert_next(src, lnb, context, use_linky?) do
- _find_and_execute_converter({src, lnb, context, use_linky?})
- end
-
- defp _find_and_execute_converter({src, lnb, context, use_linky?}) do
- all_converters()
- |> Enum.find_value(fn {_converter_name, converter} ->
- converter.({src, lnb, context, use_linky?})
- end)
- end
-
- ######################
- #
- # Converters
- #
- ######################
- @escape_rule ~r{^\\([\\`*\{\}\[\]()\#+\-.!_>])}
- def converter_for_escape({src, lnb, context, use_linky?}) do
- if match = Regex.run(@escape_rule, src) do
- [match, escaped] = match
- {behead(src, match), lnb, prepend(context, escaped), use_linky?}
- end
- end
-
- @autolink_rgx ~r{^<([^ >]+(@|:\/)[^ >]+)>}
- def converter_for_autolink({src, lnb, context, use_linky?}) do
- if match = Regex.run(@autolink_rgx, src) do
- [match, link, protocol] = match
- {href, text} = convert_autolink(link, protocol)
- out = render_link(href, text)
- {behead(src, match), lnb, prepend(context, out), use_linky?}
- end
- end
-
- def converter_for_pure_link({src, lnb, context, use_linky?}) do
- if context.options.pure_links do
- case PureLinkHelpers.convert_pure_link(src) do
- {ast, length} -> {behead(src, length), lnb, prepend(context, ast), use_linky?}
- _ -> nil
- end
- end
- end
-
- def converter_for_link_and_image({src, lnb, context, use_linky?}) do
- if use_linky? do
- match = LinkParser.parse_link(src, lnb)
-
- if match do
- {match1, text, href, title, link_or_img} = match
-
- out =
- case link_or_img do
- :link -> output_link(context, text, href, title, lnb)
- :wikilink -> maybe_output_wikilink(context, text, href, title, lnb)
- :image -> render_image(text, href, title)
- end
-
- if out do
- {behead(src, match1), lnb, prepend(context, out), use_linky?}
- end
- end
- end
- end
-
- @link_text ~S{(?:\[[^]]*\]|[^][]|\])*}
- @reflink ~r{^!?\[(#{@link_text})\]\s*\[([^]]*)\]}x
- def converter_for_reflink({src, lnb, context, use_linky?}) do
- if use_linky? do
- if match = Regex.run(@reflink, src) do
- {match_, alt_text, id} =
- case match do
- [match__, id, ""] -> {match__, id, id}
- [match__, alt_text, id] -> {match__, alt_text, id}
- end
-
- case reference_link(context, match_, alt_text, id, lnb) do
- {:ok, out} -> {behead(src, match_), lnb, prepend(context, out), use_linky?}
- _ -> nil
- end
- end
- end
- end
-
- def converter_for_footnote({src, lnb, context, use_linky?}) do
- if use_linky? do
- case Regex.run(context.rules.footnote, src) do
- [match, id] ->
- case footnote_link(context, match, id) do
- {:ok, out} ->
- {behead(src, match), lnb, _prepend_footnote(context, out, id), use_linky?}
-
- _ ->
- converter_for_text(
- {src, lnb,
- Message.add_message(
- context,
- {:error, lnb, "footnote #{id} undefined, reference to it ignored"}
- ), use_linky?}
- )
- end
-
- _ ->
- nil
- end
- end
- end
-
- @nolink ~r{^!?\[((?:\[[^]]*\]|[^][])*)\]}
- def converter_for_nolink({src, lnb, context, use_linky?}) do
- if use_linky? do
- case Regex.run(@nolink, src) do
- [match, id] ->
- case reference_link(context, match, id, id, lnb) do
- {:ok, out} -> {behead(src, match), lnb, prepend(context, out), use_linky?}
- _ -> nil
- end
-
- _ ->
- nil
- end
- end
- end
-
- ################################
- # Simple Tags: em, strong, del #
- ################################
- @strikethrough_rgx ~r{\A~~(?=\S)([\s\S]*?\S)~~}
- def converter_for_strikethrough_gfm({src, _, _, _} = conv_tuple) do
- if match = Regex.run(@strikethrough_rgx, src) do
- _converter_for_simple_tag(conv_tuple, match, "del")
- end
- end
-
- @strong_rgx ~r{\A__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)}
- def converter_for_strong({src, _, _, _} = conv_tuple) do
- if match = Regex.run(@strong_rgx, src) do
- _converter_for_simple_tag(conv_tuple, match, "strong")
- end
- end
-
- @emphasis_rgx ~r{\A\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)}
- def converter_for_em({src, _, _, _} = conv_tuple) do
- if match = Regex.run(@emphasis_rgx, src) do
- _converter_for_simple_tag(conv_tuple, match, "em")
- end
- end
-
- @sub_rgx ~r{\A~(?=\S)(.*?\S)~}
- def converter_for_sub({src, _, %{options: %{sub_sup: true}}, _} = conv_tuple) do
- if match = Regex.run(@sub_rgx, src) do
- _converter_for_simple_tag(conv_tuple, match, "sub")
- end
- end
-
- def converter_for_sub(_), do: nil
-
- @sup_rgx ~r{\A\^(?=\S)(.*?\S)\^}
- def converter_for_sup({src, _, %{options: %{sub_sup: true}}, _} = conv_tuple) do
- if match = Regex.run(@sup_rgx, src) do
- _converter_for_simple_tag(conv_tuple, match, "sup")
- end
- end
-
- def converter_for_sup(_), do: nil
-
- @squash_ws ~r{\s+}
- @code ~r{^
- (`+) # $1 = Opening run of `
- (.+?) # $2 = The code block
- (? String.trim()
- |> String.replace(@squash_ws, " ")
-
- out = codespan(content1)
- {behead(src, match), lnb, prepend(context, out), use_linky?}
- end
- end
-
- @inline_ial ~r<^\s*\{:\s*(.*?)\s*}>
-
- def converter_for_inline_ial({src, lnb, context, use_linky?}) do
- if match = Regex.run(@inline_ial, src) do
- [match, ial] = match
- {context1, ial_attrs} = parse_attrs(context, ial, lnb)
- new_tags = augment_tag_with_ial(context.value, ial_attrs)
- {behead(src, match), lnb, set_value(context1, new_tags), use_linky?}
- end
- end
-
- def converter_for_br({src, lnb, context, use_linky?}) do
- if match = Regex.run(context.rules.br, src, return: :index) do
- [{0, match_len}] = match
- {behead(src, match_len), lnb, prepend(context, emit("br")), use_linky?}
- end
- end
-
- @line_ending ~r{\r\n?|\n}
- @spec converter_for_text(conversion_data()) :: conversion_data()
- def converter_for_text({src, lnb, context, _}) do
- matched =
- case Regex.run(context.rules.text, src) do
- [match] -> match
- end
-
- line_count = matched |> String.split(@line_ending) |> Enum.count()
-
- ast = hard_line_breaks(matched, context.options.gfm)
- ast = walk_ast(ast, &gruber_line_breaks/1)
- {behead(src, matched), lnb + line_count - 1, prepend(context, ast), true}
- end
-
- ######################
- #
- # Helpers
- #
- ######################
- defp _converter_for_simple_tag({src, lnb, context, use_linky?}, match, for_tag) do
- {match1, content} =
- case match do
- [m, _, c] -> {m, c}
- [m, c] -> {m, c}
- end
-
- context1 = _convert(content, lnb, set_value(context, []), use_linky?)
-
- {behead(src, match1), lnb, prepend(context, emit(for_tag, context1.value |> Enum.reverse())),
- use_linky?}
- end
-
- defp _prepend_footnote(context, out, id) do
- context
- |> Map.update!(:referenced_footnote_ids, &MapSet.put(&1, id))
- |> prepend(out)
- end
-
- defp convert_autolink(link, separator)
-
- defp convert_autolink(link, _separator = "@") do
- link = if String.at(link, 6) == ":", do: behead(link, 7), else: link
- text = link
- href = "mailto:" <> text
- {href, text}
- end
-
- defp convert_autolink(link, _separator) do
- {link, link}
- end
-
- @gruber_line_break Regex.compile!(" {2,}(?>\n)", "m")
- defp gruber_line_breaks(text) do
- text
- |> String.split(@gruber_line_break)
- |> Enum.intersperse(emit("br"))
- |> _remove_leading_empty()
- end
-
- @gfm_hard_line_break ~r{\\\n}
- defp hard_line_breaks(text, gfm)
- defp hard_line_breaks(text, false), do: text
- defp hard_line_breaks(text, nil), do: text
-
- defp hard_line_breaks(text, _) do
- text
- |> String.split(@gfm_hard_line_break)
- |> Enum.intersperse(emit("br"))
- |> _remove_leading_empty()
- end
-
- defp output_image_or_link(context, link_or_image, text, href, title, lnb)
-
- defp output_image_or_link(_context, "!" <> _, text, href, title, _lnb) do
- render_image(text, href, title)
- end
-
- defp output_image_or_link(context, _, text, href, title, lnb) do
- output_link(context, text, href, title, lnb)
- end
-
- defp output_link(context, text, href, title, lnb) do
- context1 = %{context | options: %{context.options | pure_links: false}}
-
- context2 = _convert(text, lnb, set_value(context1, []), String.starts_with?(text, "!"))
-
- if title do
- emit("a", Enum.reverse(context2.value), href: href, title: title)
- else
- emit("a", Enum.reverse(context2.value), href: href)
- end
- end
-
- defp maybe_output_wikilink(context, text, href, title, lnb) do
- if context.options.wikilinks do
- {tag, attrs, content, meta} = output_link(context, text, href, title, lnb)
- {tag, attrs, content, Map.put(meta, :wikilink, true)}
- end
- end
-
- defp reference_link(context, match, alt_text, id, lnb) do
- id = id |> replace(~r{\s+}, " ") |> String.downcase()
-
- case Map.fetch(context.links, id) do
- {:ok, link} ->
- {:ok, output_image_or_link(context, match, alt_text, link.url, link.title, lnb)}
-
- _ ->
- nil
- end
- end
-
- defp footnote_link(context, _match, id) do
- case Map.fetch(context.footnotes, id) do
- {:ok, _} ->
- {:ok, render_footnote_link("fn:#{id}", "fnref:#{id}", id)}
-
- _ ->
- nil
- end
- end
-
- defp prepend(%Context{} = context, prep) do
- _prepend(context, prep)
- end
-
- defp _prepend(context, value)
-
- defp _prepend(context, [bin | rest]) when is_binary(bin) do
- _prepend(_prepend(context, bin), rest)
- end
-
- defp _prepend(%Context{value: [str | rest]} = context, prep)
- when is_binary(str) and is_binary(prep) do
- %{context | value: [str <> prep | rest]}
- end
-
- defp _prepend(%Context{value: value} = context, prep) when is_list(prep) do
- %{context | value: Enum.reverse(prep) ++ value}
- end
-
- defp _prepend(%Context{value: value} = context, prep) do
- %{context | value: [prep | value]}
- end
-
- defp _remove_leading_empty(list)
- defp _remove_leading_empty(["" | rest]), do: rest
- defp _remove_leading_empty(list), do: list
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/ast_walker.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/ast_walker.ex
deleted file mode 100644
index 3a60b0bd..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/ast_walker.ex
+++ /dev/null
@@ -1,54 +0,0 @@
-defmodule EarmarkParser.Ast.Renderer.AstWalker do
-
- @moduledoc false
-
- def walk(anything, fun, ignore_map_keys \\ false), do: _walk(anything, fun, ignore_map_keys, false)
-
- def walk_ast(ast, fun), do: _walk_ast(ast, fun, [])
-
-
- defp _walk(ast, fun, ignore_map_keys, child_of_map)
- defp _walk([], _fun, _ignore_map_keys, _child_of_map), do: []
- defp _walk(list, fun, ignore_map_keys, _child_of_map) when is_list(list) do
- Enum.map(list, &(_walk(&1, fun, ignore_map_keys, false)))
- end
- defp _walk(map, fun, ignore_map_keys, _child_of_map) when is_map(map) do
- map
- |> Enum.into(%{}, &(_walk(&1, fun, ignore_map_keys, true)))
- end
- defp _walk(tuple, fun, ignore_map_keys, child_of_map) when is_tuple(tuple) do
- if child_of_map && ignore_map_keys do
- _walk_map_element(tuple, fun, ignore_map_keys)
- else
- tuple
- |> Tuple.to_list
- |> Enum.map(&(_walk(&1, fun, ignore_map_keys, false)))
- |> List.to_tuple
- end
- end
- defp _walk(ele, fun, _ignore_map_keys, _child_of_map), do: fun.(ele)
-
- defp _walk_map_element({key, value}, fun, ignore_map_keys) do
- {key, _walk(value, fun, ignore_map_keys, false)}
- end
-
-
- defp _walk_ast(ast, fun, res)
- defp _walk_ast([], _fun, res), do: Enum.reverse(res)
- defp _walk_ast(stringy, fun, res) when is_binary(stringy), do: _walk_ast([stringy], fun, res)
- defp _walk_ast([stringy|rest], fun, res) when is_binary(stringy) do
- res1 =
- case fun.(stringy) do
- [] -> res
- [_|_]=trans -> List.flatten([Enum.reverse(trans)|res])
- stringy1 -> [stringy1|res]
- end
- _walk_ast(rest, fun, res1)
- end
- defp _walk_ast([{tag, atts, content, meta}|rest], fun, res) do
- _walk_ast(rest, fun, [{tag, atts, _walk_ast(content, fun, []), meta}|res])
- end
- defp _walk_ast([list|rest], fun, res) when is_list(list) do
- _walk_ast(rest, fun, [_walk_ast(list, fun, [])|res])
- end
-end
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/footnote_renderer.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/footnote_renderer.ex
deleted file mode 100644
index 5ccf6766..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/footnote_renderer.ex
+++ /dev/null
@@ -1,48 +0,0 @@
-defmodule EarmarkParser.Ast.Renderer.FootnoteRenderer do
- import EarmarkParser.Ast.Emitter
- alias EarmarkParser.{AstRenderer, Block, Context, Message}
- import Context, only: [clear_value: 1, prepend: 2]
-
- @moduledoc false
-
- @empty_set MapSet.new([])
-
- def render_defined_fns(%Block.FnList{blocks: footnotes}, context) do
- {elements, errors} = render_footnote_blocks(footnotes, context)
-
- ast =
- emit(
- "div",
- [
- emit("hr"),
- emit("ol", elements)
- ],
- class: "footnotes"
- )
-
- prepend(context, ast) |> Message.add_messages(errors)
- end
-
- defp _render_footnote_def(%Block.FnDef{blocks: blocks, id: id}, {ast, errors, context}=acc) do
- if MapSet.member?(context.referenced_footnote_ids, id) do
- context1 = AstRenderer.render(blocks, clear_value(context))
- a_attrs = %{title: "return to article", class: "reversefootnote", href: "#fnref:#{id}"}
- footnote_li_ast =
- emit("li", [emit("a", ["↩"], a_attrs) | context1.value],
- id: "fn:#{id}")
- {[footnote_li_ast|ast], MapSet.union(errors, context1.options.messages), context}
- else
- acc
- end
- end
-
-
- defp render_footnote_blocks(footnotes, context) do
- {elements, errors, _} =
- footnotes
- |> Enum.reduce({[], @empty_set, context}, &_render_footnote_def/2)
-
- {elements|>Enum.reverse, errors}
- end
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/html_renderer.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/html_renderer.ex
deleted file mode 100644
index 349cb1e6..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/html_renderer.ex
+++ /dev/null
@@ -1,31 +0,0 @@
-defmodule EarmarkParser.Ast.Renderer.HtmlRenderer do
-
- import EarmarkParser.Context, only: [prepend: 2]
- import EarmarkParser.Helpers.HtmlParser
- import EarmarkParser.Helpers.AstHelpers, only: [annotate: 2]
-
- @moduledoc false
-
- # Structural Renderer for html blocks
- def render_html_block(lines, context, annotation)
- def render_html_block(lines, context, annotation) do
- [tag] = parse_html(lines)
- tag_ = if annotation, do: annotate(tag, annotation), else: tag
- prepend(context, tag_)
- end
-
- def render_html_oneline([line|_], context, annotation \\ []) do
- [tag|rest] = parse_html([line])
- tag_ = if annotation, do: annotate(tag, annotation), else: tag
- prepend(context, [tag_|rest])
- end
-
- @html_comment_start ~r{\A\s*.*\z}
- def render_html_comment_line(line) do
- line
- |> String.replace(@html_comment_start, "")
- |> String.replace(@html_comment_end, "")
- end
-
-end
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/table_renderer.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/table_renderer.ex
deleted file mode 100644
index 1411ef4d..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast/renderer/table_renderer.ex
+++ /dev/null
@@ -1,47 +0,0 @@
-defmodule EarmarkParser.Ast.Renderer.TableRenderer do
- @moduledoc false
-
- alias EarmarkParser.Ast.Inline
- alias EarmarkParser.Context
-
- import EarmarkParser.Ast.Emitter
-
- def render_header(header, lnb, aligns, context) do
- {th_ast, context1} =
- header
- |> Enum.zip(aligns)
- |> Enum.map_reduce(context, &_render_col(&1, &2, lnb, "th"))
- {emit("thead", emit("tr", th_ast)), context1}
- end
-
- def render_rows(rows, lnb, aligns, context) do
- {rows1, context1} =
- rows
- |> Enum.zip(Stream.iterate(lnb, &(&1 + 1)))
- |> Enum.map_reduce(context, &_render_row(&1, &2, aligns))
- {[emit("tbody", rows1)], context1}
- end
-
-
- defp _render_cols(row, lnb, aligns, context, coltype \\ "td") do
- row
- |> Enum.zip(aligns)
- |> Enum.map_reduce(context, &_render_col(&1, &2, lnb, coltype))
- end
-
- defp _render_col({col, align}, context, lnb, coltype) do
- context1 = Inline.convert(col, lnb, Context.clear_value(context))
- {emit(coltype, context1.value |> Enum.reverse, _align_to_style(align)), context1}
- end
-
- defp _render_row({row, lnb}, context, aligns) do
- {ast, context1} = _render_cols(row, lnb, aligns, context)
- {emit("tr", ast), context1}
- end
-
- defp _align_to_style(align)
- defp _align_to_style(:left), do: [{"style", "text-align: left;"}]
- defp _align_to_style(:right), do: [{"style", "text-align: right;"}]
- defp _align_to_style(:center), do: [{"style", "text-align: center;"}]
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast_renderer.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast_renderer.ex
deleted file mode 100644
index f3881496..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/ast_renderer.ex
+++ /dev/null
@@ -1,260 +0,0 @@
-defmodule EarmarkParser.AstRenderer do
- alias EarmarkParser.Block
- alias EarmarkParser.Context
- alias EarmarkParser.Options
-
- import Context, only: [clear_value: 1, modify_value: 2, prepend: 2, prepend: 3]
-
- import EarmarkParser.Ast.Emitter
- import EarmarkParser.Ast.Inline, only: [convert: 3]
- import EarmarkParser.Helpers.AstHelpers
- import EarmarkParser.Ast.Renderer.{HtmlRenderer, FootnoteRenderer, TableRenderer}
-
- @moduledoc false
-
- def render(blocks, context = %Context{options: %Options{}}, loose? \\ true) do
- _render(blocks, context, loose?)
- end
-
- defp _render(blocks, context, loose?)
- defp _render([], context, _loose?), do: context
-
- defp _render([block | blocks], context, loose?) do
- context1 = render_block(block, clear_value(context), loose?)
- _render(blocks, prepend(context1, context), loose?)
- end
-
- defp render_block(block, context, loose?)
- #############
- # Paragraph #
- #############
- defp render_block(%Block.Para{lnb: lnb, lines: lines, attrs: attrs} = para, context, _loose?) do
- context1 = convert(lines, lnb, context)
- value = context1.value |> Enum.reverse()
-
- ast =
- emit("p", value, attrs)
- |> annotate(para)
-
- prepend(context, ast, context1)
- end
-
- ########
- # Html #
- ########
- defp render_block(%Block.Html{annotation: annotation, html: html}, context, _loose?) do
- render_html_block(html, context, annotation)
- end
-
- defp render_block(%Block.HtmlOneline{annotation: annotation, html: html}, context, _loose?) do
- render_html_oneline(html, context, annotation)
- end
-
- defp render_block(%Block.HtmlComment{lines: lines}, context, _loose?) do
- lines1 = lines |> Enum.map(&render_html_comment_line/1)
- prepend(context, emit(:comment, lines1, [], %{comment: true}))
- end
-
- #########
- # Ruler #
- #########
- defp render_block(%Block.Ruler{type: "-", attrs: attrs}, context, _loose?) do
- prepend(context, emit("hr", [], merge_attrs(attrs, %{"class" => "thin"})))
- end
-
- defp render_block(%Block.Ruler{type: "_", attrs: attrs}, context, _loose?) do
- prepend(context, emit("hr", [], merge_attrs(attrs, %{"class" => "medium"})))
- end
-
- defp render_block(%Block.Ruler{type: "*", attrs: attrs}, context, _loose?) do
- prepend(context, emit("hr", [], merge_attrs(attrs, %{"class" => "thick"})))
- end
-
- ###########
- # Heading #
- ###########
- defp render_block(
- %Block.Heading{lnb: lnb, level: level, content: content, attrs: attrs},
- context,
- _loose?
- ) do
- context1 = convert(content, lnb, clear_value(context))
-
- modify_value(
- context1,
- fn _ ->
- [
- emit(
- "h#{level}",
- context1.value |> Enum.reverse(),
- attrs)
- ]
- end
- )
- end
-
- ##############
- # Blockquote #
- ##############
- defp render_block(%Block.BlockQuote{blocks: blocks, attrs: attrs}, context, _loose?) do
- context1 = render(blocks, clear_value(context))
-
- modify_value(context1, fn ast ->
- [emit("blockquote", ast, attrs)]
- end)
- end
-
- #########
- # Table #
- #########
- defp render_block(
- %Block.Table{lnb: lnb, header: header, rows: rows, alignments: aligns, attrs: attrs},
- context,
- _loose?
- ) do
- {rows_ast, context1} = render_rows(rows, lnb, aligns, context)
-
- {rows_ast1, context2} =
- if header do
- {header_ast, context3} = render_header(header, lnb, aligns, context1)
- {[header_ast | rows_ast], context3}
- else
- {rows_ast, context1}
- end
-
- prepend(
- clear_value(context2),
- emit("table", rows_ast1, attrs)
- )
- end
-
- ########
- # Code #
- ########
- defp render_block(
- %Block.Code{language: language, attrs: attrs} = block,
- context = %Context{options: options},
- _loose?
- ) do
- classes =
- if language && language != "",
- do: [code_classes(language, options.code_class_prefix)],
- else: []
-
- lines = render_code(block)
-
- prepend(
- context,
- emit("pre", emit("code", lines, classes), attrs)
- )
- end
-
- #########
- # Lists #
- #########
- @start_rgx ~r{\A\d+}
- defp render_block(
- %Block.List{type: type, bullet: bullet, blocks: items, attrs: attrs},
- context,
- _loose?
- ) do
- context1 = render(items, clear_value(context))
-
- start_map =
- case bullet && Regex.run(@start_rgx, bullet) do
- nil -> %{}
- ["1"] -> %{}
- [start1] -> %{start: _normalize_start(start1)}
- end
-
- prepend(
- context,
- emit(to_string(type), context1.value, merge_attrs(attrs, start_map)),
- context1
- )
- end
-
- # format a spaced list item
- defp render_block(
- %Block.ListItem{blocks: blocks, attrs: attrs, loose?: loose?},
- context,
- _loose?
- ) do
- context1 = render(blocks, clear_value(context), loose?)
- prepend(
- context,
- emit("li", context1.value, attrs),
- context1
- )
- end
-
- ########
- # Text #
- ########
-
- defp render_block(%Block.Text{line: line, lnb: lnb}, context, loose?) do
- context1 = convert(line, lnb, clear_value(context))
- ast = context1.value |> Enum.reverse()
-
- if loose? do
- modify_value(context1, fn _ -> [emit("p", ast)] end)
- else
- modify_value(context1, fn _ -> ast end)
- end
- end
-
- ##################
- # Footnote Block #
- ##################
-
- @empty_set MapSet.new([])
- defp render_block(%Block.FnList{}=fn_list, context, _loose?) do
- if MapSet.equal?(context.referenced_footnote_ids, @empty_set) do
- context
- else
- render_defined_fns(fn_list, context)
- end
- end
- #######################################
- # Isolated IALs are rendered as paras #
- #######################################
-
- defp render_block(%Block.Ial{verbatim: verbatim}, context, _loose?) do
- prepend(context, emit("p", "{:#{verbatim}}"))
- end
-
- ####################
- # IDDef is ignored #
- ####################
-
- defp render_block(%Block.IdDef{}, context, _loose?), do: context
-
- # Helpers
- # -------
-
- # Seems to be dead code but as GFM list handling is broken maybe we have a bug
- # that does not call this correctly, anyhow AST triplets do not exits anymore
- # so this code would break if called
- # defp _fix_text_lines(ast, loose?)
- # defp _fix_text_lines(ast, false), do: Enum.map(ast, &_fix_tight_text_line/1)
- # defp _fix_text_lines(ast, true), do: Enum.map(ast, &_fix_loose_text_line/1)
-
- # defp _fix_loose_text_line(node)
- # defp _fix_loose_text_line({:text, _, lines}), do: emit("p", lines)
- # defp _fix_loose_text_line(node), do: node
-
- # defp _fix_tight_text_line(node)
- # defp _fix_tight_text_line({:text, _, lines}), do: lines
- # defp _fix_tight_text_line(node), do: node
-
- # INLINE CANDIDATE
- defp _normalize_start(start) do
- case String.trim_leading(start, "0") do
- "" -> "0"
- start1 -> start1
- end
- end
-
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/block_quote.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/block_quote.ex
deleted file mode 100644
index e457e039..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/block_quote.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.BlockQuote do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, blocks: []
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/code.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/code.ex
deleted file mode 100644
index 495ed72d..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/code.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Code do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, lines: [], language: nil
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_def.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_def.ex
deleted file mode 100644
index 8819b471..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_def.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.FnDef do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, number: nil, blocks: []
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_list.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_list.ex
deleted file mode 100644
index 2b218818..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/fn_list.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.FnList do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: ".footnotes", blocks: []
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/heading.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/heading.ex
deleted file mode 100644
index 5a95464c..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/heading.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Heading do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, level: nil
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html.ex
deleted file mode 100644
index d147b2b7..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Html do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, html: [], tag: nil
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_comment.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_comment.ex
deleted file mode 100644
index bbc4c850..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_comment.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.HtmlComment do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, lines: []
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_oneline.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_oneline.ex
deleted file mode 100644
index d910d404..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/html_oneline.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.HtmlOneline do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, html: ""
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ial.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ial.ex
deleted file mode 100644
index 42e4abad..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ial.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Ial do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, content: nil, verbatim: ""
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/id_def.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/id_def.ex
deleted file mode 100644
index 51fc1e12..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/id_def.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.IdDef do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, id: nil, url: nil, title: nil
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list.ex
deleted file mode 100644
index 9b099303..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list.ex
+++ /dev/null
@@ -1,17 +0,0 @@
-defmodule EarmarkParser.Block.List do
- @moduledoc false
-
- defstruct annotation: nil,
- attrs: nil,
- blocks: [],
- lines: [],
- bullet: "-",
- indent: 0,
- lnb: 0,
- loose?: false,
- pending: {nil, 0},
- spaced?: false,
- start: "",
- type: :ul
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list_item.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list_item.ex
deleted file mode 100644
index e575c75f..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/list_item.ex
+++ /dev/null
@@ -1,12 +0,0 @@
-defmodule EarmarkParser.Block.ListItem do
- @moduledoc false
- defstruct attrs: nil,
- blocks: [],
- bullet: "",
- lnb: 0,
- annotation: nil,
- loose?: false,
- spaced?: true,
- type: :ul
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/para.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/para.ex
deleted file mode 100644
index ef015cb2..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/para.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Para do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, lines: []
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ruler.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ruler.ex
deleted file mode 100644
index 75a4aa60..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/ruler.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Ruler do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, type: nil
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/table.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/table.ex
deleted file mode 100644
index 33a4988d..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/table.ex
+++ /dev/null
@@ -1,9 +0,0 @@
-defmodule EarmarkParser.Block.Table do
- @moduledoc false
- defstruct lnb: 0, annotation: nil, attrs: nil, rows: [], header: nil, alignments: []
-
- def new_for_columns(n) do
- %__MODULE__{alignments: Elixir.List.duplicate(:left, n)}
- end
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/text.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/text.ex
deleted file mode 100644
index ac965506..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/block/text.ex
+++ /dev/null
@@ -1,5 +0,0 @@
-defmodule EarmarkParser.Block.Text do
- @moduledoc false
- defstruct attrs: nil, lnb: 0, annotation: nil, line: ""
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/context.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/context.ex
deleted file mode 100644
index 6f06b9f1..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/context.ex
+++ /dev/null
@@ -1,141 +0,0 @@
-defmodule EarmarkParser.Context do
- @moduledoc false
- alias EarmarkParser.Options
-
- @type t :: %__MODULE__{
- options: EarmarkParser.Options.t(),
- links: map(),
- footnotes: map(),
- referenced_footnote_ids: MapSet.t(String.t()),
- value: String.t() | [String.t()]
- }
-
- defstruct options: %EarmarkParser.Options{},
- links: Map.new(),
- rules: nil,
- footnotes: Map.new(),
- referenced_footnote_ids: MapSet.new([]),
- value: []
-
- ##############################################################################
- # Handle adding option specific rules and processors #
- ##############################################################################
-
- @doc false
- def modify_value(%__MODULE__{value: value} = context, fun) do
- nv = fun.(value)
- %{context | value: nv}
- end
-
- @doc false
- def prepend(context1, ast_or_context, context2_or_nil \\ nil)
-
- def prepend(%__MODULE__{} = context1, %__MODULE__{} = context2, nil) do
- context1
- |> _merge_contexts(context2)
- |> _prepend(context2.value)
- end
-
- def prepend(%__MODULE__{} = context1, ast, nil) do
- context1
- |> _prepend(ast)
- end
-
- def prepend(%__MODULE__{} = context1, ast, %__MODULE__{} = context2) do
- context1
- |> _merge_contexts(context2)
- |> _prepend(ast)
- end
-
- defp _merge_contexts(
- %__MODULE__{referenced_footnote_ids: orig} = context1,
- %__MODULE__{referenced_footnote_ids: new} = context2
- ) do
- context_ = _merge_messages(context1, context2)
- %{context_| referenced_footnote_ids: MapSet.union(orig, new)}
- end
-
- defp _merge_messages(context, context_or_messages)
- defp _merge_messages(context, %__MODULE__{options: %Options{messages: messages}}) do
- _merge_messages(context, messages)
- end
- defp _merge_messages(context, messages) do
- %{context | options: %{context.options|messages: MapSet.union(context.options.messages, messages)}}
- end
-
-
- defp _prepend(ctxt, []), do: ctxt
-
- defp _prepend(%{value: value} = ctxt, {:comment, _, _, _} = ct),
- do: %{ctxt | value: [ct | value]}
-
- defp _prepend(%{value: value} = ctxt, tuple) when is_tuple(tuple) do
- %{ctxt | value: [tuple | value] |> List.flatten()}
- end
-
- defp _prepend(%{value: value} = ctxt, list) when is_list(list),
- do: %{ctxt | value: List.flatten(list ++ value)}
-
- @doc """
- Convenience method to prepend to the value list
- """
- def set_value(%__MODULE__{} = ctx, value) do
- %{ctx | value: value}
- end
-
- def clear_value(%__MODULE__{} = ctx), do: %{ctx | value: []}
-
- # this is called by the command line processor to update
- # the inline-specific rules in light of any options
- def update_context(context = %EarmarkParser.Context{options: options}) do
- %{context | rules: rules_for(options)}
- end
-
- # ( "[" .*? "]"n or anything w/o {"[", "]"}* or "]" ) *
- @link_text ~S{(?:\[[^]]*\]|[^][]|\])*}
- # "
- # @href ~S{\s*(.*?)>?(?:\s+['"](.*?)['"])?\s*}
-
- defp basic_rules do
- [
- br: ~r<^ {2,}\n(?!\s*$)>,
- text: ~r<^[\s\S]+?(?=[\\
- ]
- end
-
- defp rules_for(options) do
- subsup =
- if options.sub_sup do
- "~^"
- else
- ""
- end
- rule_updates =
- if options.gfm do
- rules = [
- text: ~r{^[\s\S]+?(?=~~|[\\ Enum.into(%{})
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/enum/ext.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/enum/ext.ex
deleted file mode 100644
index b23ffc1e..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/enum/ext.ex
+++ /dev/null
@@ -1,55 +0,0 @@
-defmodule EarmarkParser.Enum.Ext do
- @moduledoc ~S"""
- Some extensions of Enum functions
- """
-
- @doc ~S"""
- `reduce_with_end` is like `Enum.reduce` for lists, but the reducer function is called for
- each element of the list with the tuple `{:element, element}` and the accumulator and once
- more at the end with `:end` and the accumulator
-
- iex(1)> reducer =
- ...(1)> fn {:element, nil}, {partial, result} -> {[], [Enum.sum(partial)|result]}
- ...(1)> {:element, val}, {partial, result} -> {[val|partial], result}
- ...(1)> :end, {partial, result} -> [Enum.sum(partial)|result] |> Enum.reverse
- ...(1)> end
- ...(1)> [1, 2, nil, 4, 1, 0, nil, 3, 2, 2]
- ...(1)> |> reduce_with_end({[], []}, reducer)
- [3, 5, 7]
-
- **N.B.** that in the treatment of `:end` we can change the shape of the accumulator w/o any
- penalty concerning the complexity of the reducer function
- """
- def reduce_with_end(collection, initial_acc, reducer_fn)
- def reduce_with_end([], acc, reducer_fn) do
- reducer_fn.(:end, acc)
- end
- def reduce_with_end([ele|rest], acc, reducer_fn) do
- reduce_with_end(rest, reducer_fn.({:element, ele}, acc), reducer_fn)
- end
-
- @doc ~S"""
-
- Like map_reduce but reversing the list
-
- iex(2)> replace_nil_and_count = fn ele, acc ->
- ...(2)> if ele, do: {ele, acc}, else: {"", acc + 1}
- ...(2)> end
- ...(2)> ["y", nil, "u", nil, nil, "a", nil] |> reverse_map_reduce(0, replace_nil_and_count)
- { ["", "a", "", "", "u", "", "y"], 4 }
-
- """
- def reverse_map_reduce(list, initial, fun) do
- _reverse_map_reduce(list, initial, [], fun)
- end
-
- # Helpers {{{
- defp _reverse_map_reduce(list, acc, result, fun)
- defp _reverse_map_reduce([], acc, result, _fun), do: {result, acc}
- defp _reverse_map_reduce([fst|rst], acc, result, fun) do
- {new_ele, new_acc} = fun.(fst, acc)
- _reverse_map_reduce(rst, new_acc, [new_ele|result], fun)
- end
- # }}}
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers.ex
deleted file mode 100644
index 48eb1f3b..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers.ex
+++ /dev/null
@@ -1,93 +0,0 @@
-defmodule EarmarkParser.Helpers do
-
- @moduledoc false
- @doc """
- Expand tabs to multiples of 4 columns
- """
- def expand_tabs(line) do
- Regex.replace(~r{(.*?)\t}, line, &expander/2)
- end
-
- @trailing_ial_rgx ~r< (?x
- @doc ~S"""
- Returns a tuple containing a potentially present IAL and the line w/o the IAL
-
- iex(1)> extract_ial("# A headline")
- {nil, "# A headline"}
-
- iex(2)> extract_ial("# A classy headline{:.classy}")
- {".classy", "# A classy headline"}
-
- An IAL line, remains an IAL line though
-
- iex(3)> extract_ial("{:.line-ial}")
- {nil, "{:.line-ial}"}
- """
- def extract_ial(line) do
- case Regex.split(@trailing_ial_rgx, line, include_captures: true, parts: 2, on: [:ial]) do
- [_] -> {nil, line}
- [line_, "{:" <> ial, _] ->
- ial_ =
- ial
- |> String.trim_trailing("}")
- |> String.trim()
-
- {ial_, String.trim_trailing(line_)}
- end
- end
-
- defp expander(_, leader) do
- extra = 4 - rem(String.length(leader), 4)
- leader <> pad(extra)
- end
-
- @doc """
- Remove newlines at end of line and optionally annotations
- """
- # def remove_line_ending(line, annotation \\ nil)
- def remove_line_ending(line, nil) do
- _trim_line({line, nil})
- end
- def remove_line_ending(line, annotation) do
- case Regex.run(annotation, line) do
- nil -> _trim_line({line, nil})
- match -> match |> tl() |> List.to_tuple |> _trim_line()
- end
- end
-
- defp _trim_line({line, annot}), do: {line |> String.trim_trailing("\n") |> String.trim_trailing("\r"), annot}
-
- defp pad(1), do: " "
- defp pad(2), do: " "
- defp pad(3), do: " "
- defp pad(4), do: " "
-
- @doc """
- `Regex.replace` with the arguments in the correct order
- """
-
- def replace(text, regex, replacement, options \\ []) do
- Regex.replace(regex, text, replacement, options)
- end
-
- @doc """
- Replace <, >, and quotes with the corresponding entities. If
- `encode` is true, convert ampersands, too, otherwise only
- convert non-entity ampersands.
- """
-
- @amp_rgx ~r{&(?!#?\w+;)}
-
- def escape(html), do: _escape(Regex.replace(@amp_rgx, html, "&"))
-
-
- defp _escape(html) do
- html
- |> String.replace("<", "<")
- |> String.replace(">", ">")
- |> String.replace("\"", """)
- |> String.replace("'", "'")
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/ast_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/ast_helpers.ex
deleted file mode 100644
index 56a52de2..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/ast_helpers.ex
+++ /dev/null
@@ -1,120 +0,0 @@
-defmodule EarmarkParser.Helpers.AstHelpers do
-
- @moduledoc false
-
- import EarmarkParser.Ast.Emitter
- import EarmarkParser.Helpers
-
- alias EarmarkParser.Block
-
- @doc false
- def annotate(node, from_block)
- def annotate(node, %{annotation: nil}), do: node
- def annotate({tag, atts, children, meta}, %{annotation: annotation}),
- do: {tag, atts, children, Map.put(meta, :annotation, annotation)}
- def annotate({tag, atts, children, meta}, annotation),
- do: {tag, atts, children, Map.put(meta, :annotation, annotation)}
-
- @doc false
- def attrs_to_string_keys(key_value_pair)
- def attrs_to_string_keys({k, vs}) when is_list(vs) do
- {to_string(k), Enum.join(vs, " ")}
- end
- def attrs_to_string_keys({k, vs}) do
- {to_string(k),to_string(vs)}
- end
-
- @doc false
- def augment_tag_with_ial(tags, ial)
- def augment_tag_with_ial([{t, a, c, m}|tags], atts) do
- [{t, merge_attrs(a, atts), c, m}|tags]
- end
- def augment_tag_with_ial([], _atts) do
- []
- end
-
- @doc false
- def code_classes(language, prefix) do
- classes =
- ["" | String.split(prefix || "")]
- |> Enum.map(fn pfx -> "#{pfx}#{language}" end)
- {"class", classes |> Enum.join(" ")}
- end
-
- @doc false
- def codespan(text) do
- emit("code", text, class: "inline")
- end
-
- @doc false
- def render_footnote_link(ref, backref, number) do
- emit("a", to_string(number), href: "##{ref}", id: backref, class: "footnote", title: "see footnote")
- end
-
- @doc false
- def render_code(%Block.Code{lines: lines}) do
- lines |> Enum.join("\n")
- end
-
- @remove_escapes ~r{ \\ (?! \\ ) }x
- @doc false
- def render_image(text, href, title) do
- alt = text |> escape() |> String.replace(@remove_escapes, "")
-
- if title do
- emit("img", [], src: href, alt: alt, title: title)
- else
- emit("img", [], src: href, alt: alt)
- end
- end
-
- @doc false
- def render_link(url, text) do
- emit("a", text, href: _encode(url))
- end
-
-
- ##############################################
- # add attributes to the outer tag in a block #
- ##############################################
-
-
- @verbatims ~r<%[\da-f]{2}>i
- defp _encode(url) do
- url
- |> String.split(@verbatims, include_captures: true)
- |> Enum.chunk_every(2)
- |> Enum.map(&_encode_chunk/1)
- |> IO.chardata_to_string
- end
-
- defp _encode_chunk([encodable, verbatim]), do: [URI.encode(encodable), verbatim]
- defp _encode_chunk([encodable]), do: URI.encode(encodable)
-
- @doc false
- def merge_attrs(maybe_atts, new_atts)
- def merge_attrs(nil, new_atts), do: new_atts
- def merge_attrs(atts, new) when is_list(atts) do
- atts
- |> Enum.into(%{})
- |> merge_attrs(new)
- end
-
- def merge_attrs(atts, new) do
- atts
- |> Map.merge(new, &_value_merger/3)
- |> Enum.into([])
- |> Enum.map(&attrs_to_string_keys/1)
- end
-
- defp _value_merger(key, val1, val2)
- defp _value_merger(_, val1, val2) when is_list(val1) do
- val1 ++ [val2]
- end
- defp _value_merger(_, val1, val2) do
- [val1, val2]
- end
-
-
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/attr_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/attr_parser.ex
deleted file mode 100644
index 398833fa..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/attr_parser.ex
+++ /dev/null
@@ -1,61 +0,0 @@
-defmodule EarmarkParser.Helpers.AttrParser do
-
- @moduledoc false
-
- import EarmarkParser.Helpers.StringHelpers, only: [ behead: 2 ]
- import EarmarkParser.Message, only: [add_message: 2]
-
-
- @type errorlist :: list(String.t)
-
- def parse_attrs(context, attrs, lnb) do
- { attrs, errors } = _parse_attrs(%{}, attrs, [], lnb)
- { add_errors(context, errors, lnb), attrs }
- end
-
- defp _parse_attrs(dict, attrs, errors, lnb) do
- cond do
- Regex.match?(~r{^\s*$}, attrs) -> {dict, errors}
-
- match = Regex.run(~r{^\.(\S+)\s*}, attrs) ->
- [ leader, class ] = match
- Map.update(dict, "class", [ class ], &[ class | &1])
- |> _parse_attrs(behead(attrs, leader), errors, lnb)
-
- match = Regex.run(~r{^\#(\S+)\s*}, attrs) ->
- [ leader, id ] = match
- Map.update(dict, "id", [ id ], &[ id | &1])
- |> _parse_attrs(behead(attrs, leader), errors, lnb)
-
- # Might we being running into escape issues here too?
- match = Regex.run(~r{^(\S+)=\'([^\']*)'\s*}, attrs) -> #'
- [ leader, name, value ] = match
- Map.update(dict, name, [ value ], &[ value | &1])
- |> _parse_attrs(behead(attrs, leader), errors, lnb)
-
- # Might we being running into escape issues here too?
- match = Regex.run(~r{^(\S+)=\"([^\"]*)"\s*}, attrs) -> #"
- [ leader, name, value ] = match
- Map.update(dict, name, [ value ], &[ value | &1])
- |> _parse_attrs(behead(attrs, leader), errors, lnb)
-
- match = Regex.run(~r{^(\S+)=(\S+)\s*}, attrs) ->
- [ leader, name, value ] = match
- Map.update(dict, name, [ value ], &[ value | &1])
- |> _parse_attrs(behead(attrs, leader), errors, lnb)
-
- match = Regex.run(~r{^(\S+)\s*(.*)}, attrs) ->
- [ _, incorrect, rest ] = match
- _parse_attrs(dict, rest, [ incorrect | errors ], lnb)
-
- :otherwise ->
- {dict, [attrs | errors ]}
- end
- end
-
- defp add_errors(context, [], _lnb), do: context
- defp add_errors(context, errors, lnb), do: add_message(context, {:warning, lnb, "Illegal attributes #{inspect errors} ignored in IAL"})
-
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/html_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/html_parser.ex
deleted file mode 100644
index 538599f0..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/html_parser.ex
+++ /dev/null
@@ -1,78 +0,0 @@
-defmodule EarmarkParser.Helpers.HtmlParser do
-
- @moduledoc false
-
- import EarmarkParser.Helpers.StringHelpers, only: [behead: 2]
- import EarmarkParser.LineScanner, only: [void_tag?: 1]
-
- def parse_html(lines)
- def parse_html([tag_line|rest]) do
- case _parse_tag(tag_line) do
- { :ok, tag, "" } -> [_parse_rest(rest, tag, [])]
- { :ok, tag, suffix } -> [_parse_rest(rest, tag, [suffix])]
- { :ext, tag, "" } -> [_parse_rest(rest, tag, [])]
- { :ext, tag, suffix } -> [_parse_rest(rest, tag, []), [suffix]]
- end
- end
-
- # Parse One Tag
- # -------------
-
- @quoted_attr ~r{\A ([-\w]+) \s* = \s* (["']) (.*?) \2 \s*}x
- @unquoted_attr ~r{\A ([-\w]+) (?: \s* = \s* ([^&\s>]*))? \s*}x
- defp _parse_atts(string, tag, atts) do
- case Regex.run(@quoted_attr, string) do
- [all, name, _delim, value] -> _parse_atts(behead(string, all), tag, [{name, value}|atts])
- _ -> case Regex.run(@unquoted_attr, string) do
- [all, name, value] -> _parse_atts(behead(string, all), tag, [{name, value}|atts])
- [all, name] -> _parse_atts(behead(string, all), tag, [{name, name}|atts])
- _ -> _parse_tag_tail(string, tag, atts)
- end
- end
- end
-
- # Are leading and trailing "-"s ok?
- @tag_head ~r{\A \s* <([-\w]+) \s*}x
- defp _parse_tag(string) do
- case Regex.run(@tag_head, string) do
- [all, tag] -> _parse_atts(behead(string, all), tag, [])
- end
- end
-
- @tag_tail ~r{\A .*? (/?)> \s* (.*) \z}x
- defp _parse_tag_tail(string, tag, atts) do
- case Regex.run(@tag_tail, string) do
- [_, closing, suffix] ->
- suffix1 = String.replace(suffix, ~r{\s*#{tag}>.*}, "")
- _close_tag_tail(tag, atts, closing != "", suffix1)
- end
- end
-
- defp _close_tag_tail(tag, atts, closing?, suffix) do
- if closing? || void_tag?(tag) do
- {:ext, {tag, Enum.reverse(atts)}, suffix }
- else
- {:ok, {tag, Enum.reverse(atts)}, suffix }
- end
- end
-
- # Iterate over lines inside a tag
- # -------------------------------
-
- @verbatim %{verbatim: true}
- defp _parse_rest(rest, tag_tpl, lines)
- defp _parse_rest([], tag_tpl, lines) do
- tag_tpl |> Tuple.append(Enum.reverse(lines)) |> Tuple.append(@verbatim)
- end
- defp _parse_rest([last_line], {tag, _}=tag_tpl, lines) do
- case Regex.run(~r{\A\s*#{tag}>\s*(.*)}, last_line) do
- nil -> tag_tpl |> Tuple.append(Enum.reverse([last_line|lines])) |> Tuple.append(@verbatim)
- [_, ""] -> tag_tpl |> Tuple.append(Enum.reverse(lines)) |> Tuple.append(@verbatim)
- [_, suffix] -> [tag_tpl |> Tuple.append(Enum.reverse(lines)) |> Tuple.append(@verbatim), suffix]
- end
- end
- defp _parse_rest([inner_line|rest], tag_tpl, lines) do
- _parse_rest(rest, tag_tpl, [inner_line|lines])
- end
-
-end
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/leex_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/leex_helpers.ex
deleted file mode 100644
index 12c06f28..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/leex_helpers.ex
+++ /dev/null
@@ -1,31 +0,0 @@
-defmodule EarmarkParser.Helpers.LeexHelpers do
-
- @moduledoc false
- @doc """
- Allows to lex an Elixir string with a leex lexer and returns
- the tokens as needed for a yecc parser.
- """
- def lex text, with: lexer do
- case text
- |> String.to_charlist()
- |> lexer.string() do
- {:ok, tokens, _} -> tokens
- end
- end
-
- def tokenize line, with: lexer do
- {:ok, tokens, _} =
- line
- |> to_charlist()
- |> lexer.string()
- elixirize_tokens(tokens,[])
- |> Enum.reverse()
- end
-
- defp elixirize_tokens(tokens, rest)
- defp elixirize_tokens([], result), do: result
- defp elixirize_tokens([{token, _, text}|rest], result), do: elixirize_tokens(rest, [{token,to_string(text)}|result])
-
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/line_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/line_helpers.ex
deleted file mode 100644
index 0f5398fb..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/line_helpers.ex
+++ /dev/null
@@ -1,36 +0,0 @@
-defmodule EarmarkParser.Helpers.LineHelpers do
-
- @moduledoc false
-
- alias EarmarkParser.Line
-
- def blank?(%Line.Blank{}), do: true
- def blank?(_), do: false
-
- def blockquote_or_text?(%Line.BlockQuote{}), do: true
- def blockquote_or_text?(struct), do: text?(struct)
-
- def indent_or_blank?(%Line.Indent{}), do: true
- def indent_or_blank?(line), do: blank?(line)
-
- # Gruber's tests have
- #
- # para text...
- # * and more para text
- #
- # So list markers inside paragraphs are ignored. But he also has
- #
- # * line
- # * line
- #
- # And expects it to be a nested list. These seem to be in conflict
- #
- # I think the second is a better interpretation, so I commented
- # out the 2nd match below.
- def text?(%Line.Text{}), do: true
- def text?(%Line.TableLine{}), do: true
-# def text?(%Line.ListItem{}), do: true
- def text?(_), do: false
-
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/lookahead_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/lookahead_helpers.ex
deleted file mode 100644
index 79f55284..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/lookahead_helpers.ex
+++ /dev/null
@@ -1,75 +0,0 @@
-defmodule EarmarkParser.Helpers.LookaheadHelpers do
-
- @moduledoc false
-
- import EarmarkParser.Helpers.LeexHelpers
-
- @doc """
- Indicates if the _numbered_line_ passed in leaves an inline code block open.
-
- If so returns a tuple whre the first element is the opening sequence of backticks,
- and the second the linenumber of the _numbered_line_
-
- Otherwise `{nil, 0}` is returned
- """
- def opens_inline_code(%{line: line, lnb: lnb}) do
- # case tokenize(line, with: :string_lexer) |> IO.inspect() |> has_still_opening_backtix(nil) do
- case tokenize(line, with: :string_lexer) |> has_still_opening_backtix(nil) do
- nil -> {nil, 0}
- {_, btx} -> {btx, lnb}
- end
- end
-
- @doc """
- returns false if and only if the line closes a pending inline code
- *without* opening a new one.
- The opening backtix are passed in as second parameter.
- If the function does not return false it returns the (new or original)
- opening backtix
- """
- # (#{},{_,_}) -> {_,_}
- def still_inline_code(%{line: line, lnb: lnb}, old = {pending, _pending_lnb}) do
- case tokenize(line, with: :string_lexer) |> has_still_opening_backtix({:old, pending}) do
- nil -> {nil, 0}
- {:new, btx} -> {btx, lnb}
- {:old, _} -> old
- end
- end
-
- # A tokenized line {:verabtim, text} | {:backtix, ['``+]} is analyzed for
- # if it is closed (-> nil), not closed (-> {:old, btx}) or reopened (-> {:new, btx})
- # concerning backtix
- defp has_still_opening_backtix(tokens, opened_so_far)
-
- # Empty, done, but take care of tangeling escape (\)
- defp has_still_opening_backtix([], :force_outside), do: nil
- defp has_still_opening_backtix([], open), do: open
-
- # Outside state, represented by nil
- defp has_still_opening_backtix([{:other, _} | rest], nil),
- do: has_still_opening_backtix(rest, nil)
-
- defp has_still_opening_backtix([{:backtix, btx} | rest], nil),
- do: has_still_opening_backtix(rest, {:new, btx})
-
- defp has_still_opening_backtix([{:escape, _} | rest], nil),
- do: has_still_opening_backtix(rest, :force_outside)
-
- # Next state forced outside, represented by :force_outside
- defp has_still_opening_backtix([_ | rest], :force_outside),
- do: has_still_opening_backtix(rest, nil)
-
- # Inside state, represented by { :old | :new, btx }
- defp has_still_opening_backtix([{:backtix, btx} | rest], open = {_, openedbtx}) do
- if btx == openedbtx do
- has_still_opening_backtix(rest, nil)
- else
- has_still_opening_backtix(rest, open)
- end
- end
-
- defp has_still_opening_backtix([_ | rest], open = {_, _}),
- do: has_still_opening_backtix(rest, open)
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/pure_link_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/pure_link_helpers.ex
deleted file mode 100644
index f6de0dea..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/pure_link_helpers.ex
+++ /dev/null
@@ -1,80 +0,0 @@
-defmodule EarmarkParser.Helpers.PureLinkHelpers do
- @moduledoc false
-
- import EarmarkParser.Helpers.AstHelpers, only: [render_link: 2]
-
- @pure_link_rgx ~r{
- \A
- (\s*)
- (
- (?:https?://|www\.)
- [^\s<>]*
- [^\s<>?!.,:*_~]
- )
- }ux
-
- def convert_pure_link(src) do
- case Regex.run(@pure_link_rgx, src) do
- [_match, spaces, link_text] ->
- if String.ends_with?(link_text, ")") do
- remove_trailing_closing_parens(spaces, link_text)
- else
- make_result(spaces, link_text)
- end
-
- _ ->
- nil
- end
- end
-
- @split_at_ending_parens ~r{ (.*?) (\)*) \z}x
- defp remove_trailing_closing_parens(leading_spaces, link_text) do
- [_, link_text, trailing_parens] = Regex.run(@split_at_ending_parens, link_text)
- trailing_paren_count = String.length(trailing_parens)
-
- # try to balance parens from the rhs
- unbalanced_count = balance_parens(String.reverse(link_text), trailing_paren_count)
- balanced_parens = String.slice(trailing_parens, 0, trailing_paren_count - unbalanced_count)
-
- make_result(leading_spaces, link_text <> balanced_parens)
- end
-
- defp make_result(leading_spaces, link_text) do
- link =
- if String.starts_with?(link_text, "www.") do
- render_link("http://" <> link_text, link_text)
- else
- render_link(link_text, link_text)
- end
-
- if leading_spaces == "" do
- {link, String.length(link_text)}
- else
- {[leading_spaces, link], String.length(leading_spaces) + String.length(link_text)}
- end
- end
-
- # balance parens and return unbalanced *trailing* paren count
- defp balance_parens(reverse_text, trailing_count, non_trailing_count \\ 0)
-
- defp balance_parens(<<>>, trailing_paren_count, _non_trailing_count), do: trailing_paren_count
-
- defp balance_parens(_reverse_text, 0, _non_trailing_count), do: 0
-
- defp balance_parens(")" <> rest, trailing_paren_count, non_trailing_count) do
- balance_parens(rest, trailing_paren_count, non_trailing_count + 1)
- end
-
- defp balance_parens("(" <> rest, trailing_paren_count, non_trailing_count) do
- # non-trailing paren must be balanced before trailing paren
- if non_trailing_count > 0 do
- balance_parens(rest, trailing_paren_count, non_trailing_count - 1)
- else
- balance_parens(rest, trailing_paren_count - 1, non_trailing_count)
- end
- end
-
- defp balance_parens(<<_::utf8,rest::binary>>, trailing_paren_count, non_trailing_count) do
- balance_parens(rest, trailing_paren_count, non_trailing_count)
- end
-end
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/reparse_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/reparse_helpers.ex
deleted file mode 100644
index d91f0e48..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/reparse_helpers.ex
+++ /dev/null
@@ -1,25 +0,0 @@
-defmodule EarmarkParser.Helpers.ReparseHelpers do
-
- @moduledoc false
-
- alias EarmarkParser.Line
-
- @doc """
- Extract the verbatim text of `%EarmarkParser.Line.t` elements with less alignment so that
- it can be reparsed (as elements of footnotes or indented code)
- """
- # Add additional spaces for any indentation past level 1
- def properly_indent(%Line.Indent{level: level, content: content}, target_level)
- when level == target_level do
- content
- end
- def properly_indent(%Line.Indent{level: level, content: content}, target_level)
- when level > target_level do
- String.duplicate(" ", level-target_level) <> content
- end
- def properly_indent(line, _) do
- line.content
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/string_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/string_helpers.ex
deleted file mode 100644
index 4b3b5a87..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/string_helpers.ex
+++ /dev/null
@@ -1,18 +0,0 @@
-defmodule EarmarkParser.Helpers.StringHelpers do
-
- @moduledoc false
-
- @doc """
- Remove the leading part of a string
- """
- def behead(str, ignore) when is_integer(ignore) do
- {_pre, post} = String.split_at(str, ignore)
- post
- end
-
- def behead(str, leading_string) do
- behead(str, String.length(leading_string))
- end
-
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/yecc_helpers.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/yecc_helpers.ex
deleted file mode 100644
index 1d232dd9..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/helpers/yecc_helpers.ex
+++ /dev/null
@@ -1,20 +0,0 @@
-defmodule EarmarkParser.Helpers.YeccHelpers do
-
- @moduledoc false
- import EarmarkParser.Helpers.LeexHelpers, only: [lex: 2]
-
- def parse!( text, lexer: lexer, parser: parser ) do
- case parse(text, lexer: lexer, parser: parser) do
- {:ok, ast} -> ast
- {:error, _} -> nil
- end
- end
-
- def parse( text, lexer: lexer, parser: parser ) do
- with tokens <- lex(text, with: lexer) do
- parser.parse(tokens)
- end
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line.ex
deleted file mode 100644
index 54ce40b5..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line.ex
+++ /dev/null
@@ -1,98 +0,0 @@
-defmodule EarmarkParser.Line do
-
- @moduledoc false
-
-defmodule Blank do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, content: "")
- end
-defmodule Ruler do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, type: "- or * or _")
- end
-
-defmodule Heading do
- @moduledoc false
- defstruct(annotation: nil, ial: nil, lnb: 0, line: "", indent: -1, level: 1, content: "inline text")
- end
-
-defmodule BlockQuote do
- @moduledoc false
- defstruct(annotation: nil, ial: nil, lnb: 0, line: "", indent: -1, content: "text")
- end
-
-defmodule Indent do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, level: 0, content: "text")
- end
-
-defmodule Fence do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, delimiter: "~ or `", language: nil)
- end
-
-defmodule HtmlOpenTag do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, tag: "", content: "")
- end
-
-defmodule HtmlCloseTag do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, tag: "<... to eol")
- end
-defmodule HtmlComment do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, complete: true)
- end
-
-defmodule HtmlOneLine do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, tag: "", content: "")
- end
-
-defmodule IdDef do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, id: nil, url: nil, title: nil)
- end
-
-defmodule FnDef do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, id: nil, content: "text")
- end
-
-defmodule ListItem do
- @moduledoc false
- defstruct(
- annotation: nil,
- ial: nil,
- lnb: 0,
- type: :ul,
- line: "",
- indent: -1,
- bullet: "* or -",
- content: "text",
- initial_indent: 0,
- list_indent: 0
- )
- end
-
-defmodule SetextUnderlineHeading do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, level: 1)
- end
-
-defmodule TableLine do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, content: "", columns: 0, is_header: false, needs_header: false)
- end
-
-defmodule Ial do
- @moduledoc false
- defstruct(annotation: nil, ial: nil, lnb: 0, line: "", indent: -1, attrs: "", verbatim: "")
- end
-defmodule Text do
- @moduledoc false
- defstruct(annotation: nil, lnb: 0, line: "", indent: -1, content: "")
- end
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line_scanner.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line_scanner.ex
deleted file mode 100644
index 6ae879a5..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/line_scanner.ex
+++ /dev/null
@@ -1,311 +0,0 @@
-defmodule EarmarkParser.LineScanner do
- @moduledoc false
-
- alias EarmarkParser.{Helpers, Line, Options}
-
- # This is the re that matches the ridiculous "[id]: url title" syntax
-
- @id_title_part ~S"""
- (?|
- " (.*) " # in quotes
- | ' (.*) ' #
- | \( (.*) \) # in parens
- )
- """
-
- @id_re ~r'''
- ^\[([^^].*?)\]: # [someid]:
- \s+
- (?|
- < (\S+) > # url in <>s
- | (\S+) # or without
- )
- (?:
- \s+ # optional title
- #{@id_title_part}
- )?
- \s*
- $
- '''x
-
- @indent_re ~r'''
- \A ( (?: \s{4})+ ) (\s*) # 4 or more leading spaces
- (.*) # the rest
- '''x
-
- @void_tags ~w{area br hr img wbr}
- @void_tag_rgx ~r'''
- ^<( #{Enum.join(@void_tags, "|")} )
- .*?
- >
- '''x
- @doc false
- def void_tag?(tag), do: Regex.match?(@void_tag_rgx, "<#{tag}>")
-
- def scan_lines(lines, options, recursive) do
- _lines_with_count(lines, options.line - 1)
- |> _with_lookahead(options, recursive)
- end
-
- def type_of(line, recursive)
- when is_boolean(recursive),
- do: type_of(line, %Options{}, recursive)
-
- def type_of({line, lnb}, options = %Options{annotations: annotations}, recursive) when is_binary(line) do
- {line1, annotation} = line |> Helpers.expand_tabs() |> Helpers.remove_line_ending(annotations)
- %{_type_of(line1, options, recursive) | annotation: annotation, lnb: lnb}
- end
-
- def type_of({line, lnb}, _, _) do
- raise ArgumentError, "line number #{lnb} #{inspect line} is not a binary"
- end
-
- defp _type_of(line, options = %Options{}, recursive) do
- {ial, stripped_line} = Helpers.extract_ial(line)
- {content, indent} = _count_indent(line, 0)
- lt_four? = indent < 4
-
- cond do
- content == "" ->
- _create_text(line, content, indent)
-
- lt_four? && !recursive && Regex.run(~r/\A \z/x, content) ->
- %Line.HtmlComment{complete: true, indent: indent, line: line}
-
- lt_four? && !recursive && Regex.run(~r/\A /u, options, recursive)]
-
- other ->
- [other | _with_lookahead(lines, options, recursive)]
- end
- end
-
- defp _with_lookahead([], _options, _recursive), do: []
-
- defp _lookahead_until_match([], _, _, _), do: []
-
- defp _lookahead_until_match([{line, lnb} | lines], regex, options, recursive) do
- if line =~ regex do
- [type_of({line, lnb}, options, recursive) | _with_lookahead(lines, options, recursive)]
- else
- [
- %{_create_text(line) | lnb: lnb}
- | _lookahead_until_match(lines, regex, options, recursive)
- ]
- end
- end
-
- @column_rgx ~r{\A[\s|:-]+\z}
- defp _determine_if_header(columns) do
- columns
- |> Enum.all?(fn col -> Regex.run(@column_rgx, col) end)
- end
-
- defp _split_table_columns(line) do
- line
- |> String.split(~r{(? Enum.map(&String.trim/1)
- |> Enum.map(fn col -> Regex.replace(~r{\\\|}, col, "|") end)
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/message.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/message.ex
deleted file mode 100644
index 249efb67..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/message.ex
+++ /dev/null
@@ -1,39 +0,0 @@
-defmodule EarmarkParser.Message do
- @moduledoc false
-
- alias EarmarkParser.Context
- alias EarmarkParser.Options
-
- @type message_type :: :error | :warning
- @type t :: {message_type, number, binary}
- @type ts :: list(t)
- @type container_type :: Options.t() | Context.t()
-
- def add_messages(container, messages),
- do: Enum.reduce(messages, container, &add_message(&2, &1))
-
- def add_message(container, message)
-
- def add_message(options = %Options{}, message) do
- %{options | messages: MapSet.put(options.messages, message)}
- end
-
- def add_message(context = %Context{}, message) do
- %{context | options: add_message(context.options, message)}
- end
-
- def get_messages(container)
- def get_messages(%Context{options: %{messages: messages}}), do: messages
-
- @doc """
- For final output
- """
- def sort_messages(container) do
- container
- |> get_messages()
- |> Enum.sort(fn {_, l, _}, {_, r, _} -> r >= l end)
- end
-
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/options.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/options.ex
deleted file mode 100644
index 61d2eb19..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/options.ex
+++ /dev/null
@@ -1,154 +0,0 @@
-defmodule EarmarkParser.Options do
- # What we use to render
- defstruct renderer: EarmarkParser.HtmlRenderer,
- # Inline style options
- all: false,
- gfm: true,
- gfm_tables: false,
- breaks: false,
- footnotes: false,
- footnote_offset: 1,
- wikilinks: false,
- parse_inline: true,
-
- # allow for annotations
- annotations: nil,
- # additional prefies for class of code blocks
- code_class_prefix: nil,
-
- # Filename and initial line number of the markdown block passed in
- # for meaningful error messages
- file: "",
- line: 1,
- # [{:error|:warning, lnb, text},...]
- messages: MapSet.new([]),
- pure_links: true,
- sub_sup: false,
-
- # deprecated
- pedantic: false,
- smartypants: false,
- timeout: nil
-
- @type t :: %__MODULE__{
- all: boolean(),
- gfm: boolean(),
- gfm_tables: boolean(),
- breaks: boolean(),
- footnotes: boolean(),
- footnote_offset: non_neg_integer(),
- wikilinks: boolean(),
- parse_inline: boolean(),
-
- # allow for annotations
- annotations: nil | binary(),
- # additional prefies for class of code blocks
- code_class_prefix: nil | binary(),
-
- # Filename and initial line number of the markdown block passed in
- # for meaningful error messages
- file: binary(),
- line: number(),
- # [{:error|:warning, lnb, text},...]
- messages: MapSet.t,
- pure_links: boolean(),
- sub_sup: boolean(),
-
- # deprecated
- pedantic: boolean(),
- smartypants: boolean(),
- timeout: nil | non_neg_integer()
-
- }
-
- @doc false
- def add_deprecations(options, messages)
-
- def add_deprecations(%__MODULE__{smartypants: true} = options, messages) do
- add_deprecations(
- %{options | smartypants: false},
- [
- {:deprecated, 0,
- "The smartypants option has no effect anymore and will be removed in EarmarkParser 1.5"}
- | messages
- ]
- )
- end
-
- def add_deprecations(%__MODULE__{timeout: timeout} = options, messages) when timeout != nil do
- add_deprecations(
- %{options | timeout: nil},
- [
- {:deprecated, 0,
- "The timeout option has no effect anymore and will be removed in EarmarkParser 1.5"}
- | messages
- ]
- )
- end
-
- def add_deprecations(%__MODULE__{pedantic: true} = options, messages) do
- add_deprecations(
- %{options | pedantic: false},
- [
- {:deprecated, 0,
- "The pedantic option has no effect anymore and will be removed in EarmarkParser 1.5"}
- | messages
- ]
- )
- end
-
- def add_deprecations(_options, messages), do: messages
-
- @doc ~S"""
- Use normalize before passing it into any API function
-
- iex(1)> options = normalize(annotations: "%%")
- ...(1)> options.annotations
- ~r{\A(.*)(%%.*)}
- """
- def normalize(options)
-
- def normalize(%__MODULE__{} = options) do
- case options.annotations do
- %Regex{} ->
- options
-
- nil ->
- options
-
- _ ->
- %{
- options
- | annotations: Regex.compile!("\\A(.*)(#{Regex.escape(options.annotations)}.*)")
- }
- end
- |> _set_all_if_applicable()
- |> _deprecate_old_messages()
- end
-
- def normalize(options), do: struct(__MODULE__, options) |> normalize()
-
- defp _deprecate_old_messages(opitons)
- defp _deprecate_old_messages(%__MODULE__{messages: %MapSet{}} = options), do: options
-
- defp _deprecate_old_messages(%__MODULE__{} = options) do
- %{
- options
- | messages:
- MapSet.new([
- {:deprecated, 0,
- "messages is an internal option that is ignored and will be removed from the API in v1.5"}
- ])
- }
- end
-
- defp _set_all_if_applicable(options)
-
- defp _set_all_if_applicable(%{all: true} = options) do
- %{options | breaks: true, footnotes: true, gfm_tables: true, sub_sup: true, wikilinks: true}
- end
-
- defp _set_all_if_applicable(options), do: options
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser.ex
deleted file mode 100644
index 727f8735..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser.ex
+++ /dev/null
@@ -1,692 +0,0 @@
-defmodule EarmarkParser.Parser do
-
- @moduledoc false
- alias EarmarkParser.{Block, Line, LineScanner, Options}
-
- import EarmarkParser.Helpers.{AttrParser, LineHelpers, ReparseHelpers}
-
- import EarmarkParser.Helpers.LookaheadHelpers,
- only: [opens_inline_code: 1, still_inline_code: 2]
-
- import EarmarkParser.Message, only: [add_message: 2, add_messages: 2]
- import EarmarkParser.Parser.FootnoteParser, only: [parse_fn_defs: 3]
- import EarmarkParser.Parser.ListParser, only: [parse_list: 3]
-
- @doc """
- Given a markdown document (as either a list of lines or
- a string containing newlines), return a parse tree and
- the context necessary to render the tree.
-
- The options are a `%EarmarkParser.Options{}` structure. See `as_html!`
- for more details.
- """
- def parse_markdown(lines, options)
-
- def parse_markdown(lines, options = %Options{}) when is_list(lines) do
- {blocks, links, footnotes, options1} = parse(lines, options, false)
-
- context =
- %EarmarkParser.Context{options: options1, links: links}
- |> EarmarkParser.Context.update_context()
-
- context = put_in(context.footnotes, footnotes)
- context = put_in(context.options, options1)
- {blocks, context}
- end
-
- def parse_markdown(lines, options) when is_binary(lines) do
- lines
- |> String.split(~r{\r\n?|\n})
- |> parse_markdown(options)
- end
-
- def parse_markdown(lines, _) do
- raise ArgumentError, "#{inspect lines} not a binary, nor a list of binaries"
- end
-
- def parse(text_lines, options = %Options{}, recursive) do
- ["" | text_lines ++ [""]]
- |> LineScanner.scan_lines(options, recursive)
- |> parse_lines(options, recursive)
- end
-
- @doc false
- # Given a list of `Line.xxx` structs, group them into related blocks.
- # Then extract any id definitions, and build a map from them. Not
- # for external consumption.
-
- def parse_lines(lines, options, recursive) do
- {blocks, footnotes, options} =
- lines |> remove_trailing_blank_lines() |> lines_to_blocks(options, recursive)
-
-
- links = links_from_blocks(blocks)
- {blocks, links, footnotes, options}
- end
-
- defp lines_to_blocks(lines, options, recursive) do
- {blocks, footnotes, options1} = _parse(lines, [], options, recursive)
-
- {blocks |> assign_attributes_to_blocks([]), footnotes, options1}
- end
-
- defp _parse(input, result, options, recursive)
- defp _parse([], result, options, _recursive), do: {result, %{}, options}
-
- ###################
- # setext headings #
- ###################
-
- # 1 step
- defp _parse(
- [
- %Line.Blank{},
- %Line.Text{content: heading, lnb: lnb},
- %Line.SetextUnderlineHeading{annotation: annotation, level: level}
- | rest
- ],
- result,
- options,
- recursive
- ) do
- _parse(
- rest,
- [%Block.Heading{annotation: annotation, content: heading, level: level, lnb: lnb} | result],
- options,
- recursive
- )
- end
-
- # 1 step
- defp _parse(
- [
- %Line.Blank{},
- %Line.Text{content: heading, lnb: lnb},
- %Line.Ruler{type: "-"}
- | rest
- ],
- result,
- options,
- recursive
- ) do
- _parse(
- rest,
- [%Block.Heading{content: heading, level: 2, lnb: lnb} | result],
- options,
- recursive
- )
- end
-
- #################
- # Other heading #
- #################
-
- # 1 step
- defp _parse(
- [%Line.Heading{content: content, ial: ial, level: level, lnb: lnb} | rest],
- result,
- options,
- recursive
- ) do
- {options1, result1} =
- prepend_ial(
- options,
- ial,
- lnb,
- [%Block.Heading{content: content, level: level, lnb: lnb} | result]
- )
-
- _parse(rest, result1, options1, recursive)
- end
-
- #########
- # Ruler #
- #########
-
- # 1 step
- defp _parse([%Line.Ruler{type: type, lnb: lnb} | rest], result, options, recursive) do
- _parse(rest, [%Block.Ruler{type: type, lnb: lnb} | result], options, recursive)
- end
-
- ###############
- # Block Quote #
- ###############
-
- # split and parse
- defp _parse(lines = [%Line.BlockQuote{lnb: lnb} | _], result, options, recursive) do
- {quote_lines, rest} = Enum.split_while(lines, &blockquote_or_text?/1)
- lines = for line <- quote_lines, do: line.content
- {blocks, _, _, options1} = parse(lines, %{options | line: lnb}, true)
- _parse(rest, [%Block.BlockQuote{blocks: blocks, lnb: lnb} | result], options1, recursive)
- end
-
- #########
- # Table #
- #########
-
- # read and add verbatim
- defp _parse(
- lines = [
- %Line.TableLine{columns: cols1, lnb: lnb1, needs_header: false},
- %Line.TableLine{columns: cols2}
- | _rest
- ],
- result,
- options,
- recursive
- )
- when length(cols1) == length(cols2) do
- columns = length(cols1)
- {table, rest} = read_table(lines, columns, [])
- table1 = %{table | lnb: lnb1}
- _parse(rest, [table1 | result], options, recursive)
- end
-
- defp _parse(
- lines = [
- %Line.TableLine{columns: cols1, lnb: lnb1, needs_header: true},
- %Line.TableLine{columns: cols2, is_header: true}
- | _rest
- ],
- result,
- options,
- recursive
- )
- when length(cols1) == length(cols2) do
- columns = length(cols1)
- {table, rest} = read_table(lines, columns, [])
- table1 = %{table | lnb: lnb1}
- _parse(rest, [table1 | result], options, recursive)
- end
-
- #############
- # Paragraph #
- #############
-
- # split and add verbatim
- defp _parse(lines = [%Line.TableLine{lnb: lnb} | _], result, options, recursive) do
- {para_lines, rest} = Enum.split_while(lines, &text?/1)
- line_text = for line <- para_lines, do: line.line
- _parse(rest, [%Block.Para{lines: line_text, lnb: lnb + 1} | result], options, recursive)
- end
-
- # read and parse
- defp _parse(lines = [%Line.Text{lnb: lnb} | _], result, options, recursive) do
- {reversed_para_lines, rest, pending, annotation} = consolidate_para(lines)
-
- options1 =
- case pending do
- {nil, _} ->
- options
-
- {pending, lnb1} ->
- add_message(
- options,
- {:warning, lnb1, "Closing unclosed backquotes #{pending} at end of input"}
- )
- end
-
- line_text = for line <- reversed_para_lines |> Enum.reverse(), do: line.line
-
- if recursive == :list do
- _parse(rest, [%Block.Text{line: line_text, lnb: lnb} | result], options1, recursive)
- else
- _parse(
- rest,
- [%Block.Para{annotation: annotation, lines: line_text, lnb: lnb} | result],
- options1,
- recursive
- )
- end
- end
-
- defp _parse(
- [%Line.SetextUnderlineHeading{line: line, lnb: lnb, level: 2} | rest],
- result,
- options,
- recursive
- ) do
- _parse([%Line.Text{line: line, lnb: lnb} | rest], result, options, recursive)
- end
-
- #########
- # Lists #
- #########
- # We handle lists in two passes. In the first, we build list items,
- # in the second we combine adjacent items into lists. This is pass one
-
- defp _parse([%Line.ListItem{} | _] = input, result, options, recursive) do
- {with_prepended_lists, rest, options1} = parse_list(input, result, options)
- _parse([%Line.Blank{lnb: 0} | rest], with_prepended_lists, options1, recursive)
- end
-
- #################
- # Indented code #
- #################
-
- defp _parse(list = [%Line.Indent{lnb: lnb} | _], result, options, recursive) do
- {code_lines, rest} = Enum.split_while(list, &indent_or_blank?/1)
- code_lines = remove_trailing_blank_lines(code_lines)
- code = for line <- code_lines, do: properly_indent(line, 1)
- _parse([%Line.Blank{}|rest], [%Block.Code{lines: code, lnb: lnb} | result], options, recursive)
- end
-
- ###############
- # Fenced code #
- ###############
-
- defp _parse(
- [%Line.Fence{delimiter: delimiter, language: language, lnb: lnb} | rest],
- result,
- options,
- recursive
- ) do
- {code_lines, rest} =
- Enum.split_while(rest, fn line ->
- !match?(%Line.Fence{delimiter: ^delimiter, language: _}, line)
- end)
-
- {rest1, options1} = _check_closing_fence(rest, lnb, delimiter, options)
- code = for line <- code_lines, do: line.line
-
- _parse(
- rest1,
- [%Block.Code{lines: code, language: language, lnb: lnb} | result],
- options1,
- recursive
- )
- end
-
- ##############
- # HTML block #
- ##############
- defp _parse(
- [opener = %Line.HtmlOpenTag{annotation: annotation, tag: tag, lnb: lnb} | rest],
- result,
- options,
- recursive
- ) do
- {html_lines, rest1, unclosed, annotation} = _html_match_to_closing(opener, rest, annotation)
-
- options1 =
- add_messages(
- options,
- unclosed
- |> Enum.map(fn %{lnb: lnb1, tag: tag} ->
- {:warning, lnb1, "Failed to find closing <#{tag}>"}
- end)
- )
-
- html = Enum.reverse(html_lines)
-
- _parse(
- rest1,
- [%Block.Html{tag: tag, html: html, lnb: lnb, annotation: annotation} | result],
- options1,
- recursive
- )
- end
-
- ####################
- # HTML on one line #
- ####################
-
- defp _parse(
- [%Line.HtmlOneLine{annotation: annotation, line: line, lnb: lnb} | rest],
- result,
- options,
- recursive
- ) do
- _parse(
- rest,
- [%Block.HtmlOneline{annotation: annotation, html: [line], lnb: lnb} | result],
- options,
- recursive
- )
- end
-
- ################
- # HTML Comment #
- ################
-
- defp _parse(
- [line = %Line.HtmlComment{complete: true, lnb: lnb} | rest],
- result,
- options,
- recursive
- ) do
- _parse(rest, [%Block.HtmlComment{lines: [line.line], lnb: lnb} | result], options, recursive)
- end
-
- defp _parse(
- lines = [%Line.HtmlComment{complete: false, lnb: lnb} | _],
- result,
- options,
- recursive
- ) do
- {html_lines, rest} =
- Enum.split_while(lines, fn line ->
- !(line.line =~ ~r/-->/)
- end)
-
- {html_lines, rest} =
- if rest == [] do
- {html_lines, rest}
- else
- {html_lines ++ [hd(rest)], tl(rest)}
- end
-
- html = for line <- html_lines, do: line.line
- _parse(rest, [%Block.HtmlComment{lines: html, lnb: lnb} | result], options, recursive)
- end
-
- #################
- # ID definition #
- #################
-
- defp _parse([defn = %Line.IdDef{lnb: lnb} | rest], result, options, recursive) do
- _parse(
- rest,
- [%Block.IdDef{id: defn.id, url: defn.url, title: defn.title, lnb: lnb} | result],
- options,
- recursive
- )
- end
-
- #######################
- # Footnote Definition #
- #######################
-
- # Starting from 1.5.0 Footnote Definitions are always at the end of the document (GFM) meaning that the
- # `_parse` iteration can now end and we will trigger `_parse_fn_defs`
- # this has the advantage that we can make the assumption that the top of the `result`
- # list contains a `Block.FnList` element
- defp _parse([%Line.FnDef{} | _] = input, result, options, _recursive) do
- parse_fn_defs(input, result, options)
- end
-
- ####################
- # IAL (attributes) #
- ####################
-
- defp _parse(
- [%Line.Ial{attrs: attrs, lnb: lnb, verbatim: verbatim} | rest],
- result,
- options,
- recursive
- ) do
- {options1, attributes} = parse_attrs(options, attrs, lnb)
-
- _parse(
- rest,
- [%Block.Ial{attrs: attributes, content: attrs, lnb: lnb, verbatim: verbatim} | result],
- options1,
- recursive
- )
- end
-
- ###############
- # Blank Lines #
- ###############
- # We've reached the point where empty lines are no longer significant
-
- defp _parse([%Line.Blank{} | rest], result, options, recursive) do
- _parse(rest, result, options, recursive)
- end
-
- ##############################################################
- # Anything else... we warn, then treat it as if it were text #
- ##############################################################
-
- defp _parse([anything = %{lnb: lnb} | rest], result, options, recursive) do
- _parse(
- [%Line.Text{content: anything.line, lnb: lnb} | rest],
- result,
- add_message(options, {:warning, anything.lnb, "Unexpected line #{anything.line}"}),
- recursive
- )
- end
-
-
- #######################################################
- # Assign attributes that follow a block to that block #
- #######################################################
-
- defp assign_attributes_to_blocks([], result), do: result
-
- defp assign_attributes_to_blocks([%Block.Ial{attrs: attrs}, block | rest], result) do
- assign_attributes_to_blocks(rest, [%{block | attrs: attrs} | result])
- end
-
- defp assign_attributes_to_blocks([block | rest], result) do
- assign_attributes_to_blocks(rest, [block | result])
- end
-
- defp _check_closing_fence(rest, lnb, delimiter, options)
- defp _check_closing_fence([], lnb, delimiter, options) do
- {[], add_message(options, {:error, lnb, "Fenced Code Block opened with #{delimiter} not closed at end of input"})}
- end
- defp _check_closing_fence([_|rest], _lnb, _delimiter, options) do
- {rest, options}
- end
-
- ############################################################
- # Consolidate multiline inline code blocks into an element #
- ############################################################
- @not_pending {nil, 0}
- # ([#{},...]) -> {[#{}],[#{}],{'nil' | binary(),number()}}
- # @spec consolidate_para( ts ) :: { ts, ts, {nil | String.t, number} }
- defp consolidate_para(lines), do: _consolidate_para(lines, [], @not_pending, nil)
-
- defp _consolidate_para([], result, pending, annotation) do
- {result, [], pending, annotation}
- end
-
- defp _consolidate_para([line | rest] = lines, result, pending, annotation) do
- case _inline_or_text?(line, pending) do
- %{pending: still_pending, continue: true} ->
- _consolidate_para(rest, [line | result], still_pending, annotation || line.annotation)
-
- _ ->
- {result, lines, @not_pending, annotation}
- end
- end
-
- ##################################################
- # Read in a table (consecutive TableLines with
- # the same number of columns)
-
- defp read_table(lines, col_count, rows)
-
- defp read_table(
- [%Line.TableLine{columns: cols} | rest],
- col_count,
- rows
- )
- when length(cols) == col_count do
- read_table(rest, col_count, [cols | rows])
- end
-
- defp read_table(rest, col_count, rows) do
- rows = Enum.reverse(rows)
- table = Block.Table.new_for_columns(col_count)
-
- table =
- case look_for_alignments(rows) do
- nil -> %Block.Table{table | rows: rows}
- aligns -> %Block.Table{table | alignments: aligns, header: hd(rows), rows: tl(tl(rows))}
- end
-
- {table, [%Line.Blank{lnb: 0} | rest]}
- end
-
- defp look_for_alignments([_first, second | _rest]) do
- if Enum.all?(second, fn row -> row =~ ~r{^:?-+:?$} end) do
- second
- |> Enum.map(fn row -> Regex.replace(~r/-+/, row, "-") end)
- |> Enum.map(fn row ->
- case row do
- ":-:" -> :center
- ":-" -> :left
- "-" -> :left
- "-:" -> :right
- end
- end)
- else
- nil
- end
- end
-
- #####################################################
- # Traverse the block list and build a list of links #
- #####################################################
-
- defp links_from_blocks(blocks) do
- visit(blocks, Map.new(), &link_extractor/2)
- end
-
- defp link_extractor(item = %Block.IdDef{id: id}, result) do
- Map.put(result, String.downcase(id), item)
- end
-
- defp link_extractor(_, result), do: result
-
- ##################################
- # Visitor pattern for each block #
- ##################################
-
- defp visit([], result, _func), do: result
-
- # Structural node BlockQuote -> descend
- defp visit([item = %Block.BlockQuote{blocks: blocks} | rest], result, func) do
- result = func.(item, result)
- result = visit(blocks, result, func)
- visit(rest, result, func)
- end
-
- # Structural node List -> descend
- defp visit([item = %Block.List{blocks: blocks} | rest], result, func) do
- result = func.(item, result)
- result = visit(blocks, result, func)
- visit(rest, result, func)
- end
-
- # Structural node ListItem -> descend
- defp visit([item = %Block.ListItem{blocks: blocks} | rest], result, func) do
- result = func.(item, result)
- result = visit(blocks, result, func)
- visit(rest, result, func)
- end
-
- # Leaf, leaf it alone
- defp visit([item | rest], result, func) do
- result = func.(item, result)
- visit(rest, result, func)
- end
-
- ###################################################################
- # Consume HTML, taking care of nesting. Assumes one tag per line. #
- ###################################################################
-
- defp _html_match_to_closing(opener, rest, annotation),
- do: _find_closing_tags([opener], rest, [opener.line], [], annotation)
-
- defp _find_closing_tags(needed, input, html_lines, text_lines, annotation)
-
- # No more open tags, happy case
- defp _find_closing_tags([], rest, html_lines, [], annotation),
- do: {html_lines, rest, [], annotation}
-
- # run out of input, unhappy case
- defp _find_closing_tags(needed, [], html_lines, text_lines, annotation),
- do: {_add_text_lines(html_lines, text_lines), [], needed, annotation}
-
- # still more lines, still needed closing
- defp _find_closing_tags(
- needed = [needed_hd | needed_tl],
- [rest_hd | rest_tl],
- html_lines,
- text_lines,
- annotation
- ) do
- cond do
- _closes_tag?(rest_hd, needed_hd) ->
- _find_closing_tags(
- needed_tl,
- rest_tl,
- [rest_hd.line | _add_text_lines(html_lines, text_lines)],
- [],
- _override_annotation(annotation, rest_hd)
- )
-
- _opens_tag?(rest_hd) ->
- _find_closing_tags(
- [rest_hd | needed],
- rest_tl,
- [rest_hd.line | _add_text_lines(html_lines, text_lines)],
- [],
- annotation
- )
-
- true ->
- _find_closing_tags(needed, rest_tl, html_lines, [rest_hd.line | text_lines], annotation)
- end
- end
-
- defp _add_text_lines(html_lines, []),
- do: html_lines
-
- defp _add_text_lines(html_lines, text_lines),
- do: [text_lines |> Enum.reverse() |> Enum.join("\n") | html_lines]
-
- ###########
- # Helpers #
- ###########
-
- defp _closes_tag?(%Line.HtmlCloseTag{tag: ctag}, %Line.HtmlOpenTag{tag: otag}) do
- ctag == otag
- end
-
- defp _closes_tag?(_, _), do: false
-
- defp _opens_tag?(%Line.HtmlOpenTag{}), do: true
- defp _opens_tag?(_), do: false
-
- defp _inline_or_text?(line, pending)
-
- defp _inline_or_text?(line = %Line.Text{}, @not_pending) do
- pending = opens_inline_code(line)
- %{pending: pending, continue: true}
- end
-
- defp _inline_or_text?(line = %Line.TableLine{}, @not_pending) do
- pending = opens_inline_code(line)
- %{pending: pending, continue: true}
- end
-
- defp _inline_or_text?(_line, @not_pending), do: %{pending: @not_pending, continue: false}
-
- defp _inline_or_text?(line, pending) do
- pending = still_inline_code(line, pending)
- %{pending: pending, continue: true}
- end
-
- defp _override_annotation(annotation, line), do: annotation || line.annotation
-
- defp remove_trailing_blank_lines(lines) do
- lines
- |> Enum.reverse()
- |> Enum.drop_while(&blank?/1)
- |> Enum.reverse()
- end
-
- def prepend_ial(context, maybeatts, lnb, result)
- def prepend_ial(context, nil, _lnb, result), do: {context, result}
-
- def prepend_ial(context, ial, lnb, result) do
- {context1, attributes} = parse_attrs(context, ial, lnb)
- {context1, [%Block.Ial{attrs: attributes, content: ial, lnb: lnb, verbatim: ial} | result]}
- end
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/footnote_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/footnote_parser.ex
deleted file mode 100644
index 024ceef9..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/footnote_parser.ex
+++ /dev/null
@@ -1,58 +0,0 @@
-defmodule EarmarkParser.Parser.FootnoteParser do
- alias EarmarkParser.{Block, Enum.Ext, Line}
-
- @moduledoc false
- def parse_fn_defs([fn_def | rest], result, options) do
- acc =
- {[fn_def.content], [%Block.FnList{blocks: [_block_fn_def(fn_def)]} | result], %{}, options}
-
- rest
- |> Ext.reduce_with_end(acc, &_parse_fn_def_reduce/2)
- end
-
- defp _parse_fn_def_reduce(ele_or_end, acc)
-
- defp _parse_fn_def_reduce({:element, %Line.FnDef{content: content}=fn_def}, acc) do
- {result1, footnotes, options1} = _complete_fn_def_block(acc, fn_def)
- {[content], result1, footnotes, options1}
- end
-
- defp _parse_fn_def_reduce({:element, %{line: line}}, acc) do
- _prepend_to_first_in4(line, acc)
- end
-
- defp _parse_fn_def_reduce(:end, acc) do
- {[fn_list | rest], footnotes, options} = _complete_fn_def_block(acc)
- {[%{fn_list | blocks: Enum.reverse(fn_list.blocks)} | rest], footnotes, options}
- end
-
- defp _prepend_to_first_in4(element, {a, b, c, d}) do
- {[element | a], b, c, d}
- end
-
- defp _block_fn_def(%Line.FnDef{} = fn_def) do
- %Block.FnDef{id: fn_def.id, lnb: fn_def.lnb}
- end
-
- defp _complete_fn_def_block(
- {input, [%Block.FnList{blocks: [open_fn | closed_fns]} | rest], footnotes, options},
- new_fn_def \\ nil
- ) do
- # `_footnotes1` should be empty but let us not change the shape of parse depending
- # on options or the value of recursive?
- {inner_blocks, _links, _footnotes1, options1} = EarmarkParser.Parser.parse(Enum.reverse(input), options, true)
- closed_fn = %{open_fn | blocks: inner_blocks}
- footnotes1 = Map.put(footnotes, closed_fn.id, closed_fn)
-
- fn_blocks =
- if new_fn_def do
- [_block_fn_def(new_fn_def), closed_fn | closed_fns]
- else
- [closed_fn | closed_fns]
- end
-
- {[%Block.FnList{blocks: fn_blocks} | rest], footnotes1, options1}
- end
-
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/link_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/link_parser.ex
deleted file mode 100644
index 71a78904..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/link_parser.ex
+++ /dev/null
@@ -1,130 +0,0 @@
-defmodule EarmarkParser.Parser.LinkParser do
-
- @moduledoc false
- import EarmarkParser.Helpers.LeexHelpers, only: [tokenize: 2]
- import EarmarkParser.Helpers.YeccHelpers, only: [parse!: 2]
- import EarmarkParser.Helpers.StringHelpers, only: [behead: 2]
-
- # Hopefully this will go away in v1.3
- # **********************************
- #
- # Right now it needs to parse the url part of strings according to the following grammar
- #
- # url -> ( inner_url )
- # url -> ( inner_url title )
- #
- # inner_url -> ( inner_url )
- # inner_url -> [ inner_url ]
- # inner_url -> url_char*
- #
- # url_char -> . - quote - ( - ) - [ - ]
- #
- # title -> quote .* quote ;; not LALR-k here
- #
- # quote -> "
- # quote -> ' ;; yep allowing '...." for now
- #
- # non_quote -> . - quote
-
- @doc false
- def parse_link(src, lnb) do
- case parse!(src, lexer: :link_text_lexer, parser: :link_text_parser) do
- {link_or_img, link_text, parsed_text} ->
- beheaded = behead(src, to_string(parsed_text))
- tokens = tokenize(beheaded, with: :link_text_lexer)
- p_url(tokens, lnb) |> make_result(to_string(link_text), to_string(parsed_text), link_or_img)
- _ -> nil
- end
- end
-
- defp p_url([{:open_paren, _} | ts], lnb), do: url(ts, {[], [], nil}, [:close_paren], lnb)
- defp p_url(_, _), do: nil
-
- # push one level
- defp url([{:open_paren, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), [:close_paren | needed], lnb)
-
- # pop last level
- defp url([{:close_paren, _} | _], result, [:close_paren], _lnb), do: result
- # pop inner level
- defp url([{:close_paren, text} | ts], result, [:close_paren | needed], lnb),
- do: url(ts, add(result, text), needed, lnb)
-
- # A quote on level 0 -> bailing out if there is a matching quote
- defp url(ts_all = [{:open_title, text} | ts], result, [:close_paren], lnb) do
- case bail_out_to_title(ts_all, result) do
- nil -> url(ts, add(result, text), [:close_paren], lnb)
- res -> res
- end
- end
-
- # All these are just added to the url
- defp url([{:open_bracket, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
- defp url([{:close_bracket, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
- defp url([{:any_quote, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
- defp url([{:verbatim, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
- defp url([{:ws, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
- defp url([{:escaped, text} | ts], result, needed, lnb),
- do: url(ts, add(result, text), needed, lnb)
-
- # That is not good, actually this is not a legal url part of a link
- defp url(_, _, _, _), do: nil
-
- defp bail_out_to_title(ts, result) do
- with remaining_text <- ts |> Enum.map(&text_of_token/1) |> Enum.join("") do
- case title(remaining_text) do
- nil -> nil
- {title_text, inner_title} ->
- add_title(result, {title_text, inner_title})
- end
- end
- end
-
- defp text_of_token(token)
- defp text_of_token({:escaped, text}), do: "\\#{text}"
- defp text_of_token({_, text}) do
- text
- end
-
- # sic!!! Greedy and not context aware, matching '..." and "...' for backward comp
- @title_rgx ~r{\A\s+(['"])(.*?)\1(?=\))}
- defp title(remaining_text) do
- case Regex.run(@title_rgx, remaining_text) do
- nil -> nil
- [parsed, _, inner] -> {parsed, inner}
- end
- end
-
- @wikilink_rgx ~r{\A\[\[([^\]\|]+)(?:\|([^\]]+))?\]\]\Z}
- defp make_result(nil, _, parsed_text, :link) do
- case Regex.run(@wikilink_rgx, parsed_text) do
- nil -> nil
- [_, wikilink] -> make_wikilink(parsed_text, wikilink, wikilink)
- [_, wikilink, link_text] -> make_wikilink(parsed_text, wikilink, link_text)
- end
- end
-
- defp make_result(nil, _, _, _), do: nil
-
- defp make_result({parsed, url, title}, link_text, parsed_text, link_or_img) do
- {"#{parsed_text}(#{list_to_text(parsed)})", link_text, list_to_text(url), title, link_or_img}
- end
-
- defp add({parsed_text, url_text, nil}, text), do: {[text | parsed_text], [text | url_text], nil}
-
- defp add_title({parsed_text, url_text, _}, {parsed, inner}),
- do: {[parsed | parsed_text], url_text, inner}
-
- defp make_wikilink(parsed_text, target, link_text) do
- {parsed_text, String.trim(link_text), String.trim(target), nil, :wikilink}
- end
-
- defp list_to_text(lst), do: lst |> Enum.reverse() |> Enum.join("")
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_info.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_info.ex
deleted file mode 100644
index 03c3f05c..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_info.ex
+++ /dev/null
@@ -1,41 +0,0 @@
-defmodule EarmarkParser.Parser.ListInfo do
-
- import EarmarkParser.Helpers.LookaheadHelpers, only: [opens_inline_code: 1, still_inline_code: 2]
-
- @moduledoc false
-
- @not_pending {nil, 0}
-
- defstruct(
- indent: 0,
- lines: [],
- loose?: false,
- pending: @not_pending,
- options: %EarmarkParser.Options{},
- width: 0
- )
-
- def new(%EarmarkParser.Line.ListItem{initial_indent: ii, list_indent: width}=item, options) do
- pending = opens_inline_code(item)
- %__MODULE__{indent: ii, lines: [item.content], options: options, pending: pending, width: width}
- end
-
- def update_list_info(list_info, line, pending_line, loose? \\ false) do
- prepend_line(list_info, line) |> _update_rest(pending_line, loose?)
- end
-
- def prepend_line(%__MODULE__{lines: lines}=list_info, line) do
- %{list_info|lines: [line|lines]}
- end
-
- defp _update_rest(%{pending: @not_pending}=list_info, line, loose?) do
- pending = opens_inline_code(line)
- %{list_info | pending: pending, loose?: loose?}
- end
-
- defp _update_rest(%{pending: pending}=list_info, line, loose?) do
- pending1 = still_inline_code(line, pending)
- %{list_info | pending: pending1, loose?: loose?}
- end
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_parser.ex b/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_parser.ex
deleted file mode 100644
index 6246dbf5..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/lib/earmark_parser/parser/list_parser.ex
+++ /dev/null
@@ -1,181 +0,0 @@
-defmodule EarmarkParser.Parser.ListParser do
- alias EarmarkParser.{Block, Line, Options}
- alias EarmarkParser.Parser.ListInfo
-
- import EarmarkParser.Helpers.StringHelpers, only: [behead: 2]
- import EarmarkParser.Message, only: [add_message: 2]
- import ListInfo
-
- @moduledoc false
-
- @not_pending {nil, 0}
-
- def parse_list(lines, result, options \\ %Options{}) do
- {items, rest, options1} = _parse_list_items_init(lines, [], options)
- list = _make_list(items, _empty_list(items) )
- {[list|result], rest, options1}
- end
-
- defp _parse_list_items_init([item|rest], list_items, options) do
- options1 = %{options|line: item.lnb}
- _parse_list_items_start(rest, _make_and_prepend_list_item(item, list_items), new(item, options1))
- end
-
- defp _parse_list_items_spaced(input, items, list_info)
- defp _parse_list_items_spaced(input, items, %{pending: @not_pending}=list_info) do
- _parse_list_items_spaced_np(input, items, list_info)
- end
- defp _parse_list_items_spaced(input, items, list_info) do
- _parse_list_items_spaced_pdg(input, items, list_info)
- end
-
- defp _parse_list_items_spaced_np([%Line.Blank{}|rest], items, list_info) do
- list_info1 = %{list_info|lines: [""|list_info.lines], options: %{list_info.options|line: list_info.options.line + 1}}
- _parse_list_items_spaced_np(rest, items, list_info1)
- end
- defp _parse_list_items_spaced_np([%Line.Ruler{}|_]=lines, items, list_info) do
- _finish_list_items(lines, items, false, list_info)
- end
- defp _parse_list_items_spaced_np([%Line.ListItem{indent: ii}=item|_]=input, list_items, %{width: w}=list_info)
- when ii < w do
- if _starts_list?(item, list_items) do
- _finish_list_items(input, list_items, false, list_info)
- else
- {items1, options1} = _finish_list_item(list_items, false, _loose(list_info))
- _parse_list_items_init(input, items1, options1)
- end
- end
- defp _parse_list_items_spaced_np([%Line.Indent{indent: ii}=item|rest], list_items, %{width: w}=list_info)
- when ii >= w do
- indented = _behead_spaces(item.line, w)
- _parse_list_items_spaced(rest, list_items, update_list_info(list_info, indented, item, true))
- end
- defp _parse_list_items_spaced_np([%Line.ListItem{}=line|rest], items, list_info) do
- indented = _behead_spaces(line.line, list_info.width)
- _parse_list_items_start(rest, items, update_list_info(list_info, indented, line))
- end
- # BUG: Still do not know how much to indent here???
- defp _parse_list_items_spaced_np([%{indent: indent, line: str_line}=line|rest], items, %{width: width}=list_info) when
- indent >= width
- do
- _parse_list_items_spaced(rest, items, update_list_info(list_info, behead(str_line, width), line, true))
- end
- defp _parse_list_items_spaced_np(input, items, list_info) do
- _finish_list_items(input ,items, false, list_info)
- end
-
- defp _parse_list_items_spaced_pdg(input, items, list_info)
- defp _parse_list_items_spaced_pdg([], items, %{pending: {pending, lnb}}=list_info) do
- options1 =
- add_message(list_info.options, {:warning, lnb, "Closing unclosed backquotes #{pending} at end of input"})
- _finish_list_items([], items, false, %{list_info| options: options1})
- end
- defp _parse_list_items_spaced_pdg([line|rest], items, list_info) do
- indented = _behead_spaces(line.line, list_info.width)
- _parse_list_items_spaced(rest, items, update_list_info(list_info, indented, line, true))
- end
-
-
- defp _parse_list_items_start(input, list_items, list_info)
- defp _parse_list_items_start(input, list_items, %{pending: @not_pending}=list_info) do
- _parse_list_items_start_np(input, list_items, list_info)
- end
- defp _parse_list_items_start(input, list_items, list_info) do
- _parse_list_items_start_pdg(input, list_items, list_info)
- end
-
- defp _parse_list_items_start_np(input, list_items, list_info)
- defp _parse_list_items_start_np([%Line.Blank{}|input], items, list_info) do
- _parse_list_items_spaced(input, items, prepend_line(list_info, ""))
- end
- defp _parse_list_items_start_np([], list_items, list_info) do
- _finish_list_items([], list_items, true, list_info)
- end
- defp _parse_list_items_start_np([%Line.Ruler{}|_]=input, list_items, list_info) do
- _finish_list_items(input, list_items, true, list_info)
- end
- defp _parse_list_items_start_np([%Line.Heading{}|_]=input, list_items, list_info) do
- _finish_list_items(input, list_items, true, list_info)
- end
- defp _parse_list_items_start_np([%Line.ListItem{indent: ii}=item|_]=input, list_items, %{width: w}=list_info)
- when ii < w do
- if _starts_list?(item, list_items) do
- _finish_list_items(input, list_items, true, list_info)
- else
- {items1, options1} = _finish_list_item(list_items, true, list_info)
- _parse_list_items_init(input, items1, options1)
- end
- end
- # Slurp in everything else before a first blank line
- defp _parse_list_items_start_np([%{line: str_line}=line|rest], items, list_info) do
- indented = _behead_spaces(str_line, list_info.width)
- _parse_list_items_start(rest, items, update_list_info(list_info, indented, line))
- end
-
- defp _parse_list_items_start_pdg(input, items, list_info)
- defp _parse_list_items_start_pdg([], items, list_info) do
- _finish_list_items([], items, true, list_info)
- end
- defp _parse_list_items_start_pdg([%{line: str_line}=line|rest], items, list_info) do
- indented = _behead_spaces(str_line, list_info.width)
- _parse_list_items_start(rest, items, update_list_info(list_info, indented, line))
- end
-
- defp _behead_spaces(str, len) do
- Regex.replace(~r/\A\s{1,#{len}}/, str, "")
- end
-
- # INLINE CANDIDATE
- defp _empty_list([%Block.ListItem{loose?: loose?, type: type}|_]) do
- %Block.List{loose?: loose?, type: type}
- end
-
- @start_number_rgx ~r{\A0*(\d+)\.}
- defp _extract_start(%{bullet: bullet}) do
- case Regex.run(@start_number_rgx, bullet) do
- nil -> ""
- [_, "1"] -> ""
- [_, start] -> ~s{ start="#{start}"}
- end
- end
-
- defp _finish_list_item([%Block.ListItem{}=item|items], _at_start?, list_info) do
- {blocks, _, _, options1} = list_info.lines
- |> Enum.reverse
- |> EarmarkParser.Parser.parse(%{list_info.options|line: item.lnb}, :list)
- loose1? = _already_loose?(items) || list_info.loose?
- {[%{item | blocks: blocks, loose?: loose1?}|items], options1}
- end
-
- defp _finish_list_items(input, items, at_start?, list_info) do
- {items1, options1} = _finish_list_item(items, at_start?, list_info)
- {items1, input, options1}
- end
-
- defp _make_and_prepend_list_item(%Line.ListItem{bullet: bullet, lnb: lnb, type: type}, list_items) do
- [%Block.ListItem{bullet: bullet, lnb: lnb, spaced?: false, type: type}|list_items]
- end
-
- defp _make_list(items, list)
- defp _make_list([%Block.ListItem{bullet: bullet, lnb: lnb}=item], %Block.List{loose?: loose?}=list) do
- %{list | blocks: [%{item | loose?: loose?}|list.blocks],
- bullet: bullet,
- lnb: lnb,
- start: _extract_start(item)}
- end
- defp _make_list([%Block.ListItem{}=item|rest], %Block.List{loose?: loose?}=list) do
- _make_list(rest, %{list | blocks: [%{item | loose?: loose?}|list.blocks]})
- end
-
- defp _already_loose?(items)
- defp _already_loose?([]), do: false
- defp _already_loose?([%{loose?: loose?}|_]), do: loose?
-
- defp _loose(list_info), do: %{list_info|loose?: true}
-
- defp _starts_list?(%{bullet: bullet1}, [%Block.ListItem{bullet: bullet2}|_]) do
- String.last(bullet1) != String.last(bullet2)
- end
-
-end
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/mix.exs b/apps/plataforma_digital/deps/earmark_parser/mix.exs
deleted file mode 100644
index 7b7e19e8..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/mix.exs
+++ /dev/null
@@ -1,102 +0,0 @@
-defmodule EarmarkParser.MixProject do
- use Mix.Project
-
- @version "1.4.36"
- @url "https://github.com/RobertDober/earmark_parser"
-
- @deps [
- {:dialyxir, "~> 1.4.1", only: [:dev]},
- {:earmark_ast_dsl, "~> 0.3.7", only: [:test]},
- {:excoveralls, "~> 0.14.4", only: [:test]},
- {:extractly, "~> 0.5.3", only: [:dev]},
- {:floki, "~> 0.32", only: [:dev, :test]}
- ]
-
- @description """
- Earmark AST the parser and AST Generator for
- Dave Thomas' Earmark.
-
- The parser generates
- an Abstract Syntax Tree from Markdown.
-
- The original Earmark will still provide the HTML Transformation and
- the CLI, however its Scanner, Parser and AST Renderer have been
- extracted into this library.
- """
-
- ############################################################
-
- def project do
- [
- app: :earmark_parser,
- version: @version,
- elixir: "~> 1.11",
- elixirc_paths: elixirc_paths(Mix.env()),
- deps: @deps,
- description: @description,
- package: package(),
- preferred_cli_env: [
- coveralls: :test,
- "coveralls.detail": :test,
- "coveralls.post": :test,
- "coveralls.html": :test
- ],
- test_coverage: [tool: ExCoveralls],
- aliases: [docs: &build_docs/1]
- ]
- end
-
- defp package do
- [
- files: [
- "lib",
- "src/*.xrl",
- "src/*.yrl",
- "mix.exs",
- "README.md",
- "RELEASE.md",
- "LICENSE"
- ],
- maintainers: [
- "Robert Dober "
- ],
- licenses: [
- "Apache-2.0"
- ],
- links: %{
- "Changelog" => "#{@url}/blob/master/RELEASE.md",
- "GitHub" => @url
- }
- ]
- end
-
- defp elixirc_paths(:test), do: ["lib", "test/support", "dev"]
- defp elixirc_paths(:dev), do: ["lib", "bench", "dev"]
- defp elixirc_paths(_), do: ["lib"]
-
- @prerequisites """
- run `mix escript.install hex ex_doc` and adjust `PATH` accordingly
- """
- @module "EarmarkParser"
- defp build_docs(_) do
- Mix.Task.run("compile")
- ex_doc = Path.join(Mix.path_for(:escripts), "ex_doc")
- Mix.shell().info("Using escript: #{ex_doc} to build the docs")
-
- unless File.exists?(ex_doc) do
- raise "cannot build docs because escript for ex_doc is not installed, make sure to \n#{
- @prerequisites
- }"
- end
-
- args = [@module, @version, Mix.Project.compile_path()]
- opts = ~w[--main #{@module} --source-ref v#{@version} --source-url #{@url}]
-
- Mix.shell().info("Running: #{ex_doc} #{inspect(args ++ opts)}")
- System.cmd(ex_doc, args ++ opts)
- Mix.shell().info("Docs built successfully")
- end
-
-end
-
-# SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/src/link_text_lexer.xrl b/apps/plataforma_digital/deps/earmark_parser/src/link_text_lexer.xrl
deleted file mode 100644
index dff3ff13..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/src/link_text_lexer.xrl
+++ /dev/null
@@ -1,31 +0,0 @@
-Definitions.
-
-ESCAPED = \\.
-ESCAPE = \\
-EXCLAMATION_MARK = [!]
-OPEN_PAREN = \(
-CLOSE_PAREN = \)
-OPEN_BRACKET = \[
-CLOSE_BRACKET = \]
-OPEN_TITLE = \s+['"]
-ANY_QUOTE = ['"]
-WS = \s+
-ANY = [^]\\"'()[\s]+
-
-Rules.
-
-{ESCAPED} : {token, {escaped, TokenLine, dismiss_backslash(TokenChars)}}.
-{EXCLAMATION_MARK} : {token, {exclamation_mark, TokenLine, TokenChars}}.
-{OPEN_PAREN} : {token, {open_paren, TokenLine, TokenChars}}.
-{CLOSE_PAREN} : {token, {close_paren, TokenLine, TokenChars}}.
-{OPEN_BRACKET} : {token, {open_bracket, TokenLine, TokenChars}}.
-{CLOSE_BRACKET} : {token, {close_bracket, TokenLine, TokenChars}}.
-{OPEN_TITLE} : {token, {open_title, TokenLine, TokenChars}}.
-{ANY_QUOTE} : {token, {any_quote, TokenLine, TokenChars}}.
-{ESCAPE} : {token, {verbatim, TokenLine, TokenChars}}.
-{WS} : {token, {ws, TokenLine, TokenChars}}.
-{ANY} : {token, {verbatim, TokenLine, TokenChars}}.
-
-Erlang code.
-
-dismiss_backslash([$\\|Chars]) -> Chars.
diff --git a/apps/plataforma_digital/deps/earmark_parser/src/link_text_parser.yrl b/apps/plataforma_digital/deps/earmark_parser/src/link_text_parser.yrl
deleted file mode 100644
index 21f6dec2..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/src/link_text_parser.yrl
+++ /dev/null
@@ -1,59 +0,0 @@
-Nonterminals link_or_image
- link rest
- inside_brackets inside_brackets_part anything.
-
-Terminals any_quote open_bracket open_title close_bracket open_paren close_paren verbatim escaped exclamation_mark ws.
-
-Rootsymbol link_or_image.
-
-link_or_image -> exclamation_mark link : make_image_tuple('$2').
-link_or_image -> link : '$1'.
-
-link -> open_bracket close_bracket : {link, "", "[]"}.
-link -> open_bracket close_bracket rest : {link, "", "[]"}.
-link -> open_bracket inside_brackets close_bracket : title_tuple('$2').
-link -> open_bracket inside_brackets close_bracket rest : title_tuple('$2').
-
-inside_brackets -> inside_brackets_part : '$1'.
-inside_brackets -> inside_brackets_part inside_brackets : concat_tuple('$1', '$2').
-
-inside_brackets_part -> exclamation_mark : extract_token('$1').
-inside_brackets_part -> verbatim : extract_token('$1').
-inside_brackets_part -> ws : extract_token('$1').
-inside_brackets_part -> open_title : extract_token('$1').
-inside_brackets_part -> open_paren : {"(", "("}.
-inside_brackets_part -> close_paren : {")", ")"}.
-inside_brackets_part -> any_quote : extract_token('$1').
-inside_brackets_part -> escaped : escaped_token('$1').
-inside_brackets_part -> open_bracket close_bracket : {"[]", "[]"}.
-inside_brackets_part -> open_bracket inside_brackets close_bracket : concat_3t("[", '$2', "]").
-
-rest -> anything.
-rest -> anything rest.
-
-anything -> exclamation_mark.
-anything -> ws.
-anything -> verbatim.
-anything -> open_paren.
-anything -> close_paren.
-anything -> open_bracket.
-anything -> close_bracket.
-anything -> any_quote.
-anything -> escaped.
-anything -> open_title.
-
-Erlang code.
-
-concat_tuple({LT, LP}, {RT, RP}) -> {string:concat(LT, RT), string:concat(LP, RP)}.
-
-concat_3t(L, {MT, MP}, R) -> {string:join([L, MT, R], ""), string:join([ L, MP, R ], "")}.
-
-escaped_token({_Token, _Line, Value}) -> {string:concat("\\", Value), string:concat("\\", Value)}.
-
-extract_token({_Token, _Line, Value}) -> {Value, Value}.
-
-make_image_tuple({_Link, L, R}) -> {image, L, string:concat("!", R)}.
-
-title_tuple({Title, Parsed}) -> {link, Title, string:join(["[", Parsed, "]"], "")}.
-
-%% SPDX-License-Identifier: Apache-2.0
diff --git a/apps/plataforma_digital/deps/earmark_parser/src/string_lexer.xrl b/apps/plataforma_digital/deps/earmark_parser/src/string_lexer.xrl
deleted file mode 100644
index c308b524..00000000
--- a/apps/plataforma_digital/deps/earmark_parser/src/string_lexer.xrl
+++ /dev/null
@@ -1,13 +0,0 @@
-Definitions.
-
-OTHER = [^`\\]+
-ESCAPE = \\
-BACKTIX = `+
-
-Rules.
-
-{OTHER} : {token, {other, TokenLine, TokenChars}}.
-{ESCAPE} : {token, {escape, TokenLine, TokenChars}}.
-{BACKTIX} : {token, {backtix, TokenLine, TokenChars}}.
-
-Erlang code.
diff --git a/apps/plataforma_digital/deps/erlex/.fetch b/apps/plataforma_digital/deps/erlex/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/erlex/.hex b/apps/plataforma_digital/deps/erlex/.hex
deleted file mode 100644
index ffb6ddb6..00000000
Binary files a/apps/plataforma_digital/deps/erlex/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/erlex/LICENSE.md b/apps/plataforma_digital/deps/erlex/LICENSE.md
deleted file mode 100644
index 32bc75f2..00000000
--- a/apps/plataforma_digital/deps/erlex/LICENSE.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2013-2018 Andrew Summers and contributors.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/apps/plataforma_digital/deps/erlex/README.md b/apps/plataforma_digital/deps/erlex/README.md
deleted file mode 100644
index 3aa5f1aa..00000000
--- a/apps/plataforma_digital/deps/erlex/README.md
+++ /dev/null
@@ -1,73 +0,0 @@
-[![Hex version badge](https://img.shields.io/hexpm/v/erlex.svg)](https://hex.pm/packages/erlex)
-[![License badge](https://img.shields.io/hexpm/l/erlex.svg)](https://github.com/asummers/erlex/blob/master/LICENSE.md)
-[![Build status badge](https://img.shields.io/circleci/project/github/asummers/erlex/master.svg)](https://circleci.com/gh/asummers/erlex/tree/master)
-[![Code coverage badge](https://img.shields.io/codecov/c/github/asummers/erlex/master.svg)](https://codecov.io/gh/asummers/erlex/branch/master)
-
-# Erlex
-
-Convert Erlang style structs and error messages to equivalent Elixir.
-
-Useful for pretty printing things like Dialyzer errors and Observer
-state. NOTE: Because this code calls the Elixir formatter, it requires
-Elixir 1.6+.
-
-## Documentation
-[Hex Docs](https://hexdocs.pm/erlex).
-
-## Changelog
-
-Check out the [Changelog](https://github.com/asummers/erlex/blob/master/CHANGELOG.md).
-
-## Installation
-
-The package can be installed from Hex by adding `erlex` to your list
-of dependencies in `mix.exs`:
-
-```elixir
-def deps do
- [
- {:erlex, "~> 0.2"},
- ]
-end
-```
-
-## Usage
-
-Invoke `Erlex.pretty_print/1` with the input string.
-
-```elixir
-iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map()) -> 'Elixir.Plug.Conn':t()"
-iex> Erlex.pretty_print(str)
-(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
-```
-
-While the lion's share of the work is done via invoking
-`Erlex.pretty_print/1`, other higher order functions exist for further
-formatting certain messages by running through the Elixir formatter.
-Because we know the previous example is a type, we can invoke the
-`Erlex.pretty_print_contract/1` function, which would format that
-appropriately for very long lines.
-
-```elixir
-iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map(), map() | atom(), non_neg_integer(), binary(), binary(), binary(), binary(), binary()) -> 'Elixir.Plug.Conn':t()"
-iex> Erlex.pretty_print_contract(str)
-(
- Plug.Conn.t(),
- binary() | atom(),
- Keyword.t() | map(),
- map() | atom(),
- non_neg_integer(),
- binary(),
- binary(),
- binary(),
- binary(),
- binary()
-) :: Plug.Conn.t()
-```
-## Contributing
-
-We welcome contributions of all kinds! To get started, click [here](https://github.com/asummers/erlex/blob/master/CONTRIBUTING.md).
-
-## Code of Conduct
-
-Be sure to read and follow the [code of conduct](https://github.com/asummers/erlex/blob/master/code-of-conduct.md).
diff --git a/apps/plataforma_digital/deps/erlex/hex_metadata.config b/apps/plataforma_digital/deps/erlex/hex_metadata.config
deleted file mode 100644
index 70539917..00000000
--- a/apps/plataforma_digital/deps/erlex/hex_metadata.config
+++ /dev/null
@@ -1,13 +0,0 @@
-{<<"app">>,<<"erlex">>}.
-{<<"build_tools">>,[<<"mix">>]}.
-{<<"description">>,
- <<"Convert Erlang style structs and error messages to equivalent Elixir.">>}.
-{<<"elixir">>,<<"~> 1.6">>}.
-{<<"files">>,
- [<<"lib">>,<<"lib/erlex.ex">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE.md">>,
- <<"src/lexer.xrl">>,<<"src/parser.yrl">>]}.
-{<<"licenses">>,[<<"Apache 2.0">>]}.
-{<<"links">>,[{<<"GitHub">>,<<"https://github.com/asummers/erlex">>}]}.
-{<<"name">>,<<"erlex">>}.
-{<<"requirements">>,[]}.
-{<<"version">>,<<"0.2.6">>}.
diff --git a/apps/plataforma_digital/deps/erlex/lib/erlex.ex b/apps/plataforma_digital/deps/erlex/lib/erlex.ex
deleted file mode 100644
index a234614e..00000000
--- a/apps/plataforma_digital/deps/erlex/lib/erlex.ex
+++ /dev/null
@@ -1,635 +0,0 @@
-defmodule Erlex do
- @moduledoc """
- Convert Erlang style structs and error messages to equivalent Elixir.
-
- Lexes and parses the Erlang output, then runs through pretty
- printer.
-
- ## Usage
-
- Invoke `Erlex.pretty_print/1` wuth the input string.
-
- ```elixir
- iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map()) -> 'Elixir.Plug.Conn':t()"
- iex> Erlex.pretty_print(str)
- (Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
- ```
-
- While the lion's share of the work is done via invoking
- `Erlex.pretty_print/1`, other higher order functions exist for further
- formatting certain messages by running through the Elixir formatter.
- Because we know the previous example is a type, we can invoke the
- `Erlex.pretty_print_contract/1` function, which would format that
- appropriately for very long lines.
-
- ```elixir
- iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map(), map() | atom(), non_neg_integer(), binary(), binary(), binary(), binary(), binary()) -> 'Elixir.Plug.Conn':t()"
- iex> Erlex.pretty_print_contract(str)
- (
- Plug.Conn.t(),
- binary() | atom(),
- Keyword.t() | map(),
- map() | atom(),
- non_neg_integer(),
- binary(),
- binary(),
- binary(),
- binary(),
- binary()
- ) :: Plug.Conn.t()
- ```
- """
-
- defp lex(str) do
- try do
- {:ok, tokens, _} = :lexer.string(str)
- tokens
- rescue
- _ ->
- throw({:error, :lexing, str})
- end
- end
-
- defp parse(tokens) do
- try do
- {:ok, [first | _]} = :parser.parse(tokens)
- first
- rescue
- _ ->
- throw({:error, :parsing, tokens})
- end
- end
-
- defp format(code) do
- try do
- Code.format_string!(code)
- rescue
- _ ->
- throw({:error, :formatting, code})
- end
- end
-
- @spec pretty_print_infix(infix :: String.t()) :: String.t()
- def pretty_print_infix('=:='), do: "==="
- def pretty_print_infix('=/='), do: "!=="
- def pretty_print_infix('/='), do: "!="
- def pretty_print_infix('=<'), do: "<="
- def pretty_print_infix(infix), do: to_string(infix)
-
- @spec pretty_print(str :: String.t()) :: String.t()
- def pretty_print(str) do
- parsed =
- str
- |> to_charlist()
- |> lex()
- |> parse()
-
- try do
- do_pretty_print(parsed)
- rescue
- _ ->
- throw({:error, :pretty_printing, parsed})
- end
- end
-
- @spec pretty_print_pattern(pattern :: String.t()) :: String.t()
- def pretty_print_pattern('pattern ' ++ rest) do
- pretty_print_type(rest)
- end
-
- def pretty_print_pattern(pattern) do
- pretty_print_type(pattern)
- end
-
- @spec pretty_print_contract(
- contract :: String.t(),
- module :: String.t(),
- function :: String.t()
- ) :: String.t()
- def pretty_print_contract(contract, module, function) do
- [head | tail] =
- contract
- |> to_string()
- |> String.split(";")
-
- head =
- head
- |> String.trim_leading(to_string(module))
- |> String.trim_leading(":")
- |> String.trim_leading(to_string(function))
-
- [head | tail]
- |> Enum.join(";")
- |> pretty_print_contract()
- end
-
- @spec pretty_print_contract(contract :: String.t()) :: String.t()
- def pretty_print_contract(contract) do
- [head | tail] =
- contract
- |> to_string()
- |> String.split(";")
-
- if Enum.empty?(tail) do
- do_pretty_print_contract(head)
- else
- joiner = "Contract head:\n"
-
- pretty =
- Enum.map_join([head | tail], "\n\n" <> joiner, fn contract ->
- contract
- |> to_charlist()
- |> do_pretty_print_contract()
- end)
-
- joiner <> pretty
- end
- end
-
- defp do_pretty_print_contract(contract) do
- prefix = "@spec a"
- suffix = "\ndef a() do\n :ok\nend"
- pretty = pretty_print(contract)
-
- """
- @spec a#{pretty}
- def a() do
- :ok
- end
- """
- |> format()
- |> Enum.join("")
- |> String.trim_leading(prefix)
- |> String.trim_trailing(suffix)
- |> String.replace("\n ", "\n")
- end
-
- @spec pretty_print_type(type :: String.t()) :: String.t()
- def pretty_print_type(type) do
- prefix = "@spec a("
- suffix = ") :: :ok\ndef a() do\n :ok\nend"
- indented_suffix = ") ::\n :ok\ndef a() do\n :ok\nend"
- pretty = pretty_print(type)
-
- """
- @spec a(#{pretty}) :: :ok
- def a() do
- :ok
- end
- """
- |> format()
- |> Enum.join("")
- |> String.trim_leading(prefix)
- |> String.trim_trailing(suffix)
- |> String.trim_trailing(indented_suffix)
- |> String.replace("\n ", "\n")
- end
-
- @spec pretty_print_args(args :: String.t()) :: String.t()
- def pretty_print_args(args) do
- prefix = "@spec a"
- suffix = " :: :ok\ndef a() do\n :ok\nend"
- pretty = pretty_print(args)
-
- """
- @spec a#{pretty} :: :ok
- def a() do
- :ok
- end
- """
- |> format()
- |> Enum.join("")
- |> String.trim_leading(prefix)
- |> String.trim_trailing(suffix)
- |> String.replace("\n ", "\n")
- end
-
- defp do_pretty_print({:any}) do
- "_"
- end
-
- defp do_pretty_print({:inner_any_function}) do
- "(...)"
- end
-
- defp do_pretty_print({:any_function}) do
- "(... -> any)"
- end
-
- defp do_pretty_print({:assignment, {:atom, atom}, value}) do
- name =
- atom
- |> deatomize()
- |> to_string()
- |> strip_var_version()
-
- "#{name} = #{do_pretty_print(value)}"
- end
-
- defp do_pretty_print({:atom, [:_]}) do
- "_"
- end
-
- defp do_pretty_print({:atom, ['_']}) do
- "_"
- end
-
- defp do_pretty_print({:atom, atom}) do
- atomize(atom)
- end
-
- defp do_pretty_print({:binary_part, value, _, size}) do
- "#{do_pretty_print(value)} :: #{do_pretty_print(size)}"
- end
-
- defp do_pretty_print({:binary_part, value, size}) do
- "#{do_pretty_print(value)} :: #{do_pretty_print(size)}"
- end
-
- defp do_pretty_print({:binary, [{:binary_part, {:any}, {:any}, {:size, {:int, 8}}}]}) do
- "binary()"
- end
-
- defp do_pretty_print({:binary, [{:binary_part, {:any}, {:any}, {:size, {:int, 1}}}]}) do
- "bitstring()"
- end
-
- defp do_pretty_print({:binary, binary_parts}) do
- binary_parts = Enum.map_join(binary_parts, ", ", &do_pretty_print/1)
- "<<#{binary_parts}>>"
- end
-
- defp do_pretty_print({:binary, value, size}) do
- "<<#{do_pretty_print(value)} :: #{do_pretty_print(size)}>>"
- end
-
- defp do_pretty_print({:byte_list, byte_list}) do
- byte_list
- |> Enum.into(<<>>, fn byte ->
- <>
- end)
- |> inspect()
- end
-
- defp do_pretty_print({:contract, {:args, args}, {:return, return}, {:whens, whens}}) do
- {printed_whens, when_names} = collect_and_print_whens(whens)
-
- args = {:when_names, when_names, args}
- return = {:when_names, when_names, return}
-
- "(#{do_pretty_print(args)}) :: #{do_pretty_print(return)} when #{printed_whens}"
- end
-
- defp do_pretty_print({:contract, {:args, {:inner_any_function}}, {:return, return}}) do
- "((...) -> #{do_pretty_print(return)})"
- end
-
- defp do_pretty_print({:contract, {:args, args}, {:return, return}}) do
- "#{do_pretty_print(args)} :: #{do_pretty_print(return)}"
- end
-
- defp do_pretty_print({:function, {:contract, {:args, args}, {:return, return}}}) do
- "(#{do_pretty_print(args)} -> #{do_pretty_print(return)})"
- end
-
- defp do_pretty_print({:int, int}) do
- "#{to_string(int)}"
- end
-
- defp do_pretty_print({:list, :paren, items}) do
- "(#{Enum.map_join(items, ", ", &do_pretty_print/1)})"
- end
-
- defp do_pretty_print(
- {:list, :square,
- [
- tuple: [
- {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}},
- {:atom, [:_]}
- ]
- ]}
- ) do
- "Keyword.t()"
- end
-
- defp do_pretty_print(
- {:list, :square,
- [
- tuple: [
- {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}},
- t
- ]
- ]}
- ) do
- "Keyword.t(#{do_pretty_print(t)})"
- end
-
- defp do_pretty_print({:list, :square, items}) do
- "[#{Enum.map_join(items, ", ", &do_pretty_print/1)}]"
- end
-
- defp do_pretty_print({:map_entry, key, value}) do
- "#{do_pretty_print(key)} => #{do_pretty_print(value)}"
- end
-
- defp do_pretty_print(
- {:map,
- [
- {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}},
- {:map_entry, {:atom, [:_]}, {:atom, [:_]}}
- ]}
- ) do
- "struct()"
- end
-
- defp do_pretty_print(
- {:map,
- [
- {:map_entry, {:atom, '\'__struct__\''},
- {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}},
- {:map_entry, {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}, {:atom, [:_]}}
- ]}
- ) do
- "struct()"
- end
-
- defp do_pretty_print(
- {:map,
- [
- {:map_entry, {:atom, '\'__struct__\''},
- {:type_list, ['a', 't', 'o', 'm'], {:list, :paren, []}}},
- {:map_entry, {:atom, [:_]}, {:atom, [:_]}}
- ]}
- ) do
- "struct()"
- end
-
- defp do_pretty_print(
- {:map,
- [
- {:map_entry, {:atom, '\'__exception__\''}, {:atom, '\'true\''}},
- {:map_entry, {:atom, '\'__struct__\''}, {:atom, [:_]}},
- {:map_entry, {:atom, [:_]}, {:atom, [:_]}}
- ]}
- ) do
- "Exception.t()"
- end
-
- defp do_pretty_print({:map, map_keys}) do
- %{struct_name: struct_name, entries: entries} = struct_parts(map_keys)
-
- if struct_name do
- "%#{struct_name}{#{Enum.map_join(entries, ", ", &do_pretty_print/1)}}"
- else
- "%{#{Enum.map_join(entries, ", ", &do_pretty_print/1)}}"
- end
- end
-
- defp do_pretty_print({:named_type_with_appended_colon, named_type, type})
- when is_tuple(named_type) and is_tuple(type) do
- case named_type do
- {:atom, name} ->
- name =
- name
- |> deatomize()
- |> to_string()
- |> strip_var_version()
-
- "#{name}: #{do_pretty_print(type)}"
-
- other ->
- "#{do_pretty_print(other)}: #{do_pretty_print(type)}"
- end
- end
-
- defp do_pretty_print({:named_type, named_type, type})
- when is_tuple(named_type) and is_tuple(type) do
- case named_type do
- {:atom, name} ->
- name =
- name
- |> deatomize()
- |> to_string()
- |> strip_var_version()
-
- "#{name} :: #{do_pretty_print(type)}"
-
- other ->
- "#{do_pretty_print(other)} :: #{do_pretty_print(type)}"
- end
- end
-
- defp do_pretty_print({:named_type, named_type, type}) when is_tuple(named_type) do
- case named_type do
- {:atom, name = '\'Elixir' ++ _} ->
- "#{atomize(name)}.#{deatomize(type)}()"
-
- {:atom, name} ->
- name =
- name
- |> deatomize()
- |> to_string()
- |> strip_var_version()
-
- "#{name} :: #{deatomize(type)}()"
-
- other ->
- name = do_pretty_print(other)
- "#{name} :: #{deatomize(type)}()"
- end
- end
-
- defp do_pretty_print({nil}) do
- "nil"
- end
-
- defp do_pretty_print({:pattern, pattern_items}) do
- "#{Enum.map_join(pattern_items, ", ", &do_pretty_print/1)}"
- end
-
- defp do_pretty_print(
- {:pipe_list, {:atom, ['f', 'a', 'l', 's', 'e']}, {:atom, ['t', 'r', 'u', 'e']}}
- ) do
- "boolean()"
- end
-
- defp do_pretty_print(
- {:pipe_list, {:atom, '\'infinity\''},
- {:type_list, ['n', 'o', 'n', :_, 'n', 'e', 'g', :_, 'i', 'n', 't', 'e', 'g', 'e', 'r'],
- {:list, :paren, []}}}
- ) do
- "timeout()"
- end
-
- defp do_pretty_print({:pipe_list, head, tail}) do
- "#{do_pretty_print(head)} | #{do_pretty_print(tail)}"
- end
-
- defp do_pretty_print({:range, from, to}) do
- "#{do_pretty_print(from)}..#{do_pretty_print(to)}"
- end
-
- defp do_pretty_print({:rest}) do
- "..."
- end
-
- defp do_pretty_print({:size, size}) do
- "size(#{do_pretty_print(size)})"
- end
-
- defp do_pretty_print({:tuple, tuple_items}) do
- "{#{Enum.map_join(tuple_items, ", ", &do_pretty_print/1)}}"
- end
-
- defp do_pretty_print({:type, type}) do
- "#{deatomize(type)}()"
- end
-
- defp do_pretty_print({:type, module, type}) do
- module = do_pretty_print(module)
-
- type =
- if is_tuple(type) do
- do_pretty_print(type)
- else
- deatomize(type) <> "()"
- end
-
- "#{module}.#{type}"
- end
-
- defp do_pretty_print({:type, module, type, inner_type}) do
- "#{atomize(module)}.#{deatomize(type)}(#{do_pretty_print(inner_type)})"
- end
-
- defp do_pretty_print({:type_list, type, types}) do
- "#{deatomize(type)}#{do_pretty_print(types)}"
- end
-
- defp do_pretty_print({:when_names, when_names, {:list, :paren, items}}) do
- Enum.map_join(items, ", ", &format_when_names(do_pretty_print(&1), when_names))
- end
-
- defp do_pretty_print({:when_names, when_names, item}) do
- format_when_names(do_pretty_print(item), when_names)
- end
-
- defp format_when_names(item, when_names) do
- trimmed = String.trim_leading(item, ":")
-
- if trimmed in when_names do
- downcase_first(trimmed)
- else
- item
- end
- end
-
- defp collect_and_print_whens(whens) do
- {pretty_names, when_names} =
- Enum.reduce(whens, {[], []}, fn {_, when_name, type}, {prettys, whens} ->
- pretty_name =
- {:named_type_with_appended_colon, when_name, type}
- |> do_pretty_print()
- |> downcase_first()
-
- {[pretty_name | prettys], [when_name | whens]}
- end)
-
- when_names =
- when_names
- |> Enum.map(fn {_, v} -> v |> atomize() |> String.trim_leading(":") end)
-
- printed_whens = pretty_names |> Enum.reverse() |> Enum.join(", ")
-
- {printed_whens, when_names}
- end
-
- defp downcase_first(string) do
- {first, rest} = String.split_at(string, 1)
- String.downcase(first) <> rest
- end
-
- defp atomize("Elixir." <> module_name) do
- String.trim(module_name, "'")
- end
-
- defp atomize([char]) do
- to_string(char)
- end
-
- defp atomize(atom) when is_list(atom) do
- atom_string =
- atom
- |> deatomize()
- |> to_string()
-
- stripped = strip_var_version(atom_string)
-
- if stripped == atom_string do
- atomize(stripped)
- else
- stripped
- end
- end
-
- defp atomize(<>) when is_number(atom) do
- "#{atom}"
- end
-
- defp atomize(atom) do
- atom = to_string(atom)
-
- if String.starts_with?(atom, "_") do
- atom
- else
- inspect(:"#{String.trim(atom, "'")}")
- end
- end
-
- defp atom_part_to_string({:int, atom_part}), do: Integer.to_charlist(atom_part)
- defp atom_part_to_string(atom_part), do: atom_part
-
- defp strip_var_version(var_name) do
- var_name
- |> String.replace(~r/^V(.+)@\d+$/, "\\1")
- |> String.replace(~r/^(.+)@\d+$/, "\\1")
- end
-
- defp struct_parts(map_keys) do
- %{struct_name: struct_name, entries: entries} =
- Enum.reduce(map_keys, %{struct_name: nil, entries: []}, &struct_part/2)
-
- %{struct_name: struct_name, entries: Enum.reverse(entries)}
- end
-
- defp struct_part({:map_entry, {:atom, '\'__struct__\''}, {:atom, struct_name}}, struct_parts) do
- struct_name =
- struct_name
- |> atomize()
- |> String.trim("\"")
-
- Map.put(struct_parts, :struct_name, struct_name)
- end
-
- defp struct_part(entry, struct_parts = %{entries: entries}) do
- Map.put(struct_parts, :entries, [entry | entries])
- end
-
- defp deatomize([:_, :_, '@', {:int, _}]) do
- "_"
- end
-
- defp deatomize(chars) when is_list(chars) do
- Enum.map(chars, fn char ->
- char
- |> deatomize_char()
- |> atom_part_to_string()
- end)
- end
-
- defp deatomize_char(char) when is_atom(char) do
- Atom.to_string(char)
- end
-
- defp deatomize_char(char), do: char
-end
diff --git a/apps/plataforma_digital/deps/erlex/mix.exs b/apps/plataforma_digital/deps/erlex/mix.exs
deleted file mode 100644
index d89eb08b..00000000
--- a/apps/plataforma_digital/deps/erlex/mix.exs
+++ /dev/null
@@ -1,75 +0,0 @@
-defmodule Erlex.MixProject do
- use Mix.Project
-
- def project do
- [
- app: :erlex,
- version: "0.2.6",
- elixir: "~> 1.6",
- start_permanent: Mix.env() == :prod,
- deps: deps(),
- description: description(),
- package: package(),
- docs: docs(),
- test_coverage: [tool: ExCoveralls],
- dialyzer: [
- # plt_core_path: ".",
- plt_add_apps: [:mix, :erts, :kernel, :stdlib],
- flags: ["-Wunmatched_returns", "-Werror_handling", "-Wrace_conditions", "-Wno_opaque"],
- ignore_warnings: "dialyzer.ignore_warnings.exs"
- ],
- preferred_cli_env: [
- coveralls: :test,
- "coveralls.detail": :test,
- "coveralls.post": :test,
- "coveralls.html": :test
- ]
- ]
- end
-
- def application do
- [
- extra_applications: [:logger]
- ]
- end
-
- defp deps do
- [
- {:credo, "~> 0.9", only: [:dev, :test], runtime: false},
- {:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
- {:dialyxir, "~> 1.0.0-rc.3", only: :dev, runtime: false},
- {:excoveralls, "~> 0.8", only: :test}
- ]
- end
-
- defp description do
- """
- Convert Erlang style structs and error messages to equivalent Elixir.
- """
- end
-
- defp docs() do
- [
- main: "readme",
- source_url: "https://github.com/asummers/erlex",
- homepage_url: "https://github.com/asummers/erlex",
- extras: ["README.md", "CHANGELOG.md"]
- ]
- end
-
- defp package do
- [
- files: [
- "lib",
- "mix.exs",
- "README.md",
- "LICENSE.md",
- "src/lexer.xrl",
- "src/parser.yrl"
- ],
- maintainers: ["Andrew Summers"],
- licenses: ["Apache 2.0"],
- links: %{"GitHub" => "https://github.com/asummers/erlex"}
- ]
- end
-end
diff --git a/apps/plataforma_digital/deps/erlex/src/lexer.xrl b/apps/plataforma_digital/deps/erlex/src/lexer.xrl
deleted file mode 100644
index ce5e9c08..00000000
--- a/apps/plataforma_digital/deps/erlex/src/lexer.xrl
+++ /dev/null
@@ -1,45 +0,0 @@
-Definitions.
-
-WHITESPACE=[\s\t\r\n]+
-SCIENTIFIC_NOTATION = -?[0-9]+\.[0-9]+e-?[0-9]+
-INT = -?[0-9]+
-REST = \.\.\.
-RANGE = \.\.
-ATOM = \'[^']+\'
-WHEN = \swhen\s
-
-Rules.
-
-{WHITESPACE} : skip_token.
-
-{REST} : {token, {'...', TokenLine}}.
-{WHEN} : {token, {'when', TokenLine}}.
-fun\( : {token, {'fun(', TokenLine}}.
-\* : {token, {'*', TokenLine}}.
-\[ : {token, {'[', TokenLine}}.
-\] : {token, {']', TokenLine}}.
-\( : {token, {'(', TokenLine}}.
-\) : {token, {')', TokenLine}}.
-\{ : {token, {'{', TokenLine}}.
-\} : {token, {'}', TokenLine}}.
-\# : {token, {'#', TokenLine}}.
-\| : {token, {'|', TokenLine}}.
-_ : {token, {'_', TokenLine}}.
-\:\: : {token, {'::', TokenLine}}.
-\: : {token, {':', TokenLine}}.
-\:\= : {token, {':=', TokenLine}}.
-\=\> : {token, {'=>', TokenLine}}.
-\-\> : {token, {'->', TokenLine}}.
-\| : {token, {'|', TokenLine}}.
-\< : {token, {'<', TokenLine}}.
-\> : {token, {'>', TokenLine}}.
-\' : {token, {'\'', TokenLine}}.
-, : {token, {',', TokenLine}}.
-\= : {token, {'=', TokenLine}}.
-{RANGE} : {token, {'..', TokenLine}}.
-{SCIENTIFIC_NOTATION} : {token, {int, TokenLine, TokenChars}}.
-{INT} : {token, {int, TokenLine, list_to_integer(TokenChars)}}.
-{ATOM} : {token, {atom_full, TokenLine, TokenChars}}.
-. : {token, {atom_part, TokenLine, TokenChars}}.
-
-Erlang code.
diff --git a/apps/plataforma_digital/deps/erlex/src/parser.yrl b/apps/plataforma_digital/deps/erlex/src/parser.yrl
deleted file mode 100644
index c3ce9ccc..00000000
--- a/apps/plataforma_digital/deps/erlex/src/parser.yrl
+++ /dev/null
@@ -1,139 +0,0 @@
-Nonterminals
-
-assignment
-atom
-binary binary_items binary_part
-byte
-byte_list byte_items
-contract
-document
-function
-integer
-list
-map map_items map_entry
-pattern
-pipe_list
-range
-rest
-tuple
-type
-value_items
-values value.
-
-Terminals
-
-atom_part atom_full
-int
-'(' ')'
-'[' ']'
-'_'
-'\''
-','
-'#' '{' '}'
-':=' '=>'
-'fun(' '->'
-'|'
-'..'
-'::'
-':'
-'...'
-'<' '>'
-'*'
-'when'
-'='.
-
-Rootsymbol document.
-
-document -> values : '$1'.
-
-values -> value : ['$1'].
-values -> value values : ['$1'] ++ '$2'.
-
-value -> '\'' value '\'' : '$2'.
-value -> assignment : '$1'.
-value -> atom : {atom, '$1'}.
-value -> binary : '$1'.
-value -> byte_list : '$1'.
-value -> contract : '$1'.
-value -> function : '$1'.
-value -> integer : '$1'.
-value -> list : '$1'.
-value -> map : '$1'.
-value -> pattern : '$1'.
-value -> pipe_list : '$1'.
-value -> range : '$1'.
-value -> rest : '$1'.
-value -> tuple : '$1'.
-value -> type : '$1'.
-
-binary -> '<' '<' '>' '>' : {binary, []}.
-binary -> '<' '<' binary_items '>' '>' : {binary, '$3'}.
-binary -> '<' '<' value_items '>' '>' : {binary, '$3'}.
-
-pattern -> '<' value_items '>' : {pattern, '$2'}.
-
-tuple -> '{' '}' : {tuple, []}.
-tuple -> '{' value_items '}' : {tuple, '$2'}.
-
-byte_list -> '#' '{' '}' '#' : {byte_list, []}.
-byte_list -> '#' '{' byte_items '}' '#' : {byte_list, '$3'}.
-
-list -> '(' ')' : {list, paren, []}.
-list -> '(' value_items ')' : {list, paren, '$2'}.
-list -> '[' ']' : {list, square, []}.
-list -> '[' value_items ']' : {list, square, '$2'}.
-
-map -> '#' '{' '}' : {map, []}.
-map -> '#' '{' map_items '}' : {map, '$3'}.
-
-map_entry -> value ':=' value : {map_entry, '$1', '$3'}.
-map_entry -> value '=>' value : {map_entry, '$1', '$3'}.
-
-function -> 'fun(' ')' : {any_function}.
-function -> 'fun(' '...' ')' : {inner_any_function}.
-function -> 'fun(' contract ')' : {function, '$2'}.
-
-binary_part -> '_' ':' value : {binary_part, {any}, '$3'}.
-binary_part -> '_' ':' '_' '*' value : {binary_part, {any}, {any}, {size, '$5'}}.
-
-assignment -> value '=' value : {assignment, '$1', '$3'}.
-
-byte -> '#' '<' int '>' '(' int ',' int ',' atom ',' '[' atom ',' atom ']' ')' : unwrap('$3').
-
-contract -> list '->' value when value_items : {contract, {args, '$1'}, {return, '$3'}, {whens, '$5'}}.
-contract -> list '->' value : {contract, {args, '$1'}, {return, '$3'}}.
-contract -> function '->' value : {contract, {args, '$1'}, {return, '$3'}}.
-
-integer -> int : {int, unwrap('$1')}.
-
-pipe_list -> value '|' value : {pipe_list, '$1', '$3'}.
-
-range -> integer '..' integer : {range, '$1', '$3'}.
-
-rest -> '...' : {rest}.
-
-atom -> atom_full : unwrap('$1').
-atom -> atom_part : [unwrap('$1')].
-atom -> '_' : ['_'].
-atom -> atom integer : '$1' ++ ['$2'].
-atom -> atom atom : '$1' ++ '$2'.
-
-type -> atom ':' type : {type, {atom, '$1'}, '$3'}.
-type -> atom '::' value : {named_type, {atom, '$1'}, '$3'}.
-type -> atom list : {type_list, '$1', '$2'}.
-
-binary_items -> binary_part : ['$1'].
-binary_items -> binary_part ',' binary_items : ['$1'] ++ '$3'.
-
-byte_items -> byte : ['$1'].
-byte_items -> byte ',' byte_items : ['$1'] ++ '$3'.
-
-map_items -> map_entry : ['$1'].
-map_items -> map_entry ',' map_items : ['$1'] ++ '$3'.
-
-value_items -> value : ['$1'].
-value_items -> value ',' value_items : ['$1'] ++ '$3'.
-
-Erlang code.
-
-unwrap({_,_,V}) -> V.
diff --git a/apps/plataforma_digital/deps/ex_doc/.fetch b/apps/plataforma_digital/deps/ex_doc/.fetch
deleted file mode 100644
index e69de29b..00000000
diff --git a/apps/plataforma_digital/deps/ex_doc/.hex b/apps/plataforma_digital/deps/ex_doc/.hex
deleted file mode 100644
index 08808751..00000000
Binary files a/apps/plataforma_digital/deps/ex_doc/.hex and /dev/null differ
diff --git a/apps/plataforma_digital/deps/ex_doc/CHANGELOG.md b/apps/plataforma_digital/deps/ex_doc/CHANGELOG.md
deleted file mode 100644
index cf211c02..00000000
--- a/apps/plataforma_digital/deps/ex_doc/CHANGELOG.md
+++ /dev/null
@@ -1,961 +0,0 @@
-# Changelog
-
-## v0.30.6 (2023-08-25)
-
- * Enhancements
- * Extract title from Markdown file when preceeded with comments
- * Improve focus navigation in notebooks
-
-## v0.30.5 (2023-08-12)
-
- * Bug fixes
- * Fix style for code in headers
- * Fix search data generation for Erlang/OTP
-
-## v0.30.4 (2023-08-03)
-
- * Bug fixes
- * Fix style for anchors in headers
-
-## v0.30.3 (2023-07-15)
-
- * Enhancements
- * Compress search index before storing in local storage
-
- * Bug fixes
- * Fix styling for headers on cheatsheets and small screens
-
-## v0.30.2 (2023-07-11)
-
- * Bug fixes
- * Fix escaping in `search_data.json`
- * Skip vega-lite code blocks in `search_data.json`
-
-## v0.30.1 (2023-07-07)
-
- * Bug fixes
- * Fix styling for headers on cheatsheets and small screens
-
-## v0.30.0 (2023-07-07)
-
- * Enhancements
- * Support tabsets (see the README for more information)
- * Improve search results and indexing by storing more data and metadata
- * Warn on invalid references in links
- * Strike-through deprecated items on autocompletion
- * Add source URL link to API reference page
- * Allow multiple extra files with the same name by generating unique names in case of conflicts
-
- * Bug fixes
- * Fix rendering of large code blocks in admonition texts
- * Do not log errors on module mismatch in case-insensitive file systems
-
-## v0.29.4 (2023-03-29)
-
- * Bug fixes
- * Fix sidebar element with no children taking additional padding
- * Fix elements being rendered too thick on macOS
- * Fix rendering of HTML elements inside tooltips
-
-## v0.29.3 (2023-03-17)
-
- * Enhancements
- * Propagate `:since` metadata from modules
- * Add support for MFAs and maps in `before_closing_body_tag` and `before_closing_head_tag`
-
- * Bug fixes
- * Improve font consistency across different OSes
- * Keep language class on livebook output code block
- * Ensure switches have higher precedence than config
-
-## v0.29.2 (2023-03-02)
-
- * Enhancements
- * Improvements to cheatsheets spacing
- * Improvements to cheatsheets print
- * Include sections of modules and extras in search suggestions
- * Make sidebar links full-width and add hover states
- * Improve clickable area of sidebar tabs
- * Improve contrast on sidebar
-
- * Bug fix
- * Add media type for .license files for epub
- * Fix overscroll on the sidebar
- * Focus search input immediately after keyboard shortcut
- * Don't attempt parsing code blocks that don't look like modules
- * Fix visited link color in admonition blocks
-
-## v0.29.1 (2022-11-21)
-
- * Enhancements
- * Add optional function annotations
- * Support media print on stylesheets
- * Add download ePub link to footer
- * Support extras for Erlang
- * Add tooltip to functions on sidebar
- * Disable spellcheck and autocorrect on search input
-
- * Bug fix
- * Special handle functions called `record/*` in Erlang
-
- * Deprecations
- * Rename `:groups_for_functions` to `:groups_for_docs`
-
-## v0.29.0 (2022-10-19)
-
- * Enhancements
- * Support cheatsheets as `.cheatmd` files
-
- * Bug fix
- * Collapse sidebar when resizing page even if stored in the session as opened
-
-## v0.28.6 (2022-10-13)
-
- * Enhancements
- * Add Elixir special punctuation ! and ? to natural sort
- * Add night mode to settings pane
- * Support --proglang in mix docs
- * Save sidebar state per session
- * Distinguish output code blocks in Livebooks
-
- * Bug fixes
- * Prevent sidebar button scrolling out of view
- * Prevent unreadable text when using inline code with admonition headers
-
-## v0.28.5 (2022-08-18)
-
- * Enhancements
- * Do not preserve spaces from spec declaration in signature rendering
- * Index hyphens in search
- * Index `@` in search
- * Change minimal package search length to 2
-
- * Bug fixes
- * Remove extra `term()` argument at start of `@macrocallback`
-
-## v0.28.4 (2022-04-28)
-
- * Enhancements
- * Add a toast when changing theme via keyboard
- * Automatically convert `.livemd` links to `.html` ones
- * Show programming language in HTML footer
-
- * Bug fixes
- * Properly escape `%/2` special form
- * Improve ranking of exact-matching modules in search
-
-## v0.28.3 (2022-03-23)
-
- * Enhacements
- * Include page titles in autocomplete suggestions
- * Allow theme to be set to "System" version
- * Remove "Specs" heading and render full typespecs
- * Support for `source_url_pattern` in config being a function
-
- * Bug fixes
- * Adjustments for blockquotes and admonition blocks in dark mode
- * Fix module sorting when a list of dirs is provided
- * Consider casing of letters when sorting items in the menu, summary, function list, etc
-
-## v0.28.2 (2022-02-23)
-
- * Bug fixes
- * Fix links and code tags in admonition text blocks for dark mode
-
-## v0.28.1 (2022-02-20)
-
- * Enhancements
- * Add support for admonition text blocks
- * Improve accessibility for light and dark themes
-
- * Bug fixes
- * Ensure that `mix docs --open` works on Windows
- * Ensure search tokenizer also splits on underscore
- * Fix false warnings about missing types when running ExDoc in escript mode
- * Don't navigate when clicking the current page
-
-## v0.28.0 (2022-01-24)
-
-ExDoc v0.28.0 requires Elixir v1.11+.
-
- * Enhancements
- * Use custom scrollbar in the sidebar
- * Keep hamburger absolute to the opened sidebar
- * Support `--open` flag on `mix docs`
- * The copy button now only copies selectable content
-
- * Bug fixes
- * Make sure filename configuration in `:extras` is used across links
- * Ensure all `extras` pages have a title generated
- * Fix margin on 3rd level headers and beyond
- * Ensure a task that defines callbacks is still listed as a task
-
-## v0.27.3 (2022-01-12)
-
- * Bug fixes
- * Make HexDocs search case insensitive
- * Improve sidebar open/close animation
-
-## v0.27.2 (2022-01-11)
-
- * Bug fixes
- * Fix version dropdown when hosted on HexDocs
- * Fix tooltips
- * Fix JavaScript error when Hex package information is not available
-
-## v0.27.1 (2022-01-11)
-
- * Bug fixes
- * Several usability fixes on the new layout
- * Keep page ordering
-
-## v0.27.0 (2022-01-11)
-
- * Enhancements
- * Introduce new sidebar design
- * Add `--quiet` option to CLI
- * Support multiple formatters in the CLI
- * Show structs as `%Struct{}` instead of `__struct__` in the sidebar
- * Point Erlang links to `www.erlang.org` instead of `erlang.org`
- * Improvements to the night mode and styling
-
-## v0.26.0 (2021-11-21)
-
- * Backwards incompatible changes
- * `:filter_prefix` has been renamed to `:filter_modules` and supports anonymous functions
- * `:source_ref` now defaults to `"main"`
- * Dropped support for smartypants in Markdown
-
- * Bug fixes
- * Do not warn on links to sections
-
- * Enhancements
- * Add copy button to code snippets
- * Add `translate="no"` to the relevant attributes to improve interoperability with automatic translation tools
- * Support optional module annotations
- * Introduce a settings modal to group most of configuration
- * Allow customizing the Livebook expansion URL
- * Provide documentation on how to render plugins such as Katex, VegaLite, and Mermaid
-
-## v0.25.5 (2021-10-20)
-
- * Bug fixes
- * Do not duplicate API Reference title
- * Update assets for Livebook badge functionality
-
-## v0.25.4 (2021-10-20)
-
- * Enhancements
- * Add source link to pages in `:extras`
- * Add "Run in Livebook" badge to `.livemd` pages in `:extras`
-
- * Bug fixes
- * Do not generate entries for private Erlang functions
- * Do not trim `?` and `!` from Elixir tokens on search
-
- * Incompatible changes
- * Remove unused `:source_root` option
-
-## v0.25.3 (2021-09-21)
-
- * Enhancements
- * Track user preference for sidebar state
-
- * Bug fixes
- * Do not double escape page titles on the sidebar
- * Do not fail when documenting cover compiled modules
- * Don't crash upon doc chunks for unknown beam languages
-
-## v0.25.2 (2021-09-02)
-
- * Enhancements
- * Add support for Livebook's `.livemd` Markdown files
- * Preload all applications starting with `makeup_` before doc generation
- * Add Hex package config and display "Find on Hex" footer links
-
-## v0.25.1 (2021-08-02)
-
- * Enhancements
- * Supporting grouping of callbacks
- * Use shell lexer for code blocks with no language and starting with `$ `
-
- * Bug fixes
- * Fix generating type signatures with maps
- * Skip Erlang modules that have empty docs
- * Skip Erlang functions that have empty docs
- * Fix accidentally showing shape of opaque types
-
-## v0.25.0 (2021-07-20)
-
- * Enhancements
- * Handle remote types when generating signatures, e.g. `@callback callback1(GenServer.options())` becomes `callback1(options)`
- * Support Markdown processor options
- * Add `--paths` command line argument to prepend directories to the code path when generating docs
- * Make shell prompt, `$ `, not selectable for `shell`, `sh`, `bash` and `zsh` code blocks
-
- * Bug fixes
- * Fix custom links to undefined/hidden references
- * Fix generating external links with `:deps` configuration
- * Add ellipsis to more sections
-
- * Backwards incompatible changes
- * Remove function landing pages
-
-## v0.24.2 (2021-04-06)
-
- * Enhancements
- * Support stepped range syntax
-
- * Bug fixes
- * Add spaces on paragraph endings for search results
- * Fix bug defining app name in config
- * Fix rendering void elements (` ` etc)
-
-## v0.24.1 (2021-03-22)
-
- * Bug fixes
- * Fix generating function landing pages
-
-## v0.24.0 (2021-03-16)
-
- * Enhancements
- * Drop jQuery and refactor JavaScript codebase
- * Remove highlight.js in favour of migration to Makeup
- * Change autolink to return both path and hash for the current module
- * Add next/previous at the end of extra pages
- * Improve search input blur handling
- * Update erlang.org/man URL
- * Add function landing page
-
- * Bug fixes
- * Ignore extensions when generating external links
- * Fix autolink to handle URIs with arbitrary scheme part without warning
- * Fix undefined reference warning for typespecs
- * Fix search click behavior when a suggestion refers the current page
- * Don't crash when we can't format spec
- * Fix HTML escaping
-
-## v0.23.0 (2020-10-12)
-
-Requires Elixir v1.10.
-
- * Enhancements
- * Improve warnings on broken references
- * Support Elixir v1.12-dev
-
- * Bug fixes
- * Respect deps config in autolink
- * Fix html escaping in the sidebar entries
- * Fix retrieving specs for macros with `when`
- * Raise if none of :name or :app are found in mix.exs
- * Don't crash on code blocks like "A.b.C"
-
-## v0.22.6 (2020-09-16)
-
- * Bug fixes
- * Properly fix CSS bug on headings
- * Add expansion arrow to sections on sidebar
-
-## v0.22.5 (2020-09-13)
-
- * Bug fixes
- * Fix CSS bug on headings
-
-## v0.22.4 (2020-09-12)
-
- * Enhancements
- * Improve accessibility and add aria labels
- * Show different title and message for a empty search value
-
-## v0.22.3 (2020-07-25)
-
- * Bug fixes
- * [HTML+EPUB] Remove overlapping functions from defaults
- * [HTML] Don't show tooltip for module sections and non-html files
- * [HTML] Make sure tooltips work with escape ids.
-
-## v0.22.2 (2020-07-20)
-
- * Enhancements
- * [HTML+EPUB] Add support for path dependent markdown autolink (`feeddc1`)
- * [HTML+EPUB] Improve auto-linking to callbacks and types (`12c0a01`)
- * [HTML+EPUB] Replace `` with `` when it represents keys to be hit (`bd2b8df`)
- * [HTML] Hide sidebar-over-content on click/tap outside it (`b050775`)
- * [HTML] Redirect to correct file when changing version (`0f6f24b`)
- * [mix docs] Allow files with no extension in extra files (`26b93b6`)
- * [mix docs] Link to siblings in an umbrella (`b0d6fdd`)
- * [mix docs] Switch to `earmark_parser`. Run `mix deps.unlock --unused` to remove the now
- unused `earmark` dependency. (`021c772`)
-
- * Bug fixes
- * [HTML+EPUB] Bring back auto-linking to Kernel and Kernel.SpecialForms (`fa174eb`)
- * [HTML+EPUB] Escape HTML special characters in signature (`5fed479`)
- * [HTML+EPUB] Fix auto-linking `./2` and `../2` (`2e40acb`)
- * [HTML+EPUB] Fix list of basic types to auto-link (`6df4a3b`)
- * [HTML+EPUB] Make HTML valid (`1187ace`)
- * [HTML] Escape HTML special characters in sidebar (`d26ca71`)
- * [HTML] Fix keyboard shortcuts on non US keyboard layouts (`829c4ee`)
- * [HTML] Fix text overflow in sidebar (`a4ff547`)
- * [HTML] Handle snake case terms in search results (`d511d55`)
- * [mix docs] Don't crash on markdown that triggers warning (`e7cb79c`)
-
-## v0.22.1 (2020-05-19)
-
- * Bug fixes
- * [mix docs] Depend on earmark `~> 1.4.0`
- * [mix docs] Don't crash on comments in markdown
- * [mix docs] Don't crash on HTML in markdown
-
-## v0.22.0 (2020-05-11)
-
- * Enhancements
- * [EPUB] Add epub to the default formatters
- * [HTML+EPUB] Move specs out of signature
- * [HTML+EPUB] Auto-link "erlang" types & callbacks
- * [HTML+EPUB] Auto-link "erlang" modules in custom links
- * [mix docs] Warn on broken references in dependencies (e.g. `` `String.upcase/9` ``)
- * [escript] Add `--app`
- * [HTML+EPUB] Auto-link to extras (e.g. `[foo](foo.md)`)
- * [mix docs] Undefined references warning now includes the filename
- * [mix docs] `:skip_undefined_reference_warnings_on` now also accepts a filename
- * [HTML+EPUB] Display moduledoc headings in the sidebar
-
- * Bug fixes
- * [HTML] Fix hidden text selection, hide tooltips for details link
- * [HTML+EPUB] Fix function name sorting (group operators together)
- * [HTML+EPUB] Fix displaying nested modules
-
- * Backwards incompatible changes
- * [mix docs] Remove built-in support for cmark markdown processor
- * [mix docs] Replace `ExDoc.Markdown.to_html/2` with `to_ast/2`
- * [HTML+EPUB] Remove auto-linking for local calls to Kernel & Kernel.SpecialForms,
- use fully qualified calls instead. (e.g. replace `` `==/2` `` with `` `Kernel.==/2` ``.)
- * [mix docs] `:skip_undefined_reference_warnings_on` no longer accepts extras id, use
- extras filename instead.
-
-## v0.21.3
-
- * Enhancements
- * [HTML] Make "Exceptions" a module sub-grouping instead of a top-level group
- * [HTML] Automatically group deprecated modules
- * [HTML] Rely on `prefers-color-scheme` w/o night mode set
- * [HTML] Boost title on search results, add fun/arity to title
- * [mix docs] Initial work on support for multiple languages
-
- * Bug fixes
- * [HTML] Many improvements to the search engine
- * [mix docs] Link to callback docs instead of copying them
-
-## v0.21.2
-
- * Enhancements
- * [HTML] Add hardcoded packages to the quick-switch search results
- * [HTML] Filter out packages without docs on HexDocs in quick-switch
- * [HTML+EPUB] Support autolinking for multiple arities
- * [mix docs] Avoid deprecation warnings on more recent earmark versions
- * [mix docs] Warn on unavailable local functions
- * [mix docs] Make invalid index redirect warning case-sensitive
- * [mix docs] Ignore non-Elixir modules when missing chunk
-
- * Bug fixes
- * [HTML+EPUB] Do not create a custom link when destination does not exist
- * [EPUB] Hide screen reader elements
-
-## v0.21.1
-
- * Bug fixes
- * [HTML] Make sure package selector can be reopened after closed with `ESC`
- * [HTML] Ensure tooltip pages can be cached
- * [HTML] Support large version numbers on the version dropdown
- * [mix docs] Raise nice exception for missing ExDoc.Config
-
-## v0.21.0
-
- * Enhancements
- * [HTML] Add support for reference popovers
- * [HTML] Provide a "g" shortcut to Go To a Hexdocs package (with autocomplete)
- * [HTML] Detect if browser prefers night mode
- * [EPUB] Add support for covers and the authors field
-
- * Bug fixes
- * [HTML+EPUB] Ensure that link headers generate unique IDs
- * [HTML+EPUB] Sort structs fields so field names are always ordered
- * [HTML+EPUB] Do not strip "Elixir." prefix from module names
- * [HTML] Support URLs with non-HTML safe characters
- * [EPUB] Fix table of contents without groups
-
-## v0.20.2
-
- * Enhancements
- * Add "mix " prefix to Mix tasks
-
- * Bug fixes
- * Improve scrolling on Safari
- * Prevent text casing of codes
- * Do not remove stop words from search and make sure function names are searchable in isolation
- * Reduce the size of the search metadata
- * Remove outline on focus and keep width in version dropdown
- * Do not fail if we can't persist index
-
-## v0.20.1
-
- * Bug fixes
- * Hide the spinner when no term is searched
- * Use `?` for the shortcut hint text
- * Improve style of the version dropdown
-
-## v0.20.0
-
- * Enhancements
- * Rework the search bar to provide autocompletion
- * Provide full-text search
- * Automatically generate documentation for `defdelegate` definitions (requires Elixir v1.8+)
- * Provide keyboard shortcuts (press `?` to see all available outputs) or click the link at the bottom of the page
- * Add support for versions dropdown to the HTML sidebar. This requires adding a `docs_config.js` (also configurable) that sets a `versionNodes` JavaScript variable.
- * Improve mouseover titles on sidebar navigation
-
- * Bug fixes
- * Do not hide structs in type/callback summary signatures
- * No longer require double click to open up a sidebar on Mobile Safari
- * Keep trailing periods in summaries
- * Fix typespec `arg` number to start from 1 instead of 0
-
-## v0.19.3
-
- * Enhancements
- * Include a "goto" link on mouseover for expandable menu items
-
- * Bug fixes
- * Always expand menu items, even if has a single child
- * Fix sidebar bottom margin on Firefox
- * Fix anchor links sometimes not working by moving JS to HTML head
- * Unify code styling for makeup and hljs
- * Do not replace the content of custom links pointing to Elixir modules
- * Remove border-left on deprecated to not mistake it with a heading
-
-## v0.19.2
-
- * Enhancements
- * Allow logo in SVG extension
- * Allow functions to be grouped based on metadata
- * Allow api-reference.html page to be disabled
- * Allow nesting of modules by prefix
- * Autolink `mix help TASK`
- * Warn on undefined remote functions from project's docs
-
- * Bug fixes
- * Sort function names alphabetically in the sidebar
- * Fix search input color
- * Disable earmark smartypants option
-
-## v0.19.1
-
- * Enhancements
- * Update CSS styles
- * Remove sourcemaps from package
-
-## v0.19.0
-
-This release requires Elixir v1.7 and later. For earlier Elixir versions, use ExDoc ~> 0.18.0.
-
- * Enhancements
- * Do not select "iex>" when selecting code samples
- * Use makeup to perform ELixir's syntax highlighting (other languages still use highlight.js)
- * Use `[rel="noopener"]` on external links
- * Link directly to page if sidebar item has no subitems
- * Autolink Kernel and Kernel functions and special forms with shorthands (for example, only `is_atom/1` is necessary)
- * Trim EEx contents to reduce HTML size
- * Allow apps to be excluded from umbrella app docs
-
- * Bug fixes
- * Exclude types with `@typedoc false` from the docs
- * Make sure autolink considers the longest matching dependency name in case of shared prefixes
-
-## v0.18.3
-
- * Bug fix
- * Fix formatting of typespecs causing errors
- * Update jQuery
- * Properly remove underscore from typespec links
-
-## v0.18.2
-
- * Enhancements
- * Improve documentation pages for printing
- * Autolink Kernel, Kernel.SpecialForms, and built-in types
- * Annotate opaque types
- * Add vertical-align:top to tables
- * Allow module-function-arity references in links
- * Remove underscore from view source link
- * Run code formatter on typespecs (if one is available)
- * Make night mode switch link more obvious
-
-## v0.18.1
-
- * Bug fixes
- * Include missing formatter files
-
-## v0.18.0
-
- * Enhancements
- * No longer strip empty parens from types
- * Provide more extension point for markdown processors
- * Remove assets from priv since they are now embedded at compile time
-
- * Backwards incompatible changes
- * Remove built-in support for hoedown markdown processor
- * No longer add favicon when logo option is present (this was added in 0.17.0 but it was reported the logo almost never fits as a favicon)
-
-## v0.17.1
-
- * Bug fixes
- * Fix broken search caused by outdated JavaScript files
-
-## v0.17.0
-
- * Enhancements
- * Allow modules to be grouped on the sidebar with the `:groups_for_modules` option
- * Allow extras to be grouped on the sidebar with the `:groups_for_extras` option
-
- * Backwards incompatible changes
- * The previous `:group` option that could be specified for each entry in `:extras` is no longer supported
- * No longer add a specific section for "Protocols". If you would like to segregate the protocols in your application, use the new `:groups_for_modules` functionality
-
-## v0.16.4
-
- * Enhancements
- * Generate favicon link if a logo is available
-
- * Bug fixes
- * Do not version epub filename as the doc directory is likely already versioned
-
-## v0.16.3
-
- * Enhancements
- * Make sure its own search.html page and provide history
- * Generate source maps only if the `--debug` flag is given
- * Users can now add custom HTML before the closing head tag and the closing body tag
- * Highlight the target function/macro/type/callback when clicked
-
- * Bug fixes
- * Remove extra `term()` argument at start of macro spec
- * Add unencoded link target for functions with special chars to cope with different behaviour in browsers
-
-## v0.16.2
-
- * Enhancements
- * Link `
` headers as well
- * Add border to code tag
- * Bug fixes
- * Fix sidebar on mobile devices
-
-## v0.16.1
-
- * Bug fixes
- * Fix hover icons coloring
-
-## v0.16.0
-
- * Enhancements
- * Separate tasks into "Mix Tasks" in sidebar
- * Add types to the search results
- * Improve accessibility
-
- * Bug fixes
- * Strip nesting HTML tags in h2 headers
- * Remove the old search results after every new search attempt
-
-## v0.15.1
-
- * Bug fixes
- * Improve project name wrapping on HTML
- * Properly set link in types with parameter
- * Fix ExDoc.CLI.main/2 to keep --source-ref on Elixir v1.4
- * Do not fail if localStorage is not available
-
-## v0.15.0
-
- * Enhancements
- * Closing the search takes you to where you were in the previous page
- * Handle `__struct__/0` by displaying the struct instead
- * Warn when redirecting to a non-existent file
- * List both functions and macros under "Functions"
- * Automatically detect GitLab source URL patterns
-
- * Bug fixes
- * Break long specs into lines
- * Fix the initial state of the sidebar hamburger
- * Do not error when abstract code is missing
- * Properly link to erlang lib dirs
-
- * Backwards incompatible changes
- * No longer support Pandoc
- * Require Earmark 1.1
-
-## v0.14.5
-
- * Enhancements
- * Allow ExDoc to work as an escript
-
-## v0.14.4
-
- * Enhancements
- * Point to Elixir docs on hexdocs.pm
- * Many improvements to layout and styling of EPUB formatter
- * Support multiple formatters to be configured on `mix.exs`
- * Also digest `sidebar_items.js`
- * Force parentheses on type signature to remove ambiguity
- * Generate top-level docs for an umbrella project
- * Searching on mobile closes menu when the Enter key is hit
-
-## v0.14.3
-
- * Enhancements
- * Support the `:assets` option that automatically copies all entries in the given directory to `doc/assets`
- * Remove numbering on Extras subheaders from sidebar
- * Pass file and line information to markdown formatters for better warnings
- * Allow extra pages to be grouped together under a given heading
- * Generate ids for default name/arity pairs so they can be linked (both remotely and locally)
-
- * Bug fixes
- * Fix autolink for functions containing `%`, `{`, `}` or uppercase characters in the name
-
-## v0.14.2
-
- * Enhancements
- * Automatically generate documentations links to any of your dependencies (by default links to hexdocs.pm but allows the URL to be configured)
- * Allow documentation to be generated to Erlang modules
-
- * Bug fixes
- * Make sure "Top" is not included twice on pages
-
-## v0.14.1
-
- * Bug fixes
- * Include "Top" link in pages with no headings
- * Include "Top" link in modules with no docs
-
-## v0.14.0
-
- * Enhancements
- * Add support for the epub formatter
- * Support extraction from `
` headers out of the settext format
-
- * Layout changes
- * Indent documentation inside the function/macro/type/callback header
- * Style types the same way as function/macro/callback and include a link to the source
- * Increase font-sizes in the sidebar and code snippets
- * Move the specs definition inside the function/macro/type/callback header and make better use of vertical space
- * Use a gradient on the sidebar to avoid sudden cut-off when scrolling the modules list
- * Fix the use of the back-button in some browsers
- * Allow the whole sidebar to be navigated without moving away from the current page. Expand (+) and collapse (-) buttons have been added to aid exploration
- * Numerically order pages/guides headers
-
-## v0.13.2
-
- * Bug fixes
- * Avoid scrollbar from appearing on all code snippets
-
-## v0.13.1
-
- * Enhancements
- * Autolink Elixir's stdlib modules and functions
- * Show callbacks in search results
- * Reduce size taken by font-sizes
- * Increase size for headings in the moduledoc
-
- * Bug fixes
- * Fix opened sidebar on small screens
- * Allow horizontal scrolling for code snippets on small screens
-
-## v0.13.0
-
- * Bug fixes
- * Fix issue where docs would fail when being built on Erlang 19
- * Store templates in `priv` rather than in `lib`
-
- * Backwards incompatible changes
- * Require Elixir ~> v1.2
-
-## v0.12.0
-
- * Enhancements
- * Remove warnings when running on Elixir v1.3
- * Support for `@optional_callbacks`
- * Improve styling for nested lists
- * Include earmark as a default dependency
-
- * Bug fixes
- * Fix many styling and performance front-end related bugs
-
-## v0.11.5
-
- * Enhancements
- * Support canonical URLs
-
- * Bug fixes
- * Autolink now allows digits in function names
- * Sort specs by line to preserve ordering
- * Focus on content element on document ready
- * Remove ligature fix on Firefox and Safari as Google Fonts have been updated
-
-## v0.11.4
-
- * Bug fixes
- * Fix ligature issues in recent browsers
- * HTML escape headers
- * Avoid warning on Elixir master (v1.3)
-
-## v0.11.3
-
- * Bug fixes
- * Fix a regression where the sidebar wouldn't stick on small screens
-
-## v0.11.2
-
- * Enhancements
- * Include night mode for docs
- * Take advantage of extra space on large screens by widening sidebar
-
- * Bug fixes
- * Do not attempt to retrieve docs from Erlang modules
-
-## v0.11.1
-
- * Bug fixes
- * Include callbacks even if a module defines a struct
-
-## v0.11.0
-
- * Enhancements
- * From now on it's possible to set the title in the sidebar area for
- additional content, *default:* "Pages"
- * Set the path and title of each additional page in `mix.exs` file
- * Use the first `h1` as menu title if title is not configured
- * Include the project name as part of the header in small devices
-
- * Bug fixes
- * Increase the visual separation between functions
- * Remove the `extra-` prefix for the additional documentation files
- * Extra large images do not create an overflow in the content
-
-## v0.10.0
-
- * Enhancements
- * Many improvements and bug fixes in new layout
- * Reduced build size
- * Overview has been renamed to API Reference
- * All extra content, including API Reference, has been moved to inside
- "Pages"
- * Extra files are now downcased and prefixed by `extra-`
-
-## v0.9.0
-
- * Enhancements
- * Whole new clean, readable, usable, responsive layout
- * Support for adding logo to generated docs (must be 64x64 pixels)
- * Support for adding extra pages to generated docs
- * Improve formatting of typespecs and callbacks
-
- * Backwards incompatible changes
- * `--readme` option and `:readme` configuration have been removed. Use
- `:extras` in your `mix.exs` file or pass `--extra` / `-e` in the
- command-line (may be given multiple times)
-
-## v0.8.4
-
- * Bug fixes
- * Generate `README.html` file instead of `readme.html` as in previous
- releases
- * Style fixes in the new layout
-
-## v0.8.3
-
- * Bug fixes
- * Style fixes in the new layout
-
-## v0.8.2
-
- * Enhancements
- * Uglify and minify JS and CSS code
- * Performance improvements when building sidebar
- * Redirect from index.html to proper page
-
- * Bug fixes
- * Style fixes in the new layout
-
-## v0.8.1
-
- * Bug fixes
- * Style fixes in the new layout
-
-## v0.8.0
-
- * Enhancements
- * New and responsive layout without frames
-
-## v0.7.3
-
- * Bug fixes
- * Update [highlight.js][] with fixes some inlining issues
- * Require latest [Earmark][]
-
-## v0.7.2
-
- * Bug fixes
- * Support Elixir master
- * Fix error reporting when modules are compiled without docs
-
-## v0.7.1
-
- * Enhancements
- * Use `type=search` for search input
- * Update [highlight.js][] dependency
- * Properly tag code comments as coming from Elixir/IEx unless noted otherwise
- * Add support for hash redirection
-
-## v0.7.0
-
- * Enhancements
- * Documentation is now generated at `doc` to follow OTP "standard"
-
-## v0.6.2
-
- * Enhancements
- * Improvements to the document structure
- * Add syntax highlight
-
-## v0.6.1
-
- * Enhancements
- * Autolink modules and functions in the README
- * Generate ids for callbacks starting with "c:"
- * Ensure group ordering is consistent: TYPES > FUNCTIONS > MACROS > CALLBACKS
- * Allow users to search by Module.function
-
-## v0.6.0
-
- * Enhancements
- * Support Elixir v1.0.0-rc1
-
-## v0.5.2
-
- * Bug fixes
- * Use proper ANSI escape sequence on Mix success messages
-
-## v0.5.1
-
- * Enhancements
- * Support Elixir v0.15.0
- * Add support for [Earmark][] - no need for external processors
-
-## v0.5.0
-
- * Enhancements
- * First public release
- * Support [pandoc][] and [devinus/markdown][markdown] as markdown processors
-
-[pandoc]: http://pandoc.org/
-[markdown]: https://github.com/devinus/markdown
-[earmark]: https://github.com/pragdave/earmark
-[highlight.js]: https://highlightjs.org/
diff --git a/apps/plataforma_digital/deps/ex_doc/Cheatsheet.cheatmd b/apps/plataforma_digital/deps/ex_doc/Cheatsheet.cheatmd
deleted file mode 100644
index 49a715c8..00000000
--- a/apps/plataforma_digital/deps/ex_doc/Cheatsheet.cheatmd
+++ /dev/null
@@ -1,260 +0,0 @@
-# Cheatsheet User Guide
-
-This document is a cheatsheet on how to use cheatsheets.
-Cheatsheets are Markdown files with the `.cheatmd` extension. You may also check the source of this document as a reference.
-
-## I'm a H2 title with 2 columns
-{: .col-2}
-
-### I'm a H3 title
-
-#### I'm a H4 title.
-
-And this is a paragraph.
-
-### Code
-
-```elixir
-# hello.exs
-defmodule Greeter do
- def greet(name) do
- message = "Hello, " <> name <> "!"
- IO.puts message
- end
-end
-
-Greeter.greet("world")
-```
-
-### Paragraphs
-
-Paragraphs are also supported and can quote `code`.
-
-Several paragraphs are visually distinct.
-
-### Lists
-
-- Element 1
-- Element 2
-- `piece of code`
-
-### Table
-
-#### Date (H4 header)
-
-| Example | Output |
-| --- | --- |
-| `%m/%d/%Y` | `06/05/2013` |
-| `%A, %B %e, %Y` | `Sunday, June 5, 2013` |
-| `%b %e %a` | `Jun 5 Sun` |
-
-## Variants
-{: .col-2}
-
-### Adding variants
-
-```
-## H2
-{: .col-2}
-
-### H3
-{: .list-6}
-
-* example 1
-* example 2
-```
-
-Variants customize how your cheatsheet looks like via Markdown's inline attribute notation.
-
-### Header variants
-
-#### H2
-
-| `.col-2` | two-columns |
-| `.col-3` | three-columns |
-| `.col-2-left` | two-columns (1/3 - 2/3) |
-
-#### H3
-
-| `.list-4` | four-columns for lists |
-| `.list-6` | six-columns for lists |
-
-## Code
-{: .col-3}
-
-### Code with headings
-
-#### index.ex
-
-```
-Path.join(["~", "foo"])
-"~/foo"
-```
-
-#### other.ex
-
-```
-Path.join(["foo"])
-"foo"
-```
-
-Code blocks can have headings.
-
-### Long lines
-
-```elixir
-defmodule MyTracer do
- def trace({:remote_function, _meta, module, name, arity}, env) do
- IO.puts "#{env.file}:#{env.line} #{inspect(module)}.#{name}/#{arity}"
- :ok
- end
-
- def trace(_event, _env) do
- :ok
- end
-end
-```
-
-Long lines show scrollbars.
-
-### Line wrapping
-
-```elixir
-defmodule MyTracer do
- def trace({:remote_function, _meta, module, name, arity}, env) do
- IO.puts "#{env.file}:#{env.line} #{inspect(module)}.#{name}/#{arity}"
- :ok
- end
-
- def trace(_event, _env) do
- :ok
- end
-end
-```
-{: .wrap}
-
-Add `wrap` to wrap long lines.
-
-## Lists
-{: .col-2}
-
-### Bullet lists
-
-- This is
-- a list
-- with a few items
-
-### Ordered lists
-
-1. I'm first;
-2. You are second;
-3. We are third;
-
-Here's an extra paragraph after the list.
-
-### With headings and code links
-
-#### Part 1
-
-- `is_atom/1`
-- `is_binary/1`
-- `is_number/1`
-
-#### Part 2
-
-- `length/1`
-- `elem/2`
-
-## List columns
-
-### Six columns
-{: .list-6}
-
-- One
-- Two
-- Three
-- Four
-- Five
-- Six
-- Seven
-- Eight
-- Nine
-- Ten
-- Eleven
-
-Add `{: .list-6}` after the H3 title to make large lists.
-
-### Four columns
-{: .list-4}
-
-- One
-- Two
-- Three
-- Four
-- Five
-- Six
-- Seven
-- Eight
-- Nine
-- Ten
-- Eleven
-
-Add `{: .list-4}` after the H3 title to make large lists.
-
-## Full page
-
-This is the default.
-
-## Half width
-{: .width-50}
-
-### I make tables look nicer
-
-#### Time
-
-| Example | Output |
-| --- | --- |
-| `%H:%M` | `23:05` |
-| `%I:%M %p` | `11:05 PM` |
-
-Add `{: .width-50}` after the H2 title to use only half width.
-
-## Column left reference
-{: .col-2-left}
-
-### One
-
-```elixir
-# hello.exs
-defmodule Greeter do
- def greet(name) do
- message = "Hello, " <> name <> "!"
- IO.puts message
- end
-end
-
-Greeter.greet("world")
-```
-
-### Two
-
-```elixir
-user = %{
- name: "John",
- city: "Melbourne"
-}
-```
-
-```elixir
-IO.puts "Hello, " <> user.name
-```
-
-### Three
-
-* Yet
-* Another
-* List
-
-### Four
-
-I'm a grid, with 1/3 - 2/3 width.
\ No newline at end of file
diff --git a/apps/plataforma_digital/deps/ex_doc/LICENSE b/apps/plataforma_digital/deps/ex_doc/LICENSE
deleted file mode 100644
index ff133ccf..00000000
--- a/apps/plataforma_digital/deps/ex_doc/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 2012 Plataformatec
-Copyright 2021 The Elixir Team
-https://github.com/elixir-lang/ex_doc/
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-==========================================================================
-
-Dependencies are externally maintained and have their own licenses; we
-recommend you read them as their terms may differ from the terms above.
diff --git a/apps/plataforma_digital/deps/ex_doc/README.md b/apps/plataforma_digital/deps/ex_doc/README.md
deleted file mode 100644
index 7ed8f2dd..00000000
--- a/apps/plataforma_digital/deps/ex_doc/README.md
+++ /dev/null
@@ -1,406 +0,0 @@
-# ExDoc
-
-[![Build Status](https://github.com/elixir-lang/ex_doc/workflows/CI/badge.svg)](https://github.com/elixir-lang/ex_doc/actions?query=workflow%3A%22CI%22)
-
-ExDoc is a tool to generate documentation for your Elixir projects. To see an example, [you can access Elixir's official docs](https://hexdocs.pm/elixir/).
-
-To learn about how to document your projects, see [Elixir's writing documentation page](https://hexdocs.pm/elixir/writing-documentation.html).
-
-To see all supported options, see the documentation for [mix docs](https://hexdocs.pm/ex_doc/Mix.Tasks.Docs.html).
-
-## Features
-
-ExDoc ships with many features:
-
- * Automatically generates online- and offline-accessible HTML and EPUB documents from your API documentation.
- * Responsive design, covering phones and tablets.
- * Support for custom pages, guides, livebooks and cheatsheets.
- * Support for custom grouping of modules, functions, and pages in the sidebar.
- * Customizable logo.
- * A direct link back to the source code for every documented entity.
- * Full-text search.
- * Keyboard shortcuts. (Press `?` to show help.)
- * Quick-search with autocompletion support. (`s` keyboard shortcut.)
- * Go-to shortcut with auto-complete to take the reader to any HexDocs package documentation. (`g` keyboard shortcut.)
- * Support for night mode, activated according to the browser preference.
- * Tooltips for links to modules and functions, both for the current project and other projects.
- * Version dropdown, automatically configured when hosted on HexDocs.
-
-## Usage
-
-You can use ExDoc with Mix (recommended for Elixir projects), with Rebar (recommended for Erlang projects), or via the command line.
-
-### Using ExDoc with Mix
-
-ExDoc requires Elixir v1.10 or later.
-
-First, add ExDoc as a dependency:
-
-```elixir
-def deps do
- [
- {:ex_doc, "~> 0.27", only: :dev, runtime: false},
- ]
-end
-```
-
-Then run `mix deps.get`.
-
-> #### Erlang development environment {: .warning}
->
-> Some Operating System distributions split Erlang into multiple packages, and at least one ExDoc dependency (`earmark_parser`) requires the Erlang development environment. If you see a message like "/usr/lib/erlang/lib/parsetools-2.3.1/include/yeccpre.hrl: no such file or directory", it means you lack this environment. For instance, on the Debian operating system and its derivatives, you need to `apt install erlang-dev`.
-
-ExDoc will automatically pull in information from your projects, such as the application and version. However, you may want to set `:name`, `:source_url` and `:homepage_url` in order to have nicer output from ExDoc:
-
-```elixir
-def project do
- [
- app: :my_app,
- version: "0.1.0-dev",
- deps: deps(),
-
- # Docs
- name: "MyApp",
- source_url: "https://github.com/USER/PROJECT",
- homepage_url: "http://YOUR_PROJECT_HOMEPAGE",
- docs: [
- main: "MyApp", # The main page in the docs
- logo: "path/to/logo.png",
- extras: ["README.md"]
- ]
- ]
-end
-```
-
-Now you are ready to generate your project documentation with `mix docs`. To see all options available, run `mix help docs`.
-
-### Using ExDoc with Rebar3
-
-From Erlang/OTP 24+, you can use ExDoc to render your Erlang documentation written with EDoc. See [`rebar3_ex_doc`](https://github.com/starbelly/rebar3_ex_doc/) for more information.
-
-### Using ExDoc via command line
-
-You can use ExDoc via the command line.
-
-1. Install ExDoc as an escript:
-
- ```bash
- $ mix escript.install hex ex_doc
- ```
-
-2. Now you are ready to use it in your projects. Move into your project directory and make sure it's compiled:
-
- ```bash
- $ cd PATH_TO_YOUR_PROJECT
- $ mix compile
- ```
-
-3. Invoke the `ex_doc` executable from your project:
-
- ```bash
- $ ex_doc "PROJECT_NAME" "PROJECT_VERSION" _build/dev/lib/project/ebin -m "PROJECT_MODULE" -u "https://github.com/GITHUB_USER/GITHUB_REPO" -l path/to/logo.png
- ```
-
- Examples of appropriate values:
-
- ```plain
- PROJECT_NAME => Ecto
- PROJECT_VERSION => 0.1.0
- PROJECT_MODULE => Ecto (the main module provided by the library)
- GITHUB_USER => elixir-lang
- GITHUB_REPO => ecto
- ```
-
-## Syntax highlighting
-
-ExDoc uses [the makeup project](https://github.com/elixir-makeup/makeup) for syntax highlighting. By default, highlighters for Erlang and Elixir are included. To syntax-highlight other languages, simply add the equivalent `makeup_LANGUAGE` package to your `mix.exs`/`rebar.config` file. For example, for HTML support you would add:
-
-```elixir
-{:makeup_html, ">= 0.0.0", only: :dev, runtime: false}
-```
-
-You can find all supported languages under [the Makeup organization on GitHub](https://github.com/elixir-makeup) and view them at [Makeup's website](https://elixir-makeup.github.io/makeup_demo/).
-
-## Additional pages
-
-You can publish additional pages in your project documentation by configuring them as `:extras`. The following formats and extensions are supported:
-
- * Markdown (`.md` extension) - useful for general long-term text. [Learn more](https://daringfireball.net/projects/markdown/syntax).
-
- * Cheatsheets (`.cheatmd` extension) - useful for discovery and quick reference. [Learn more](https://hexdocs.pm/ex_doc/cheatsheet.html).
-
- * Livebooks (`.livemd` extension) - useful for tutorials, interactive examples and deep dives. [Learn more](https://livebook.dev/).
-
-For example, you can set your `:extras` to:
-
-```elixir
-extras: ["README.md", "LICENSE", "tutorial.livemd", "cheatsheet.cheatmd"]
-```
-
-Run `mix help docs` for more information on configuration.
-
-## Metadata
-
-ExDoc supports metadata keys in your documentation.
-
-In Elixir, you can add metadata to modules and functions.
-
-For a module, use `@moduledoc`, which is equivalent to adding the annotation to everything inside the module (functions, macros, callbacks, types):
-
-```elixir
-@moduledoc since: "1.10.0"
-```
-
-For a function, use `@doc`:
-
-```elixir
-@doc since: "1.13.1"
-```
-
-In Erlang's EDoc:
-
-```erlang
-%% @since 0.1.0
-```
-
-The following metadata is available for both modules and functions:
-
- * `deprecated` (string) - marks a module/function as deprecated, with the given string as the reason.
- * `since` (string) - declares a module/function available from a particular version.
-
-The following metadata is available for modules:
-
- * `tags` (list of atoms) - a list of strings to be added as tags to the module. (Not supported by EDoc.)
-
-## Auto-linking
-
-ExDoc for Elixir will automatically generate links across modules and functions if you enclose them in backticks.
-
- * When referring to a module, function, type or callback from your project, such as `` `MyModule` ``, ExDoc will automatically link to it.
- * When referring to a module, function, type or callback from Elixir, such as `` `String` ``, ExDoc will automatically link to it at Elixir's stable documentation.
- * When referring to a function, type, or callback from OTP, such as (`` `:queue.new/0` ``), ExDoc will automatically link to it at the OTP documentation.
- * When referring to a module, function, type or callback from any of your dependencies, such as `` `MyDep` ``, ExDoc will automatically link to it at the dependency's documentation at [hexdocs.pm](https://hexdocs.pm/). (The link can be configured by setting `docs: [deps: [my_dep: "https://path/to/docs/"]]` in your `mix.exs`.)
-
-ExDoc supports linking to modules (`` `MyModule` ``), functions (`` `MyModule.function/1` ``), types (`` `t:MyModule.type/2` ``) and callbacks (`` `c:MyModule.callback/3` ``). If you want to link a function, type or callback in the current module, you may skip the module name; e.g.: `` `function/1` ``.
-
-You can also use custom text; e.g.: `` [custom text](`MyModule.function/1`) ``. This also allows you to refer to OTP modules; e.g.: `` [`:array`](`:array`) ``.
-
-Link to extra pages using the syntax `` [Up and running](Up and running.md) ``, skipping the directory in which the page is. The final link will be automatically converted to `up-and-running.html`.
-
-## Admonition blocks
-
-You may want to draw attention to certain statements by taking them out of the content's flow and labeling them with a priority. Such statements are called admonitions. (They are also known as asides or callouts.) An admonition block is rendered based on the assigned label or class. ExDoc supports `warning`, `error`, `info`, `tip` and `neutral` tags, on header levels `h3` and `h4`.
-
-The syntax is as follows:
-
-```markdown
-> #### Error {: .error}
->
-> This syntax will render an error block
-```
-
-The result for the previous syntax is:
-
-> #### Error {: .error}
->
-> This syntax will render an error block
-
-For example, if you change the class name to `neutral`, you get the same admonition block in neutral style:
-
-> #### Neutral {: .neutral}
->
-> This syntax will render a neutral block
-
-## Tabsets
-
-Where only one section of content of a series is likely to apply to the reader, you may wish to define a set of tabs.
-
-This example contains code blocks, separating them into tabs based on language:
-
-
-
-### Elixir
-
-```elixir
-IO.puts "Hello, world!"
-```
-
-### Erlang
-
-```erlang
-io:fwrite("Hello, world!\n").
-```
-
-
-
-Tabbed content must be defined between `` and `` HTML comments. Each `h3` heading results in a new tab panel, with its text setting the tab button label.
-
-Here is the above example's source:
-
-````markdown
-
-
-### Elixir
-
-```elixir
-IO.puts "Hello, world!"
-```
-
-### Erlang
-
-```erlang
-io:fwrite("hello, world!\n").
-```
-
-
-````
-
-## Extensions
-
-ExDoc renders Markdown content for you, but you can extend it to render complex objects on the page using JavaScript. To inject custom JavaScript into every page, add this to your configuration:
-
-```elixir
-docs: [
- # ...
- before_closing_head_tag: &before_closing_head_tag/1,
- before_closing_body_tag: &before_closing_body_tag/1
-]
-
-# ...
-
-defp before_closing_head_tag(:html) do
- """
-
- """
-end
-
-defp before_closing_head_tag(:epub), do: ""
-
-defp before_closing_body_tag(:html) do
- """
-
- """
-end
-
-defp before_closing_body_tag(:epub), do: ""
-```
-
-Besides an anonymous function, you can also pass a `module-function-args` tuple. It will the given module and function, with the format prefixed to the arguments:
-
-```elixir
-docs: [
- # ...
- before_closing_head_tag: {MyModule, :before_closing_head_tag, []},
- before_closing_body_tag: {MyModule, :before_closing_body_tag, []}
-]
-```
-
-Or you can pass a map where the key is the format:
-
-```elixir
-docs: [
- # ...
- before_closing_head_tag: %{html: "...", epub: "..."},
- before_closing_body_tag: %{html: "...", epub: "..."}
-]
-```
-
-### Rendering Math
-
-If you write TeX-style math in your Markdown, such as `$\sum_{i}^{N} x_i$`, it ends up as raw text on the generated pages. To render expressions, we recommend using [KaTeX](https://katex.org/), a JavaScript library that turns expressions into graphics. To load and trigger KaTeX on every documentation page, we can insert the following HTML:
-
-```html
-
-
-
-
-
-
-
-
-```
-
-For more details and configuration options, see the [KaTeX Auto-render Extension](https://katex.org/docs/autorender.html).
-
-### Rendering Vega-Lite plots
-
-Snippets are also objects you may want to render in a special manner. For example, assuming your Markdown includes Vega-Lite specification in `vega-lite` code snippets:
-
-```html
-
-
-
-
-```
-
-For more details and configuration options, see [vega/vega-embed](https://github.com/vega/vega-embed).
-
-### Rendering Mermaid graphs
-
-Similarly to the example above, if your Markdown includes Mermaid graph specification in `mermaid` code snippets:
-
-```html
-
-
-```
-
-For more details and configuration options, see the [Mermaid usage docs](https://mermaid-js.github.io/mermaid/#/usage).
-
-## Contributing
-
-The easiest way to test changes to ExDoc is to locally rebuild the app and its own documentation:
-
- 1. Run `mix setup` to install all dependencies.
- 2. Run `mix build` to generate the docs. This is a custom alias that will build assets, recompile ExDoc, and output fresh docs into the `doc/` directory.
- 3. If working on the assets, you may wish to run the assets build script in watch mode: `npm run --prefix assets build:watch`.
- 4. Run `mix lint` to check if the Elixir and JavaScript files are properly formatted. You can run `mix fix` to let the JavaScript linter and Elixir formatter fix the code automatically before submitting your pull request.
- 5. Please do not add the files generated in the `formatters/` directory to your commits. These will be handled as necessary by the repository maintainers.
-
-See the README in the `assets/` directory for more information on working on the assets.
-
-## License
-
-ExDoc source code is released under the Apache 2 License. The generated contents, however, are under different licenses based on projects used to help render HTML, including CSS, JS, and other assets.
-
-Any documentation generated by ExDoc, or any documentation generated by any "Derivative Works" (as specified in the Apache 2 License), must include a direct, readable, and visible link to the [ExDoc repository](https://github.com/elixir-lang/ex_doc) on each rendered material. For HTML pages, every single page is a rendered material. For PDF, EPUB and other ebook formats, the whole body of documentation is a rendered material.
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-75RCTLK3.js b/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-75RCTLK3.js
deleted file mode 100644
index fe413151..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-75RCTLK3.js
+++ /dev/null
@@ -1 +0,0 @@
-(()=>{var s=document.querySelector.bind(document),o=document.querySelectorAll.bind(document);var a="hll";function c(){u()}function u(){o("[data-group-id]").forEach(e=>{let t=e.getAttribute("data-group-id");e.addEventListener("mouseenter",n=>{i(t,!0)}),e.addEventListener("mouseleave",n=>{i(t,!1)})})}function i(r,e){o(`[data-group-id="${r}"]`).forEach(n=>{n.classList.toggle(a,e)})}c();})();
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-elixir-OAJBJGFQ.css b/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-elixir-OAJBJGFQ.css
deleted file mode 100644
index c43b901e..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-elixir-OAJBJGFQ.css
+++ /dev/null
@@ -1 +0,0 @@
-:root{--main: hsl(250, 68%, 69%);--main-darkened-10: hsl(250, 68%, 59%);--main-darkened-20: hsl(250, 68%, 49%);--main-lightened-05: hsl(250, 68%, 74%);--main-lightened-10: hsl(250, 68%, 79%)}:root{--content-width: 949px;--content-gutter: 60px;--borderRadius: 4px;--serifFontFamily: "Merriweather", "Book Antiqua", Georgia, "Century Schoolbook", serif;--sansFontFamily: "Lato", sans-serif;--monoFontFamily: "Inconsolata", Menlo, Courier, monospace;--baseFontSize: 18px;--baseLineHeight: 1.5em;--gray25: hsl(207, 43%, 98% );--gray50: hsl(207, 43%, 96% );--gray100: hsl(212, 33%, 91% );--gray200: hsl(210, 29%, 88% );--gray300: hsl(210, 26%, 84% );--gray400: hsl(210, 21%, 64% );--gray500: hsl(210, 21%, 34% );--gray600: hsl(210, 27%, 26% );--gray700: hsl(212, 35%, 17% );--gray750: hsl(214, 46%, 14% );--gray800: hsl(216, 52%, 11% );--gray800-opacity-0: hsla(216, 52%, 11%, 0%);--gray850: hsl(216, 63%, 8% );--gray900: hsl(218, 73%, 4% );--gray900-opacity-50: hsla(218, 73%, 4%, 50%);--gray900-opacity-0: hsla(218, 73%, 4%, 0%);--coldGrayFaint: hsl(240, 5%, 97% );--coldGrayLight: hsl(240, 5%, 88% );--coldGray-lightened-10: hsl(240, 5%, 56% );--coldGray: hsl(240, 5%, 46% );--coldGrayDark: hsl(240, 5%, 28% );--coldGrayDim: hsl(240, 5%, 18% );--yellowLight: hsl( 60, 100%, 81% );--yellowDark: hsl( 60, 100%, 43%, 62%);--yellow: hsl( 60, 100%, 43% );--green-lightened-10: hsl( 90, 100%, 45% );--green: hsl( 90, 100%, 35% );--white: hsl( 0, 0%, 100% );--white-opacity-50: hsla( 0, 0%, 100%, 50%);--white-opacity-10: hsla( 0, 0%, 100%, 10%);--white-opacity-0: hsla( 0, 0%, 100%, 0%);--black: hsl( 0, 0%, 0% );--black-opacity-10: hsla( 0, 0%, 0%, 10%);--black-opacity-50: hsla( 0, 0%, 0%, 50%)}@media screen and (max-width: 768px){:root{--content-width: 100%;--content-gutter: 20px}}:root{--background: var(--white);--contrast: var(--black);--textBody: var(--gray700);--textHeaders: var(--gray800);--textDetailBackground: var(--coldGrayFaint);--textFooter: var(--gray600);--links: var(--black);--linksVisited: var(--black);--linksNoUnderline: var(--main-darkened-10);--linksNoUnderlineVisited: var(--main-darkened-20);--linksDecoration: var(--gray400);--iconAction: var(--coldGray);--iconActionHover: var(--gray800);--blockquoteBackground: var(--coldGrayFaint);--blockquoteBorder: var(--coldGrayLight);--warningBackground: hsl( 33, 100%, 97%);--warningHeadingBackground: hsl( 33, 87%, 64%);--warningHeading: var(--black);--errorBackground: hsl( 7, 81%, 96%);--errorHeadingBackground: hsl( 6, 80%, 60%);--errorHeading: var(--white);--infoBackground: hsl(206, 91%, 96%);--infoHeadingBackground: hsl(213, 92%, 62%);--infoHeading: var(--white);--neutralBackground: hsl(212, 29%, 92%);--neutralHeadingBackground: hsl(220, 43%, 11%);--neutralHeading: var(--white);--tipBackground: hsl(142, 31%, 93%);--tipHeadingBackground: hsl(134, 39%, 36%);--tipHeading: var(--white);--fnSpecAttr: var(--coldGray);--fnDeprecated: var(--yellowLight);--blink: var(--yellowLight);--codeBackground: var(--gray25);--codeBorder: var(--gray100);--codeScrollThumb: var(--gray400);--codeScrollBackground: var(--codeBorder);--admCodeBackground: var(--gray25);--admCodeBorder: var(--gray100);--admInlineCode: var(--black);--admInlineCodeBackground: var(--gray25);--admInlineCodeBorder: var(--gray100);--tabBackground: var(--white);--tabBorder: var(--gray300);--tabBorderTop: var(--gray100);--tab: var(--gray600);--tabShadow: var(--gray25);--bottomActionsBtnBorder: var(--black-opacity-10);--bottomActionsBtnSubheader: var(--main-darkened-10);--modalBackground: var(--white);--settingsInput: var(--gray500);--settingsInputBackground: var(--white);--settingsInputBorder: var(--gray300);--settingsSectionBorder: var(--gray300);--quickSwitchInput: var(--gray500);--quickSwitchContour: var(--coldGray);--success: var(--green);--sidebarButtonBackground: linear-gradient(180deg, var(--white) 20%, var(--white-opacity-50) 70%, var(--white-opacity-0) 100%);--sidebarAccentMain: var(--gray50);--sidebarBackground: var(--gray800);--sidebarHeader: var(--gray700);--sidebarMuted: var(--gray300);--sidebarHover: var(--white);--sidebarScrollbarThumb: var(--coldGray);--sidebarScrollbarTrack: var(--sidebarBackground);--sidebarSearch: var(--gray700);--sidebarSubheadings: var(--gray400);--sidebarItem: var(--gray200);--sidebarInactiveItemMarker: var(--gray600);--sidebarLanguageAccentBar: var(--main);--sidebarActiveItem: var(--main-lightened-10)}.content-inner :is(a.no-underline,pre a){color:var(--linksNoUnderline);text-shadow:none;text-decoration:none;background-image:none}.content-inner :is(a.no-underline,pre a):is(:visited,:active,:focus,:hover){color:var(--linksNoUnderlineVisited)}.content-inner code{background-color:var(--codeBackground);vertical-align:baseline;border-radius:2px;padding:.1em .2em;border:1px solid var(--codeBorder);text-transform:none}.content-inner pre{margin:var(--baseLineHeight) 0}.content-inner pre code{display:block;overflow-x:auto;white-space:inherit;padding:.5em 1em}.content-inner pre code::-webkit-scrollbar{width:.4rem;height:.4rem}.content-inner pre code::-webkit-scrollbar-thumb{border-radius:.25rem;background-color:var(--codeScrollThumb)}.content-inner pre code::-webkit-scrollbar-track{background-color:var(--codeScrollBackground)}.content-inner pre code::-webkit-scrollbar-corner{background-color:var(--codeScrollBackground)}.content-inner pre code.output{margin:0 12px;max-height:400px;overflow:auto}.content-inner pre code.output+.copy-button{margin-right:12px}.content-inner pre code.output:before{content:"Output";display:block;position:absolute;top:-16px;left:12px;padding:2px 4px;font-size:12px;font-family:var(--monoFontFamily);line-height:1;color:var(--textHeaders);background-color:var(--codeBackground);border:1px solid var(--codeBorder);border-bottom:0;border-radius:2px}@media screen and (max-width: 768px){.content-inner>pre,.content-inner section>pre{margin-left:calc(-1 * var(--content-gutter));margin-right:calc(-1 * var(--content-gutter))}.content-inner>pre code,.content-inner section>pre code{padding-left:var(--content-gutter);padding-right:var(--content-gutter);border-radius:0;border-left-width:0;border-right-width:0}}@keyframes blink-background{0%{background-color:var(--textDetailBackground)}to{background-color:var(--blink)}}.content-inner .detail:target .detail-header{animation-duration:.55s;animation-name:blink-background;animation-iteration-count:1;animation-timing-function:ease-in-out}.content-inner .detail-header{margin:2em 0 1em;padding:.5em 1em;background-color:var(--textDetailBackground);border-left:3px solid var(--main);font-size:1em;font-family:var(--monoFontFamily);position:relative}.content-inner .detail-header .note{float:right}.content-inner .detail-header .signature{display:inline-block;font-family:var(--monoFontFamily);font-size:1rem;font-weight:700}.content-inner .detail-header:hover a.detail-link,.content-inner .detail-header a.detail-link:focus{opacity:1;text-decoration:none}.content-inner .detail-header a.detail-link{transition:opacity .3s ease-in-out;position:absolute;top:0;left:0;display:block;opacity:0;padding:.6em;line-height:1.5em;margin-left:-2.5em;text-decoration:none;border:none}@media screen and (max-width: 768px){.content-inner .detail-header a.detail-link{margin-left:-30px}}.content-inner .specs pre{font-family:var(--monoFontFamily);font-size:.9em;font-style:normal;line-height:24px;white-space:pre-wrap;margin:0;padding:0}.content-inner .specs .attribute{color:var(--fnSpecAttr)}.content-inner .docstring{margin:1.2em 0 3em 1.2em}@media screen and (max-width: 768px){.content-inner .docstring{margin-left:0}}.content-inner .docstring:is(h2,h3,h4,h5){font-weight:700}.content-inner .docstring h2{font-size:1.1em}.content-inner .docstring h3{font-size:1em}.content-inner .docstring h4{font-size:.95em}.content-inner .docstring h5{font-size:.9em}.content-inner div.deprecated{display:block;padding:9px 15px;background-color:var(--fnDeprecated)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;user-select:none}code.makeup .unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.makeup .hll{background-color:#ffc}.makeup .bp{color:#3465a4}.makeup .c,.makeup .c1,.makeup .ch,.makeup .cm,.makeup .cp,.makeup .cpf,.makeup .cs{color:#4d4d4d}.makeup .dl{color:#408200}.makeup .err{color:#a40000;border:#ef2929}.makeup .fm,.makeup .g{color:#4d4d4c}.makeup .gd{color:#a40000}.makeup .ge{color:#4d4d4c;font-style:italic}.makeup .gh{color:navy;font-weight:700}.makeup .gi{color:#00a000}.makeup .go{color:#4d4d4c;font-style:italic}.makeup .gp{color:#4d4d4d}.makeup .gr{color:#ef2929}.makeup .gs{color:#4d4d4c;font-weight:700}.makeup .gt{color:#a40000;font-weight:700}.makeup .gu{color:purple;font-weight:700}.makeup .il{color:#0000cf;font-weight:700}.makeup .k,.makeup .kc,.makeup .kd,.makeup .kn,.makeup .kp,.makeup .kr,.makeup .kt{color:#204a87}.makeup .l{color:#4d4d4c}.makeup .ld{color:#c00}.makeup .m,.makeup .mb,.makeup .mf,.makeup .mh,.makeup .mi,.makeup .mo{color:#2937ab}.makeup .n{color:#4d4d4c}.makeup .na{color:#8a7000}.makeup .nb{color:#204a87}.makeup .nc{color:#0000cf}.makeup .nd{color:#5c35cc;font-weight:700}.makeup .ne{color:#c00;font-weight:700}.makeup .nf{color:#b65800}.makeup .ni{color:#bc5400}.makeup .nl{color:#b65800}.makeup .nn{color:#4d4d4c}.makeup .no{color:#a06600}.makeup .nt{color:#204a87;font-weight:700}.makeup .nv,.makeup .nx{color:#4d4d4c}.makeup .o{color:#bc5400}.makeup .ow{color:#204a87}.makeup .p,.makeup .py{color:#4d4d4c}.makeup .s,.makeup .s1,.makeup .s2,.makeup .sa,.makeup .sb,.makeup .sc{color:#408200}.makeup .sd{color:#8f5902;font-style:italic}.makeup .se{color:#204a87}.makeup .sh{color:#408200}.makeup .si{color:#204a87}.makeup .sr{color:#c00}.makeup .ss{color:#a06600}.makeup .sx{color:#408200}.makeup .vc,.makeup .vg,.makeup .vi,.makeup .vm,.makeup .x{color:#4d4d4c}.dark .makeup{color:#dce1e6}.dark .makeup .hll{background-color:#49483e}.dark .makeup .bp{color:#dce1e6}.dark .makeup .c,.dark .makeup .c1,.dark .makeup .ch,.dark .makeup .cm,.dark .makeup .cp,.dark .makeup .cpf,.dark .makeup .cs{color:#969386}.dark .makeup .dl{color:#e6db74}.dark .makeup .err{color:#960050;background-color:#1e0010}.dark .makeup .fm{color:#a6e22e}.dark .makeup .gd{color:#ff5385}.dark .makeup .ge{font-style:italic}.dark .makeup .gi{color:#a6e22e}.dark .makeup .gp{color:#969386}.dark .makeup .gs{font-weight:700}.dark .makeup .gu{color:#969386}.dark .makeup .gt{color:#ff5385;font-weight:700}.dark .makeup .il{color:#ae81ff}.dark .makeup .k,.dark .makeup .kc,.dark .makeup .kd{color:#66d9ef}.dark .makeup .kn{color:#ff5385}.dark .makeup .kp,.dark .makeup .kr,.dark .makeup .kt{color:#66d9ef}.dark .makeup .l,.dark .makeup .ld,.dark .makeup .m,.dark .makeup .mb,.dark .makeup .mf,.dark .makeup .mh,.dark .makeup .mi,.dark .makeup .mo{color:#ae81ff}.dark .makeup .n{color:#dce1e6}.dark .makeup .na{color:#a6e22e}.dark .makeup .nb{color:#dce1e6}.dark .makeup .nc,.dark .makeup .nd,.dark .makeup .ne,.dark .makeup .nf{color:#a6e22e}.dark .makeup .ni,.dark .makeup .nl,.dark .makeup .nn{color:#dce1e6}.dark .makeup .no{color:#66d9ef}.dark .makeup .nt{color:#ff5385}.dark .makeup .nv{color:#dce1e6}.dark .makeup .nx{color:#a6e22e}.dark .makeup .o,.dark .makeup .ow{color:#ff5385}.dark .makeup .p,.dark .makeup .py{color:#dce1e6}.dark .makeup .s,.dark .makeup .s1,.dark .makeup .s2,.dark .makeup .sa,.dark .makeup .sb,.dark .makeup .sc,.dark .makeup .sd{color:#e6db74}.dark .makeup .se{color:#ae81ff}.dark .makeup .sh,.dark .makeup .si,.dark .makeup .sr,.dark .makeup .ss,.dark .makeup .sx{color:#e6db74}.dark .makeup .vc,.dark .makeup .vg,.dark .makeup .vi,.dark .makeup .vm{color:#dce1e6}body{display:block;font-size:1em;line-height:1.2;padding-left:0;padding-right:0;margin:0 5pt}nav>ol{list-style-type:square}nav>ol ol{list-style-type:disc}.title-container{text-align:center}img[src*="#gh-dark-mode-only"]{display:none}
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-erlang-GOUKTTJJ.css b/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-erlang-GOUKTTJJ.css
deleted file mode 100644
index cf30048d..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/epub/dist/epub-erlang-GOUKTTJJ.css
+++ /dev/null
@@ -1 +0,0 @@
-:root{--main: hsl(0, 100%, 64%);--main-darkened-10: hsl(0, 100%, 54%);--main-darkened-20: hsl(0, 100%, 44%);--main-lightened-05: hsl(0, 100%, 69%);--main-lightened-10: hsl(0, 100%, 74%)}:root{--content-width: 949px;--content-gutter: 60px;--borderRadius: 4px;--serifFontFamily: "Merriweather", "Book Antiqua", Georgia, "Century Schoolbook", serif;--sansFontFamily: "Lato", sans-serif;--monoFontFamily: "Inconsolata", Menlo, Courier, monospace;--baseFontSize: 18px;--baseLineHeight: 1.5em;--gray25: hsl(207, 43%, 98% );--gray50: hsl(207, 43%, 96% );--gray100: hsl(212, 33%, 91% );--gray200: hsl(210, 29%, 88% );--gray300: hsl(210, 26%, 84% );--gray400: hsl(210, 21%, 64% );--gray500: hsl(210, 21%, 34% );--gray600: hsl(210, 27%, 26% );--gray700: hsl(212, 35%, 17% );--gray750: hsl(214, 46%, 14% );--gray800: hsl(216, 52%, 11% );--gray800-opacity-0: hsla(216, 52%, 11%, 0%);--gray850: hsl(216, 63%, 8% );--gray900: hsl(218, 73%, 4% );--gray900-opacity-50: hsla(218, 73%, 4%, 50%);--gray900-opacity-0: hsla(218, 73%, 4%, 0%);--coldGrayFaint: hsl(240, 5%, 97% );--coldGrayLight: hsl(240, 5%, 88% );--coldGray-lightened-10: hsl(240, 5%, 56% );--coldGray: hsl(240, 5%, 46% );--coldGrayDark: hsl(240, 5%, 28% );--coldGrayDim: hsl(240, 5%, 18% );--yellowLight: hsl( 60, 100%, 81% );--yellowDark: hsl( 60, 100%, 43%, 62%);--yellow: hsl( 60, 100%, 43% );--green-lightened-10: hsl( 90, 100%, 45% );--green: hsl( 90, 100%, 35% );--white: hsl( 0, 0%, 100% );--white-opacity-50: hsla( 0, 0%, 100%, 50%);--white-opacity-10: hsla( 0, 0%, 100%, 10%);--white-opacity-0: hsla( 0, 0%, 100%, 0%);--black: hsl( 0, 0%, 0% );--black-opacity-10: hsla( 0, 0%, 0%, 10%);--black-opacity-50: hsla( 0, 0%, 0%, 50%)}@media screen and (max-width: 768px){:root{--content-width: 100%;--content-gutter: 20px}}:root{--background: var(--white);--contrast: var(--black);--textBody: var(--gray700);--textHeaders: var(--gray800);--textDetailBackground: var(--coldGrayFaint);--textFooter: var(--gray600);--links: var(--black);--linksVisited: var(--black);--linksNoUnderline: var(--main-darkened-10);--linksNoUnderlineVisited: var(--main-darkened-20);--linksDecoration: var(--gray400);--iconAction: var(--coldGray);--iconActionHover: var(--gray800);--blockquoteBackground: var(--coldGrayFaint);--blockquoteBorder: var(--coldGrayLight);--warningBackground: hsl( 33, 100%, 97%);--warningHeadingBackground: hsl( 33, 87%, 64%);--warningHeading: var(--black);--errorBackground: hsl( 7, 81%, 96%);--errorHeadingBackground: hsl( 6, 80%, 60%);--errorHeading: var(--white);--infoBackground: hsl(206, 91%, 96%);--infoHeadingBackground: hsl(213, 92%, 62%);--infoHeading: var(--white);--neutralBackground: hsl(212, 29%, 92%);--neutralHeadingBackground: hsl(220, 43%, 11%);--neutralHeading: var(--white);--tipBackground: hsl(142, 31%, 93%);--tipHeadingBackground: hsl(134, 39%, 36%);--tipHeading: var(--white);--fnSpecAttr: var(--coldGray);--fnDeprecated: var(--yellowLight);--blink: var(--yellowLight);--codeBackground: var(--gray25);--codeBorder: var(--gray100);--codeScrollThumb: var(--gray400);--codeScrollBackground: var(--codeBorder);--admCodeBackground: var(--gray25);--admCodeBorder: var(--gray100);--admInlineCode: var(--black);--admInlineCodeBackground: var(--gray25);--admInlineCodeBorder: var(--gray100);--tabBackground: var(--white);--tabBorder: var(--gray300);--tabBorderTop: var(--gray100);--tab: var(--gray600);--tabShadow: var(--gray25);--bottomActionsBtnBorder: var(--black-opacity-10);--bottomActionsBtnSubheader: var(--main-darkened-10);--modalBackground: var(--white);--settingsInput: var(--gray500);--settingsInputBackground: var(--white);--settingsInputBorder: var(--gray300);--settingsSectionBorder: var(--gray300);--quickSwitchInput: var(--gray500);--quickSwitchContour: var(--coldGray);--success: var(--green);--sidebarButtonBackground: linear-gradient(180deg, var(--white) 20%, var(--white-opacity-50) 70%, var(--white-opacity-0) 100%);--sidebarAccentMain: var(--gray50);--sidebarBackground: var(--gray800);--sidebarHeader: var(--gray700);--sidebarMuted: var(--gray300);--sidebarHover: var(--white);--sidebarScrollbarThumb: var(--coldGray);--sidebarScrollbarTrack: var(--sidebarBackground);--sidebarSearch: var(--gray700);--sidebarSubheadings: var(--gray400);--sidebarItem: var(--gray200);--sidebarInactiveItemMarker: var(--gray600);--sidebarLanguageAccentBar: var(--main);--sidebarActiveItem: var(--main-lightened-10)}.content-inner :is(a.no-underline,pre a){color:var(--linksNoUnderline);text-shadow:none;text-decoration:none;background-image:none}.content-inner :is(a.no-underline,pre a):is(:visited,:active,:focus,:hover){color:var(--linksNoUnderlineVisited)}.content-inner code{background-color:var(--codeBackground);vertical-align:baseline;border-radius:2px;padding:.1em .2em;border:1px solid var(--codeBorder);text-transform:none}.content-inner pre{margin:var(--baseLineHeight) 0}.content-inner pre code{display:block;overflow-x:auto;white-space:inherit;padding:.5em 1em}.content-inner pre code::-webkit-scrollbar{width:.4rem;height:.4rem}.content-inner pre code::-webkit-scrollbar-thumb{border-radius:.25rem;background-color:var(--codeScrollThumb)}.content-inner pre code::-webkit-scrollbar-track{background-color:var(--codeScrollBackground)}.content-inner pre code::-webkit-scrollbar-corner{background-color:var(--codeScrollBackground)}.content-inner pre code.output{margin:0 12px;max-height:400px;overflow:auto}.content-inner pre code.output+.copy-button{margin-right:12px}.content-inner pre code.output:before{content:"Output";display:block;position:absolute;top:-16px;left:12px;padding:2px 4px;font-size:12px;font-family:var(--monoFontFamily);line-height:1;color:var(--textHeaders);background-color:var(--codeBackground);border:1px solid var(--codeBorder);border-bottom:0;border-radius:2px}@media screen and (max-width: 768px){.content-inner>pre,.content-inner section>pre{margin-left:calc(-1 * var(--content-gutter));margin-right:calc(-1 * var(--content-gutter))}.content-inner>pre code,.content-inner section>pre code{padding-left:var(--content-gutter);padding-right:var(--content-gutter);border-radius:0;border-left-width:0;border-right-width:0}}@keyframes blink-background{0%{background-color:var(--textDetailBackground)}to{background-color:var(--blink)}}.content-inner .detail:target .detail-header{animation-duration:.55s;animation-name:blink-background;animation-iteration-count:1;animation-timing-function:ease-in-out}.content-inner .detail-header{margin:2em 0 1em;padding:.5em 1em;background-color:var(--textDetailBackground);border-left:3px solid var(--main);font-size:1em;font-family:var(--monoFontFamily);position:relative}.content-inner .detail-header .note{float:right}.content-inner .detail-header .signature{display:inline-block;font-family:var(--monoFontFamily);font-size:1rem;font-weight:700}.content-inner .detail-header:hover a.detail-link,.content-inner .detail-header a.detail-link:focus{opacity:1;text-decoration:none}.content-inner .detail-header a.detail-link{transition:opacity .3s ease-in-out;position:absolute;top:0;left:0;display:block;opacity:0;padding:.6em;line-height:1.5em;margin-left:-2.5em;text-decoration:none;border:none}@media screen and (max-width: 768px){.content-inner .detail-header a.detail-link{margin-left:-30px}}.content-inner .specs pre{font-family:var(--monoFontFamily);font-size:.9em;font-style:normal;line-height:24px;white-space:pre-wrap;margin:0;padding:0}.content-inner .specs .attribute{color:var(--fnSpecAttr)}.content-inner .docstring{margin:1.2em 0 3em 1.2em}@media screen and (max-width: 768px){.content-inner .docstring{margin-left:0}}.content-inner .docstring:is(h2,h3,h4,h5){font-weight:700}.content-inner .docstring h2{font-size:1.1em}.content-inner .docstring h3{font-size:1em}.content-inner .docstring h4{font-size:.95em}.content-inner .docstring h5{font-size:.9em}.content-inner div.deprecated{display:block;padding:9px 15px;background-color:var(--fnDeprecated)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;user-select:none}code.makeup .unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.makeup .hll{background-color:#ffc}.makeup .bp{color:#3465a4}.makeup .c,.makeup .c1,.makeup .ch,.makeup .cm,.makeup .cp,.makeup .cpf,.makeup .cs{color:#4d4d4d}.makeup .dl{color:#408200}.makeup .err{color:#a40000;border:#ef2929}.makeup .fm,.makeup .g{color:#4d4d4c}.makeup .gd{color:#a40000}.makeup .ge{color:#4d4d4c;font-style:italic}.makeup .gh{color:navy;font-weight:700}.makeup .gi{color:#00a000}.makeup .go{color:#4d4d4c;font-style:italic}.makeup .gp{color:#4d4d4d}.makeup .gr{color:#ef2929}.makeup .gs{color:#4d4d4c;font-weight:700}.makeup .gt{color:#a40000;font-weight:700}.makeup .gu{color:purple;font-weight:700}.makeup .il{color:#0000cf;font-weight:700}.makeup .k,.makeup .kc,.makeup .kd,.makeup .kn,.makeup .kp,.makeup .kr,.makeup .kt{color:#204a87}.makeup .l{color:#4d4d4c}.makeup .ld{color:#c00}.makeup .m,.makeup .mb,.makeup .mf,.makeup .mh,.makeup .mi,.makeup .mo{color:#2937ab}.makeup .n{color:#4d4d4c}.makeup .na{color:#8a7000}.makeup .nb{color:#204a87}.makeup .nc{color:#0000cf}.makeup .nd{color:#5c35cc;font-weight:700}.makeup .ne{color:#c00;font-weight:700}.makeup .nf{color:#b65800}.makeup .ni{color:#bc5400}.makeup .nl{color:#b65800}.makeup .nn{color:#4d4d4c}.makeup .no{color:#a06600}.makeup .nt{color:#204a87;font-weight:700}.makeup .nv,.makeup .nx{color:#4d4d4c}.makeup .o{color:#bc5400}.makeup .ow{color:#204a87}.makeup .p,.makeup .py{color:#4d4d4c}.makeup .s,.makeup .s1,.makeup .s2,.makeup .sa,.makeup .sb,.makeup .sc{color:#408200}.makeup .sd{color:#8f5902;font-style:italic}.makeup .se{color:#204a87}.makeup .sh{color:#408200}.makeup .si{color:#204a87}.makeup .sr{color:#c00}.makeup .ss{color:#a06600}.makeup .sx{color:#408200}.makeup .vc,.makeup .vg,.makeup .vi,.makeup .vm,.makeup .x{color:#4d4d4c}.dark .makeup{color:#dce1e6}.dark .makeup .hll{background-color:#49483e}.dark .makeup .bp{color:#dce1e6}.dark .makeup .c,.dark .makeup .c1,.dark .makeup .ch,.dark .makeup .cm,.dark .makeup .cp,.dark .makeup .cpf,.dark .makeup .cs{color:#969386}.dark .makeup .dl{color:#e6db74}.dark .makeup .err{color:#960050;background-color:#1e0010}.dark .makeup .fm{color:#a6e22e}.dark .makeup .gd{color:#ff5385}.dark .makeup .ge{font-style:italic}.dark .makeup .gi{color:#a6e22e}.dark .makeup .gp{color:#969386}.dark .makeup .gs{font-weight:700}.dark .makeup .gu{color:#969386}.dark .makeup .gt{color:#ff5385;font-weight:700}.dark .makeup .il{color:#ae81ff}.dark .makeup .k,.dark .makeup .kc,.dark .makeup .kd{color:#66d9ef}.dark .makeup .kn{color:#ff5385}.dark .makeup .kp,.dark .makeup .kr,.dark .makeup .kt{color:#66d9ef}.dark .makeup .l,.dark .makeup .ld,.dark .makeup .m,.dark .makeup .mb,.dark .makeup .mf,.dark .makeup .mh,.dark .makeup .mi,.dark .makeup .mo{color:#ae81ff}.dark .makeup .n{color:#dce1e6}.dark .makeup .na{color:#a6e22e}.dark .makeup .nb{color:#dce1e6}.dark .makeup .nc,.dark .makeup .nd,.dark .makeup .ne,.dark .makeup .nf{color:#a6e22e}.dark .makeup .ni,.dark .makeup .nl,.dark .makeup .nn{color:#dce1e6}.dark .makeup .no{color:#66d9ef}.dark .makeup .nt{color:#ff5385}.dark .makeup .nv{color:#dce1e6}.dark .makeup .nx{color:#a6e22e}.dark .makeup .o,.dark .makeup .ow{color:#ff5385}.dark .makeup .p,.dark .makeup .py{color:#dce1e6}.dark .makeup .s,.dark .makeup .s1,.dark .makeup .s2,.dark .makeup .sa,.dark .makeup .sb,.dark .makeup .sc,.dark .makeup .sd{color:#e6db74}.dark .makeup .se{color:#ae81ff}.dark .makeup .sh,.dark .makeup .si,.dark .makeup .sr,.dark .makeup .ss,.dark .makeup .sx{color:#e6db74}.dark .makeup .vc,.dark .makeup .vg,.dark .makeup .vi,.dark .makeup .vm{color:#dce1e6}body{display:block;font-size:1em;line-height:1.2;padding-left:0;padding-right:0;margin:0 5pt}nav>ol{list-style-type:square}nav>ol ol{list-style-type:disc}.title-container{text-align:center}img[src*="#gh-dark-mode-only"]{display:none}
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/com.apple.ibooks.display-options.xml b/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/com.apple.ibooks.display-options.xml
deleted file mode 100644
index d9f042ab..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/com.apple.ibooks.display-options.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/container.xml b/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/container.xml
deleted file mode 100644
index 8b80cd07..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/epub/metainfo/container.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/apps/plataforma_digital/deps/ex_doc/formatters/html/dist/handlebars.runtime-NWIB6V2M.js b/apps/plataforma_digital/deps/ex_doc/formatters/html/dist/handlebars.runtime-NWIB6V2M.js
deleted file mode 100644
index 117dc6c9..00000000
--- a/apps/plataforma_digital/deps/ex_doc/formatters/html/dist/handlebars.runtime-NWIB6V2M.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/**!
-
- @license
- handlebars v4.7.7
-
-Copyright (C) 2011-2019 by Yehuda Katz
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/(function(r,e){typeof exports=="object"&&typeof module=="object"?module.exports=e():typeof define=="function"&&define.amd?define([],e):typeof exports=="object"?exports.Handlebars=e():r.Handlebars=e()})(this,function(){return function(u){var r={};function e(n){if(r[n])return r[n].exports;var t=r[n]={exports:{},id:n,loaded:!1};return u[n].call(t.exports,t,t.exports,e),t.loaded=!0,t.exports}return e.m=u,e.c=r,e.p="",e(0)}([function(u,r,e){"use strict";var n=e(1).default,t=e(2).default;r.__esModule=!0;var f=e(3),a=n(f),i=e(36),l=t(i),h=e(5),v=t(h),P=e(4),H=n(P),C=e(37),E=n(C),I=e(43),o=t(I);function g(){var y=new a.HandlebarsEnvironment;return H.extend(y,a),y.SafeString=l.default,y.Exception=v.default,y.Utils=H,y.escapeExpression=H.escapeExpression,y.VM=E,y.template=function(p){return E.template(p,y)},y}var w=g();w.create=g,o.default(w),w.default=w,r.default=w,u.exports=r.default},function(u,r){"use strict";r.default=function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n},r.__esModule=!0},function(u,r){"use strict";r.default=function(e){return e&&e.__esModule?e:{default:e}},r.__esModule=!0},function(u,r,e){"use strict";var n=e(2).default;r.__esModule=!0,r.HandlebarsEnvironment=g;var t=e(4),f=e(5),a=n(f),i=e(9),l=e(29),h=e(31),v=n(h),P=e(32),H="4.7.7";r.VERSION=H;var C=8;r.COMPILER_REVISION=C;var E=7;r.LAST_COMPATIBLE_COMPILER_REVISION=E;var I={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};r.REVISION_CHANGES=I;var o="[object Object]";function g(y,p,R){this.helpers=y||{},this.partials=p||{},this.decorators=R||{},i.registerDefaultHelpers(this),l.registerDefaultDecorators(this)}g.prototype={constructor:g,logger:v.default,log:v.default.log,registerHelper:function(p,R){if(t.toString.call(p)===o){if(R)throw new a.default("Arg not supported with multiple helpers");t.extend(this.helpers,p)}else this.helpers[p]=R},unregisterHelper:function(p){delete this.helpers[p]},registerPartial:function(p,R){if(t.toString.call(p)===o)t.extend(this.partials,p);else{if(typeof R>"u")throw new a.default('Attempting to register a partial called "'+p+'" as undefined');this.partials[p]=R}},unregisterPartial:function(p){delete this.partials[p]},registerDecorator:function(p,R){if(t.toString.call(p)===o){if(R)throw new a.default("Arg not supported with multiple decorators");t.extend(this.decorators,p)}else this.decorators[p]=R},unregisterDecorator:function(p){delete this.decorators[p]},resetLoggedPropertyAccesses:function(){P.resetLoggedProperties()}};var w=v.default.log;r.log=w,r.createFrame=t.createFrame,r.logger=v.default},function(u,r){"use strict";r.__esModule=!0,r.extend=a,r.indexOf=v,r.escapeExpression=P,r.isEmpty=H,r.createFrame=C,r.blockParams=E,r.appendContextPath=I;var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},n=/[&<>"'`=]/g,t=/[&<>"'`=]/;function f(o){return e[o]}function a(o){for(var g=1;g0?(a.ids&&(a.ids=[a.name]),t.helpers.each(f,a)):i(this);if(a.data&&a.ids){var h=n.createFrame(a.data);h.contextPath=n.appendContextPath(a.data.contextPath,a.name),a={data:h}}return l(f,a)})},u.exports=r.default},function(u,r,e){(function(n){"use strict";var t=e(12).default,f=e(2).default;r.__esModule=!0;var a=e(4),i=e(5),l=f(i);r.default=function(h){h.registerHelper("each",function(v,P){if(!P)throw new l.default("Must pass iterator to #each");var H=P.fn,C=P.inverse,E=0,I="",o=void 0,g=void 0;P.data&&P.ids&&(g=a.appendContextPath(P.data.contextPath,P.ids[0])+"."),a.isFunction(v)&&(v=v.call(this)),P.data&&(o=a.createFrame(P.data));function w(b,F,c){o&&(o.key=b,o.index=F,o.first=F===0,o.last=!!c,g&&(o.contextPath=g+b)),I=I+H(v[b],{data:o,blockParams:a.blockParams([v[b],b],[g+b,null])})}if(v&&typeof v=="object")if(a.isArray(v))for(var y=v.length;E=0?a=i:a=parseInt(a,10)}return a},log:function(a){if(a=t.lookupLevel(a),typeof console<"u"&&t.lookupLevel(t.level)<=a){var i=t.methodMap[a];console[i]||(i="log");for(var l=arguments.length,h=Array(l>1?l-1:0),v=1;v=P.LAST_COMPATIBLE_COMPILER_REVISION&&O<=P.COMPILER_REVISION))if(O{(function(){var y=Handlebars.template,d=Handlebars.templates=Handlebars.templates||{};d["autocomplete-suggestions"]=y({1:function(n,l,a,f,r){var e,o,u=l??(n.nullContext||{}),s=n.hooks.helperMissing,i="function",c=n.escapeExpression,t=n.lookupProperty||function(p,m){if(Object.prototype.hasOwnProperty.call(p,m))return p[m]};return'
-
Sorry, we couldn't find anything for "+n.escapeExpression((e=(e=o(a,"value")||(l!=null?o(l,"value"):l))!=null?e:n.hooks.helperMissing,typeof e=="function"?e.call(l??(n.nullContext||{}),{name:"value",hash:{},data:r,loc:{start:{line:29,column:48},end:{line:29,column:57}}}):e))+`.