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

feat: add editorconfig #3

Merged

Conversation

mateusoliveira43
Copy link
Contributor

Description

Add editorconfig to project. This will check all project's file format, by checking:

  • if there is no trailing whitespace in them
  • if there is a empty newline at the end of them
  • if they use the correct indent style (tab or space)
  • if they have correct indent size

How to test

Run make ec


[*]
indent_size = 4
indent_style = space
Copy link
Member

Choose a reason for hiding this comment

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

For .go

Indentation
We use tabs for indentation and gofmt emits them by default. Use spaces only if you must.

https://go.dev/doc/effective_go#formatting

Copy link
Member

Choose a reason for hiding this comment

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

Why not leave .go files out of editorconfig and do something like
openshift/oadp-operator#1337

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did not understand the linked PR

but yes, go files and Makefile both accept tabs and spaces (go example of spaces: the headers copyright), so added them to list of indent_style=unset. go fmt (run by golangci-lint) will take care of this for us in go files

Copy link
Member

Choose a reason for hiding this comment

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

The tab character is a very important part of the syntax of Makefiles.

So Makefile should not be indented using spaces. Yes unset sounds good.

Spaces can exists in go and makefile but not as an indent method for non-comments.

Signed-off-by: Mateus Oliveira <[email protected]>
Signed-off-by: Mateus Oliveira <[email protected]>
@mateusoliveira43 mateusoliveira43 marked this pull request as ready for review March 1, 2024 17:08
Makefile Show resolved Hide resolved
@mateusoliveira43 mateusoliveira43 merged commit 065eed6 into migtools:master Mar 1, 2024
5 checks passed
@mateusoliveira43 mateusoliveira43 deleted the feat/add-editorconfig branch March 13, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants