Code style - formatting between IDE's
Hey
I'm wondering how people are dealing with people using different IDE's in their projects?
At the moment I'm stuck with people using Eclipse in an OSS project and was wondering if anyone had a codestyle schema/settings to import in IDEA to get the same autoformating settings as Eclipse's default settings?
请先登录再写评论。
Did you try one of the external formatter plugins?
Perhaps: http://plugins.intellij.net/plugin/?idea&id=6020
On Sun, 17 Apr 2011 20:37:20 MSD, Roy Sindre Norangshol
<no_reply@jetbrains.com> wrote, quoted or indirectly quoted someone
who said :
>I'm wondering how people are dealing with people using different IDE's in their projects?
>
>At the moment I'm stuck with people using Eclipse in an OSS project and was wondering if anyone had a codestyle schema/settings to import in IDEA to get the same autoformating settings as Eclipse's default settings?
I this is normally handled by the boss dictating an IDE and format
framework for the project. Everyone must run their code through it
before checkin. If they use a different IDE, that is their problem.
Perhaps a more politically sensitive solution would be to write a
standalone reformatter, and leave it up to programmers to integrate it
with their favourite IDE.
Not having a standard IDE is a recipe for mayhem. The worst possible
scheme is to set up fiefdoms where in each one the alpha programmer
gets to decide the format, and anyone modifying the code is supposed
to psychically understand it and manually conform to it.
Just telling people "blend" is an ego trip.
Consider that the check in format need not be beautiful. It could even
be nearly-all blanks and line breaks squeezed out. You can always
fluff it up to your favourite format. This means the general "tidier"
can be quite primitive.
--
Roedy Green Canadian Mind Products
http://mindprod.com
Doing what the user expects with respect to navigation is absurdly important for user satisfaction.
~ anonymous Google Android developer
Personally, I think automatic code formatting is a travesty and I will resist with all my might ever having my code subject to such mangling.
Programmers should take responsibility for readable code. Short of a language like Lisp, there is no way an automated formatter can make code look as good as a person can and we should expect programmers to take the time to do so.
Randall schulz
Well, I guess it comes down to how much you (or your employer) value your time. Should you spend it typing spaces and linefeeds or typing functioning source code.
What happens if someone else edits your masterpiece of indentation and messes up the formatting. Who'se job is it to fix whitespace issues in otherwise functional sourcecode (with the risk of breaking the code due to human error)
Making your code readable is as important, if not more, than making your code functional. Typing spaces and linefeeds is not wasted time in the long run -- the time spent making your code better readable will more than make up for the time other programmers would otherwise lose trying to understand it.
I agree with you about the importance of good formatting. I just think if you can automate it, then you should so you can focus on other "more important" tasks.
I tried it, but I never got it working. The eclipse loading screen appeard but it didn't do any formatting :-/
I've tried it both on Windows- and Linux- platforms.
(sorry for some delayed answer, had some busy days)
Agree with the above, clean code is indeed important..
But my issue is still about the formatting of the source code, it's not a question about if this code is easier to read (in the sense of variables you use, method names etc). You might argue that the auto formatting of your sourec code makes your source code difficult to read, but that sounds more like an issue for not following clean code imo :-)
If you work in a large project where everyone is not using one standard IDE, the automatic formatting tools generate different styles, which again generates a lot of unneccery changes to the files when their getting commited and turns into unreadable diff's if your not carefull..
That's time spent I'd rather use on coding. My hope is that there would be a setting which let me say : "follow this standard" and the different IDE's would confirm to this and not generate different output. Even a stupid option like "follow eclipse formatting" would make my job a lot easier when joining such projects where most of the users are Eclipse users etc. I guess the problem is that there is no such standard defining all this settings so fine-tuned. You have Sun/Oracle's code style conventions[1] but they seem to be clearly not enough..
because I think Eclipse even uses the Sun/Oracle's code style conventions[1], and I have a feeling IntelliJ does the same? At least they do format the source code differently..
In the end, I guess I might have to sit down and see if I'm able to make the styles identical by adjusting all the settings in IntelliJ to be on par with Eclipse's code formatting. (or the other way around).
(I'll post back in the future when I find the time to sit down and do the task :-))