From 995eb2f8538d47bea495d1c92eeb1740bf238967 Mon Sep 17 00:00:00 2001 From: Josh Larson Date: Tue, 4 Feb 2025 16:50:14 -0500 Subject: [PATCH] fix: Fix dialyzer/dialyxir config (#2359) A few fixes: - Uses the default dialyzer ignore file location and format - Fails the CI task on dialyzer failure --- .dialyzer.ignore-warnings | 33 -------------- .dialyzer_ignore.exs | 90 +++++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 4 +- mix.exs | 3 +- 4 files changed, 92 insertions(+), 38 deletions(-) delete mode 100644 .dialyzer.ignore-warnings diff --git a/.dialyzer.ignore-warnings b/.dialyzer.ignore-warnings deleted file mode 100644 index 95ef90fb6c..0000000000 --- a/.dialyzer.ignore-warnings +++ /dev/null @@ -1,33 +0,0 @@ -Unknown function 'Elixir.Util.Position.Atom':'__impl__'/1 -Unknown function 'Elixir.Util.Position.BitString':'__impl__'/1 -Unknown function 'Elixir.Util.Position.Float':'__impl__'/1 -Unknown function 'Elixir.Util.Position.Function':'__impl__'/1 -Unknown function 'Elixir.Util.Position.Integer':'__impl__'/1 -Unknown function 'Elixir.Util.Position.List':'__impl__'/1 -Unknown function 'Elixir.Util.Position.PID':'__impl__'/1 -Unknown function 'Elixir.Util.Position.Port':'__impl__'/1 -Unknown function 'Elixir.Util.Position.Reference':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Atom':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.BitString':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Float':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Function':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Integer':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.List':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Map':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.PID':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Port':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Reference':'__impl__'/1 -Unknown function 'Elixir.Algolia.Object.Tuple':'__impl__'/1 -Unknown function 'Elixir.ServerSentEventStage':start_link/1 -Unknown type 'Elixir.ServerSentEventStage.Event':t/0 -Unknown function 'Elixir.BannerAlert.Atom':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.BitString':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Float':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Function':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Integer':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.List':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Map':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.PID':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Port':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Reference':'__impl__'/1 -Unknown function 'Elixir.BannerAlert.Tuple':'__impl__'/1 diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs index e69de29bb2..ed493b56a9 100644 --- a/.dialyzer_ignore.exs +++ b/.dialyzer_ignore.exs @@ -0,0 +1,90 @@ +[ + {"lib/alerts/parser.ex", :unknown_type}, + {"lib/algolia/object.ex", :no_return}, + {"lib/algolia/routes.ex", :call}, + {"lib/algolia/routes.ex", :no_return}, + {"lib/cms/api.ex", :unknown_type}, + {"lib/cms/helpers.ex", :unknown_type}, + {"lib/cms/partial/banner.ex", :unknown_type}, + {"lib/cms/partial/teaser.ex", :unknown_type}, + {"lib/cms/repo.ex", :pattern_match}, + {"lib/cms/repo.ex", :unknown_type}, + {"lib/dotcom/cache/subscriber.ex", :unmatched_return}, + {"lib/dotcom/content_rewriter.ex", :call}, + {"lib/dotcom/content_rewriter.ex", :invalid_contract}, + {"lib/dotcom/content_rewriter.ex", :no_return}, + {"lib/dotcom/content_rewriters/embedded_media.ex", :call}, + {"lib/dotcom/content_rewriters/embedded_media.ex", :invalid_contract}, + {"lib/dotcom/content_rewriters/embedded_media.ex", :no_return}, + {"lib/dotcom/content_rewriters/links.ex", :invalid_contract}, + {"lib/dotcom/content_rewriters/responsive_tables.ex", :invalid_contract}, + {"lib/dotcom/floki_helpers.ex", :invalid_contract}, + {"lib/dotcom/trip_plan/itinerary.ex", :unknown_type}, + {"lib/dotcom/trip_plan/itinerary_row.ex", :unknown_type}, + {"lib/dotcom/trip_plan/itinerary_row_list.ex", :unknown_type}, + {"lib/dotcom/trip_plan/leg.ex", :guard_fail}, + {"lib/dotcom/trip_plan/leg.ex", :invalid_contract}, + {"lib/dotcom/trip_plan/leg.ex", :unknown_type}, + {"lib/dotcom/trip_plan/location.ex", :call}, + {"lib/dotcom/trip_plan/map.ex", :neg_guard_fail}, + {"lib/dotcom/trip_plan/open_trip_planner.ex", :invalid_contract}, + {"lib/dotcom/trip_plan/query.ex", :unknown_type}, + {"lib/dotcom/trip_plan/related_link.ex", :call}, + {"lib/dotcom/trip_plan/transit_detail.ex", :unknown_type}, + {"lib/dotcom_web/components/trip_planner/itinerary_summary.ex", :unmatched_return}, + {"lib/dotcom_web/controllers/cms_controller.ex", :pattern_match}, + {"lib/dotcom_web/controllers/cms_controller.ex", :unknown_type}, + {"lib/dotcom_web/controllers/event_controller.ex", :unknown_type}, + {"lib/dotcom_web/controllers/fare_controller.ex", :unknown_type}, + {"lib/dotcom_web/controllers/helpers.ex", :call}, + {"lib/dotcom_web/controllers/helpers.ex", :invalid_contract}, + {"lib/dotcom_web/controllers/map_config_controller.ex", :unknown_type}, + {"lib/dotcom_web/controllers/mode/hub_behavior.ex", :unknown_type}, + {"lib/dotcom_web/controllers/schedule/line/maps.ex", :unknown_type}, + {"lib/dotcom_web/controllers/schedule/line_api.ex", :invalid_contract}, + {"lib/dotcom_web/controllers/schedule/predictions.ex", :pattern_match}, + {"lib/dotcom_web/controllers/schedule/timetable_controller.ex", :call}, + {"lib/dotcom_web/controllers/schedule/timetable_controller.ex", :no_return}, + {"lib/dotcom_web/controllers/search_controller.ex", :unknown_type}, + {"lib/dotcom_web/controllers/transit_near_me_controller.ex", :pattern_match}, + {"lib/dotcom_web/controllers/trip_plan/feedback.ex", :unmatched_return}, + {"lib/dotcom_web/controllers/trip_plan_controller.ex", :call}, + {"lib/dotcom_web/controllers/trip_plan_controller.ex", :no_return}, + {"lib/dotcom_web/router.ex", :unused_fun}, + {"lib/dotcom_web/stats.ex", :unmatched_return}, + {"lib/dotcom_web/views/bus_stop_change_view.ex", :unknown_type}, + {"lib/dotcom_web/views/helpers.ex", :unmatched_return}, + {"lib/dotcom_web/views/helpers/cms_helpers.ex", :unknown_type}, + {"lib/dotcom_web/views/page_content_view.ex", :call}, + {"lib/dotcom_web/views/paragraph_view.ex", :unknown_type}, + {"lib/dotcom_web/views/teaser_view.ex", :unknown_type}, + {"lib/dotcom_web/views/trip_plan_view.ex", :invalid_contract}, + {"lib/fares/fares.ex", :unknown_type}, + {"lib/location_service/address.ex", :call}, + {"lib/location_service/address.ex", :no_return}, + {"lib/location_service/behaviour.ex", :unknown_type}, + {"lib/location_service/location_service.ex", :unmatched_return}, + {"lib/mix/tasks/header_footer.ex", :pattern_match}, + {"lib/mix/tasks/header_footer.ex", :unknown_function}, + {"lib/mix/tasks/header_footer.ex", :unmatched_return}, + {"lib/open_trip_planner_client/schema/leg.ex", :unknown_type}, + {"lib/open_trip_planner_client/schema/leg_time.ex", :unknown_type}, + {"lib/predictions/pub_sub.ex", :unknown_type}, + {"lib/predictions/pub_sub.ex", :unmatched_return}, + {"lib/predictions/pub_sub/behaviour.ex", :unknown_type}, + {"lib/predictions/repo.ex", :pattern_match}, + {"lib/predictions/stream_supervisor.ex", :unknown_type}, + {"lib/predictions/stream_topic.ex", :unknown_type}, + {"lib/predictions/stream_worker.ex", :unknown_type}, + {"lib/req/stats.ex", :unmatched_return}, + {"lib/routes/populate_caches.ex", :unmatched_return}, + {"lib/schedules/by_stop/departures.ex", :unknown_type}, + {"lib/schedules/by_stop/schedules_by_stop_repo.ex", :unknown_type}, + {"lib/schedules/hours_of_operation.ex", :unknown_type}, + {"lib/telemetry/helper.ex", :unmatched_return}, + {"test/support/cms/factory.ex", :call}, + {"test/support/cms/factory.ex", :no_return}, + {"test/support/cms/factory.ex", :unknown_type}, + {"test/support/integration_helpers.ex", :unknown_function}, + {"test/support/page_helpers.ex", :guard_fail} +] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0c75301aab..d176cfe86c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -159,9 +159,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-all - - uses: mbta/actions/dialyzer@v2 - with: - cmd-line: "--ignore-exit-status" + - run: mix dialyzer type_typescript: name: Type checks / TypeScript diff --git a/mix.exs b/mix.exs index 5889b516f4..2a4c43d248 100644 --- a/mix.exs +++ b/mix.exs @@ -21,8 +21,7 @@ defmodule DotCom.Mixfile do ], dialyzer: [ plt_add_apps: [:mix, :phoenix_live_reload], - flags: [:unmatched_returns], - ignore_warnings: ".dialyzer.ignore-warnings" + flags: [:unmatched_returns] ], deps: deps(),