Skip to content

Commit a251ccc

Browse files
committed
Format raise message consistently
Kernel.raise messages should not start with uppercase, and should not have trailing punctuation. Mix.raise messages should start with uppercase, and should not have a trailing puntuation. # starting with uppercase # exclude (Mix.raise, and any message that starts with all uppecase such as: I or IO ag '(?<!Mix\.)raise\s+\"+(?!([A-Z]+\b))[A-Z]' # Mix.raise should start with upper case # except when `mix` or `rebar` are mentioned ag 'Mix\.raise\s+\"(?!(mix|rebar))+[a-z]' # ending in period ag "raise\s+\"+.+\.\"\s*\n"
1 parent b5322b1 commit a251ccc

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,8 +1305,8 @@ defmodule Kernel do
13051305
13061306
## Examples
13071307
1308-
iex> raise "Oops"
1309-
** (RuntimeError) Oops
1308+
iex> raise "oops"
1309+
** (RuntimeError) oops
13101310
13111311
try do
13121312
1 + :foo
@@ -1393,11 +1393,11 @@ defmodule Kernel do
13931393
## Examples
13941394
13951395
try do
1396-
raise "Oops"
1396+
raise "oops"
13971397
rescue
13981398
exception ->
13991399
stacktrace = System.stacktrace
1400-
if Exception.message(exception) == "Oops" do
1400+
if Exception.message(exception) == "oops" do
14011401
reraise exception, stacktrace
14021402
end
14031403
end
@@ -1446,7 +1446,7 @@ defmodule Kernel do
14461446
## Examples
14471447
14481448
try do
1449-
raise "Oops"
1449+
raise "oops"
14501450
rescue
14511451
exception ->
14521452
stacktrace = System.stacktrace

lib/elixir/unicode/unicode.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ defmodule String.Graphemes do
223223

224224
# There is no codepoint marked as Prepend by Unicode 6.3.0
225225
if cluster["Prepend"] do
226-
raise "It seems this new unicode version has added Prepend items. " <>
227-
"Please remove this error and uncomment the code below."
226+
raise "it seems this new unicode version has added Prepend items. " <>
227+
"Please remove this error and uncomment the code below"
228228
end
229229

230230
# Don't break CRLF

lib/ex_unit/test/ex_unit/callbacks_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ defmodule ExUnit.CallbacksNoTests do
245245
use ExUnit.Case, async: true
246246

247247
setup_all do
248-
raise "Never run"
248+
raise "never run"
249249
end
250250

251251
setup do
252-
raise "Never run"
252+
raise "never run"
253253
end
254254
end

lib/mix/lib/mix/compilers/erlang.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ defmodule Mix.Compilers.Erlang do
9090

9191
# Raise if any error, return :ok otherwise
9292
if :error in results do
93-
Mix.raise "Encountered compilation errors."
93+
Mix.raise "Encountered compilation errors"
9494
end
9595
:ok
9696
end

lib/mix/lib/mix/dep/converger.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule Mix.Dep.Converger do
2626
Enum.find(deps, fn(%Mix.Dep{app: other_app}) -> app == other_app end)
2727
end)
2828
else
29-
Mix.raise "Could not sort dependencies. There are cycles in the dependency graph."
29+
Mix.raise "Could not sort dependencies. There are cycles in the dependency graph"
3030
end
3131
after
3232
:digraph.delete(graph)

lib/mix/lib/mix/shell/process.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ defmodule Mix.Shell.Process do
9797
receive do
9898
{:mix_shell_input, :prompt, response} -> response
9999
after
100-
0 -> raise "No shell process input given for prompt/1"
100+
0 -> raise "no shell process input given for prompt/1"
101101
end
102102
end
103103

@@ -117,7 +117,7 @@ defmodule Mix.Shell.Process do
117117
receive do
118118
{:mix_shell_input, :yes?, response} -> response
119119
after
120-
0 -> raise "No shell process input given for yes?/1"
120+
0 -> raise "no shell process input given for yes?/1"
121121
end
122122
end
123123
end

lib/mix/lib/mix/tasks/deps.clean.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule Mix.Tasks.Deps.Clean do
4343
Mix.raise "mix deps.clean expects dependencies as arguments or " <>
4444
"a flag indicating which dependencies to clean. " <>
4545
"The --all option will clean all dependencies while " <>
46-
"the --unused option cleans unused dependencies."
46+
"the --unused option cleans unused dependencies"
4747
end
4848

4949
if opts[:unlock] do

lib/mix/test/mix/tasks/deps_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ defmodule Mix.Tasks.DepsTest do
578578
message = "mix deps.clean expects dependencies as arguments or " <>
579579
"a flag indicating which dependencies to clean. " <>
580580
"The --all option will clean all dependencies while " <>
581-
"the --unused option cleans unused dependencies."
581+
"the --unused option cleans unused dependencies"
582582

583583
assert_raise Mix.Error, message, fn ->
584584
Mix.Tasks.Deps.Clean.run []

0 commit comments

Comments
 (0)