-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new format for ignore_file_strict: {file, warning_description} (#493
- Loading branch information
Showing
12 changed files
with
154 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
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 = warning(warning_name) | ||
warning = Utils.warning(warning_name) | ||
string = warning.format_short(arguments) | ||
|
||
"::warning file=#{base_name},line=#{line},title=#{warning_name}::#{string}" | ||
end | ||
|
||
defp 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
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 = warning(warning_name) | ||
warning = Utils.warning(warning_name) | ||
string = warning.format_short(arguments) | ||
|
||
"#{base_name}:#{line}:#{warning_name} #{string}" | ||
end | ||
|
||
defp 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{"lib/poorly_written_code.ex", "Function do_a_thing/1 has no local return."}, | ||
{"lib/poorly_written_code.ex", "Function do_something_else/2 has no local return."}, | ||
{"lib/poorly_written_code.ex", "Function do_many_things/3 has no local return."} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule IgnoreStrict.Mixfile do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
app: :ignore_strict, | ||
version: "0.1.0", | ||
dialyzer: [ | ||
ignore_warnings: "ignore_strict_test.exs", | ||
list_unused_filters: true | ||
] | ||
] | ||
end | ||
end |