Skip to content

Commit 86faca5

Browse files
Upgrade to Elixir 1.15 (#143)
* Upgrade to Elixir 1.15 * Inets and SSL need to be loaded in Elixir 1.15 due to code load changes. * added mix format changes --------- Co-authored-by: Holden Oullette <6202965+houllette@users.noreply.github.com>
1 parent 374807d commit 86faca5

File tree

5 files changed

+32
-24
lines changed

5 files changed

+32
-24
lines changed

.github/workflows/elixir.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
otp: 25.1
3434
- elixir: '1.14.x'
3535
otp: 25.1
36+
- elixir: '1.15.x'
37+
otp: 26.0
3638

3739
steps:
3840
- name: Setup Elixir
@@ -54,11 +56,11 @@ jobs:
5456
run: mix hex.audit
5557

5658
- name: Check Formatting
57-
if: ${{ matrix.elixir == '1.14.x' }} # we only care about formatting for latest version of Elixir
59+
if: ${{ matrix.elixir == '1.15.x' }} # we only care about formatting for latest version of Elixir
5860
run: mix format --check-formatted
5961

6062
- name: Compiles w/o Warnings
61-
if: ${{ matrix.elixir == '1.14.x' }} # we only care about warnings for latest version of Elixir
63+
if: ${{ matrix.elixir == '1.15.x' }} # we only care about warnings for latest version of Elixir
6264
run: mix compile --warnings-as-errors
6365

6466
- name: Credo

lib/mix/tasks/sobelow.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ defmodule Mix.Tasks.Sobelow do
169169

170170
save_config = Keyword.get(opts, :save_config)
171171

172+
if function_exported?(Mix, :ensure_application!, 1) do
173+
Mix.ensure_application!(:ssl)
174+
Mix.ensure_application!(:inets)
175+
end
176+
172177
cond do
173178
diff ->
174179
run_diff(argv)

lib/sobelow.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ defmodule Sobelow do
526526

527527
{timestamp, _} =
528528
case :file.read_line(iofile) do
529-
{:ok, 'sobelow-' ++ timestamp} -> to_string(timestamp) |> Integer.parse()
529+
{:ok, ~c"sobelow-" ++ timestamp} -> to_string(timestamp) |> Integer.parse()
530530
_ -> file_error()
531531
end
532532

@@ -546,7 +546,7 @@ defmodule Sobelow do
546546
{:ok, _} = Application.ensure_all_started(:inets)
547547
{:ok, _} = :inets.start(:httpc, [{:profile, :sobelow}])
548548

549-
url = 'https://sobelow.io/version'
549+
url = ~c"https://sobelow.io/version"
550550

551551
http_options = [
552552
ssl: [

test/fixtures/utils/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
use Mix.Config
22

33
config :test,
4-
security_option: 'option'
4+
security_option: ~c"option"

test/log_test.exs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ defmodule SobelowTest.LogTest do
44

55
# log_json_finding(line_no, filename, fun_name, var, severity, type)
66
test "Log JSON finding with function as function name" do
7-
output = """
8-
{
9-
"findings": {
10-
"high_confidence": [
11-
{
12-
"file": "file.ex",
13-
"line": 1,
14-
"type": "N/A",
15-
"variable": "var"
16-
}
17-
],
18-
"low_confidence": [],
19-
"medium_confidence": []
20-
},
21-
"sobelow_version": "1.0.0",
22-
"total_findings": 1
23-
}
24-
"""
7+
output =
8+
Jason.decode!("""
9+
{
10+
"findings": {
11+
"high_confidence": [
12+
{
13+
"file": "file.ex",
14+
"line": 1,
15+
"type": "N/A",
16+
"variable": "var"
17+
}
18+
],
19+
"low_confidence": [],
20+
"medium_confidence": []
21+
},
22+
"sobelow_version": "1.0.0",
23+
"total_findings": 1
24+
}
25+
""")
2526

2627
FindingLog.start_link()
2728
Fingerprint.start_link()
@@ -35,6 +36,6 @@ defmodule SobelowTest.LogTest do
3536

3637
Sobelow.log_finding(finding, %Sobelow.Finding{confidence: :high})
3738

38-
assert FindingLog.json("1.0.0") <> "\n" == output
39+
assert Jason.decode!(FindingLog.json("1.0.0")) == output
3940
end
4041
end

0 commit comments

Comments
 (0)