diff --git a/src/mdhlp/lint.md b/src/mdhlp/lint.md index f76e5ca..0adc98d 100644 --- a/src/mdhlp/lint.md +++ b/src/mdhlp/lint.md @@ -13,9 +13,7 @@ To install Python packages, refer to [this page](https://blog.stata.com/2020/09/ __lint__ "_input_file_" [using "_output_file_"] , [_options_] The lint command can be broken into two functionalities: - 1. __Detection__ identifies bad coding practices in a Stata do-files - 2. __Correction__ corrects bad coding practices in a Stata do-file. If an _output_file_ is specified with __using__, then the linter will apply the __Correction__ functionality and will write a new file with corrections. If not, the command will only apply the __Detection__ functionality, returning a report of suggested corrections and potential issues of the do-file in Stata's Results window. Users should note that not all the bad practices identified in __Detection__ can be amended by __Correction__. @@ -26,7 +24,7 @@ If an _output_file_ is specified with __using__, then the linter will apply the | __**v**erbose__ | Report bad practices and issues found on each line of the do-file. | | __**nosum**mary__ | Suppress summary table of bad practices and potential issues. | | __**i**ndent__(_integer_) | Number of whitespaces used when checking indentation coding practices (default: 4). | -| __**s**pace__(_integer_) | Number of whitespaces used instead of hard tabs when checking indentation practices (default: same as indent). | +| __**s**pace__(_integer_) | Number of whitespaces used instead of hard tabs when checking indentation practices (default: same as indent). | | __**l**inemax__(_integer_) | Maximum number of characters in a line when checking line extension practices (default: 80). | | __**e**xcel__(_filename_) | Save an Excel file of line-by-line results. | | __force__ | Allow the output file name to be the same as the name of the input file; overwriting the original do-file. __The use of this option is not recommended__ because it is slightly possible that the corrected do-file created by the command will break something in your code and you should always keep a backup of it. | @@ -36,7 +34,7 @@ If an _output_file_ is specified with __using__, then the linter will apply the # Description -## Detect functionality +## Detect functionality __Bad style practices and potential issues detected:__ @@ -51,7 +49,7 @@ __Avoid abstract index names__ ``` foreach i of varlist cassava maize wheat { } -``` +``` - Instead, looping commands should name the index local descriptively: @@ -64,7 +62,7 @@ __Use proper indentations__ - After declaring for-loop statements or if-else statements, add indentation with whitespaces (usually 2 or 4) in the lines inside the loop. - + __Use indentations after declaring newline symbols (///)__ - After a new line statement (///), add indentation (usually 2 or 4 whitespaces). @@ -146,7 +144,7 @@ If the option `automatic` is omitted, Stata will prompt the user to confirm that # Examples The following examples illustrate the basic usage of lint. Additional examples can be found [here](https://github.com/worldbank/repkit/blob/add-linter/src/vignettes/lint-examples.md) - + ## Detecting bad coding practices The basic usage is to point to a do-file that requires revision as follows: @@ -166,7 +164,7 @@ lint "test/bad.do", verbose ``` 2. Remove the summary of bad practices - + ``` lint "test/bad.do", nosummary ```