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 format check action - initial repo format #2520

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

t-bltg
Copy link
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.

@t-bltg t-bltg changed the title Fmt add formatter check action - initial repo format Dec 24, 2022
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
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
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 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
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
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
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

src/basic_recipes/arrows.jl Outdated Show resolved Hide resolved
src/interaction/inspector.jl Outdated Show resolved Hide resolved
src/interaction/inspector.jl Outdated Show resolved Hide resolved
src/interaction/inspector.jl Outdated Show resolved Hide resolved
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
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
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
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.

src/makielayout/blocks/axis.jl Outdated Show resolved Hide resolved
@t-bltg
Copy link
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
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
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 e55ee76 to eeeea7c Compare March 2, 2023 11:57
@t-bltg
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs discussion/help
Development

Successfully merging this pull request may close these issues.

Inconsistent formatting / code style
3 participants