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

Apply new formatter version #1842

Closed

Conversation

JoshuaLampert
Copy link
Member

Due to domluna/JuliaFormatter.jl#792, which is part of the new version v1.0.46 from JuliaFormatter.jl released 13 hours ago, the formatting changes and CI fails. This PR applies the changes from the new version.

Copy link
Contributor

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.

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 ❤️ by the Trixi.jl community.

]
mpi_mesh_info.mpi_mortars.local_neighbor_ids[local_mpi_mortar_id] = [current_index +
1]
mpi_mesh_info.mpi_mortars.local_neighbor_positions[local_mpi_mortar_id] = [map_iface_to_ichild_to_position[iface + 1][t8_element_child_id(eclass_scheme, element) + 1]]
Copy link
Member Author

@JoshuaLampert JoshuaLampert Feb 10, 2024

Choose a reason for hiding this comment

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

This line gets really long.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check if a line break behind e.g. the = gets removed from the formater?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, after the =, it does get removed. I've pushed an alternative in f393d48 with a line break after the first closing bracket.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, never mind. This does not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

So none of the tried options work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately yes. We could, however, give shorter names to map_iface_to_ichild_to_position[iface + 1] and t8_element_child_id(eclass_scheme, element) + 1 before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I would hesitate to change variable names due to formatter issues - probably we have a new formatting in 2-3 months anyway

Copy link
Contributor

@DanielDoehring DanielDoehring Feb 12, 2024

Choose a reason for hiding this comment

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

Maybe we should just push this through to get the other PRs going

Copy link

codecov bot commented Feb 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fe6a527) 96.38% compared to head (228fd01) 96.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1842   +/-   ##
=======================================
  Coverage   96.38%   96.38%           
=======================================
  Files         455      455           
  Lines       36391    36391           
=======================================
  Hits        35074    35074           
  Misses       1317     1317           
Flag Coverage Δ
unittests 96.38% <100.00%> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

DanielDoehring
DanielDoehring previously approved these changes Feb 10, 2024
Copy link
Contributor

@DanielDoehring DanielDoehring left a comment

Choose a reason for hiding this comment

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

I like the more compact code

@JoshuaLampert
Copy link
Member Author

CI failures seem to be a server error on the codecov side.

@JoshuaLampert
Copy link
Member Author

Could maybe one of you have a brief look, @sloede, @ranocha? Thanks!

Comment on lines 819 to +826
map_iface_to_ichild_to_position = [
# 0 1 2 3 4 5 6 7 ichild/iface
[1, 0, 2, 0, 3, 0, 4, 0], # 0
[0, 1, 0, 2, 0, 3, 0, 4], # 1
[1, 2, 0, 0, 3, 4, 0, 0], # 2
[0, 0, 1, 2, 0, 0, 3, 4], # 3
[1, 2, 3, 4, 0, 0, 0, 0], # 4
[0, 0, 0, 0, 1, 2, 3, 4], # 5
]
# 0 1 2 3 4 5 6 7 ichild/iface
[1, 0, 2, 0, 3, 0, 4, 0], # 0
[0, 1, 0, 2, 0, 3, 0, 4], # 1
[1, 2, 0, 0, 3, 4, 0, 0], # 2
[0, 0, 1, 2, 0, 0, 3, 4], # 3
[1, 2, 3, 4, 0, 0, 0, 0], # 4
[0, 0, 0, 0, 1, 2, 3, 4]]
Copy link
Member

@efaulhaber efaulhaber Feb 12, 2024

Choose a reason for hiding this comment

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

This is absolutely terrible. Why do these things always happen in new versions of JuliaFormatter?

Copy link
Member

Choose a reason for hiding this comment

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

@efaulhaber
Copy link
Member

I created a PR reverting the changes in JuliaFormatter: domluna/JuliaFormatter.jl#807
I ran JuliaFormatter on Trixi.jl main with this patch, and there are no changes.
If my PR in JuliaFormatter is merged soon, we can avoid meging this huge PR and another subsequent PR reverting this PR again.

@JoshuaLampert JoshuaLampert marked this pull request as draft February 12, 2024 17:18
@DanielDoehring
Copy link
Contributor

Question is whether we should pin the version of the Julia formatter to something fixed we are happy with? Otherwise stuff like this will come up again and probably confuse / de-motivate people in contributing.

@Arpit-Babbar
Copy link
Member

Question is whether we should pin the version of the Julia formatter to something fixed we are happy with?

Some are indeed taking this approach SciML/ModelingToolkit.jl#2456

Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

I created a PR reverting the changes in JuliaFormatter: domluna/JuliaFormatter.jl#807 I ran JuliaFormatter on Trixi.jl main with this patch, and there are no changes. If my PR in JuliaFormatter is merged soon, we can avoid meging this huge PR and another subsequent PR reverting this PR again.

Thanks a lot, @efaulhaber! I would like to fix the version of JuliaFormatter (e.g., #1843) or wait for your patch to be accepted and released.

@efaulhaber
Copy link
Member

Maybe it would make sense to permanently fix the formatter version, so that development is not delayed by new versions. But then add a GitHub workflow to periodically check if a new version is available and perhaps automatically create a PR like the compat workflow.

@ranocha
Copy link
Member

ranocha commented Feb 13, 2024

That sounds like a good idea 👍

@JoshuaLampert
Copy link
Member Author

Ok, then let's fix the JuliaFormatter version. Closing this.

@JoshuaLampert JoshuaLampert deleted the new-formatter-version branch February 18, 2024 18:55
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.

5 participants