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

Define/Use a code convention for new/updated code #1375

Open
juherr opened this issue Mar 4, 2017 · 8 comments
Open

Define/Use a code convention for new/updated code #1375

juherr opened this issue Mar 4, 2017 · 8 comments

Comments

@juherr
Copy link
Member

juherr commented Mar 4, 2017

I think we should define a code convention for new & updated code in order to have the same IDE configuration everywhere and avoid syntax typo in pull requests.

Usually, I use the google convention because they provide the idea and eclipse configuration file.

@testng-team WDYT?

@krmahadevan
Copy link
Member

I agree. We could also perhaps include a editorConfig file. In case of the formatter and user would still need to import it into their IDE for it to take effect. But in the case of editorConfig, it comes bundled with IntelliJ. Please see complete list here
They also have a plugin for eclipse that can be downloaded. Am not trying to compare this against that, but just throwing out options.

@juherr
Copy link
Member Author

juherr commented Mar 5, 2017

Yes, EditorConfig is another option. But we need to determine the rules before. And I think we should not apply it to the current code quickly because the diff will be too huge.

We can discuss on rules but I don't want to spend to much time because I don't care to follow rules I don't like (once they are defined).
The google convention could be a good start and we can customize it according to opinion of @testng-team

@cbeust
Copy link
Collaborator

cbeust commented Mar 5, 2017

Agreed, it would be nice to have formatting rules for IDEA and Eclipse included in the project, but in my experience, it's not always easy without specifying preferences for a lot of other things in the IDE (not sure if it's still true). If it's possible to commit a file that only specifies code formatting and nothing else, great.

Also, that file should ideally define import orders so we never see imports shuffling in the PR's.

@juherr
Copy link
Member Author

juherr commented Mar 5, 2017

@cbeust And WDYT about the google style?

@cbeust
Copy link
Collaborator

cbeust commented Mar 6, 2017

I'm fine with the Google style.

@missedone
Copy link
Contributor

Agreed, it would be nice to have formatting rules for IDEA and Eclipse included in the project, but in my experience, it's not always easy without specifying preferences for a lot of other things in the IDE (not sure if it's still true).

This still sucks today, for import order, eclipse has a separate preference and can be exported.
For now, our team uses both Eclipse and Intellij, we use eclipse preference as the source of truth. For Intellij, there is a Eclipse Code Formatter plugin can import the eclipse preference files (including the import order one)

@juherr
Copy link
Member Author

juherr commented Mar 8, 2017

@missedone As proposed by @krmahadevan , editorConfig is supposed to fix configuration issues. Do you have any bad experience with it?

BTW, if we follow the google style, they already provide eclipse and intellij configuration files.

@missedone
Copy link
Contributor

I didn't use editorConfig before, it could be a fun with trying something new, but looks like need to define the editorConfig profile from scratch to fit TestNG...

I would say let's start with google style first.
for the import order, there need to be a separate profile file.

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

No branches or pull requests

4 participants