naersk icon indicating copy to clipboard operation
naersk copied to clipboard

chore: formatted code and fixed lints

Open AxelSilverdew opened this issue 1 year ago • 5 comments

I took the liberty of formatting all the code with alejandra and resolving a few lint warnings that were thrown by statix.

This should make it a wee bit easier to contribute code to the repo.

AxelSilverdew avatar Oct 28 '23 12:10 AxelSilverdew

While I'm not necessarily the number one fan of this particular formatting style (more of a nixpkgs-fmt guy myself), I think as long as we have something consistent, it's nice -- would it be possible to attach some formatting check into the pipeline as well, so that misformatted code can't be committed?

cc @nmattia, ofc.

Patryk27 avatar Oct 28 '23 18:10 Patryk27

Oh yeah, it should be pretty easy to add a format and lint check to the pipeline. I'll push a commit adding that in a little bit.

AxelSilverdew avatar Oct 29 '23 03:10 AxelSilverdew

Oh, I had never heard of Alejandra! I don't have a strong opinion for one style or another, but since this is technically a nix-community project, might be less confusing to use nixpkgs-fmt? or is alejandra the accepted default formatter now?

would it be possible to attach some formatting check into the pipeline

would even go further and say: let's not format anything unless there are CI checks :)

nmattia avatar Oct 30 '23 09:10 nmattia

since this is technically a nix-community project, might be less confusing to use nixpkgs-fmt?

That's a good point, I have no problem using nixpkgs-fmt here instead of alejandra if needed.

I just picked alejandra because that's been my goto default for a while now, so it was just force of habit :D

This discussion is what made me choose alejandra for my own projects in case you were interested in giving it a read.

would even go further and say: let's not format anything unless there are CI checks :)

Checks for formatting and linting? Or checks for functionality in general?

For formatting and linting we'd just need actions to run nix run nixpkgs#alejandra -- --check . and nix run nixpkgs#statix check.

For general checks, I'm gonna try to get our existing tests to pass over the weekend.

AxelSilverdew avatar Oct 30 '23 09:10 AxelSilverdew

Also for the record, I don't have a preference between nixpkgs-fmt or alejandra, so I'm fine with whatever as long as the outputs are consistent. :D

AxelSilverdew avatar Oct 30 '23 09:10 AxelSilverdew