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

Replace the assert macro with the new _assert utility function #226

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

eliascarv
Copy link
Member

@eliascarv eliascarv commented Nov 6, 2023

Motivation: @assert docstring:

help?> @assert
  @assert cond [text]

  Throw an AssertionError if cond is false. Preferred syntax for writing
  assertions. Message text is optionally displayed upon assertion failure.

  │ Warning
  │
  │  An assert might be disabled at various optimization levels. Assert
  │  should therefore only be used as a debugging tool and not used for
  │  authentication verification (e.g., verifying passwords), nor should
  │  side effects needed for the function to work correctly be used
  │  inside of asserts.

@eliascarv eliascarv requested a review from juliohm November 6, 2023 17:18
@codecov-commenter
Copy link

Codecov Report

Merging #226 (97b0228) into master (beb0c2a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #226   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files          40       40           
  Lines        1259     1259           
=======================================
  Hits         1182     1182           
  Misses         77       77           
Files Coverage Δ
src/assertions.jl 100.00% <100.00%> (ø)
src/distributions.jl 91.66% <100.00%> (ø)
src/tableselection.jl 90.00% <100.00%> (ø)
src/transforms.jl 100.00% <100.00%> (ø)
src/transforms/dropextrema.jl 100.00% <100.00%> (ø)
src/transforms/eigenanalysis.jl 87.30% <100.00%> (ø)
src/transforms/functional.jl 89.79% <ø> (-0.21%) ⬇️
src/transforms/logratio.jl 100.00% <100.00%> (ø)
src/transforms/parallel.jl 95.06% <100.00%> (ø)
src/transforms/remainder.jl 100.00% <100.00%> (ø)
... and 2 more

@juliohm juliohm merged commit 33e8f01 into master Nov 6, 2023
@juliohm juliohm deleted the assert branch November 6, 2023 17:28
@CameronBieganek
Copy link

Nitpick:
This is better than using @assert, but it is more idiomatic to throw an ArgumentError than to throw an AssertionError.

@juliohm
Copy link
Member

juliohm commented Nov 7, 2023 via email

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.

4 participants