Skip to content

Commit e074e17

Browse files
committed
Remove old cruft
1 parent a68a90b commit e074e17

14 files changed

+87
-122
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
executors:
44
elixir:
55
docker:
6-
- image: cimg/elixir:1.12.1
6+
- image: cimg/elixir:1.12.2
77
environment:
88
MIX_ENV: test
99

.credo.exs

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
# You can customize the priority of any check
8282
# Priority values are: `low, normal, high, higher`
8383
#
84-
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
84+
{Credo.Check.Design.AliasUsage,
85+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
8586
# You can also customize the exit_status of each check.
8687
# If you don't want TODO comments to cause `mix credo` to fail, just
8788
# set this value to 0 (zero).

.formatter.exs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
inputs: [
55
"{mix,.credo,.formatter}.exs",
66
"{config,lib,test,bench,profile}/**/*.{ex,exs}"
7-
],
8-
line_length: 120
7+
]
98
]

.tool-versions

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
erlang 24.0.2
2-
elixir 1.12.1-otp-24
1+
erlang 24.0.3
2+
elixir 1.12.2-otp-24

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ dist: focal
22
sudo: false
33
language: elixir
44
elixir:
5+
- 1.12.2
56
- 1.12.1
67
- 1.12.0
78
- 1.11.4

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"editor.formatOnSave": true,
3+
"editor.formatOnType": true,
34
"files.watcherExclude": {
45
"**/target": true
5-
}
6+
},
7+
"elixirLS.enableTestLenses": true,
8+
"elixirLS.dialyzerWarnOpts": ["no_improper_lists"]
69
}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM elixir:1.12.1-alpine as base
1+
FROM elixir:1.12.2-alpine as base
22
ARG MIX_ENV
33
ENV MIX_ENV ${MIX_ENV:-test}
44
RUN apk --no-cache add git build-base

config/config.exs

-38
This file was deleted.

config/profile.exs

-3
This file was deleted.

dialyzer.ignore-warnings

-16
This file was deleted.

lib/poison/parser.ex

+41-41
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ defmodule Poison.Parser do
6262
@compile {:inline_size, 150}
6363
@compile {:inline_unroll, 3}
6464

65-
if Application.get_env(:poison, :native) do
66-
@compile [:native, {:hipe, [:o3]}]
67-
end
68-
6965
use Bitwise
7066

7167
alias Poison.{Decoder, ParseError}
@@ -81,14 +77,6 @@ defmodule Poison.Parser do
8177
whitespace = '\s\t\n\r'
8278
digits = ?0..?9
8379

84-
defmacrop stacktrace do
85-
if Version.compare(System.version(), "1.7.0") != :lt do
86-
quote do: __STACKTRACE__
87-
else
88-
quote do: System.stacktrace()
89-
end
90-
end
91-
9280
defmacrop syntax_error(skip) do
9381
quote do
9482
raise ParseError, skip: unquote(skip)
@@ -99,12 +87,16 @@ defmodule Poison.Parser do
9987
def parse!(value, options \\ %{})
10088

10189
def parse!(data, options) when is_bitstring(data) do
102-
[value | skip] = value(data, data, :maps.get(:keys, options, nil), :maps.get(:decimal, options, nil), 0)
90+
[value | skip] =
91+
value(data, data, :maps.get(:keys, options, nil), :maps.get(:decimal, options, nil), 0)
92+
10393
<<_::binary-size(skip), rest::bits>> = data
10494
skip_whitespace(rest, skip, value)
10595
rescue
10696
exception in ParseError ->
107-
reraise ParseError, [data: data, skip: exception.skip, value: exception.value], stacktrace()
97+
reraise ParseError,
98+
[data: data, skip: exception.skip, value: exception.value],
99+
__STACKTRACE__
108100
end
109101

110102
def parse!(iodata, options) do
@@ -175,22 +167,22 @@ defmodule Poison.Parser do
175167
## Objects
176168

177169
defmacrop object_name(keys, skip, name) do
178-
quote do
179-
case unquote(keys) do
170+
quote bind_quoted: [keys: keys, skip: skip, name: name] do
171+
case keys do
180172
:atoms! ->
181173
try do
182-
String.to_existing_atom(unquote(name))
174+
String.to_existing_atom(name)
183175
rescue
184176
ArgumentError ->
185-
reraise ParseError, [skip: unquote(skip), value: unquote(name)], stacktrace()
177+
reraise ParseError, [skip: skip, value: name], __STACKTRACE__
186178
end
187179

188180
:atoms ->
189181
# credo:disable-for-next-line Credo.Check.Warning.UnsafeToAtom
190-
String.to_atom(unquote(name))
182+
String.to_atom(name)
191183

192184
_keys ->
193-
unquote(name)
185+
name
194186
end
195187
end
196188
end
@@ -200,12 +192,14 @@ defmodule Poison.Parser do
200192
defp object_pairs(<<?", rest::bits>>, data, keys, decimal, skip, acc) do
201193
start = skip + 1
202194
[name | skip] = string_continue(rest, data, start)
203-
204195
<<_::binary-size(skip), rest::bits>> = data
205-
[value | skip] = object_value(rest, data, keys, decimal, skip)
206196

197+
[value | skip] = object_value(rest, data, keys, decimal, skip)
207198
<<_::binary-size(skip), rest::bits>> = data
208-
object_pairs_continue(rest, data, keys, decimal, skip, [{object_name(keys, start, name), value} | acc])
199+
200+
object_pairs_continue(rest, data, keys, decimal, skip, [
201+
{object_name(keys, start, name), value} | acc
202+
])
209203
end
210204

211205
defp object_pairs(<<?}, _rest::bits>>, _data, _keys, _decimal, skip, []) do
@@ -274,19 +268,15 @@ defmodule Poison.Parser do
274268

275269
defp array_values(rest, data, keys, decimal, skip, acc) do
276270
[value | skip] = value(rest, data, keys, decimal, skip)
277-
278271
<<_::binary-size(skip), rest::bits>> = data
279-
280272
array_values_continue(rest, data, keys, decimal, skip, [value | acc])
281273
end
282274

283275
@compile {:inline, array_values_continue: 6}
284276

285277
defp array_values_continue(<<?,, rest::bits>>, data, keys, decimal, skip, acc) do
286278
[value | skip] = value(rest, data, keys, decimal, skip + 1)
287-
288279
<<_::binary-size(skip), rest::bits>> = data
289-
290280
array_values_continue(rest, data, keys, decimal, skip, [value | acc])
291281
end
292282

@@ -427,25 +417,31 @@ defmodule Poison.Parser do
427417
end
428418

429419
defp number_complete(_decimal, skip, sign, coef, 0) do
430-
[sign * coef | skip]
420+
[coef * sign | skip]
431421
end
432422

433423
max_sig = 1 <<< 53
434424

435425
# See: https://arxiv.org/pdf/2101.11408.pdf
436-
defp number_complete(_decimal, skip, sign, coef, exp) when exp in -10..10 and coef <= unquote(max_sig) do
426+
defp number_complete(_decimal, skip, sign, coef, exp)
427+
when exp in -10..10 and coef <= unquote(max_sig) do
437428
if exp < 0 do
438-
[sign * coef / pow10(-exp) | skip]
429+
[coef / pow10(-exp) * sign | skip]
439430
else
440-
[sign * coef * pow10(exp) | skip]
431+
[coef * pow10(exp) * sign | skip]
441432
end
442433
end
443434

444435
defp number_complete(_decimal, skip, sign, coef, exp) do
445-
[String.to_float(<<Integer.to_string(sign * coef)::bits, ".0e"::bits, Integer.to_string(exp)::bits>>) | skip]
436+
[
437+
String.to_float(
438+
<<Integer.to_string(coef * sign)::bits, ".0e"::bits, Integer.to_string(exp)::bits>>
439+
)
440+
| skip
441+
]
446442
rescue
447443
ArithmeticError ->
448-
reraise ParseError, [skip: skip, value: "#{sign * coef}e#{exp}"], stacktrace()
444+
reraise ParseError, [skip: skip, value: "#{coef * sign}e#{exp}"], __STACKTRACE__
449445
end
450446

451447
@compile {:inline, pow10: 1}
@@ -459,10 +455,10 @@ defmodule Poison.Parser do
459455
## Strings
460456

461457
defmacrop string_codepoint_size(codepoint) do
462-
quote do
458+
quote bind_quoted: [codepoint: codepoint] do
463459
cond do
464-
unquote(codepoint) <= 0x7FF -> 2
465-
unquote(codepoint) <= 0xFFFF -> 3
460+
codepoint <= 0x7FF -> 2
461+
codepoint <= 0xFFFF -> 3
466462
true -> 4
467463
end
468464
end
@@ -490,7 +486,10 @@ defmodule Poison.Parser do
490486
end
491487

492488
unicode ->
493-
[:unicode.characters_to_binary([acc | binary_part(data, skip, len)], :utf8) | skip + len + 1]
489+
[
490+
:unicode.characters_to_binary([acc | binary_part(data, skip, len)], :utf8)
491+
| skip + len + 1
492+
]
494493

495494
true ->
496495
[IO.iodata_to_binary([acc | binary_part(data, skip, len)]) | skip + len + 1]
@@ -505,7 +504,8 @@ defmodule Poison.Parser do
505504
string_continue(rest, data, skip, unicode, len + 1, acc)
506505
end
507506

508-
defp string_continue(<<codepoint::utf8, rest::bits>>, data, skip, _unicode, len, acc) when codepoint > 0x80 do
507+
defp string_continue(<<codepoint::utf8, rest::bits>>, data, skip, _unicode, len, acc)
508+
when codepoint > 0x80 do
509509
string_continue(rest, data, skip, true, len + string_codepoint_size(codepoint), acc)
510510
end
511511

@@ -540,12 +540,12 @@ defmodule Poison.Parser do
540540
defguardp is_surrogate_pair(hi, lo) when hi in 0xD800..0xDBFF and lo in 0xDC00..0xDFFF
541541

542542
defmacrop get_codepoint(seq, skip) do
543-
quote do
543+
quote bind_quoted: [seq: seq, skip: skip] do
544544
try do
545-
String.to_integer(unquote(seq), 16)
545+
String.to_integer(seq, 16)
546546
rescue
547547
ArgumentError ->
548-
reraise ParseError, [skip: unquote(skip), value: "\\u#{unquote(seq)}"], stacktrace()
548+
reraise ParseError, [skip: skip, value: "\\u#{seq}"], __STACKTRACE__
549549
end
550550
end
551551
end

mix.exs

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ defmodule Poison.Mixfile do
2020
deps: deps(),
2121
docs: docs(),
2222
package: package(),
23+
aliases: aliases(),
2324
xref: [exclude: [Decimal]],
2425
dialyzer: [
2526
ignore_warnings: ".dialyzer_ignore.exs",
@@ -70,7 +71,7 @@ defmodule Poison.Mixfile do
7071
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
7172
{:decimal, "~> 2.0", optional: true},
7273
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
73-
{:ex_doc, "~> 0.24", only: [:dev, :test], runtime: false},
74+
{:ex_doc, "~> 0.25", only: [:dev, :test], runtime: false},
7475
{:excoveralls, "~> 0.14", only: :test, runtime: false},
7576
{:exjsx, "~> 4.0", only: [:bench, :profile], runtime: false},
7677
{:jason, "~> 1.2", only: [:dev, :test, :bench, :profile], runtime: false},
@@ -99,4 +100,15 @@ defmodule Poison.Mixfile do
99100
links: %{"GitHub" => "https://github.com/devinus/poison"}
100101
]
101102
end
103+
104+
defp aliases do
105+
[
106+
"deps.get": [
107+
fn _ ->
108+
System.cmd("git", ["submodule", "update", "--init"], cd: __DIR__, parallelism: true)
109+
end,
110+
"deps.get"
111+
]
112+
]
113+
end
102114
end

mix.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
1111
"earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"},
1212
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
13-
"ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"},
13+
"ex_doc": {:hex, :ex_doc, "0.25.0", "4070a254664ee5495c2f7cce87c2f43064a8752f7976f2de4937b65871b05223", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2d90883bd4f3d826af0bde7fea733a4c20adba1c79158e2330f7465821c8949b"},
1414
"excoveralls": {:hex, :excoveralls, "0.14.1", "14140e4ef343f2af2de33d35268c77bc7983d7824cb945e6c2af54235bc2e61f", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "4a588f9f8cf9dc140cc1f3d0ea4d849b2f76d5d8bee66b73c304bb3d3689c8b0"},
1515
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "32e95820a97cffea67830e91514a2ad53b888850442d6d395f53a1ac60c82e07"},
1616
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
@@ -19,7 +19,7 @@
1919
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
2020
"jiffy": {:hex, :jiffy, "1.0.8", "60e36f00be35e5ac6e6cf2d4caf3bdf3103d4460aff385f543a8d7df2d6d9613", [:rebar3], [], "hexpm", "f9ae986ba5a0854eb48cf6a76192d9367086da86c20197da430630be7c087a4e"},
2121
"json": {:hex, :json, "1.4.1", "8648f04a9439765ad449bc56a3ff7d8b11dd44ff08ffcdefc4329f7c93843dfa", [:mix], [], "hexpm", "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16"},
22-
"jsone": {:hex, :jsone, "1.6.0", "4ed7e456cff24ff153c2eac7e1855797ea1b1416ef0bbc368525ed8cbeb57518", [:rebar3], [], "hexpm", "9e5623ac927a278086a3e758537c68f312f6b16a2d0582a0d1c8a58bd4a939db"},
22+
"jsone": {:hex, :jsone, "1.6.1", "7ea1098fe004c4127320fe0e3cf6a951b01f82039feaa56c322dc7e34dd59762", [:rebar3], [], "hexpm", "a6c1df6081df742068d2ed747a4fe8a7740c56421b53e02bc9d4907dd3502922"},
2323
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"},
2424
"junit_formatter": {:hex, :junit_formatter, "3.3.0", "bd7914d92885f7cf949dbe1dc6bacf76badfb2c1f5f7b3f9433c20e5b6ec42c8", [:mix], [], "hexpm", "4d040410925324b155ae4c7d41e884a0cdebe53b917bee4f22adf152e987a666"},
2525
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},

0 commit comments

Comments
 (0)