Trixi.jl icon indicating copy to clipboard operation
Trixi.jl copied to clipboard

Apply Runic.jl formatter

Open efaulhaber opened this issue 1 year ago • 7 comments

CC @ranocha @sloede

efaulhaber avatar Sep 09 '24 13:09 efaulhaber

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • [ ] The PR has a single goal that is clear from the PR title and/or description.
  • [ ] All code changes represent a single set of modifications that logically belong together.
  • [ ] No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • [ ] The code can be understood easily.
  • [ ] Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • [ ] There are no redundancies that can be removed by simple modularization/refactoring.
  • [ ] There are no leftover debug statements or commented code sections.
  • [ ] The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • [ ] New functions and types are documented with a docstring or top-level comment.
  • [ ] Relevant publications are referenced in docstrings (see example for formatting).
  • [ ] Inline comments are used to document longer or unusual code sections.
  • [ ] Comments describe intent ("why?") and not just functionality ("what?").
  • [ ] If the PR introduces a significant change or new feature, it is documented in NEWS.md with its PR number.

Testing

  • [ ] The PR passes all tests.
  • [ ] New or modified lines of code are covered by tests.
  • [ ] New or modified tests run in less then 10 seconds.

Performance

  • [ ] There are no type instabilities or memory allocations in performance-critical parts.
  • [ ] If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • [ ] The correctness of the code was verified using appropriate tests.
  • [ ] If new equations/methods are added, a convergence test has been run and the results are posted in the PR.

Created with :heart: by the Trixi.jl community.

github-actions[bot] avatar Sep 09 '24 13:09 github-actions[bot]

Codecov Report

:x: Patch coverage is 95.67901% with 7 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 96.28%. Comparing base (f9c9107) to head (5b633f1). :warning: Report is 479 commits behind head on main.

Files with missing lines Patch % Lines
...les/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl 0.00% 4 Missing :warning:
...p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl 0.00% 2 Missing :warning:
...es/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2070      +/-   ##
==========================================
- Coverage   96.32%   96.28%   -0.05%     
==========================================
  Files         470      470              
  Lines       37447    37511      +64     
==========================================
+ Hits        36070    36114      +44     
- Misses       1377     1397      +20     
Flag Coverage Δ
unittests 96.28% <95.68%> (-0.05%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 09 '24 14:09 codecov[bot]

Do you have an idea why CI fails?

ranocha avatar Sep 09 '24 17:09 ranocha

Do you have an idea why CI fails?

That seems to be a bug in Runic.jl:

julia> Runic.format_string("x, = (1, 2, 3)")
"x = (1, 2, 3)"

That is, of course, not equivalent:

julia> x, = (1, 2, 3); x
1

julia> x = (1, 2, 3); x
(1, 2, 3)

Edit: https://github.com/fredrikekre/Runic.jl/issues/58

efaulhaber avatar Sep 09 '24 18:09 efaulhaber

Already fixed.

efaulhaber avatar Sep 10 '24 07:09 efaulhaber

Maybe you are aware but I want to point out https://gist.github.com/kateinoigakukun/b0bc920e587851bfffa98b9e279175f2 so you can keep the blame functionality working without everything pointing to this PR modifying it.

KristofferC avatar Sep 10 '24 09:09 KristofferC

Before we discuss this newly formatted code to decide if we want to use Runic.jl, note the following:

Note that currently there is no line-length limit employed so expressions that only take up a single line, even if they are long, are not formatted like the above. Thus, only expressions where the original author have "committed" to mulitples lines are affected by this rule.

I think it wouldn't be wise to use Runic.jl at this point, as we would end up with PR comments like "please split this long line", which were the main reason why we introduced automatic formatting in the first place. Once this feature exists, we can re-evaluate.

efaulhaber avatar Sep 10 '24 10:09 efaulhaber