Skip to content

Add .JuliaFormatter.toml + workflow - #76

Open
giopaglia wants to merge 2 commits into
mainfrom
gio/add-juliaformatter
Open

giopaglia wants to merge 2 commits into
mainfrom
gio/add-juliaformatter

Conversation

@giopaglia

@giopaglia giopaglia commented Mar 7, 2026 •

Copy link
Copy Markdown
Member

#74 is introducing some changes + blue style formatting, which makes inspecting the diff hard.

So let's deal with autoformatting first: let's add an JuliaFormatter.toml + a Julia action.

But which style should we go for? Has this been discussed already? Some Sole packages have JuliaAutoformatter.toml, like https://github.com/aclai-lab/SoleLogics.jl/blob/main/.JuliaFormatter.toml and https://github.com/aclai-lab/Sole.jl/blob/main/.JuliaFormatter.toml, but it's a sciml-based one (not blue style).

One thing I can advocate for is using two spaces instead of four for indenting. I often find that 4 are unnecessary. Other than that, I'm fine with either blue style or sci ml.

@giopaglia

Copy link
Copy Markdown
Member Author

Once we settle on a style the same change can be applied to other repos.

@codecov

codecov Bot commented Mar 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.94571% with 461 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.87%. Comparing base (2517efa) to head (5ce7b51).

Files with missing lines Patch % Lines
...ional-structures/representatives/Full1DFrame+IA.jl 9.43% 96 Missing ⚠️
src/scalar/var-features.jl 28.07% 41 Missing ⚠️
src/utils/multilogiset.jl 16.66% 40 Missing ⚠️
src/scalar/onestep-memoset.jl 58.10% 31 Missing ⚠️
src/minimize.jl 15.38% 22 Missing ⚠️
src/utils/autologiset-tools.jl 45.00% 22 Missing ⚠️
src/scalar/scalarlogiset.jl 72.72% 18 Missing ⚠️
src/types/MLJ-interface.jl 0.00% 18 Missing ⚠️
src/SoleData.jl 5.88% 16 Missing ⚠️
src/scalar/dnf-domain-minimization.jl 0.00% 15 Missing ⚠️
... and 31 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
- Coverage   50.10%   49.87%   -0.23%     
==========================================
  Files          62       62              
  Lines        3838     4002     +164     
==========================================
+ Hits         1923     1996      +73     
- Misses       1915     2006      +91     

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

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

@PasoStudio73

Copy link
Copy Markdown
Member

Sir, you are right: #74 was a mess after blue style formatting.
We had a meeting and decided to go for Blue format.
I used Julia Formatter to perform that, but I totally dislike its default settings.
I don’t know if it’s a best practice or not, but it changes the code, not only formatting.

I show you an example:

# before JuliaFormatter

for instance in 1:(X |> size |> first)
    ] |> x -> filter(!isnothing, x)

# after JuliaFormatter

for instance in 1:(first(size(X)))

my concern is: is it normal?

@giopaglia

Copy link
Copy Markdown
Member Author

I see, perhaps there are some configs to control these behavior.

I'll change to blue style and see if we can avoid these |> rewritings. In this specific case though the semantics is the same and I prefer the syntax without |>, so I see no issue.

Are there other cases where it can potentially affect the code?

@PasoStudio73

Copy link
Copy Markdown
Member

This is the one that take my attention. I don’t remember other changes, but if I find other “code refactoring” I will post here.
I don’t personally use “|>” and I’m used to use parentheses instead.
But, for example, @mauro-milella is a big fan of “|>” and he would be afraid of refactoring it

@mauro-milella

Copy link
Copy Markdown
Member

Hi guys! Don't worry for the pipe, actually I rarely see it in others' code and is fine to keep a more traditional style.

@giopaglia I would prefer four spaces for indenting. Together with the ruler set at 80 characters (I think this is the default in the blue style), it is a good "guardrail" for avoiding very long messy lines even when I am distracted.

Does this make sense?

@giopaglia

giopaglia commented Mar 8, 2026 via email

Copy link
Copy Markdown
Member Author

@alberto-paparella

Copy link
Copy Markdown
Member

Hi guys, sorry if I'm late to the party!

Yes, let's go with blue style 😎 (@mauro-milella you make me proud asking for the 80 characters per line)

I just wanted to add a comment on the github action: together with @ferdiu we decided to have an action for checking that the blue style guidelines are followed (i.e., differently from the proposed action, which automatically applies blue syle calling the formatter).

We are working on it (:

@giopaglia

Copy link
Copy Markdown
Member Author

I just wanted to add a comment on the github action: together with @ferdiu we decided to have an action for checking that the blue style guidelines are followed (i.e., differently from the proposed action, which automatically applies blue syle calling the formatter).

Why not let ci autofix the syntax? Your suggestion seems to need more manual work from developers

This branch has not been deployed

No deployments
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