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

Add --quiet-with-result flag #496

Merged
merged 1 commit into from
May 11, 2023
Merged

Conversation

Nezteb
Copy link
Sponsor Contributor

@Nezteb Nezteb commented May 3, 2023

An alternative to --quiet that doesn't print any of the:

Finding suitable PLTs
Checking PLT...
[:amqp, :amqp10_client, :amqp10_common, :amqp_client, :argon2_elixir, :asn1, :bus, :castore, :certifi, :combine, :compiler, :configparser_ex, :connection, :cowboy, :cowboy_telemetry, :cowlib, :crypto, :db_connection, :decimal, :ecto, :ecto_sql, :eex, :elixir, :elixir_uuid, :ex_aws, :ex_aws_rds, :ex_aws_s3, :expo, :gettext, :gun, :hackney, :hierarch, :inets, :jason, :jsx, :kernel, :logger, :logger_json, :metrics, :mime, ...]
PLT is up to date!
No :ignore_warnings opt specified in mix.exs. Using default: .dialyzer_ignore.exs.

Starting Dialyzer
[
  check_plt: false,
  init_plt: '/Users/noah/Git/project/priv/plts/dialyzer.plt',
  files: ['/Users/noah/Git/project/_build/dev/lib/project/...',
   ...],
  warnings: [:underspecs, :unknown]
]

But does print:

Total errors: 207, Skipped: 207, Unnecessary Skips: 0
done (passed successfully)

@Nezteb Nezteb force-pushed the add-no-debug-print branch 4 times, most recently from 62e6a50 to 647f898 Compare May 3, 2023 19:05
Comment on lines +282 to +286
fn text ->
Mix.shell(Mix.Shell.IO)
info(text)
Mix.shell(Mix.Shell.Quiet)
end
Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of this method, but since --quiet is implemented by changing the Mix shell, I couldn't think of a better way without drastically refactoring things.

{result, 0} = System.cmd("mix", args, env: env)

assert result =~
~r/Total errors: ., Skipped: ., Unnecessary Skips: .\ndone \(passed successfully\)\n/
Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When some versions of Elixir/Erlang run this test, they have different numbers of errors/skipped/etc, so I had to use a regex check.

Copy link
Owner

@jeremyjh jeremyjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry for the delay responding. Looks good and thanks!

@jeremyjh jeremyjh merged commit 3008741 into jeremyjh:master May 11, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants