Skip to content

Commit

Permalink
chore: Bump credo from 1.6.7 to 1.7.5
Browse files Browse the repository at this point in the history
Bumps [credo](https://github.com/rrrene/credo) from 1.6.7 to 1.7.5.
- [Release notes](https://github.com/rrrene/credo/releases)
- [Changelog](https://github.com/rrrene/credo/blob/master/CHANGELOG.md)
- [Commits](rrrene/credo@v1.6.7...v1.7.5)

---
updated-dependencies:
- dependency-name: credo
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
dependabot[bot] authored and bklebe committed Apr 25, 2024
1 parent 60dc957 commit 580c480
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 36 deletions.
8 changes: 8 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
{Credo.Check.Warning.BoolOperationOnSameValues},
{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect},
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig,
[
files: %{excluded: ["**/*_test.exs"]},
metadata_keys:
"apps/api_web/config/prod.exs"
|> Config.Reader.read!()
|> get_in([:logger, :console, :metadata])
]},
{Credo.Check.Warning.OperationOnSameValues},
{Credo.Check.Warning.OperationWithConstantResult},
{Credo.Check.Warning.UnusedEnumOperation},
Expand Down
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used by "mix format"
[
inputs: ["mix.exs", "apps/*/{config,lib,test}/**/*.{heex,ex,exs}"],
inputs: ["{mix,.credo}.exs", "apps/*/{config,lib,test}/**/*.{heex,ex,exs}"],
import_deps: [:phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
rename_deprecated_at: "1.14.3"
Expand Down
10 changes: 6 additions & 4 deletions apps/api_web/lib/api_web/api_controller_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ defmodule ApiWeb.ApiControllerHelpers do
end

def index(module, conn, params) do
conn
|> get_format()
|> index_for_format()
|> apply(:call, [conn, module, params])
index =
conn
|> get_format()
|> index_for_format()

index.call(conn, module, params)
end

def call(conn, module, params) do
Expand Down
30 changes: 15 additions & 15 deletions apps/api_web/lib/api_web/controllers/prediction_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@ defmodule ApiWeb.PredictionController do
{:error, :only_route_type}

p when map_size(p) > 0 ->
filtered_params
|> Params.split_on_comma("trip")
|> case do
[] ->
case route_pattern_ids do
[] ->
all_stops_and_routes(stop_ids, route_ids, matchers)

route_pattern_ids ->
all_stops_and_route_patterns(stop_ids, route_pattern_ids, matchers)
end

trip_ids ->
all_stops_and_trips(stop_ids, trip_ids, matchers)
end
trip_params = Params.split_on_comma(filtered_params, "trip")

matchers =
case {trip_params, route_pattern_ids} do
{[], []} ->
all_stops_and_routes(stop_ids, route_ids, matchers)

{[], route_pattern_ids} ->
all_stops_and_route_patterns(stop_ids, route_pattern_ids, matchers)

{trip_ids, _} ->
all_stops_and_trips(stop_ids, trip_ids, matchers)
end

matchers
|> Prediction.filter_by_route_type(route_types)
|> State.all(pagination_opts)

Expand Down
12 changes: 4 additions & 8 deletions apps/api_web/lib/api_web/event_stream/diff.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ defmodule ApiWeb.EventStream.Diff do
update = Map.values(updated_map)

remove =
map_list_1
|> Enum.flat_map(fn item ->
if item_in_map(removed_map, item) do
[Map.take(item, ~w(id type))]
else
[]
end
end)
for item <- map_list_1,
item_in_map(removed_map, item) do
Map.take(item, ~w(id type))
end
|> Enum.reverse()

%{
Expand Down
6 changes: 3 additions & 3 deletions apps/api_web/lib/api_web/plugs/modified_since_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule ApiWeb.Plugs.ModifiedSinceHandler do
last_modified_header = State.Metadata.last_modified_header(mod),
conn = Plug.Conn.put_resp_header(conn, "last-modified", last_modified_header),
{conn, [if_modified_since_header]} <- {conn, get_req_header(conn, "if-modified-since")},
{conn, false} <- {conn, is_modified?(last_modified_header, if_modified_since_header)} do
{conn, false} <- {conn, modified?(last_modified_header, if_modified_since_header)} do
conn
|> send_resp(:not_modified, "")
|> halt()
Expand All @@ -64,12 +64,12 @@ defmodule ApiWeb.Plugs.ModifiedSinceHandler do
end
end

def is_modified?(same, same) do
def modified?(same, same) do
# shortcut if the headers have the same value
false
end

def is_modified?(first, second) do
def modified?(first, second) do
with {:ok, first_val} <- modified_value(first),
{:ok, second_val} <- modified_value(second) do
first_val > second_val
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ defmodule ApiWeb.Plugs.ModifiedSinceHandlerTest do
end
end

describe "is_modified?/2" do
describe "modified?/2" do
property "is true when first header is greater than second header" do
check all(
{first, first_header} <- rfc1123(),
{second, second_header} <- rfc1123(),
max_runs: 1000
) do
expected = first > second
actual = ModifiedSinceHandler.is_modified?(first_header, second_header)
actual = ModifiedSinceHandler.modified?(first_header, second_header)
assert expected == actual
end
end
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.1.0", "0b110a9a6c619b19a7f73fa3004aa11d6e719a67e672d1633dc36b6b2290a0f7", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2ad2acb5a8bc049e8d5aa267802631912bb80d5f4110a178ae7999e69dca1bf7"},
"benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], [], "hexpm", "23f27cbc482cbac03fc8926441eb60a5e111759c17642bac005c3225f5eb809d"},
"benchwarmer": {:hex, :benchwarmer, "0.0.2", "902e5c020608647b07c38b82103e4af6d2667dfd5d5d13c67382238de6943136", [:mix], [], "hexpm", "8b98b39c1c50df624f9c2d13ca953eeed465eed6feda975da26b479df2b4c9f5"},
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"castore": {:hex, :castore, "0.1.22", "4127549e411bedd012ca3a308dede574f43819fe9394254ca55ab4895abfa1a2", [:mix], [], "hexpm", "c17576df47eb5aa1ee40cc4134316a99f5cad3e215d5c77b8dd3cfef12a22cac"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"comeonin": {:hex, :comeonin, "5.4.0", "246a56ca3f41d404380fc6465650ddaa532c7f98be4bda1b4656b3a37cc13abe", [:mix], [], "hexpm", "796393a9e50d01999d56b7b8420ab0481a7538d0caf80919da493b4a6e51faf1"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"corsica": {:hex, :corsica, "1.3.0", "bbec02ccbeca1fdf44ee23b25a8ae32f7c6c28fc127ef8836dd8420e8f65bd9b", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "8847ec817554047e9aa6d9933539cacb10c4ee60b58e0c15c3b380c5b737b35f"},
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
"credo": {:hex, :credo, "1.7.5", "643213503b1c766ec0496d828c90c424471ea54da77c8a168c725686377b9545", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "f799e9b5cd1891577d8c773d245668aa74a2fcd15eb277f51a0131690ebfb3fd"},
"dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"},
"diskusage_logger": {:hex, :diskusage_logger, "0.2.0", "04fc48b538fe4de43153542a71ea94f623d54707d85844123baacfceedf625c3", [:mix], [], "hexpm", "e3f2aed1b0fc4590931c089a6453a4c4eb4c945912aa97bcabcc0cff7851f34d"},
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
Expand All @@ -33,7 +33,7 @@
"expo": {:hex, :expo, "0.3.0", "13127c1d5f653b2927f2616a4c9ace5ae372efd67c7c2693b87fd0fdc30c6feb", [:mix], [], "hexpm", "fb3cd4bf012a77bc1608915497dae2ff684a06f0fa633c7afa90c4d72b881823"},
"exprotobuf": {:hex, :exprotobuf, "1.2.17", "3003937da617f588a8fb63ebdd7b127a18d78d6502623c272076fd54c07c4de1", [:mix], [{:gpb, "~> 4.0", [hex: :gpb, repo: "hexpm", optional: false]}], "hexpm", "e07ec1e5ae6f8c1c8521450d5f6b658c8c700b1f34c70356e91ece0766f4361a"},
"fast_local_datetime": {:hex, :fast_local_datetime, "1.0.1", "1a7babf4a7bbcadd665c635e4b585ecfb24f07349ea5391e45458f239122c4bc", [:mix], [{:tzdata, "~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "b3ea84154c5937e3894247edb60f57635f77e5f2ec2ba4742b7522081d7acf6d"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
"finch": {:hex, :finch, "0.14.0", "619bfdee18fc135190bf590356c4bf5d5f71f916adb12aec94caa3fa9267a4bc", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5459acaf18c4fdb47a8c22fb3baff5d8173106217c8e56c5ba0b93e66501a8dd"},
"gettext": {:hex, :gettext, "0.22.0", "a25d71ec21b1848957d9207b81fd61cb25161688d282d58bdafef74c2270bdc4", [:mix], [{:expo, "~> 0.3.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "cb0675141576f73720c8e49b4f0fd3f2c69f0cd8c218202724d4aebab8c70ace"},
"goth": {:hex, :goth, "1.3.1", "f3e08a7f23ea8992ab92d2e1d5c72ea1a8fbd2fe3a46ad1b08d0620f71374fdc", [:mix], [{:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:jose, "~> 1.10", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "90326c2c0a7acda7fb75fc4a4f0cba84945d8fcb22694d36c9967cec8949937c"},
Expand Down

0 comments on commit 580c480

Please sign in to comment.