Skip to content

Add a few more notes to the style guide#13055

Merged
jpakkane merged 1 commit intomesonbuild:masterfrom
Ericson2314:style-notes
Apr 23, 2024
Merged

Add a few more notes to the style guide#13055
jpakkane merged 1 commit intomesonbuild:masterfrom
Ericson2314:style-notes

Conversation

@Ericson2314
Copy link
Member

  • Mention 2 space indent seems to be the most ideomatic

  • Mention trailing commas are good

  • Update example to use trailing commas

@Ericson2314 Ericson2314 requested review from dcbaker and jpakkane April 8, 2024 14:39
## Tabs or spaces?

Always spaces.
Always spaces. Two spaces is most common.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really?

I religiously avoid them, personally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know! :) I thought it was 2; I just looked in the test suite and saw mostly 2 spaces; but I don't have a good sense of what people do in the wild.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anecdotally, muon fmt which is supported by the vscode extension, defaults to 4 spaces but allows you to configure an arbitrary "indentation string".

Copy link
Member

@dcbaker dcbaker Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our documentation uses two space indent, and that's what I use, so anything I've worked on has two space indent. I picked that style up from what @jpakkane was doing.


## Trailing commas?

Yes where possible. They help make nicer diffs in version control systems.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, the "JSON Problem" should be avoided wherever possible.

@QuLogic
Copy link
Member

QuLogic commented Apr 22, 2024

  • Mention 2 space indent seems to be the most ideomatic

s/ideomatic/idiomatic/ in the commit message.

@Ericson2314
Copy link
Member Author

Fixed the commit message and removed the [...] in the example. Is there anything else that needs to be done for this?

- Mention 2 space indent seems to be the most idiomatic

- Mention trailing commas are good

- Update example to use trailing commas
@jpakkane jpakkane merged commit be62df7 into mesonbuild:master Apr 23, 2024
@Ericson2314 Ericson2314 deleted the style-notes branch April 23, 2024 17:13
@Ericson2314
Copy link
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants