Hi, I have come across the document for <Harshil a...
# linting
d
Hi, I have come across the document for Harshil alignment, currently thats not something that we follow and we are not in the process of submitting modules to nf-core. However, what would be your advice in following this. is this a "MUST" ? Would this break nf-core lint or any future changes?
n
I think this is optional
r
Easiest is to use the Nextflow VScode extension and enable Harshil Alignment: https://marketplace.visualstudio.com/items?itemName=nextflow.nextflow In modules it is semi-optional. I don't think anyone checks it religiously, but suggestions to properly align on some common symbols are sometimes added because it makes the code a lot easier to read.
this 1
👍 1
j
Yeah, not following it won't break anything:) but you definitely get happier reviewer s :) The extension (and format your file via the context menu / update your settings to 'format on save') is definitely fastest/easiest as @Rike Hanssen says
👍 1
i
If I'm the reviewer, the probability of a Harshil alignment comment is close to 100% (given that the module template is wrong to start with)
🤣 3
j
Considered a PR to the template to fix it? 😏 (Although the extension also doesn't do a true harshil alignment 😬)
i
I've thought about it many times and then forgotten
j
tenor_gif2277129374894430408.gif
tenor_gif6387700220951960719.gif
p
Automated formatter coming soooon 🤫
🙌 2
It has flags such as
Copy code
-harshil-alignment
       Use Harshil alignment
@nf-core-bot fix formatting
j
🤩
d
oh great, thank you!
j
Is @nf-core-bot public?
p
But the bot account itself doesn't do much, the magic is done within GitHub Actios (fix-linting.yml)
For
@nf-core-bot fix linting
☝🏻
Note that the actions workflows are configured to check out the repositories using authentication as the
@nf-core-bot
user, which is why the automated commits then come from that user.
✅ 1
j
As an experienced developer, I would request to not have Harshil alignments as mandatory, as they are a great enemy of version tracking because they tend to clutter the history: removing/adding/editing a line may require adjusting the spaces in many other lines, and this affects the blame tracking (if people are good at adding information in their commits, it may take you several "roll backs" to find the information you want, instead of just having it there at a quick glance). (Trying to stay in the "objective" scope, as readability can be subjective and there are too many schools and flavours to please everyone)
p
yes I'm inclined to agree, though this is something that has gone through many rounds of argument discussion previously, so it's a hornets nest that I don't personally really want to kick 🫠
It's already effectively mandatory, so we have a choice to revert that decision now if we want
j
Wait wait wait no one ever said it was Mandatory
p
ah is it not?
j
No
p
ok well we need to decide one way or the other now if we are to adopt auto-formatting
j
We go with the word of god Ben
Auto formatter yes, basically like Black
Which is basically a partial Harshil alignment The point there is if it's automated it's consistent for everyone and it gets around the issues Jorge raises
The 'must' comes from the slightly misleading OP which was more 'do I really have to do it as someone suggested '
p
ok, so decision is auto-formatter without Harshil alignment?
shared a GIF
j
I thought auto formatter IS harshil alignment (as far as it was possible)
?
p
No, the auto-formatter has a flag, you can choose whether to have Harshil alignment or not
j
Oooohh
p
teased the CLI help text here
j
Missed that
I just saw 'autoformstting from bot' and went to a happy place I guess 🤣
👌 1
😂 1
j
That sounds good, cheers!
j
So what's wrong with the
-harshil-formatting as implemented by the
language server exactly?
p
j
Ahhhhh now I'm following. But Ben's harshil alignment doesn't do that anyway does it?
p
in other words - you fix a typo and instead of a 1-character diff, you have a massive block-diff of 15 lines where all other variables around it get indented by an extra space
👍 1
j
I thought that was one of the things that was too tricky anyway?
?
I thought it was just the comments stuff
p
Just tried it, doing a diff with and without the flag I get this kind of thing:
CleanShot 2025-04-01 at 17.29.13@2x.png
r
but look at how readable it is
this 1
j
Well anyway point being, personally: • Never was Mandatory • I like it as I do find it makes stuff much more readable when developing • But ultimately I just want it consistent so what ever the bot says is fine with me if that is enforced Harshil alignment as a 'spec' was a hackathon joke Easter egg 🤣
p
I guess it depends on which you think is more important - git blame like @Jorge Alvarez-Jarreta or readability like @Rike Hanssen
j
Readability 💯💯💯
I use git blame once or twice a month maybe 😅
p
shared a GIF
😆 1
j
Reading other people's and my own code multiple times a week
r
I mean git blame is pretty convoluted already. The module change in your pipeline (that is associated to you) comes from the modules repo from yet another person
this 1
not sure the indentation makes that big of a difference anymore
p
not sure the indentation makes that big of a difference anymore
how do you mean?
j
We can ask on #C043UU89KKQ maybe
👍🏻 1
r
not sure the indentation makes that big of a difference anymore
you already need to do a bit of backtracking through the pipelines and modules repo to get to the git commit hash of the module version you have installed
d
sorry, the document says its a "MUST" https://nf-co.re/docs/guidelines/components/subworkflows#misc > • Never was Mandatory
j
Oh oops 👀
It shouldn't be 😅
I'll update that tomorrow to 'sgluld'
Should*
Sorry about that 🫠
d
yes, that started the confusion for me, thank you ! it will be a great help
j
I think I must have written that at first and forgot to change it after the discussions 🤦🏼‍♀️
blob no problem 1
(where it was definitely 'should ')
👍 1
m
how was I not in this discussion?
j
#C073ZDLNC92
m
confused dog
j
(too busy ;) )
p
Is it worth changing now if it's about to become a MUST in a few weeks anyway?
j
I really do not want to enter into the readability discussion in this thread, because there are a few things I would add in that case, and this may become the longest thread in nf-core history 😂
😂 2
j
Is it worth changing now if it's about to become a MUST in a few weeks anyway?
Fair 😬
I really do not want to enter into the readability discussion in this thread, because there are a few things I would add in that case, and this may become the longest thread in nf-core history 😂
We can always improve the Harshil Alignment 😏
nextflow shake 1
🙏 1
m
I don't like where most people align the commas
shakefist 1
j
Vote so far but with little context (reflexive emotional response)
@Phil Ewels if you want to provide more context you're welcome to, but I think people will quite strongly feel to keep
-harshil-alignment
p
shared a GIF
👍 1
Nah I'm not sure it's needed to be honest, the above seems to align with previous discussions that we've had on the topic
👍 1