I hit the source code format button in an editor and the result is ugly. Something worth crying over. Unfortunately some open source projects have strange formatting requirements not contributing to readability.
I am sharing the code because it is a project where I use code shared by others. Everyone shares their code. Everyone benefits. The total cost of development falls.
The code is still ugly.
What is the ugliest code you have had to produce? What is the least readable?
I find Java is the most difficult to explain because there is so much that is weird then the common code formatting conventions make the weird unreadable.
C is difficult because there is a bunch of stuff that does not fit with the rest of the language. When you write code in Assembler, you become used to writing in two languages, the actual assembler, and a macro language for building code automatically. C has code that is not C but is not a macro language and the mixture is difficult to read. C is not helped by people mixing the two types of code in a shotgun approach.
Perl has an option to write code in something readable, almost English, but nobody uses the option.
Fortran is famous for starting life without spaces.
PHP has some shortcuts that everyone switches off and the result is readable. People can work hard to make PHP as unreadable as Perl but it is difficult. PHP has the flexibility to be clean and readable without effort. Many editors let you set your PHP format to readable. Unfortunately many editors only have one set of settings for PHP. When you set the editor to ugly mode for an open source project, you cannot use it in readable mode for everything else.
Some settings, in some editors, can be set by project but you cannot maintain two standard profiles then select a profile by project. If you contribute to Drupal, you cannot set one profile for all Drupal projects and a clean readable profile for everything else.
The code is still ugly.
I am thinking of using two editors with the two editors set to different formats.
For some Drupal modules, I used to maintain the code in a readable form for development then copy the code to the Drupal format for people who want the Drupal format. Too much work.
Many of my projects are based on code extracted from applications written before Drupal was invented. Some were written before PHP was invented. The code, in the original form, has excellent documentation and is thoroughly tested. The easiest way to incorporate the code in Drupal is as a library. You then need only a small module to connect the code into Drupal. Code in that form can be difficult to support across releases of Drupal. Copying all the code into a Drupal module can increase efficiency because there is less overhead. Arghhh, but it is no longer readable!