You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/09 09:26:08 UTC

[GitHub] [apisix] jbampton opened a new issue #4017: feat: add Prettier

jbampton opened a new issue #4017:
URL: https://github.com/apache/apisix/issues/4017


   From what I can see Prettier which is mainly written in JavaScript and can run on pre-commit is now best in class for code formatting. Prettier is an opinionated code formatter and has about 39,000+ Stars. 
   
   With Prettier there are five different ways to implement the pre-commit check. Seems Prettier is the way to go at least for some pre-commit checks and it seems that one of the best features of pre-commit is the added automation.
   
   https://prettier.io/
   https://prettier.io/docs/en/precommit.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jbampton commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
jbampton commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816630657


   Another way to explain this is -> @spacewander is a top Lua programmer and works with many other Lua programmers and sometimes some people write a different style or perhaps syntax of Lua and @spacewander decides that all this different style is getting hard to maintain so @spacewander sets the Lua code standard and style for the project and all existing and new code needs to match the new standard.  So code needs to be reformatted.
   
   Similar to this is that most other top languages have formatters and official `style guides` or best practice advice on how you should write your code.
   
   Ruby and Python are well known for their style guides.
   
   There is the PEP 8 -- Style Guide for Python Code and also the Ruby Style Guide.
   
   https://www.python.org/dev/peps/pep-0008/
   https://rubystyle.guide/
   
   In Ruby the best known Linter / Formatter is Rubocop.
   And in Python it's black.  The Python Software Foundation make black. 
   Even Golang has `gofmt` which auto formats Go code
   
   https://rubocop.org/
   https://black.readthedocs.io/en/stable/
   https://github.com/rubocop
   https://github.com/psf/black
   https://github.com/psf
   https://golang.org/pkg/cmd/gofmt/
   
   <img width="879" alt="Screen Shot 2021-04-09 at 9 43 59 pm" src="https://user-images.githubusercontent.com/418747/114176052-042e3c00-997e-11eb-94a9-b5110b8cacba.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jbampton commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
jbampton commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816647262


   Hey @spacewander you just approved this PR -> https://github.com/apache/apisix/pull/4018  which is code formatting of Markdown files or linting whitespace 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816637090


   > > @spacewander is a top Lua programmer and works with many other Lua programmers and sometimes some people write a different style or perhaps syntax of Lua and @spacewander decides that all this different style is getting hard to maintain so @spacewander sets the Lua code standard and style for the project and all existing and new code needs to match the new standard
   
   Actually, I drop a similar request before: https://github.com/apache/apisix/issues/3303.
   One real-world ruined example is https://github.com/openssl/openssl/commit/0f113f3ee4d629ef9a4a30911b22b224772085e5. It makes searching history before 2015 quite hard.
   
   We care more about history than code's format. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander closed issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4017:
URL: https://github.com/apache/apisix/issues/4017


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jbampton commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
jbampton commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816582838


   We are already reformatting code with Markdownlint and yamllint and have been doing this for a long time.
   
   Prettier does the same thing it lints Markdown and YAML and other files, just like the checkes that run on the GitHub Super Linter or the checkes that run with pre-commit they all format or reformat files to best practice
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816580141


   Reformat the code will ruin the git history. Don't do it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jbampton commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
jbampton commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-816595009


   Prettier is used by a lot of the worlds top companies and has 530 contributors and over 2+ million users.
   
   https://github.com/prettier/prettier
   
   <img width="462" alt="Screen Shot 2021-04-09 at 8 41 16 pm" src="https://user-images.githubusercontent.com/418747/114168867-2fac2900-9974-11eb-8da2-6423dd1c12d8.png">
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jbampton commented on issue #4017: feat: add Prettier

Posted by GitBox <gi...@apache.org>.
jbampton commented on issue #4017:
URL: https://github.com/apache/apisix/issues/4017#issuecomment-817050191


   Hey @spacewander so was I more thinking about say one good test to use like Python `isort` which orders Python imports and most likely is about 10 lines of code.  
   
   We have other proposed tests too but for sure your example in `openssl` is what's called an `extreme value` since it has close to 293,000 lines added.  Extreme value theory or extreme value analysis (EVA) is a branch of statistics dealing with the extreme deviations from the median of probability distributions. 
   
   So you approved a one line code format do can we do a 10 line code format ?  
   
   Hey @membphis why is it that most of the team wanted or liked the pre-commit checks and the GitHub Super Linter and this was in progress for months and months and now on the very day the work is ready and working we now don't want these features ??  
   
   https://github.com/apache/apisix/pull/3624
   
   Hey @membphis why is it that for months team members wanted the pre-commit checks but none were or are willing to install, test and check the pre-commit feature and get it merged ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org