Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce proper code formatting #509

Closed
DusanJovic-NOAA opened this issue Sep 19, 2024 · 3 comments · Fixed by #533
Closed

Enforce proper code formatting #509

DusanJovic-NOAA opened this issue Sep 19, 2024 · 3 comments · Fixed by #533
Assignees
Labels

Comments

@DusanJovic-NOAA
Copy link
Contributor

This section of code does not look properly indented, which makes it hard to read and reason about it:

image

This is because in my editor tabs are displayed as 4 spaces. We should not use tabs in the source code.

To fix:

  1. Replace all tabs with spaces in all source files.
  2. Delete trailing spaces.
  3. Use clang-format to uniformly and consistently reformat all source code.
  4. Enforce proper formatting in CI
@edwardhartnett
Copy link
Contributor

Agree.

We are using 4-spaces, no tabs. If you see anything else, feel free to correct.

I have never used clang-format. I would welcome a CI that demonstrates this in the CI.

@DusanJovic-NOAA
Copy link
Contributor Author

I added .clang-fomat in this commit f32fb5d

And with those settings I ran it in the src directory on all source files, see this commit (ignoring whitespace changes)

Is this acceptable format/style?

I ran it locally on my laptop, I do not know how to integrate it in CI.

@edwardhartnett
Copy link
Contributor

Yes, that looks great. Let's get your commits merged and I will put clang-format in the CI.

Thanks for this, it's really helpful. I'll suggest it for the netcdf-c repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants