Linux automated code formatting (PHP, JavaScript,

2019-07-06 17:00发布

I am seeking a Linux or PHP program to automate code formatting. Optimally it would handle many languages, but the priority is (highest first): PHP, JavaScript, HTML, CSS and MySQL. Comparability is nice, but not the most important feature.

Context / use: automation via Subversion post-commit. I'm working with teams and want to always follow a single method of formatting.

3条回答
啃猪蹄的小仙女
2楼-- · 2019-07-06 17:55

Astyle is the canonical answer if you insist on just one.

You likely cannot get a single formatter for many langauges that understands their syntax, and you can't afford to get the syntax wrong, because you don't want the formatter to break code (especially after it has just been checked in!) [Astyle works on several because it accepts only C-like langauges]. See Semantic Designs Formatters for such tools for many langauges that do understand syntax accurately and can't make such mistakes.

查看更多
叛逆
3楼-- · 2019-07-06 17:56

Check out Geany. It is in the Ubuntu repos and its the best PHP IDE I've used yet.

EDIT: 8 year update: try VS Code. Its my main IDE for most everything these days.

查看更多
不美不萌又怎样
4楼-- · 2019-07-06 17:57

I find that using an IDE such as Eclipse or Aptana will accomplish this task very easily. It's not automated but if all developers use an IDE this is very simple

查看更多
登录 后发表回答