Couple requests for the Beautifier

bcoulam

Member²
Marco,

I've been working with the Beautifier heavily over the last two days. To my
pleasant surprise I found that you had addressed a number of the annoyances I'd
raised before, especially leaving inline and right-margin comments where they are.

Thank you! That has saved me so much time not having to revisit those sections
after formatting.

However, there are still a couple tiny things, that if enhanced, would enable
me (hopefully other developers across the world as well), the ability to
format blindly and not have to revisit code after applying the Beautifier.

The first is the right justification of parameters to called routines.

With a little indentation, and identifiers all pushing the 30 character
boundary, the opening parenthesis is already near or past the column 80 margin.
Trying to align and right-justify every parameter after that parenthesis
results in wide-load code, especially if a shop (like ours) discourages much
code beyond the 80th column. On smaller screens, or really busy screens or
other tools with many-paned IDEs, one has to scroll right to see all the
code. This also leaves no room for inline comments (which we like to put
to the right of the parameter the comment is explaining).

For example, the Beautifier does this to a chunk of code. This happens a lot
in our systems where the developers push the 30 character boundary all the
time.

Code:
1         2         3         4         5         6         7         8
         0         0         0         0         0         0         0         0
         v         v         v         v         v         v         v         v
      lrc_sttl_dtl_by_day_sum := xmkt_all_sm_sttl_dtl.view_sttl_dtl_by_day_sum_stmt(i_audit_rec,
                                                                                    i_start_dt_gmt,
                                                                                    i_end_dt_gmt,
                                                                                    i_statement_id,
                                                                                    i_source_cd,
                                                                                    i_sttl_pub_cd,
                                                                                    l_sttl_chggrp_cd,
                                                                                    l_ptcpt_hierarchy);
Instead, I'd like to have the option to align the parameters indented under the
target variable (FUNCTION) or under the name of the called PROCEDURE. So the above
would look something like this

Code:
1         2         3         4         5         6         7         8
         0         0         0         0         0         0         0         0
         v         v         v         v         v         v         v         v
      lrc_sttl_dtl_by_day_sum := xmkt_all_sm_sttl_dtl.view_sttl_dtl_by_day_sum_stmt(
         i_audit_rec,
         i_start_dt_gmt,
         i_end_dt_gmt,
         i_statement_id, -- now there is room for inline parameter comments!
         i_source_cd,
         i_sttl_pub_cd,
         l_sttl_chggrp_cd,
         l_ptcpt_hierarchy
      );
OR like this

Code:
1         2         3         4         5         6         7         8
         0         0         0         0         0         0         0         0
         v         v         v         v         v         v         v         v
      lrc_sttl_dtl_by_day_sum := xmkt_all_sm_sttl_dtl.view_sttl_dtl_by_day_sum_stmt(
                                    i_audit_rec,
                                    i_start_dt_gmt,
                                    i_end_dt_gmt,
                                    i_statement_id,  -- inline parameter comments go here
                                    i_source_cd,
                                    i_sttl_pub_cd,
                                    l_sttl_chggrp_cd,
                                    l_ptcpt_hierarchy
                                 );
This is similar to the left-aligned parameter declarations that you enhanced
in version 6.

The second item is a personal preference. The Beautifier dutifully turns DECODE
calls into single-parameter per line calls, as I've specified in the Beautifier
options. I'd like to see the Beautifier treat DECODEs specially. Since DECODE
statements are really just IF-THEN-ELSE blocks, I'd like to see the IF-THEN
pairs on the same line, with the initial expression and the ending ELSE
expression on their own lines.

So instead of the Beautifier doing this to DECODEs in my SQL...

Code:
DECODE(nss.source_cd,
                    pkgc_src_typ_estim,
                    nss.calc_dt_sys,
                    pkgc_src_typ_mktrpt,
                    nss.master_rpt_version_dt_sys,
                    pkgc_src_typ_iso,
                    nss.master_rpt_version_dt_sys) create_dt_sys
it would do this instead...

Code:
DECODE(nss.source_cd,                                      // column to evaluate
                    pkgc_src_typ_estim, nss.calc_dt_sys,                // first pair
                    pkgc_src_typ_mktrpt, nss.master_rpt_version_dt_sys, // second pair
                    pkgc_src_typ_iso, nss.master_rpt_version_dt_sys,    // third pair
                    NULL) create_dt_sys                                 // default (ELSE)
OR

Code:
DECODE(nss.source_cd,
                    pkgc_src_typ_estim, nss.calc_dt_sys,
                    pkgc_src_typ_mktrpt, nss.master_rpt_version_dt_sys,
                    pkgc_src_typ_iso, nss.master_rpt_version_dt_sys,
                    NULL
             ) create_dt_sys
Thanks for considering this.

bill c.
 
Thanks for your feedback and for your detailed examples. I have added this to the list of enhancement requests.
 
Back
Top