Does the operator adjust a decent style?

some_var = foo()
another_var = bar()

or

some_var    = foo()
another_var = bar()

Enables changing spaces when lines are added or deleted to align them. Does it really look good? Is it worth it to upset diff?

+3
source share
7 answers

Since my time as a VCS administrator, the curse of a few stylistic problems is to clear the difference. We had developer change names with his gender reassignment procedure, and her new name did not have the same initial one. Then she changed her old initials to new ones when she worked on the program, and it caused me a lot of annoyance.

+4
source

, , ( , ), .

, , , , .

:

some_var    = foo()
another_var = bar()

var another_another_var:

some_var    = foo()
another_var = bar()
another_another_var = baz()

:

some_var            = foo()
another_var         = bar()
another_another_var = baz()

.

+9

Perl perl-tidy .

aligned = 's, , , , .

, , , .

, .

, , , .

+2

, , :

some_var[  1] = "foo";
some_var[100] = "bar";

, , . SQL, , ( ) , - .

@some_var varchar(25) = NULL
@another_var varchar(1000) = ''
@one_more int = 0
+1

.

, IDE , , .

, , , . , .

+1

; . , , .

+1

In addition, in extreme cases, it becomes difficult to accidentally see which task occurs due to large gaps. This is what I see too often in header files.

...
some_important_number                                             = 348273;
initial_message_prefix                                            = "foo";
another_important_number                                          = 348711;
max_bucket_sz                                                     = 456;
...

With dozens of them in a block, it becomes difficult to read.

+1
source

Source: https://habr.com/ru/post/1699491/


All Articles