From eb6335664b78a30997034624f86b4f6a393c99e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 10:21:42 +0000 Subject: [PATCH 1/2] build(deps-dev): Bump credo from 1.7.0 to 1.7.2 Bumps [credo](https://github.com/rrrene/credo) from 1.7.0 to 1.7.2. - [Changelog](https://github.com/rrrene/credo/blob/master/CHANGELOG.md) - [Commits](https://github.com/rrrene/credo/commits) --- updated-dependencies: - dependency-name: credo dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- mix.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mix.lock b/mix.lock index 778dfe50..12889892 100644 --- a/mix.lock +++ b/mix.lock @@ -1,13 +1,13 @@ %{ "backoff": {:hex, :backoff, "1.1.6", "83b72ed2108ba1ee8f7d1c22e0b4a00cfe3593a67dbc792799e8cce9f42f796b", [:rebar3], [], "hexpm", "cf0cfff8995fb20562f822e5cc47d8ccf664c5ecdc26a684cbe85c225f9d7c39"}, "benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"}, - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"}, "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [: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", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"}, + "credo": {:hex, :credo, "1.7.2", "fdee3a7cb553d8f2e773569181f0a4a2bb7d192e27e325404cc31b354f59d68c", [: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", "dd15d6fbc280f6cf9b269f41df4e4992dee6615939653b164ef951f60afcb68e"}, "csv": {:hex, :csv, "2.4.1", "50e32749953b6bf9818dbfed81cf1190e38cdf24f95891303108087486c5925e", [:mix], [{:parallel_stream, "~> 1.0.4", [hex: :parallel_stream, repo: "hexpm", optional: false]}], "hexpm", "54508938ac67e27966b10ef49606e3ad5995d665d7fc2688efb3eab1307c9079"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"}, @@ -17,13 +17,13 @@ "ex_aws": {:hex, :ex_aws, "2.4.2", "d2686c34b69287cc8dd7629e70131aec05fef3cd3eae13698c9422933f7bc9ee", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8 or ~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0a2c07bd1541b0bef315f67e050d3cb9f947ab1a281896a8c35e3ee4976889f6"}, "ex_aws_s3": {:hex, :ex_aws_s3, "2.4.0", "ce8decb6b523381812798396bc0e3aaa62282e1b40520125d1f4eff4abdff0f4", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "85dda6e27754d94582869d39cba3241d9ea60b6aa4167f9c88e309dc687e56bb"}, "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"}, "gpb": {:hex, :gpb, "4.20.0", "3617fb7762801c1bed0460ed496d5bab0f4d76e26b923a9ad9abf026c2220e8a", [:make, :rebar3], [], "hexpm", "4268756a98674d5159eeaa0fd4501b7e43b2dd7f10a1f052499e9b09f107d40b"}, "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, "httpoison": {:hex, :httpoison, "1.8.0", "6b85dea15820b7804ef607ff78406ab449dd78bed923a49c7160e1886e987a3d", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "28089eaa98cf90c66265b6b5ad87c59a3729bea2e74e9d08f9b51eb9729b3c3a"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, - "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, + "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, "lcov_ex": {:hex, :lcov_ex, "0.3.2", "66e6080fd6e23ab57ee82a09365fcbde9b415d0624ed5afc908e623eeaf541d0", [:mix], [], "hexpm", "e05cfe47e3a4ea26c8220bca7e4612e31b94cdb76cd1538fb59654ba62f9a323"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, From 3c3ca6a92d11ad4fff778c97b816565f8572f4f5 Mon Sep 17 00:00:00 2001 From: Paul Swartz Date: Thu, 28 Dec 2023 12:51:29 -0500 Subject: [PATCH 2/2] chore: update code for more recent Credo defaults In particular, `AliasOrder` should have been the default before, but for whatever reason in #167 it was set to `false`. --- .credo.exs | 253 ++++++++++-------- lib/concentrate.ex | 6 +- .../remove_uncertain_stop_time_updates.ex | 3 +- .../encoder/gtfs_realtime_helpers_test.exs | 2 +- .../encoder/trip_updates/json_test.exs | 2 +- .../encoder/trip_updates_enhanced_test.exs | 2 +- .../concentrate/encoder/trip_updates_test.exs | 2 +- .../encoder/vehicle_positions_test.exs | 2 +- .../group_filter/cancelled_trip_test.exs | 2 +- .../group_filter/closed_stop_test.exs | 2 +- ...emove_uncertain_stop_time_updates_test.exs | 3 +- .../remove_unneeded_times_test.exs | 2 +- .../scheduled_stop_times_test.exs | 2 +- .../concentrate/group_filter/shuttle_test.exs | 2 +- .../skipped_stop_on_added_trip_test.exs | 2 +- .../vehicle_at_skipped_stop_test.exs | 2 +- .../group_filter/vehicle_past_stop_test.exs | 2 +- .../group_filter/vehicle_stop_match_test.exs | 2 +- test/concentrate/merge_filter_test.exs | 2 +- .../parser/gtfs_realtime_enhanced_test.exs | 10 +- .../concentrate/parser/gtfs_realtime_test.exs | 2 +- test/concentrate/parser/helpers_test.exs | 4 +- .../concentrate/reporter/time_travel_test.exs | 2 +- 23 files changed, 169 insertions(+), 144 deletions(-) diff --git a/.credo.exs b/.credo.exs index f0ba01e3..31599ae9 100644 --- a/.credo.exs +++ b/.credo.exs @@ -64,126 +64,153 @@ # # {Credo.Check.Design.DuplicatedCode, false} # - checks: [ - # - ## Consistency Checks - # - {Credo.Check.Consistency.ExceptionNames, []}, - {Credo.Check.Consistency.LineEndings, []}, - {Credo.Check.Consistency.ParameterPatternMatching, []}, - {Credo.Check.Consistency.SpaceAroundOperators, []}, - {Credo.Check.Consistency.SpaceInParentheses, []}, - {Credo.Check.Consistency.TabsOrSpaces, []}, + checks: %{ + enabled: [ + # + ## Consistency Checks + # + {Credo.Check.Consistency.ExceptionNames, []}, + {Credo.Check.Consistency.LineEndings, []}, + {Credo.Check.Consistency.ParameterPatternMatching, []}, + {Credo.Check.Consistency.SpaceAroundOperators, []}, + {Credo.Check.Consistency.SpaceInParentheses, []}, + {Credo.Check.Consistency.TabsOrSpaces, []}, - # - ## Design Checks - # - # You can customize the priority of any check - # Priority values are: `low, normal, high, higher` - # - {Credo.Check.Design.AliasUsage, - [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 2]}, - # You can also customize the exit_status of each check. - # If you don't want TODO comments to cause `mix credo` to fail, just - # set this value to 0 (zero). - # - {Credo.Check.Design.TagTODO, [exit_status: 2]}, - {Credo.Check.Design.TagFIXME, []}, + # + ## Design Checks + # + # You can customize the priority of any check + # Priority values are: `low, normal, high, higher` + # + {Credo.Check.Design.AliasUsage, + [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, + {Credo.Check.Design.TagFIXME, []}, + # You can also customize the exit_status of each check. + # If you don't want TODO comments to cause `mix credo` to fail, just + # set this value to 0 (zero). + # + {Credo.Check.Design.TagTODO, [exit_status: 2]}, - # - ## Readability Checks - # - {Credo.Check.Readability.AliasOrder, false}, - {Credo.Check.Readability.FunctionNames, []}, - {Credo.Check.Readability.LargeNumbers, []}, - {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 100]}, - {Credo.Check.Readability.ModuleAttributeNames, []}, - {Credo.Check.Readability.ModuleDoc, []}, - {Credo.Check.Readability.ModuleNames, []}, - {Credo.Check.Readability.ParenthesesInCondition, []}, - {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, - {Credo.Check.Readability.PredicateFunctionNames, []}, - {Credo.Check.Readability.PreferImplicitTry, []}, - {Credo.Check.Readability.RedundantBlankLines, []}, - {Credo.Check.Readability.Semicolons, []}, - {Credo.Check.Readability.SpaceAfterCommas, []}, - {Credo.Check.Readability.StringSigils, []}, - {Credo.Check.Readability.TrailingBlankLine, []}, - {Credo.Check.Readability.TrailingWhiteSpace, []}, - {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, - {Credo.Check.Readability.VariableNames, []}, + # + ## Readability Checks + # + {Credo.Check.Readability.AliasOrder, []}, + {Credo.Check.Readability.FunctionNames, []}, + {Credo.Check.Readability.LargeNumbers, []}, + {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, + {Credo.Check.Readability.ModuleAttributeNames, []}, + {Credo.Check.Readability.ModuleDoc, []}, + {Credo.Check.Readability.ModuleNames, []}, + {Credo.Check.Readability.ParenthesesInCondition, []}, + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, + {Credo.Check.Readability.PipeIntoAnonymousFunctions, []}, + {Credo.Check.Readability.PredicateFunctionNames, []}, + {Credo.Check.Readability.PreferImplicitTry, []}, + {Credo.Check.Readability.RedundantBlankLines, []}, + {Credo.Check.Readability.Semicolons, []}, + {Credo.Check.Readability.SpaceAfterCommas, []}, + {Credo.Check.Readability.StringSigils, []}, + {Credo.Check.Readability.TrailingBlankLine, []}, + {Credo.Check.Readability.TrailingWhiteSpace, []}, + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, + {Credo.Check.Readability.VariableNames, []}, + {Credo.Check.Readability.WithSingleClause, []}, - # - ## Refactoring Opportunities - # - {Credo.Check.Refactor.CondStatements, []}, - {Credo.Check.Refactor.CyclomaticComplexity, []}, - {Credo.Check.Refactor.FunctionArity, []}, - {Credo.Check.Refactor.LongQuoteBlocks, []}, - # {Credo.Check.Refactor.MapInto, []}, - {Credo.Check.Refactor.MatchInCondition, []}, - {Credo.Check.Refactor.NegatedConditionsInUnless, []}, - {Credo.Check.Refactor.NegatedConditionsWithElse, []}, - {Credo.Check.Refactor.Nesting, []}, - {Credo.Check.Refactor.UnlessWithElse, []}, - {Credo.Check.Refactor.WithClauses, []}, + # + ## Refactoring Opportunities + # + {Credo.Check.Refactor.Apply, []}, + {Credo.Check.Refactor.CondStatements, []}, + {Credo.Check.Refactor.CyclomaticComplexity, []}, + {Credo.Check.Refactor.FilterCount, []}, + {Credo.Check.Refactor.FilterFilter, []}, + {Credo.Check.Refactor.FunctionArity, []}, + {Credo.Check.Refactor.LongQuoteBlocks, []}, + {Credo.Check.Refactor.MapJoin, []}, + {Credo.Check.Refactor.MatchInCondition, []}, + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, + {Credo.Check.Refactor.Nesting, []}, + {Credo.Check.Refactor.RedundantWithClauseResult, []}, + {Credo.Check.Refactor.RejectReject, []}, + {Credo.Check.Refactor.UnlessWithElse, []}, + {Credo.Check.Refactor.WithClauses, []}, - # - ## Warnings - # - {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, - {Credo.Check.Warning.BoolOperationOnSameValues, []}, - {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, - {Credo.Check.Warning.IExPry, []}, - {Credo.Check.Warning.IoInspect, []}, - # {Credo.Check.Warning.LazyLogging, []}, - {Credo.Check.Warning.MixEnv, false}, - {Credo.Check.Warning.OperationOnSameValues, []}, - {Credo.Check.Warning.OperationWithConstantResult, []}, - {Credo.Check.Warning.RaiseInsideRescue, []}, - {Credo.Check.Warning.UnusedEnumOperation, []}, - {Credo.Check.Warning.UnusedFileOperation, []}, - {Credo.Check.Warning.UnusedKeywordOperation, []}, - {Credo.Check.Warning.UnusedListOperation, []}, - {Credo.Check.Warning.UnusedPathOperation, []}, - {Credo.Check.Warning.UnusedRegexOperation, []}, - {Credo.Check.Warning.UnusedStringOperation, []}, - {Credo.Check.Warning.UnusedTupleOperation, []}, - {Credo.Check.Warning.UnsafeExec, []}, + # + ## Warnings + # + {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, + {Credo.Check.Warning.BoolOperationOnSameValues, []}, + {Credo.Check.Warning.Dbg, []}, + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, + {Credo.Check.Warning.IExPry, []}, + {Credo.Check.Warning.IoInspect, []}, + {Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []}, + {Credo.Check.Warning.OperationOnSameValues, []}, + {Credo.Check.Warning.OperationWithConstantResult, []}, + {Credo.Check.Warning.RaiseInsideRescue, []}, + {Credo.Check.Warning.SpecWithStruct, []}, + {Credo.Check.Warning.UnsafeExec, []}, + {Credo.Check.Warning.UnusedEnumOperation, []}, + {Credo.Check.Warning.UnusedFileOperation, []}, + {Credo.Check.Warning.UnusedKeywordOperation, []}, + {Credo.Check.Warning.UnusedListOperation, []}, + {Credo.Check.Warning.UnusedPathOperation, []}, + {Credo.Check.Warning.UnusedRegexOperation, []}, + {Credo.Check.Warning.UnusedStringOperation, []}, + {Credo.Check.Warning.UnusedTupleOperation, []}, + {Credo.Check.Warning.WrongTestFileExtension, []} + ], + disabled: [ + # + # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) - # - # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) + # + # Controversial and experimental checks (opt-in, just move the check to `:enabled` + # and be sure to use `mix credo --strict` to see low priority checks) + # + {Credo.Check.Consistency.MultiAliasImportRequireUse, []}, + {Credo.Check.Consistency.UnusedVariableNames, []}, + {Credo.Check.Design.DuplicatedCode, []}, + {Credo.Check.Design.SkipTestWithoutComment, []}, + {Credo.Check.Readability.AliasAs, []}, + {Credo.Check.Readability.BlockPipe, []}, + {Credo.Check.Readability.ImplTrue, []}, + {Credo.Check.Readability.MultiAlias, []}, + {Credo.Check.Readability.NestedFunctionCalls, []}, + {Credo.Check.Readability.OneArityFunctionInPipe, []}, + {Credo.Check.Readability.OnePipePerLine, []}, + {Credo.Check.Readability.SeparateAliasRequire, []}, + {Credo.Check.Readability.SingleFunctionToBlockPipe, []}, + {Credo.Check.Readability.SinglePipe, []}, + {Credo.Check.Readability.Specs, []}, + {Credo.Check.Readability.StrictModuleLayout, []}, + {Credo.Check.Readability.WithCustomTaggedTuple, []}, + {Credo.Check.Refactor.ABCSize, []}, + {Credo.Check.Refactor.AppendSingleItem, []}, + {Credo.Check.Refactor.DoubleBooleanNegation, []}, + {Credo.Check.Refactor.FilterReject, []}, + {Credo.Check.Refactor.IoPuts, []}, + {Credo.Check.Refactor.MapMap, []}, + {Credo.Check.Refactor.ModuleDependencies, []}, + {Credo.Check.Refactor.NegatedIsNil, []}, + {Credo.Check.Refactor.PassAsyncInTestCases, []}, + {Credo.Check.Refactor.PipeChainStart, []}, + {Credo.Check.Refactor.RejectFilter, []}, + {Credo.Check.Refactor.VariableRebinding, []}, + {Credo.Check.Warning.LazyLogging, []}, + {Credo.Check.Warning.LeakyEnvironment, []}, + {Credo.Check.Warning.MapGetUnsafePass, []}, + {Credo.Check.Warning.MixEnv, []}, + {Credo.Check.Warning.UnsafeToAtom, []} - # - # Controversial and experimental checks (opt-in, just replace `false` with `[]`) - # - {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, - {Credo.Check.Consistency.UnusedVariableNames, false}, - {Credo.Check.Design.DuplicatedCode, false}, - {Credo.Check.Readability.AliasAs, false}, - {Credo.Check.Readability.BlockPipe, false}, - {Credo.Check.Readability.ImplTrue, false}, - {Credo.Check.Readability.MultiAlias, false}, - {Credo.Check.Readability.SeparateAliasRequire, false}, - {Credo.Check.Readability.SinglePipe, false}, - {Credo.Check.Readability.Specs, false}, - {Credo.Check.Readability.StrictModuleLayout, false}, - {Credo.Check.Readability.WithCustomTaggedTuple, false}, - {Credo.Check.Refactor.ABCSize, false}, - {Credo.Check.Refactor.AppendSingleItem, false}, - {Credo.Check.Refactor.DoubleBooleanNegation, false}, - {Credo.Check.Refactor.ModuleDependencies, false}, - {Credo.Check.Refactor.NegatedIsNil, false}, - {Credo.Check.Refactor.PipeChainStart, false}, - {Credo.Check.Refactor.VariableRebinding, false}, - {Credo.Check.Warning.LeakyEnvironment, false}, - {Credo.Check.Warning.MapGetUnsafePass, false}, - {Credo.Check.Warning.UnsafeToAtom, false} + # {Credo.Check.Refactor.MapInto, []}, - # - # Custom checks can be created using `mix credo.gen.check`. - # - ] + # + # Custom checks can be created using `mix credo.gen.check`. + # + ] + } } ] } diff --git a/lib/concentrate.ex b/lib/concentrate.ex index 84e60055..4ca83942 100644 --- a/lib/concentrate.ex +++ b/lib/concentrate.ex @@ -146,8 +146,8 @@ defmodule Concentrate do routes: {&is_list/1, & &1}, excluded_routes: {&is_list/1, & &1}, fallback_url: {&is_binary/1, & &1}, - username: {&is_possible_env_var/1, &process_possible_env_var/1}, - password: {&is_possible_env_var/1, &process_possible_env_var/1}, + username: {&possible_env_var?/1, &process_possible_env_var/1}, + password: {&possible_env_var?/1, &process_possible_env_var/1}, topics: {&is_list/1, & &1}, max_future_time: {&is_integer/1, & &1}, fetch_after: {&is_integer/1, & &1}, @@ -187,7 +187,7 @@ defmodule Concentrate do Keyword.new(acc) end - defp is_possible_env_var(value) do + defp possible_env_var?(value) do case value do %{"system" => _} -> true <<_::binary>> -> true diff --git a/lib/concentrate/group_filter/remove_uncertain_stop_time_updates.ex b/lib/concentrate/group_filter/remove_uncertain_stop_time_updates.ex index 4742f4cf..837b3c64 100644 --- a/lib/concentrate/group_filter/remove_uncertain_stop_time_updates.ex +++ b/lib/concentrate/group_filter/remove_uncertain_stop_time_updates.ex @@ -13,8 +13,7 @@ defmodule Concentrate.GroupFilter.RemoveUncertainStopTimeUpdates do If no uncertainty values are configured, enabling this filter has no effect. """ - alias Concentrate.TripDescriptor - alias Concentrate.StopTimeUpdate + alias Concentrate.{StopTimeUpdate, TripDescriptor} @behaviour Concentrate.GroupFilter diff --git a/test/concentrate/encoder/gtfs_realtime_helpers_test.exs b/test/concentrate/encoder/gtfs_realtime_helpers_test.exs index ee29f8cc..54170121 100644 --- a/test/concentrate/encoder/gtfs_realtime_helpers_test.exs +++ b/test/concentrate/encoder/gtfs_realtime_helpers_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.Encoder.GTFSRealtimeHelpersTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.Encoder.GTFSRealtimeHelpers - alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition} doctest Concentrate.Encoder.GTFSRealtimeHelpers diff --git a/test/concentrate/encoder/trip_updates/json_test.exs b/test/concentrate/encoder/trip_updates/json_test.exs index d6eb11ae..aa812a63 100644 --- a/test/concentrate/encoder/trip_updates/json_test.exs +++ b/test/concentrate/encoder/trip_updates/json_test.exs @@ -3,7 +3,7 @@ defmodule Concentrate.Encoder.TripUpdates.JSONTest do use ExUnit.Case, async: true import Concentrate.Encoder.TripUpdates.JSON import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1] - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} describe "encode_groups/1" do test "same output as EncoderTripUpdates.encode_groups/1 but in JSON" do diff --git a/test/concentrate/encoder/trip_updates_enhanced_test.exs b/test/concentrate/encoder/trip_updates_enhanced_test.exs index 80b9d2a9..96555a92 100644 --- a/test/concentrate/encoder/trip_updates_enhanced_test.exs +++ b/test/concentrate/encoder/trip_updates_enhanced_test.exs @@ -5,7 +5,7 @@ defmodule Concentrate.Encoder.TripUpdatesEnhancedTest do import Concentrate.Encoder.TripUpdatesEnhanced import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1] alias Concentrate.Parser.GTFSRealtimeEnhanced - alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition} describe "encode_groups/1" do test "decoding and re-encoding TripUpdates_enhanced.json is a no-op" do diff --git a/test/concentrate/encoder/trip_updates_test.exs b/test/concentrate/encoder/trip_updates_test.exs index befeea83..ec623c74 100644 --- a/test/concentrate/encoder/trip_updates_test.exs +++ b/test/concentrate/encoder/trip_updates_test.exs @@ -4,7 +4,7 @@ defmodule Concentrate.Encoder.TripUpdatesTest do import Concentrate.TestHelpers import Concentrate.Encoder.TripUpdates import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1] - alias Concentrate.{FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition} alias Concentrate.Parser.GTFSRealtime describe "encode_groups/1" do diff --git a/test/concentrate/encoder/vehicle_positions_test.exs b/test/concentrate/encoder/vehicle_positions_test.exs index cd40dd8d..056bd823 100644 --- a/test/concentrate/encoder/vehicle_positions_test.exs +++ b/test/concentrate/encoder/vehicle_positions_test.exs @@ -4,7 +4,7 @@ defmodule Concentrate.Encoder.VehiclePositionsTest do import Concentrate.TestHelpers import Concentrate.Encoder.VehiclePositions import Concentrate.Encoder.GTFSRealtimeHelpers, only: [group: 1] - alias Concentrate.{FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition} alias Concentrate.Parser.GTFSRealtime describe "encode/1" do diff --git a/test/concentrate/group_filter/cancelled_trip_test.exs b/test/concentrate/group_filter/cancelled_trip_test.exs index 77dfe236..e3c4bcfa 100644 --- a/test/concentrate/group_filter/cancelled_trip_test.exs +++ b/test/concentrate/group_filter/cancelled_trip_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.CancelledTripTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.CancelledTrip - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} @module Concentrate.Filter.FakeCancelledTrips diff --git a/test/concentrate/group_filter/closed_stop_test.exs b/test/concentrate/group_filter/closed_stop_test.exs index 0d0707ad..4b5665b3 100644 --- a/test/concentrate/group_filter/closed_stop_test.exs +++ b/test/concentrate/group_filter/closed_stop_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ClosedStopTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.ClosedStop - alias Concentrate.{TripDescriptor, StopTimeUpdate, VehiclePosition} + alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition} @trip_update TripDescriptor.new(trip_id: "trip", direction_id: 1, route_id: "route") @valid_date_time 8 diff --git a/test/concentrate/group_filter/remove_uncertain_stop_time_updates_test.exs b/test/concentrate/group_filter/remove_uncertain_stop_time_updates_test.exs index fd53907a..5f42df68 100644 --- a/test/concentrate/group_filter/remove_uncertain_stop_time_updates_test.exs +++ b/test/concentrate/group_filter/remove_uncertain_stop_time_updates_test.exs @@ -1,8 +1,7 @@ defmodule Concentrate.GroupFilter.RemoveUncertainStopTimesTest do use ExUnit.Case, async: true alias Concentrate.GroupFilter.RemoveUncertainStopTimeUpdates - alias Concentrate.TripDescriptor - alias Concentrate.StopTimeUpdate + alias Concentrate.{StopTimeUpdate, TripDescriptor} @mid_trip 60 @at_terminal 120 diff --git a/test/concentrate/group_filter/remove_unneeded_times_test.exs b/test/concentrate/group_filter/remove_unneeded_times_test.exs index e08996f0..0cbb1552 100644 --- a/test/concentrate/group_filter/remove_unneeded_times_test.exs +++ b/test/concentrate/group_filter/remove_unneeded_times_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.RemoveUnneededTimesTest do @moduledoc false use ExUnit.Case, async: true alias Concentrate.GroupFilter.RemoveUnneededTimes - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} defmodule FakeStopTimes do @moduledoc "Fake implementation of GTFS.StopTimes" diff --git a/test/concentrate/group_filter/scheduled_stop_times_test.exs b/test/concentrate/group_filter/scheduled_stop_times_test.exs index 297fd9cb..58f71397 100644 --- a/test/concentrate/group_filter/scheduled_stop_times_test.exs +++ b/test/concentrate/group_filter/scheduled_stop_times_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ScheduledStopTimesTest do @moduledoc false use ExUnit.Case, async: true alias Concentrate.GroupFilter.ScheduledStopTimes - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} defmodule FakeStopTimes do def arrival_departure("trip1", 10, {2022, 1, 1}), do: {1_610_000_000, 1_610_000_001} diff --git a/test/concentrate/group_filter/shuttle_test.exs b/test/concentrate/group_filter/shuttle_test.exs index b1b555a3..da8526db 100644 --- a/test/concentrate/group_filter/shuttle_test.exs +++ b/test/concentrate/group_filter/shuttle_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.Shuttle - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} @trip_id "trip" @route_id "route" diff --git a/test/concentrate/group_filter/skipped_stop_on_added_trip_test.exs b/test/concentrate/group_filter/skipped_stop_on_added_trip_test.exs index bb881d24..25aecb34 100644 --- a/test/concentrate/group_filter/skipped_stop_on_added_trip_test.exs +++ b/test/concentrate/group_filter/skipped_stop_on_added_trip_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.Filter.SkippedStopOnAddedTripTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.SkippedStopOnAddedTrip - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} @trip_id "trip" diff --git a/test/concentrate/group_filter/vehicle_at_skipped_stop_test.exs b/test/concentrate/group_filter/vehicle_at_skipped_stop_test.exs index b7473033..eb5cfdba 100644 --- a/test/concentrate/group_filter/vehicle_at_skipped_stop_test.exs +++ b/test/concentrate/group_filter/vehicle_at_skipped_stop_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.VehicleAtSkippedStopTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.VehicleAtSkippedStop - alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition} describe "filter/1" do test "if the vehicle's stop_id is SKIPPED, change to the next stop" do diff --git a/test/concentrate/group_filter/vehicle_past_stop_test.exs b/test/concentrate/group_filter/vehicle_past_stop_test.exs index 33728f43..a9fd7ab4 100644 --- a/test/concentrate/group_filter/vehicle_past_stop_test.exs +++ b/test/concentrate/group_filter/vehicle_past_stop_test.exs @@ -2,7 +2,7 @@ defmodule Concentrate.GroupFilter.VehiclePastStopTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.VehiclePastStop - alias Concentrate.{TripDescriptor, VehiclePosition, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition} describe "filter/1" do test "removes StopTimeUpdates if they come after the vehicle's sequence" do diff --git a/test/concentrate/group_filter/vehicle_stop_match_test.exs b/test/concentrate/group_filter/vehicle_stop_match_test.exs index b47981f0..946f7adb 100644 --- a/test/concentrate/group_filter/vehicle_stop_match_test.exs +++ b/test/concentrate/group_filter/vehicle_stop_match_test.exs @@ -2,8 +2,8 @@ defmodule Concentrate.GroupFilter.VehicleStopMatchTest do @moduledoc false use ExUnit.Case, async: true import Concentrate.GroupFilter.VehicleStopMatch - alias Concentrate.{StopTimeUpdate, VehiclePosition} alias Concentrate.GTFS.Stops + alias Concentrate.{StopTimeUpdate, VehiclePosition} describe "filter/1" do test "updates the VehiclePosition stop_id to match the StopTimeUpdate" do diff --git a/test/concentrate/merge_filter_test.exs b/test/concentrate/merge_filter_test.exs index 6688a096..450bf6bf 100644 --- a/test/concentrate/merge_filter_test.exs +++ b/test/concentrate/merge_filter_test.exs @@ -4,8 +4,8 @@ defmodule Concentrate.MergeFilterTest do use ExUnitProperties import ExUnit.CaptureLog, only: [capture_log: 1] import Concentrate.MergeFilter - alias Concentrate.{Merge, FeedUpdate, TripDescriptor, VehiclePosition, StopTimeUpdate} alias Concentrate.Encoder.GTFSRealtimeHelpers + alias Concentrate.{FeedUpdate, Merge, StopTimeUpdate, TripDescriptor, VehiclePosition} describe "handle_subscribe/4" do test "lets GenStage manage the demand automatically" do diff --git a/test/concentrate/parser/gtfs_realtime_enhanced_test.exs b/test/concentrate/parser/gtfs_realtime_enhanced_test.exs index 04489ef0..c4b985af 100644 --- a/test/concentrate/parser/gtfs_realtime_enhanced_test.exs +++ b/test/concentrate/parser/gtfs_realtime_enhanced_test.exs @@ -6,14 +6,14 @@ defmodule Concentrate.Parser.GTFSRealtimeEnhancedTest do import Concentrate.Parser.GTFSRealtimeEnhanced alias Concentrate.{ - FeedUpdate, - TripDescriptor, - StopTimeUpdate, - VehiclePosition, Alert, Alert.InformedEntity, + FeedUpdate, Parser.Helpers, - Parser.Helpers.Options + Parser.Helpers.Options, + StopTimeUpdate, + TripDescriptor, + VehiclePosition } describe "parse/1" do diff --git a/test/concentrate/parser/gtfs_realtime_test.exs b/test/concentrate/parser/gtfs_realtime_test.exs index c34f6983..bdbd0b61 100644 --- a/test/concentrate/parser/gtfs_realtime_test.exs +++ b/test/concentrate/parser/gtfs_realtime_test.exs @@ -4,7 +4,7 @@ defmodule Concentrate.Parser.GTFSRealtimeTest do import ExUnit.CaptureLog import Concentrate.TestHelpers import Concentrate.Parser.GTFSRealtime - alias Concentrate.{FeedUpdate, VehiclePosition, TripDescriptor, StopTimeUpdate, Alert} + alias Concentrate.{Alert, FeedUpdate, StopTimeUpdate, TripDescriptor, VehiclePosition} alias Concentrate.Parser.Helpers.Options describe "parse/1" do diff --git a/test/concentrate/parser/helpers_test.exs b/test/concentrate/parser/helpers_test.exs index f0f6a714..2dc0793c 100644 --- a/test/concentrate/parser/helpers_test.exs +++ b/test/concentrate/parser/helpers_test.exs @@ -1,6 +1,7 @@ defmodule Concentrate.Parser.HelpersTest do use ExUnit.Case, async: true import Concentrate.Parser.Helpers + alias Concentrate.Parser.Helpers.Options alias Concentrate.{TripDescriptor, VehiclePosition} describe "drop_fields/2" do @@ -27,8 +28,7 @@ defmodule Concentrate.Parser.HelpersTest do describe "parse_options/1" do test "handles feed_url option" do - assert %Concentrate.Parser.Helpers.Options{feed_url: "url"} = - Concentrate.Parser.Helpers.parse_options(feed_url: "url") + assert %Options{feed_url: "url"} = parse_options(feed_url: "url") end end end diff --git a/test/concentrate/reporter/time_travel_test.exs b/test/concentrate/reporter/time_travel_test.exs index a1388eda..6c25e700 100644 --- a/test/concentrate/reporter/time_travel_test.exs +++ b/test/concentrate/reporter/time_travel_test.exs @@ -4,7 +4,7 @@ defmodule Concentrate.Reporter.TimeTravelTest do import ExUnit.CaptureLog alias Concentrate.Reporter.TimeTravel - alias Concentrate.{TripDescriptor, StopTimeUpdate} + alias Concentrate.{StopTimeUpdate, TripDescriptor} defp build_trip(timings) do td = %TripDescriptor{