Skip to content

Commit

Permalink
Merge pull request #74 from worldbank/v1.1
Browse files Browse the repository at this point in the history
v1.1
- corrected bug in function detecting if a line is closing a loop so that in can handle empty lines
- changed command version format from x.x.x to x.x
- updated name in acknowledgments
  • Loading branch information
luisesanmartin committed Dec 12, 2022
2 parents bde52fe + bfcc3fc commit 09ba951
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/lint.ado
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*! version 1.0.0 06dec2022 DIME Analytics [email protected]
*! version 1.1 07dec2022 DIME Analytics [email protected]

capture program drop lint
program lint
Expand Down Expand Up @@ -536,7 +536,7 @@ capture program drop _checkversions

* IMPORTANT: Every time we have a package update, update the version number here
* Otherwise we'd be introducing a major bug!
local version_ado 1.0.0
local version_ado 1.1

* Check versions of .py files
python: from sfi import Macro
Expand Down
4 changes: 2 additions & 2 deletions src/lint.sthlp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{smcl}
{* 06 Dec 2022}{...}
{* 07 Dec 2022}{...}
{hline}
help for {hi:lint}
{hline}
Expand Down Expand Up @@ -227,7 +227,7 @@ for each bad practice detected:

{phang}This work is a product of the initial idea and work of Mizuhiro Suzuki.
Rony Rodriguez Ramirez, Luiza Cardoso de Andrade and Luis Eduardo San Martin also contributed to this command,
and Kristoffer Bjarkefur and Benjamin B. Daniels provided comments and code reviews.
and Kristoffer Bjärkefur and Benjamin B. Daniels provided comments and code reviews.

{title:Authors}

Expand Down
4 changes: 2 additions & 2 deletions src/stata_linter_correct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version 1.0.0 06dec2022 DIME Analytics [email protected]
# version 1.1 07dec2022 DIME Analytics [email protected]
# Import packages ============
import os
import re
Expand All @@ -8,7 +8,7 @@
# Version Global
## VERY IMPORTANT: Update the version number here every time there's an update
## in the package. Otherwise this will cause a major bug
VERSION = "1.0.0"
VERSION = "1.1"

# Function to update comment delimiter =============
# (detection works only when comment delimiter == 0)
Expand Down
15 changes: 11 additions & 4 deletions src/stata_linter_detect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version 1.0.0 06dec2022 DIME Analytics [email protected]
# version 1.1 07dec2022 DIME Analytics [email protected]
# Import packages ====================
import os
import re
Expand All @@ -9,7 +9,7 @@
# Version Global
## VERY IMPORTANT: Update the version number here every time there's an update
## in the package. Otherwise this will cause a major bug
VERSION = "1.0.0"
VERSION = "1.1"

# simple run entry point
def run():
Expand Down Expand Up @@ -101,8 +101,15 @@ def loop_close(line):
'''
Detects if a line is closing a loop
'''
if re.split('//', line)[0].rstrip()[-1] =='}':
return True
relevant_part = re.split('//', line)[0].rstrip()

if len(relevant_part) > 0:

if relevant_part[-1] =='}':
return True
else:
return False

else:
return False

Expand Down
2 changes: 1 addition & 1 deletion src/stata_linter_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version 1.0.0 06dec2022 DIME Analytics [email protected]
# version 1.1 07dec2022 DIME Analytics [email protected]
# Import packages ====================
import re
import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion stata.toc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
v 1.0.0
v 1.1
d DIME Analytics, World Bank Group, Development Economics Research
p stata_linter
4 changes: 2 additions & 2 deletions stata_linter.pkg
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
v 1.0.0
v 1.1
d DIME Analytics, World Bank Group, Development Economics Research
p stata_linter
f /src/stata_linter_detect.py
f /src/stata_linter_correct.py
f /src/stata_linter_utils.py
f /src/lint.ado
f /help/lint.sthlp
f /src/lint.sthlp
e

0 comments on commit 09ba951

Please sign in to comment.