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

Enable autoformat code (before commit) #14311

Open
Jako opened this Issue Jan 26, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@Jako
Copy link
Collaborator

Jako commented Jan 26, 2019

Feature request

Summary

The repository code should run through some code formatter like https://prettier.io/

Why is it needed?

  • No need to discuss style in code review

Suggested solution(s)

Add prettier at least to the template build process to make the files in that part formatted. The other part (format the php code) needs some integration in an IDE or in the commit process.

We should also provide the code styles in an Intellij IDEA code style XML scheme.

The code style of a PR should also be checked by Travis on GitHub and invalid styled code should be rejected.

Related issue(s)/PR(s)

Nothing special, but changing the default branch to 3.x would be a great time to introduce this change, since after reformatting our code we will have merge issues with code from other branches.

@OptimusCrime

This comment has been minimized.

Copy link
Contributor

OptimusCrime commented Jan 28, 2019

Should have been done a long time ago. The only problem is all the merge conflicts it is going to cause.

@JoshuaLuckers

This comment has been minimized.

Copy link
Collaborator

JoshuaLuckers commented Feb 2, 2019

How can we move forward with this? I would really like to see a more standardised code base.

@Ibochkarev

This comment has been minimized.

Copy link
Contributor

Ibochkarev commented Feb 2, 2019

Use https://prettier.io/ for our IDE with a common config.

@Ibochkarev

This comment has been minimized.

Copy link
Contributor

Ibochkarev commented Feb 12, 2019

https://www.npmjs.com/package/grunt-prettier

There is a package milking Grunt. You can use it and write a config to format your code.

@Ibochkarev

This comment has been minimized.

Copy link
Contributor

Ibochkarev commented Feb 17, 2019

I studied the information on this topic. I have found:

We need to take the first step and begin to embody this innovation.

I suggest:

  • discuss the set of rules for the .prettierrc configuration file.
  • add the given file to the root directory
  • and test

Colleagues, your move!

@JoshuaLuckers

This comment has been minimized.

Copy link
Collaborator

JoshuaLuckers commented Feb 18, 2019

Does Prettier provide default rules? Maybe we can use that for a start.

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