Skip to content

Commit

Permalink
add credo check to travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 committed Nov 30, 2017
1 parent 6d396da commit e96187f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ matrix:
sudo: false
after_script:
- MIX_ENV=test mix coveralls.travis
- mix credo
3 changes: 2 additions & 1 deletion lib/hedwig/adapters/console/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ defmodule Hedwig.Adapters.Console.Connection do
end

defp get_system_user do
System.cmd("whoami", [])
"whoami"
|> System.cmd([])
|> elem(0)
|> String.trim()
end
Expand Down
2 changes: 2 additions & 0 deletions lib/hedwig/responder/supervisor.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule Hedwig.Responder.Supervisor do
@moduledoc false

def start_link do
import Supervisor.Spec, warn: false

Expand Down
1 change: 1 addition & 0 deletions lib/hedwig/test/robot_case.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Hedwig.RobotCase do
use ExUnit.CaseTemplate

@moduledoc false
@robot Hedwig.TestRobot
@default_responders [{Hedwig.Responders.Help, []}, {TestResponder, []}]

Expand Down
2 changes: 2 additions & 0 deletions lib/hedwig/test/test_robot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Code.ensure_compiled(Hedwig.Adapters.Test)
defmodule Hedwig.TestRobot do
use Hedwig.Robot, otp_app: :hedwig, adapter: Hedwig.Adapters.Test

@moduledoc false

def handle_connect(%{name: name} = state) do
if :undefined == :global.whereis_name(name) do
:yes = :global.register_name(name, self())
Expand Down
9 changes: 7 additions & 2 deletions lib/mix/tasks/hedwig.gen.robot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ defmodule Mix.Tasks.Hedwig.Gen.Robot do
end

defp default_robot(app) do
alias_module |> Module.concat(Robot)
end

defp alias_module do
case Application.get_env(app, :app_namespace, app) do
^app -> app |> to_string |> Macro.camelize
mod -> mod |> inspect
end |> Module.concat(Robot)
end
end

defp available_adapters(deps) do
Expand Down Expand Up @@ -136,7 +140,8 @@ defmodule Mix.Tasks.Hedwig.Gen.Robot do
end

defp prompt_for_name do
Mix.shell.prompt("What would you like to name your bot?:")
"What would you like to name your bot?:"
|> Mix.shell.prompt
|> String.trim
end

Expand Down
4 changes: 3 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ defmodule Hedwig.Mixfile do

defp deps do
[{:excoveralls, "~> 0.7.2", only: :test},
{:ex_doc, "~> 0.16.3", only: :dev}]
{:ex_doc, "~> 0.16.3", only: :dev},
{:credo, "~> 0.8", only: [:dev, :test], runtime: false}
]
end

defp elixirc_paths(:test), do: ["lib", "test/support"]
Expand Down
4 changes: 3 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
%{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [], [], "hexpm"},
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"excoveralls": {:hex, :excoveralls, "0.7.2", "f69ede8c122ccd3b60afc775348a53fc8c39fe4278aee2f538f0d81cc5e7ff3a", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
Expand Down

0 comments on commit e96187f

Please sign in to comment.