It seems like the style checker is overly aggressive. I'll start with a mild-example that I think can go both ways and then provide an example where I think it's clearly incorrect to be complaining.
Ideally, I'd like if the style checker could be customized, but, absent that, I would appreciate better default settings
Innocuous Example
The use of indents to demarcate blocks of code is fairly standard, but in the example below, the indented lines are flagged for inappropriate indented line
frame create agg_data
frame agg_data {
sysuse auto
gcollapse (mean) mpg, by(foreign)
}
Indents are also commonly used to handle extremely long commands, yet the style checker will both
- complain that the line is too long if you don't do anything; and
- complain that you have inappropriately indented lines when you fix it
* This is a very long command that gets flagged
twoway (line y x) || (scatter y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x) || (line y x)
* This is the wrapped version of the same command
* that still gets flagged
twoway ///
(line y x) || ///
(scatter y x) || ///
... ///
(line y x)
Clearly wrong Example
The style checker is ignorant of standard Stata syntax for checking the display format of variables. If you write format date %td
, which is the idiomatic way to format a numeric column so that it prints as a Stata date, the style checker flags it as whitespace around operator should be 1
. Of course, this is a relic of python styling, where %
is used as an operator much like -
, +
, etc. But Stata does not use %
in that way.