Skip to content

Commit

Permalink
update white spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kbjarkefur committed Sep 30, 2024
1 parent 5d8f242 commit 55a2e0f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/mdhlp/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__.
Expand All @@ -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. |
Expand All @@ -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:__

Expand All @@ -51,7 +49,7 @@ __Avoid abstract index names__

```
foreach i of varlist cassava maize wheat { }
```
```

- Instead, looping commands should name the index local descriptively:

Expand All @@ -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).
Expand Down Expand Up @@ -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:
Expand All @@ -166,7 +164,7 @@ lint "test/bad.do", verbose
```

2. Remove the summary of bad practices

```
lint "test/bad.do", nosummary
```
Expand Down

0 comments on commit 55a2e0f

Please sign in to comment.