Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Elixir 1.15 #143

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
otp: 25.1
- elixir: '1.14.x'
otp: 25.1
- elixir: '1.15.x'
otp: 26.0

steps:
- name: Setup Elixir
Expand All @@ -54,11 +56,11 @@ jobs:
run: mix hex.audit

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

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

- name: Credo
Expand Down
5 changes: 5 additions & 0 deletions lib/mix/tasks/sobelow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ defmodule Mix.Tasks.Sobelow do

save_config = Keyword.get(opts, :save_config)

if function_exported?(Mix, :ensure_application!, 1) do
Mix.ensure_application!(:ssl)
Mix.ensure_application!(:inets)
end

cond do
diff ->
run_diff(argv)
Expand Down
4 changes: 2 additions & 2 deletions lib/sobelow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ defmodule Sobelow do

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

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

url = 'https://sobelow.io/version'
url = ~c"https://sobelow.io/version"

http_options = [
ssl: [
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/utils/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config

config :test,
security_option: 'option'
security_option: ~c"option"
39 changes: 20 additions & 19 deletions test/log_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ defmodule SobelowTest.LogTest do

# log_json_finding(line_no, filename, fun_name, var, severity, type)
test "Log JSON finding with function as function name" do
output = """
{
"findings": {
"high_confidence": [
{
"file": "file.ex",
"line": 1,
"type": "N/A",
"variable": "var"
}
],
"low_confidence": [],
"medium_confidence": []
},
"sobelow_version": "1.0.0",
"total_findings": 1
}
"""
output =
Jason.decode!("""
{
"findings": {
"high_confidence": [
{
"file": "file.ex",
"line": 1,
"type": "N/A",
"variable": "var"
}
],
"low_confidence": [],
"medium_confidence": []
},
"sobelow_version": "1.0.0",
"total_findings": 1
}
""")

FindingLog.start_link()
Fingerprint.start_link()
Expand All @@ -35,6 +36,6 @@ defmodule SobelowTest.LogTest do

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

assert FindingLog.json("1.0.0") <> "\n" == output
assert Jason.decode!(FindingLog.json("1.0.0")) == output
end
end
Loading