Skip to content

Commit 93fa83c

Browse files
fix: remove linting warnings (#13)
1 parent f63865a commit 93fa83c

4 files changed

Lines changed: 25 additions & 20 deletions

File tree

.credo.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# set this value to 0 (zero).
4242
#
4343
{Credo.Check.Design.TagTODO, [exit_status: 0]},
44-
{Credo.Check.Design.TagFIXME, []},
44+
{Credo.Check.Design.TagFIXME, [exit_status: 0]},
4545

4646
#
4747
## Readability Checks

lib/openapi_codegen/cli.ex

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
defmodule OpenApiCodeGen.CLI do
22
@moduledoc """
3-
Command line interface for OpenApiCodeGen.
4-
"""
3+
Usage: openapi_codegen [options] INPUT_FILE
54
6-
def usage do
7-
"""
8-
Usage: openapi_codegen [options] INPUT_FILE
5+
Available options:
96
10-
Available options:
7+
--output-path Output directory where the code should be generated.
8+
--req To use the :req as HTTP client.
9+
--tesla To use the :tesla as HTTP client (default).
1110
12-
--output-path Output directory where the code should be generated.
13-
--req To use the :req as HTTP client.
14-
--tesla To use the :tesla as HTTP client.
11+
The --help and --version options can be given instead of a command for usage and versioning information.
12+
"""
1513

16-
The --help and --version options can be given instead of a command for usage and versioning information.
17-
"""
18-
end
14+
def usage, do: @moduledoc
1915

2016
def main([arg]) when arg in ["--help", "-h"], do: display_help()
2117
def main([arg]) when arg in ["--version", "-v"], do: display_version()

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule TeslaCodegen.MixProject do
22
use Mix.Project
33

44
@app :openapi_codegen
5-
@version "0.1.0-pre"
5+
@version "0.1.0"
66
@description "OpenApiCodeGen is a Code Generation tool for Elixir"
77

88
def project do

test/integration_test.exs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ defmodule IntegrationTest do
44
@moduletag :integration
55

66
describe "pet store spec integration test" do
7-
test "generated Tesla client is able to call service" do
8-
on_exit(fn -> File.rm_rf!("tmp") end)
7+
setup do
8+
Code.put_compiler_option(:ignore_module_conflict, true)
9+
10+
on_exit(fn ->
11+
Code.put_compiler_option(:ignore_module_conflict, false)
12+
File.rm_rf!("tmp")
13+
end)
14+
end
915

16+
test "generated Tesla client is able to call service" do
1017
%{client: client, schemas: schemas} =
1118
OpenApiCodeGen.CLI.main([
1219
"--tesla",
@@ -15,13 +22,12 @@ defmodule IntegrationTest do
1522
"test/support/fixtures/openapi_petstore.json"
1623
])
1724

18-
Enum.map(schemas ++ [client], &Code.compile_file/1)
25+
Enum.each(schemas ++ [client], &Code.compile_file/1)
26+
1927
assert_functions(Tesla.Env)
2028
end
2129

2230
test "generated Req client is able to call service" do
23-
on_exit(fn -> File.rm_rf!("tmp") end)
24-
2531
%{client: client, schemas: schemas} =
2632
OpenApiCodeGen.CLI.main([
2733
"--req",
@@ -30,19 +36,22 @@ defmodule IntegrationTest do
3036
"test/support/fixtures/openapi_petstore.json"
3137
])
3238

33-
Enum.map(schemas ++ [client], &Code.compile_file/1)
39+
Enum.each(schemas ++ [client], &Code.compile_file/1)
3440

3541
assert_functions(Req.Response)
3642
end
3743
end
3844

45+
# credo:disable-for-lines Credo.Check.Refactor.Apply
3946
defp assert_functions(expected_struct) do
4047
pet = struct(PetstoreClient.Pet, name: "test", id: 1)
4148
user = struct(PetstoreClient.User, username: "test", id: 1)
4249
order = struct(PetstoreClient.Order, id: 1)
4350

4451
assert is_struct(apply(PetstoreClient, :find_pets_by_status, ["status"]), expected_struct)
52+
# FIXME: find pets by tags is returning 500 due to issues from the server
4553
assert is_struct(apply(PetstoreClient, :find_pets_by_tags, ["tag"]), expected_struct)
54+
# FIXME: get inventory is returning 500 due to issues from the server
4655
assert is_struct(apply(PetstoreClient, :get_inventory, []), expected_struct)
4756
assert is_struct(apply(PetstoreClient, :get_order_by_id, [1]), expected_struct)
4857
assert is_struct(apply(PetstoreClient, :get_user_by_name, ["username"]), expected_struct)

0 commit comments

Comments
 (0)