Skip to content

add format check action - initial repo format#2520

Closed
t-bltg wants to merge 16 commits intoMakieOrg:masterfrom
t-bltg:fmt
Closed

add format check action - initial repo format#2520
t-bltg wants to merge 16 commits intoMakieOrg:masterfrom
t-bltg:fmt

Conversation

@t-bltg
Copy link
Copy Markdown
Collaborator

@t-bltg t-bltg commented Dec 24, 2022

Description

Fix #2519

  • add a format check action, running on PRs.
  • apply an initial format (options to be discussed :)).

I've ran on a single format error on https://github.com/MakieOrg/Makie.jl/blob/master/src/camera/camera.jl#L32-L34, which was trivial to fix, and I'm going to open an issue + PR in JuliaFormatter to fix this, but this is non-blocking.

Type of change

Delete options that do not apply:

  • Non functional change - format, code style

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

Comment thread CairoMakie/src/CairoMakie.jl Outdated
@t-bltg t-bltg force-pushed the fmt branch 3 times, most recently from fcf0d0d to ee0aa3c Compare December 24, 2022 16:45
@t-bltg t-bltg changed the title Fmt add formatter check action - initial repo format Dec 24, 2022
Comment thread CairoMakie/src/display.jl
@t-bltg t-bltg force-pushed the fmt branch 2 times, most recently from 1e09a72 to 389be7a Compare December 24, 2022 17:39
Comment on lines +63 to +78
println(
io,
"""
in $(value_t) fragment_$(name)_index;
uniform $(sampler_t) $(name)_texture;

vec4 get_$(name)(){
return texture($(name)_texture, fragment_$(name)_index);
}
""")
vec4 get_$(name)(){
return texture($(name)_texture, fragment_$(name)_index);
}
""",
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be good to ignore indention for this

Copy link
Copy Markdown
Collaborator Author

@t-bltg t-bltg Dec 24, 2022

Choose a reason for hiding this comment

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

This is a bit annoying yes (domluna/JuliaFormatter.jl#501), but still readable.

Comment thread CairoMakie/src/overrides.jl Outdated
Comment on lines +44 to +53
function draw_poly(
scene::Scene,
screen::Screen,
poly,
points::Vector{<:Point2},
color::Union{Symbol, Colorant, Makie.AbstractPattern},
model,
strokecolor,
strokewidth,
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I prefer this to be double indented so that function .. end and ( .. ) are on different levels and visually distinct.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this is a matter of taste.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sure, that's true for pretty much all of these. I'm mostly pointing this stuff out so it can be discussed and we can figure out what we actually want

Comment thread src/basic_recipes/arrows.jl
Comment thread src/interaction/inspector.jl
Comment thread src/interaction/inspector.jl
Comment thread src/interaction/inspector.jl
Comment thread src/interaction/inspector.jl Outdated
Comment on lines +752 to +741
z =
((r - i) * img[l, b] + (i - l) * img[r, b]) * (t - j) +
((r - i) * img[l, t] + (i - l) * img[r, t]) * (j - b)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess this is very subjective and nit-picky but I think in some situations (like here) it's nicer to have e.g. (t-j) instead of (t - j). The former sort of establishes groups and gives you less separate things to look at which, in my opinion, helps readability. Maybe this is something to keep unformated?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure, I personally find this quite readable, and consistent with the rest.

@@ -4,206 +4,205 @@ represent keyboard buttons.
"""
module Keyboard
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we should lose the indention for modules with how we use them here.

Comment thread src/makielayout/blocks/axis.jl Outdated
@t-bltg t-bltg force-pushed the fmt branch 2 times, most recently from 440bcff to 2a15ad7 Compare December 24, 2022 21:25
@t-bltg
Copy link
Copy Markdown
Collaborator Author

t-bltg commented Dec 24, 2022

I have taken another approach, since there were too many controversial changes as @ffreyer pointed out.

I propose instead to use the minimal style, which e.g. doesn't take into account margins.

I'm also annoyed by the forced trailing zeros (20f0 -> 20.0f0) (see domluna/JuliaFormatter.jl#672), hopefully this will be resolved quickly. ==> EDIT: JuliaFormatter PR merged, I will update this PR asap.

@ffreyer
Copy link
Copy Markdown
Collaborator

ffreyer commented Dec 24, 2022

I'll say it again here so it's more visible: Most of my complaints are just my opinions on code style. My main reason for posting them is so we can discuss those points and figure out what styling we want. It doesn't need to be what I suggest. But I think this pr is the place to discuss that.

@t-bltg
Copy link
Copy Markdown
Collaborator Author

t-bltg commented Dec 24, 2022

Code style is always controversial, and comments on this PR are very welcome.
I'm glad we can have those discussions so that we can come up with an acceptable solution :)

@t-bltg t-bltg changed the title add formatter check action - initial repo format add format check action - initial repo format Dec 28, 2022
@t-bltg t-bltg force-pushed the fmt branch 4 times, most recently from 20aa8db to 3e58ffe Compare December 31, 2022 17:13
@t-bltg t-bltg force-pushed the fmt branch 3 times, most recently from 1397143 to 781c1f6 Compare January 9, 2023 19:28
@t-bltg t-bltg force-pushed the fmt branch 4 times, most recently from e55ee76 to eeeea7c Compare March 2, 2023 11:57
@t-bltg
Copy link
Copy Markdown
Collaborator Author

t-bltg commented Mar 2, 2023

Rebased against latest master.

Should this go in (based on #2493 (comment)) ?
This is exactly the purpose of this MR, not to waste time and endlessly discuss code style in other PRs.

@t-bltg
Copy link
Copy Markdown
Collaborator Author

t-bltg commented Jun 15, 2025

Superseded by #5078.

@t-bltg t-bltg closed this Jun 15, 2025
@github-project-automation github-project-automation Bot moved this from Needs discussion/help to Closed in PR review Jun 15, 2025
@t-bltg t-bltg deleted the fmt branch June 15, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

Inconsistent formatting / code style

3 participants