]> git.donarmstrong.com Git - perltidy.git/commitdiff
remove vertical alignment anonymous sub braces; update test cases
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 23 May 2020 13:48:14 +0000 (06:48 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 23 May 2020 13:48:14 +0000 (06:48 -0700)
12 files changed:
lib/Perl/Tidy/Formatter.pm
t/snippets/coverage_values.txt
t/snippets/expect/almost3.def
t/snippets/expect/git25.def [new file with mode: 0644]
t/snippets/expect/git25.git25 [new file with mode: 0644]
t/snippets/expect/smart.def
t/snippets/git25.in [new file with mode: 0644]
t/snippets/git25.par [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets10.t
t/snippets16.t
t/snippets20.t

index 8032b8329bb564c45fba283c3b84cd5cfa1ba20b..5acd53a34f870d6aab3cac54bc68ae7c6ade88a5 100644 (file)
@@ -12308,6 +12308,17 @@ sub get_seqno {
                     $alignment_type = $vert_last_nonblank_type;
                 }
 
+                #--------------------------------------------------------
+                # Undo alignment in special cases
+                #--------------------------------------------------------
+                if ($alignment_type) {
+
+                    # do not align the opening brace of an anonymous sub
+                    if ( $token eq '{' && $block_type =~ /$ASUB_PATTERN/ ) {
+                        $alignment_type = "";
+                    }
+                }
+
                 #--------------------------------------------------------
                 # then store the value
                 #--------------------------------------------------------
index ce53982f18c8cfa1e189dc2f0c7ebaf3c6d44871..7748adb8f7b9b6729829737176457c1aac60238b 100644 (file)
 $VAR1 = {
-          'brace-left-and-indent-list' => [
-                                            'if'
-                                          ],
-          'opening-anonymous-sub-brace-on-new-line' => [
-                                                         0,
-                                                         1
-                                                       ],
-          'maximum-fields-per-table' => [
-                                          0
-                                        ],
-          'blank-lines-after-opening-block' => [
-                                                 2
-                                               ],
-          'starting-indentation-level' => [
-                                            0
-                                          ],
-          'cuddled-else' => [
-                              0,
-                              1
-                            ],
-          'paren-tightness' => [
-                                 0,
-                                 1,
-                                 2
-                               ],
-          'perl-syntax-check-flags' => [
-                                         '-c -T'
-                                       ],
-          'outdent-labels' => [
-                                0,
-                                1
-                              ],
-          'space-function-paren' => [
-                                      0,
-                                      1
-                                    ],
-          'timestamp' => [
+          'opening-brace-on-new-line' => [
+                                           0,
+                                           1
+                                         ],
+          'brace-left-and-indent' => [
+                                       0,
+                                       1
+                                     ],
+          'delete-old-newlines' => [
+                                     0,
+                                     1
+                                   ],
+          'recombine' => [
                            0,
                            1
                          ],
-          'closing-side-comment-maximum-text' => [
-                                                   20,
-                                                   40
-                                                 ],
-          'ignore-old-breakpoints' => [
-                                        0,
-                                        1
-                                      ],
-          'closing-brace-indentation' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'blank-lines-before-closing-block' => [
-                                                  1
-                                                ],
-          'break-at-old-comma-breakpoints' => [
-                                                0,
-                                                1
-                                              ],
-          'delete-pod' => [
-                            0,
-                            1
-                          ],
-          'brace-vertical-tightness-closing' => [
-                                                  0,
-                                                  2
-                                                ],
-          'want-right-space' => [
-                                  '= .= =~ !~ ? :',
-                                  '= / *'
-                                ],
           'keyword-group-blanks-delete' => [
                                              0,
                                              1
                                            ],
-          'indent-columns' => [
-                                0,
-                                2,
-                                4
-                              ],
-          'weld-nested-containers' => [
-                                        0,
-                                        1
-                                      ],
-          'closing-side-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'cuddled-break-option' => [
-                                      1
-                                    ],
-          'space-prototype-paren' => [
-                                       0,
-                                       1,
-                                       2
-                                     ],
-          'stack-opening-hash-brace' => [
+          'space-terminal-semicolon' => [
                                           0,
                                           1
                                         ],
-          'add-whitespace' => [
-                                0,
-                                1
-                              ],
-          'static-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'trim-pod' => [
-                          0,
-                          1
-                        ],
-          'closing-side-comments-balanced' => [
+          'brace-vertical-tightness' => [
+                                          0,
+                                          1,
+                                          2
+                                        ],
+          'backup-and-modify-in-place' => [
+                                            0,
+                                            1
+                                          ],
+          'brace-left-and-indent-list' => [
+                                            'if'
+                                          ],
+          'block-brace-vertical-tightness' => [
                                                 0,
                                                 1
                                               ],
+          'cuddled-break-option' => [
+                                      1
+                                    ],
+          'square-bracket-vertical-tightness-closing' => [
+                                                           0,
+                                                           2
+                                                         ],
           'long-block-line-count' => [
                                        8
                                      ],
-          'maximum-line-length' => [
-                                     0,
-                                     1,
-                                     100,
-                                     100000,
-                                     160,
-                                     77,
-                                     78,
-                                     80
+          'opening-brace-always-on-right' => [
+                                               0,
+                                               1
+                                             ],
+          'keep-old-blank-lines' => [
+                                      0,
+                                      1,
+                                      2
+                                    ],
+          'short-concatenation-item-length' => [
+                                                 12,
+                                                 8
+                                               ],
+          'format-skipping-end' => [
+                                     '#>{2,}'
                                    ],
-          'backup-and-modify-in-place' => [
-                                            0,
-                                            1
-                                          ],
-          'delete-semicolons' => [
-                                   0,
-                                   1
+          'want-break-before' => [
+                                   ' ',
+                                   '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=',
+                                   '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=',
+                                   '='
                                  ],
-          'outdent-long-comments' => [
+          'stack-opening-square-bracket' => [
+                                              0,
+                                              1
+                                            ],
+          'indent-closing-brace' => [
+                                      0,
+                                      1
+                                    ],
+          'outdent-static-block-comments' => [
+                                               0,
+                                               1
+                                             ],
+          'block-brace-tightness' => [
                                        0,
-                                       1
+                                       1,
+                                       2
                                      ],
           'check-syntax' => [
                               0,
                               1
                             ],
-          'delete-side-comments' => [
+          'static-block-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'maximum-consecutive-blank-lines' => [
+                                                 0,
+                                                 1,
+                                                 2
+                                               ],
+          'maximum-fields-per-table' => [
+                                          0
+                                        ],
+          'space-function-paren' => [
                                       0,
                                       1
                                     ],
-          'hanging-side-comments' => [
+          'space-after-keyword' => [
+                                     'push'
+                                   ],
+          'want-right-space' => [
+                                  '= .= =~ !~ ? :',
+                                  '= / *'
+                                ],
+          'standard-error-output' => [
                                        0,
                                        1
                                      ],
-          'entab-leading-whitespace' => [
-                                          8
+          'square-bracket-tightness' => [
+                                          0,
+                                          1,
+                                          2
                                         ],
-          'one-line-block-semicolons' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'stack-closing-block-brace' => [
+          'format-skipping' => [
+                                 0,
+                                 1
+                               ],
+          'closing-side-comment-maximum-text' => [
+                                                   20,
+                                                   40
+                                                 ],
+          'sub-alias-list' => [
+                                'method fun'
+                              ],
+          'backup-file-extension' => [
+                                       'bak',
+                                       '~'
+                                     ],
+          'fixed-position-side-comment' => [
+                                             40
+                                           ],
+          'break-after-all-operators' => [
                                            0,
                                            1
                                          ],
@@ -169,370 +150,391 @@ $VAR1 = {
                               0,
                               1
                             ],
-          'keyword-group-blanks-before' => [
-                                             1,
-                                             2
+          'weld-nested-containers' => [
+                                        0,
+                                        1
+                                      ],
+          'ignore-side-comment-lengths' => [
+                                             0,
+                                             1
                                            ],
-          'indent-spaced-block-comments' => [
-                                              0,
-                                              1
-                                            ],
-          'indent-closing-brace' => [
-                                      0,
-                                      1
-                                    ],
-          'character-encoding' => [
-                                    'guess'
-                                  ],
-          'opening-sub-brace-on-new-line' => [
-                                               0,
-                                               1
-                                             ],
+          'keyword-group-blanks-repeat-count' => [
+                                                   0
+                                                 ],
+          'format-skipping-begin' => [
+                                       '#<{2,}'
+                                     ],
           'add-semicolons' => [
                                 0,
                                 1
                               ],
-          'paren-vertical-tightness-closing' => [
-                                                  0,
-                                                  2
-                                                ],
-          'nospace-after-keyword' => [
-                                       'my for'
-                                     ],
-          'delete-old-newlines' => [
+          'maximum-line-length' => [
                                      0,
-                                     1
+                                     1,
+                                     100,
+                                     100000,
+                                     160,
+                                     77,
+                                     78,
+                                     80
                                    ],
-          'paren-vertical-tightness' => [
-                                          0,
-                                          1,
-                                          2
-                                        ],
-          'nowant-right-space' => [
-                                    '+ -',
-                                    '++ --',
-                                    '..',
-                                    '= + - / *',
-                                    'A'
-                                  ],
-          'format-skipping' => [
-                                 0,
-                                 1
-                               ],
-          'brace-left-and-indent' => [
+          'outdent-labels' => [
+                                0,
+                                1
+                              ],
+          'space-prototype-paren' => [
                                        0,
-                                       1
+                                       1,
+                                       2
                                      ],
-          'delete-closing-side-comments' => [
+          'closing-square-bracket-indentation' => [
+                                                    0,
+                                                    1,
+                                                    2
+                                                  ],
+          'stack-closing-hash-brace' => [
+                                          0,
+                                          1
+                                        ],
+          'blank-lines-before-subs' => [
+                                         0,
+                                         1
+                                       ],
+          'indent-spaced-block-comments' => [
                                               0,
                                               1
                                             ],
-          'closing-side-comment-else-flag' => [
-                                                0
-                                              ],
-          'opening-paren-right' => [
+          'want-break-after' => [
+                                  '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||'
+                                ],
+          'outdent-long-quotes' => [
                                      0,
                                      1
                                    ],
-          'outdent-static-block-comments' => [
-                                               0,
-                                               1
-                                             ],
-          'keep-old-blank-lines' => [
-                                      0,
-                                      1,
-                                      2
-                                    ],
-          'break-before-all-operators' => [
-                                            0,
-                                            1
-                                          ],
+          'opening-square-bracket-right' => [
+                                              0,
+                                              1
+                                            ],
+          'tight-secret-operators' => [
+                                        0,
+                                        1
+                                      ],
+          'closing-paren-indentation' => [
+                                           0,
+                                           1,
+                                           2
+                                         ],
+          'trim-pod' => [
+                          0,
+                          1
+                        ],
+          'delete-semicolons' => [
+                                   0,
+                                   1
+                                 ],
+          'paren-vertical-tightness-closing' => [
+                                                  0,
+                                                  2
+                                                ],
+          'brace-tightness' => [
+                                 0,
+                                 1,
+                                 2
+                               ],
+          'break-at-old-method-breakpoints' => [
+                                                 0,
+                                                 1
+                                               ],
+          'nowant-left-space' => [
+                                   '+ - / *',
+                                   '++ -- ?',
+                                   '..',
+                                   '= + - / *',
+                                   '= / *'
+                                 ],
+          'stack-closing-block-brace' => [
+                                           0,
+                                           1
+                                         ],
           'space-for-semicolon' => [
                                      0,
                                      1
                                    ],
-          'want-break-before' => [
-                                   ' ',
-                                   '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=',
-                                   '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=',
-                                   '='
-                                 ],
-          'blank-lines-before-subs' => [
-                                         0,
-                                         1
-                                       ],
+          'warning-output' => [
+                                0,
+                                1
+                              ],
           'one-line-block-nesting' => [
                                         0,
                                         1
                                       ],
-          'space-after-keyword' => [
-                                     'push'
-                                   ],
-          'break-after-all-operators' => [
-                                           0,
-                                           1
-                                         ],
-          'opening-square-bracket-right' => [
+          'starting-indentation-level' => [
+                                            0
+                                          ],
+          'static-side-comments' => [
+                                      0,
+                                      1
+                                    ],
+          'stack-closing-square-bracket' => [
                                               0,
                                               1
                                             ],
-          'outdent-long-quotes' => [
+          'blanks-before-blocks' => [
+                                      0,
+                                      1
+                                    ],
+          'nospace-after-keyword' => [
+                                       'my for'
+                                     ],
+          'delete-pod' => [
+                            0,
+                            1
+                          ],
+          'timestamp' => [
+                           0,
+                           1
+                         ],
+          'stack-closing-paren' => [
                                      0,
                                      1
                                    ],
-          'stack-opening-paren' => [
+          'outdent-long-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'format' => [
+                        'html',
+                        'tidy'
+                      ],
+          'line-up-parentheses' => [
                                      0,
                                      1
                                    ],
-          'maximum-consecutive-blank-lines' => [
-                                                 0,
-                                                 1,
-                                                 2
-                                               ],
-          'stack-closing-hash-brace' => [
-                                          0,
-                                          1
-                                        ],
-          'comma-arrow-breakpoints' => [
-                                         1,
-                                         5
-                                       ],
-          'fixed-position-side-comment' => [
-                                             40
-                                           ],
-          'blank-lines-before-closing-block-list' => [
-                                                       '*'
-                                                     ],
-          'keyword-group-blanks-inside' => [
-                                             0,
-                                             1
-                                           ],
-          'want-break-after' => [
-                                  '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||'
-                                ],
-          'square-bracket-vertical-tightness-closing' => [
-                                                           0,
-                                                           2
-                                                         ],
-          'square-bracket-tightness' => [
+          'opening-anonymous-sub-brace-on-new-line' => [
+                                                         0,
+                                                         1
+                                                       ],
+          'paren-vertical-tightness' => [
                                           0,
                                           1,
                                           2
                                         ],
-          'break-at-old-method-breakpoints' => [
-                                                 0,
-                                                 1
-                                               ],
-          'square-bracket-vertical-tightness' => [
-                                                   0,
-                                                   1,
-                                                   2
-                                                 ],
-          'default-tabsize' => [
-                                 8
-                               ],
-          'ignore-side-comment-lengths' => [
-                                             0,
-                                             1
-                                           ],
+          'cuddled-else' => [
+                              0,
+                              1
+                            ],
           'iterations' => [
                             1
                           ],
-          'closing-square-bracket-indentation' => [
-                                                    0,
-                                                    1,
-                                                    2
-                                                  ],
-          'continuation-indentation' => [
-                                          0,
-                                          2,
-                                          4
-                                        ],
-          'nowant-left-space' => [
-                                   '++ -- ?',
-                                   '..',
-                                   '= + - / *',
-                                   '= / *'
-                                 ],
-          'standard-error-output' => [
-                                       0,
-                                       1
-                                     ],
-          'blanks-before-blocks' => [
-                                      0,
-                                      1
-                                    ],
-          'closing-paren-indentation' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'format-skipping-end' => [
-                                     '#>{2,}'
+          'stack-opening-paren' => [
+                                     0,
+                                     1
                                    ],
-          'keyword-group-blanks-repeat-count' => [
-                                                   0
-                                                 ],
-          'backup-file-extension' => [
-                                       'bak',
-                                       '~'
-                                     ],
-          'keyword-group-blanks-after' => [
-                                            1,
-                                            2
-                                          ],
-          'keep-interior-semicolons' => [
-                                          0,
-                                          1
-                                        ],
-          'keyword-group-blanks-size' => [
-                                           '5'
-                                         ],
-          'space-terminal-semicolon' => [
+          'outdent-keywords' => [
+                                  0,
+                                  1
+                                ],
+          'closing-side-comment-interval' => [
+                                               2,
+                                               20,
+                                               6
+                                             ],
+          'continuation-indentation' => [
                                           0,
-                                          1
+                                          2,
+                                          4
                                         ],
-          'outdent-keywords' => [
-                                  0,
-                                  1
-                                ],
-          'indent-block-comments' => [
+          'keyword-group-blanks-after' => [
+                                            1,
+                                            2
+                                          ],
+          'ignore-old-breakpoints' => [
+                                        0,
+                                        1
+                                      ],
+          'add-whitespace' => [
+                                0,
+                                1
+                              ],
+          'minimum-space-to-comment' => [
+                                          10,
+                                          2,
+                                          4
+                                        ],
+          'character-encoding' => [
+                                    'guess'
+                                  ],
+          'delete-block-comments' => [
                                        0,
                                        1
                                      ],
-          'blank-lines-before-packages' => [
-                                             0,
-                                             1
-                                           ],
-          'recombine' => [
-                           0,
-                           1
-                         ],
-          'blank-lines-after-opening-block-list' => [
-                                                      '*'
-                                                    ],
-          'stack-opening-square-bracket' => [
+          'indent-columns' => [
+                                0,
+                                2,
+                                4
+                              ],
+          'nowant-right-space' => [
+                                    '+ -',
+                                    '+ - / *',
+                                    '++ --',
+                                    '..',
+                                    '= + - / *',
+                                    'A'
+                                  ],
+          'break-at-old-semicolon-breakpoints' => [
+                                                    0,
+                                                    1
+                                                  ],
+          'variable-maximum-line-length' => [
                                               0,
                                               1
                                             ],
+          'break-before-all-operators' => [
+                                            0,
+                                            1
+                                          ],
           'cuddled-block-list' => [
                                     'map,sort,grep',
                                     'sort,map,grep'
                                   ],
-          'space-backslash-quote' => [
-                                       0,
-                                       1,
-                                       2
-                                     ],
-          'want-left-space' => [
-                                 '+ -',
-                                 '= .= =~ !~ :'
+          'closing-side-comments-balanced' => [
+                                                0,
+                                                1
+                                              ],
+          'opening-hash-brace-right' => [
+                                          0,
+                                          1
+                                        ],
+          'paren-tightness' => [
+                                 0,
+                                 1,
+                                 2
                                ],
-          'format' => [
-                        'html',
-                        'tidy'
-                      ],
           'fuzzy-line-length' => [
                                    0,
                                    1
                                  ],
-          'block-brace-tightness' => [
+          'delete-side-comments' => [
+                                      0,
+                                      1
+                                    ],
+          'brace-vertical-tightness-closing' => [
+                                                  0,
+                                                  2
+                                                ],
+          'indent-block-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'space-backslash-quote' => [
                                        0,
                                        1,
                                        2
                                      ],
-          'warning-output' => [
-                                0,
-                                1
-                              ],
-          'stack-closing-square-bracket' => [
-                                              0,
-                                              1
-                                            ],
-          'opening-hash-brace-right' => [
-                                          0,
-                                          1
-                                        ],
-          'block-brace-vertical-tightness' => [
-                                                0,
-                                                1
+          'closing-side-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'closing-side-comment-else-flag' => [
+                                                0
                                               ],
-          'minimum-space-to-comment' => [
-                                          10,
-                                          2,
-                                          4
-                                        ],
-          'opening-brace-always-on-right' => [
-                                               0,
-                                               1
-                                             ],
-          'break-at-old-semicolon-breakpoints' => [
-                                                    0,
-                                                    1
-                                                  ],
           'blanks-before-comments' => [
                                         0,
                                         1
                                       ],
+          'entab-leading-whitespace' => [
+                                          8
+                                        ],
+          'hanging-side-comments' => [
+                                       0,
+                                       1
+                                     ],
           'delete-old-whitespace' => [
                                        0,
                                        1
                                      ],
-          'closing-side-comment-interval' => [
-                                               2,
-                                               20,
-                                               6
+          'keyword-group-blanks-size' => [
+                                           '5'
+                                         ],
+          'one-line-block-semicolons' => [
+                                           0,
+                                           1,
+                                           2
+                                         ],
+          'break-at-old-comma-breakpoints' => [
+                                                0,
+                                                1
+                                              ],
+          'default-tabsize' => [
+                                 8
+                               ],
+          'comma-arrow-breakpoints' => [
+                                         1,
+                                         5
+                                       ],
+          'square-bracket-vertical-tightness' => [
+                                                   0,
+                                                   1,
+                                                   2
+                                                 ],
+          'opening-sub-brace-on-new-line' => [
+                                               0,
+                                               1
                                              ],
-          'tight-secret-operators' => [
-                                        0,
-                                        1
-                                      ],
-          'brace-vertical-tightness' => [
+          'want-left-space' => [
+                                 '+ -',
+                                 '= .= =~ !~ :'
+                               ],
+          'blank-lines-before-closing-block' => [
+                                                  1
+                                                ],
+          'stack-opening-hash-brace' => [
                                           0,
-                                          1,
-                                          2
+                                          1
                                         ],
-          'space-keyword-paren' => [
+          'blank-lines-before-packages' => [
+                                             0,
+                                             1
+                                           ],
+          'perl-syntax-check-flags' => [
+                                         '-c -T'
+                                       ],
+          'keep-interior-semicolons' => [
+                                          0,
+                                          1
+                                        ],
+          'keyword-group-blanks-inside' => [
+                                             0,
+                                             1
+                                           ],
+          'opening-paren-right' => [
                                      0,
                                      1
                                    ],
-          'variable-maximum-line-length' => [
+          'closing-brace-indentation' => [
+                                           0,
+                                           1,
+                                           2
+                                         ],
+          'blank-lines-before-closing-block-list' => [
+                                                       '*'
+                                                     ],
+          'blank-lines-after-opening-block-list' => [
+                                                      '*'
+                                                    ],
+          'delete-closing-side-comments' => [
                                               0,
                                               1
                                             ],
-          'short-concatenation-item-length' => [
-                                                 12,
-                                                 8
+          'blank-lines-after-opening-block' => [
+                                                 2
                                                ],
-          'delete-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'opening-brace-on-new-line' => [
-                                           0,
-                                           1
-                                         ],
-          'sub-alias-list' => [
-                                'method fun'
-                              ],
-          'brace-tightness' => [
-                                 0,
-                                 1,
-                                 2
-                               ],
-          'line-up-parentheses' => [
-                                     0,
-                                     1
-                                   ],
-          'format-skipping-begin' => [
-                                       '#<{2,}'
-                                     ],
-          'stack-closing-paren' => [
+          'keyword-group-blanks-before' => [
+                                             1,
+                                             2
+                                           ],
+          'space-keyword-paren' => [
                                      0,
                                      1
-                                   ],
-          'static-side-comments' => [
-                                      0,
-                                      1
-                                    ]
+                                   ]
         };
index 25e9521891592cd83f5810dde21488285a1114a1..c68b6df8e9a94d4140307dd40352ccdf7c14b996 100644 (file)
@@ -1,6 +1,6 @@
 # not a good alignment
 sub head {
     match_on_type @_ => Null => sub { die "Cannot get head of Null" },
-      ArrayRef => sub { $_->[0] };
+      ArrayRef       => sub { $_->[0] };
 }
 
diff --git a/t/snippets/expect/git25.def b/t/snippets/expect/git25.def
new file mode 100644 (file)
index 0000000..2ffb09c
--- /dev/null
@@ -0,0 +1,45 @@
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+
+    # ...
+    { 'is_col' => 'dsstdat', 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
+    { 'is_col' => 'corona_ieorres', 'cr_col' => '', 'trans' => 0, },
+    {
+        'is_col'            => 'symptoms_fever',
+        'cr_col'            => 'elig_fever',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col'            => 'symptoms_cough',
+        'cr_col'            => 'elig_cough',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col'            => 'symptoms_dys_tachy_noea',
+        'cr_col'            => 'elig_dyspnea',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col' => 'symptoms_clinical_susp',
+        'cr_col' => 'elig_ari',
+        'trans'  => 0,
+    },
+    {
+        'is_col'            => 'sex',
+        'cr_col'            => 'sex',
+        'trans'             => 1,
+        'manually_reviewed' => 1,
+        'map'               => { '0' => '1', '1' => '2' },
+    },
+    { 'is_col' => 'age',  'cr_col' => '', 'trans' => 0, },
+    { 'is_col' => 'ageu', 'cr_col' => '', 'trans' => 0, },
+
+    # ...
+];
+
diff --git a/t/snippets/expect/git25.git25 b/t/snippets/expect/git25.git25
new file mode 100644 (file)
index 0000000..ccecaef
--- /dev/null
@@ -0,0 +1,17 @@
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+
+    # ...
+    { 'is_col' => 'dsstdat',                 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
+    { 'is_col' => 'corona_ieorres',          'cr_col' => '',                   'trans' => 0, },
+    { 'is_col' => 'symptoms_fever',          'cr_col' => 'elig_fever',         'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_cough',          'cr_col' => 'elig_cough',         'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_dys_tachy_noea', 'cr_col' => 'elig_dyspnea',       'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_clinical_susp',  'cr_col' => 'elig_ari',           'trans' => 0, },
+    { 'is_col' => 'sex', 'cr_col' => 'sex', 'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
+    { 'is_col' => 'age', 'cr_col' => '', 'trans' => 0, },
+    { 'is_col' => 'ageu', 'cr_col' => '', 'trans' => 0, },
+
+    # ...
+];
+
index d02785625f604d457eefdec6869863d1eef70e1a..54e5d307ca0bedebb16ee01cc9ff0820fcfc497f 100644 (file)
@@ -1,31 +1,31 @@
 \&foo !~~ \&foo;
-\&foo ~~ \&foo;
-\&foo ~~ \&foo;
-\&foo ~~ sub { };
-sub { } ~~ \&foo;
-\&foo ~~ \&bar;
-\&bar ~~ \&foo;
-1 ~~ sub { shift };
-sub { shift } ~~ 1;
-0 ~~ sub { shift };
-sub { shift } ~~ 0;
-1 ~~ sub { scalar @_ };
+\&foo             ~~ \&foo;
+\&foo             ~~ \&foo;
+\&foo             ~~ sub { };
+sub { }           ~~ \&foo;
+\&foo             ~~ \&bar;
+\&bar             ~~ \&foo;
+1                 ~~ sub { shift };
+sub { shift }     ~~ 1;
+0                 ~~ sub { shift };
+sub { shift }     ~~ 0;
+1                 ~~ sub { scalar @_ };
 sub { scalar @_ } ~~ 1;
-[]           ~~ \&bar;
-\&bar        ~~ [];
-{}           ~~ \&bar;
-\&bar        ~~ {};
-qr//         ~~ \&bar;
-\&bar        ~~ qr//;
-a_const      ~~ "a constant";
-"a constant" ~~ a_const;
-a_const      ~~ a_const;
-a_const      ~~ a_const;
-a_const      ~~ b_const;
-b_const      ~~ a_const;
-{}           ~~ {};
-{}           ~~ {};
-{}           ~~ { 1 => 2 };
+[]                ~~ \&bar;
+\&bar             ~~ [];
+{}                ~~ \&bar;
+\&bar             ~~ {};
+qr//              ~~ \&bar;
+\&bar             ~~ qr//;
+a_const           ~~ "a constant";
+"a constant"      ~~ a_const;
+a_const           ~~ a_const;
+a_const           ~~ a_const;
+a_const           ~~ b_const;
+b_const           ~~ a_const;
+{}                ~~ {};
+{}                ~~ {};
+{}                ~~ { 1 => 2 };
 { 1 => 2 } ~~ {};
 { 1 => 2 } ~~ { 1 => 2 };
 { 1 => 2 } ~~ { 1 => 2 };
diff --git a/t/snippets/git25.in b/t/snippets/git25.in
new file mode 100644 (file)
index 0000000..233d2ab
--- /dev/null
@@ -0,0 +1,15 @@
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+# ...
+    { 'is_col' => 'dsstdat',                      'cr_col' => 'enroll_isaric_date',         'trans' => 0, },
+    { 'is_col' => 'corona_ieorres',               'cr_col' => '',                           'trans' => 0, },
+    { 'is_col' => 'symptoms_fever',               'cr_col' => 'elig_fever',                 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_cough',               'cr_col' => 'elig_cough',                 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_dys_tachy_noea',      'cr_col' => 'elig_dyspnea',               'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_clinical_susp',       'cr_col' => 'elig_ari',                   'trans' => 0, },
+    { 'is_col' => 'sex',                          'cr_col' => 'sex',                        'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
+    { 'is_col' => 'age',                          'cr_col' => '',                           'trans' => 0, },
+    { 'is_col' => 'ageu',                         'cr_col' => '',                           'trans' => 0, },
+# ...
+];
+
diff --git a/t/snippets/git25.par b/t/snippets/git25.par
new file mode 100644 (file)
index 0000000..7e615cc
--- /dev/null
@@ -0,0 +1 @@
+-l=0
index 3e63a2d9af468ee9c250cfa66269ee63e5962573..0aa1dd1171a2e8c17d8c0a58b5f70779b29b8033 100644 (file)
 ../snippets20.t        wc.wc2
 ../snippets20.t        ce2.ce
 ../snippets20.t        ce2.def
+../snippets20.t        gnu6.def
+../snippets20.t        gnu6.gnu
 ../snippets3.t ce_wn1.ce_wn
 ../snippets3.t ce_wn1.def
 ../snippets3.t colin.colin
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets20.t        gnu6.def
-../snippets20.t        gnu6.gnu
+../snippets20.t        git25.def
+../snippets20.t        git25.git25
index 231cbcc9734cfc67bbd6993164cfef45c21fcc24..762ce75354f95144c9c88dc5a2a8acdc2778fb11 100644 (file)
@@ -494,33 +494,33 @@ foreach ( split( //, $input ) ) { }
             params => "def",
             expect => <<'#8...........',
 \&foo !~~ \&foo;
-\&foo ~~ \&foo;
-\&foo ~~ \&foo;
-\&foo ~~ sub { };
-sub { } ~~ \&foo;
-\&foo ~~ \&bar;
-\&bar ~~ \&foo;
-1 ~~ sub { shift };
-sub { shift } ~~ 1;
-0 ~~ sub { shift };
-sub { shift } ~~ 0;
-1 ~~ sub { scalar @_ };
+\&foo             ~~ \&foo;
+\&foo             ~~ \&foo;
+\&foo             ~~ sub { };
+sub { }           ~~ \&foo;
+\&foo             ~~ \&bar;
+\&bar             ~~ \&foo;
+1                 ~~ sub { shift };
+sub { shift }     ~~ 1;
+0                 ~~ sub { shift };
+sub { shift }     ~~ 0;
+1                 ~~ sub { scalar @_ };
 sub { scalar @_ } ~~ 1;
-[]           ~~ \&bar;
-\&bar        ~~ [];
-{}           ~~ \&bar;
-\&bar        ~~ {};
-qr//         ~~ \&bar;
-\&bar        ~~ qr//;
-a_const      ~~ "a constant";
-"a constant" ~~ a_const;
-a_const      ~~ a_const;
-a_const      ~~ a_const;
-a_const      ~~ b_const;
-b_const      ~~ a_const;
-{}           ~~ {};
-{}           ~~ {};
-{}           ~~ { 1 => 2 };
+[]                ~~ \&bar;
+\&bar             ~~ [];
+{}                ~~ \&bar;
+\&bar             ~~ {};
+qr//              ~~ \&bar;
+\&bar             ~~ qr//;
+a_const           ~~ "a constant";
+"a constant"      ~~ a_const;
+a_const           ~~ a_const;
+a_const           ~~ a_const;
+a_const           ~~ b_const;
+b_const           ~~ a_const;
+{}                ~~ {};
+{}                ~~ {};
+{}                ~~ { 1 => 2 };
 { 1 => 2 } ~~ {};
 { 1 => 2 } ~~ { 1 => 2 };
 { 1 => 2 } ~~ { 1 => 2 };
index 768304f9ad57c2725c6509885f801e9d2a29d873..a11bdf4c42d4b068617b2c4344916800a1a9f6dc 100644 (file)
@@ -298,7 +298,7 @@ my $incname   = $indname . ( $indtot > 1 ? $indno : "" );
 # not a good alignment
 sub head {
     match_on_type @_ => Null => sub { die "Cannot get head of Null" },
-      ArrayRef => sub { $_->[0] };
+      ArrayRef       => sub { $_->[0] };
 }
 
 #10...........
index 4be39332116f7dc8a4c3d30f4f2d002df083b737..eaa747a2a4479869d87793072634b26808d74dc6 100644 (file)
@@ -11,6 +11,8 @@
 #8 ce2.def
 #9 gnu6.def
 #10 gnu6.gnu
+#11 git25.def
+#12 git25.git25
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -30,6 +32,7 @@ BEGIN {
     $rparams = {
         'ce'     => "-cuddled-blocks",
         'def'    => "",
+        'git25'  => "-l=0",
         'gnu'    => "-gnu",
         'space6' => <<'----------',
 -nwrs="+ - / *"
@@ -65,6 +68,24 @@ else {
     # Is Perl being run from a slave editor or graphical debugger?
     ...
 }
+----------
+
+        'git25' => <<'----------',
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+# ...
+    { 'is_col' => 'dsstdat',                      'cr_col' => 'enroll_isaric_date',         'trans' => 0, },
+    { 'is_col' => 'corona_ieorres',               'cr_col' => '',                           'trans' => 0, },
+    { 'is_col' => 'symptoms_fever',               'cr_col' => 'elig_fever',                 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_cough',               'cr_col' => 'elig_cough',                 'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_dys_tachy_noea',      'cr_col' => 'elig_dyspnea',               'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_clinical_susp',       'cr_col' => 'elig_ari',                   'trans' => 0, },
+    { 'is_col' => 'sex',                          'cr_col' => 'sex',                        'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
+    { 'is_col' => 'age',                          'cr_col' => '',                           'trans' => 0, },
+    { 'is_col' => 'ageu',                         'cr_col' => '',                           'trans' => 0, },
+# ...
+];
+
 ----------
 
         'gnu6' => <<'----------',
@@ -335,6 +356,82 @@ else {
 
 #10...........
         },
+
+        'git25.def' => {
+            source => "git25",
+            params => "def",
+            expect => <<'#11...........',
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+
+    # ...
+    { 'is_col' => 'dsstdat', 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
+    { 'is_col' => 'corona_ieorres', 'cr_col' => '', 'trans' => 0, },
+    {
+        'is_col'            => 'symptoms_fever',
+        'cr_col'            => 'elig_fever',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col'            => 'symptoms_cough',
+        'cr_col'            => 'elig_cough',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col'            => 'symptoms_dys_tachy_noea',
+        'cr_col'            => 'elig_dyspnea',
+        'trans'             => 1,
+        'manually_reviewed' => '@TODO',
+        'map'               => { '0' => '0', '1' => '1', '9' => '@TODO' },
+    },
+    {
+        'is_col' => 'symptoms_clinical_susp',
+        'cr_col' => 'elig_ari',
+        'trans'  => 0,
+    },
+    {
+        'is_col'            => 'sex',
+        'cr_col'            => 'sex',
+        'trans'             => 1,
+        'manually_reviewed' => 1,
+        'map'               => { '0' => '1', '1' => '2' },
+    },
+    { 'is_col' => 'age',  'cr_col' => '', 'trans' => 0, },
+    { 'is_col' => 'ageu', 'cr_col' => '', 'trans' => 0, },
+
+    # ...
+];
+
+#11...........
+        },
+
+        'git25.git25' => {
+            source => "git25",
+            params => "git25",
+            expect => <<'#12...........',
+# example for git #25; use -l=0; was losing alignment;  sub 'fix_ragged_lists' was added to fix this
+my $mapping = [
+
+    # ...
+    { 'is_col' => 'dsstdat',                 'cr_col' => 'enroll_isaric_date', 'trans' => 0, },
+    { 'is_col' => 'corona_ieorres',          'cr_col' => '',                   'trans' => 0, },
+    { 'is_col' => 'symptoms_fever',          'cr_col' => 'elig_fever',         'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_cough',          'cr_col' => 'elig_cough',         'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_dys_tachy_noea', 'cr_col' => 'elig_dyspnea',       'trans' => 1, 'manually_reviewed' => '@TODO', 'map' => { '0' => '0', '1' => '1', '9' => '@TODO' }, },
+    { 'is_col' => 'symptoms_clinical_susp',  'cr_col' => 'elig_ari',           'trans' => 0, },
+    { 'is_col' => 'sex', 'cr_col' => 'sex', 'trans' => 1, 'manually_reviewed' => 1, 'map' => { '0' => '1', '1' => '2' }, },
+    { 'is_col' => 'age', 'cr_col' => '', 'trans' => 0, },
+    { 'is_col' => 'ageu', 'cr_col' => '', 'trans' => 0, },
+
+    # ...
+];
+
+#12...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};