bluerobotics / BlueOS

The open source platform for ROV, USV, robotic system operation, development, and expansion.
https://blueos.cloud/docs/
Other
142 stars 72 forks source link

CI/CD: Enforce new line at the end of the file on pull requests #2191

Open rafaellehmkuhl opened 10 months ago

rafaellehmkuhl commented 10 months ago

Right now the linter is not doing that, which causes the files to be modified to add or remove them, depending on the commit author.

Discussed here.

avelynhc commented 10 months ago

I can work on adding a code formatter, The Ruff Formatter or black, to enforce a new line at EOF

patrickelectric commented 10 months ago

I can work on adding prettier to enforce a new line at EOF

That would be really nice!

rafaellehmkuhl commented 10 months ago

I can work on adding a code formatter, The Ruff Formatter or black, to enforce a new line at EOF

Nice! Notice we already have black in the repository, so if it has this configuration, let's use it so we don't increase dependencies.

avelynhc commented 10 months ago

Got it. I'll see what I can do with the existing black. Thanks!

rotu commented 10 months ago

I don't think black and ruff support non-python files.

rotu commented 10 months ago

And I think black and ruff already add it by default. And shellcheck which is currently in use doesn't format code (including that newline at end of line).

I think prettier might be the best bet for non-python files in this repo.

patrickelectric commented 10 months ago

An alternative would be to use https://github.com/mvdan/sh shfmt

On Thu, Nov 9, 2023, 16:14 Dan Rose @.***> wrote:

And I think black and ruff already add it by default. And shellcheck which is currently in use doesn't format code (including that newline at end of line).

I think prettier might be the best bet for non-python files in this repo.

— Reply to this email directly, view it on GitHub https://github.com/bluerobotics/BlueOS/issues/2191#issuecomment-1804450320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJIYCLS6EPKWWCKWQXXEI3YDUTQLAVCNFSM6AAAAAA7FABSOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBUGQ2TAMZSGA . You are receiving this because you commented.Message ID: @.***>

rotu commented 10 months ago

@patrickelectric you’re right. Prettier doesn’t support shell scripts, and the shell script plugin for prettier uses shfmt internally: https://github.com/un-ts/prettier/tree/master/packages/sh