I really like my Perl code formatted - lines indented, etc. The problem is I hate doing it myself, and I really enjoy auto-formatters that do this automatically for you.
I work with Eclipse and the EPIC plugin does just that. The problem is that it does not handle comments very well. If comments are too long, it does not break them into...
Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this:
if (x < 0) {
printf("Negative");
}
How do I do this? I can't seem to find the right options.
...
I've been customizing my formatting desires using ReSharper for code clean-up. So far I've been able to make the clean-up rules match my coding style within:
ReSharper -> Options -> Languages -> C# -> Formatting Style
One thing I haven't figured out how to do yet is how to have params/fields/list items wrap with leading commas inst...
VS2010 / R#5.1
I have this "line" of code:
With.Mocks(_mocks).Expecting(() => {
_fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData);
}).Verify(() => {
});
I perform a R# code cleanup, which changes the code as follows:
With.Mocks(_mocks).Expecting(() => { _fooServiceMock.Expect(x => x.FooMethod()).Return(fooMockData)...
This might not be quite the question you're expecting! I don't want a regex that will match over line-breaks; instead, I want to write a long regex that, for readability, I'd like to split onto multiple lines of code.
Something like:
"bar" =~ /(foo|
bar)/ # Doesn't work!
# => nil. Would like => 0
Can it be done?
...
I found this page which shows how to run the Java formatter but I cannot find similar resources to run the built-in C/C++ formatters.
It is possible To do this?
...
Just moving over to vim at the moment. In textmate I could format code by hitting cmd-alt-[. How do I achieve the same in vim?
See the answer below for the command. I found I also need the following in my vimrc so that vim new how to autoindent ruby.
if has("autocmd")
filetype indent on
endif
...
In a recent code review, a contributor is trying to enforce that all NULL checks on pointers be performed in the following manner:
int * some_ptr;
// ...
if( some_ptr == NULL )
{
// handle null-pointer error
}
else
{
// proceed
}
instead of
int * some_ptr;
// ...
if( some_ptr )
{
// proceed
}
else
{
//handle null-pointer err...
I'd like Visual Studio to continue automatically formatting my .cs files, but is there a way to prevent it auto-formatting C# code in between the <% %> tags in ASP.NET MVC views because it really makes a mess of it?
...
I know, it sounds really stupid, but I don't seem to be able to format my code in IntelliJ. I can see the margin line (by default at 120 columns) but it seems that the formatter (activated from the menu Code -> Reformat Code) is just ignoring this margin. I'm quite new to IntelliJ so probably I'm just missing something trivial.
It's qui...
I'm using Eclipse combined with EPIC to write my Perl code. I configured EPIC to use Perltidy with "-pbp" (perl best practices style) to format my code.
This doesn't work well when using Method::Signatures' named parameters. E.g., func (:$arg1, : $arg2) is formatted as func (: $arg1, : $arg2) which yields an error.
Also, func keyword i...
Hello,
I am looking for a list of code formatting and prettifying software; I have only found a few topics that all are language specific.
This is not about syntax highlighting!
If possible, I prefer lightweight, command-line, multiplatform, portable tools.
Nevertheless, if there is no interesting alternative, I also like to know what...
I'm looking for a very flexible C code formatting solution.
Here's the context: I need to convert some external C code to my organization's "coding rules". For example, these rules demand that I put the type of each variable in its name (int_foo, pfloat_bar, etc.). Most of these rules are completely absurd but I don't have a choice.
I ...
Possible Duplicate:
why results varies upon placement of curly braces in javascript code
We have company policies that dictate that in PHP opening curly braces should be on their own lines for readability and so that they can line-up with the closing brace; thus:
if (true)
{
...
}
but in JS they should be kept on the s...
I have notepad++ and I got a xml code which is very long and when I pasted it in notepad++ there is a long line of code. (difficult to read and work.)
Now, I want to know if there is a simple way to make the text readable. (by readable I mean properly tabbed code)
I can do it manually but want a permanent solution to this, as I have face...
$ cat temp.pl
use strict;
use warnings;
print "1\n";
print "hello, world\n";
print "2\n";
print "hello,
world\n";
print "3\n";
print "hello, \
world\n";
$ perl temp.pl
1
hello, world
2
hello,
world
3
hello,
world
$
To make my code easily readable, I want to restrict the number of columns to 80 characters. How can I break a line of...
Been looking over the python docs for code formatting best practice for large lists and dictionaries, eg
something = {'foo' : 'bar', 'foo2' : 'bar2', 'foo3' : 'bar3'..... 200 chars wide etc..}
or
something = {'foo' : 'bar',
'foo2' : 'bar2',
'foo3' : 'bar3',
...
}
or
something = {...