From 84fca2e1a6cf303b05296a5dfefeac84d6eca42f Mon Sep 17 00:00:00 2001 From: luisesanmartin Date: Tue, 6 Dec 2022 17:21:23 -0500 Subject: [PATCH 1/3] quickfixes for v1.1 - changed version format from x.x.x to x.x - corrected bug in loop_close() so the function is able to evaluate empty lines - changed pointer to location of help file in pkg file - modified name of reviewer in help file --- src/lint.ado | 4 ++-- src/lint.sthlp | 2 +- src/stata_linter_correct.py | 4 ++-- src/stata_linter_detect.py | 15 +++++++++++---- src/stata_linter_utils.py | 2 +- stata.toc | 2 +- stata_linter.pkg | 4 ++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/lint.ado b/src/lint.ado index 3d01c54..d550850 100644 --- a/src/lint.ado +++ b/src/lint.ado @@ -1,4 +1,4 @@ -*! version 1.0.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +*! version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org capture program drop lint program lint @@ -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.0 * Check versions of .py files python: from sfi import Macro diff --git a/src/lint.sthlp b/src/lint.sthlp index 7105742..ee54dc7 100644 --- a/src/lint.sthlp +++ b/src/lint.sthlp @@ -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} diff --git a/src/stata_linter_correct.py b/src/stata_linter_correct.py index 9c1b050..fb90c92 100644 --- a/src/stata_linter_correct.py +++ b/src/stata_linter_correct.py @@ -1,4 +1,4 @@ -# version 1.0.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ============ import os import re @@ -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.0" # Function to update comment delimiter ============= # (detection works only when comment delimiter == 0) diff --git a/src/stata_linter_detect.py b/src/stata_linter_detect.py index 428c025..cb951fc 100644 --- a/src/stata_linter_detect.py +++ b/src/stata_linter_detect.py @@ -1,4 +1,4 @@ -# version 1.0.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import os import re @@ -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.0" # simple run entry point def run(): @@ -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 diff --git a/src/stata_linter_utils.py b/src/stata_linter_utils.py index ddef82a..fdacfdd 100644 --- a/src/stata_linter_utils.py +++ b/src/stata_linter_utils.py @@ -1,4 +1,4 @@ -# version 1.0.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import re import pandas as pd diff --git a/stata.toc b/stata.toc index 8783b4a..082b2d8 100644 --- a/stata.toc +++ b/stata.toc @@ -1,3 +1,3 @@ -v 1.0.0 +v 1.0 d DIME Analytics, World Bank Group, Development Economics Research p stata_linter diff --git a/stata_linter.pkg b/stata_linter.pkg index 2f482e7..5cfe318 100644 --- a/stata_linter.pkg +++ b/stata_linter.pkg @@ -1,9 +1,9 @@ -v 1.0.0 +v 1.0 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 From 25e7121e84679f28ed58e3056823063c768e08a1 Mon Sep 17 00:00:00 2001 From: luisesanmartin Date: Tue, 6 Dec 2022 17:25:53 -0500 Subject: [PATCH 2/3] updated version numbers to 1.1 --- src/lint.ado | 4 ++-- src/stata_linter_correct.py | 4 ++-- src/stata_linter_detect.py | 4 ++-- src/stata_linter_utils.py | 2 +- stata.toc | 2 +- stata_linter.pkg | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lint.ado b/src/lint.ado index d550850..11c9dba 100644 --- a/src/lint.ado +++ b/src/lint.ado @@ -1,4 +1,4 @@ -*! version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +*! version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org capture program drop lint program lint @@ -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 + local version_ado 1.1 * Check versions of .py files python: from sfi import Macro diff --git a/src/stata_linter_correct.py b/src/stata_linter_correct.py index fb90c92..449aeb4 100644 --- a/src/stata_linter_correct.py +++ b/src/stata_linter_correct.py @@ -1,4 +1,4 @@ -# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ============ import os import re @@ -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" +VERSION = "1.1" # Function to update comment delimiter ============= # (detection works only when comment delimiter == 0) diff --git a/src/stata_linter_detect.py b/src/stata_linter_detect.py index cb951fc..1630ff4 100644 --- a/src/stata_linter_detect.py +++ b/src/stata_linter_detect.py @@ -1,4 +1,4 @@ -# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import os import re @@ -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" +VERSION = "1.1" # simple run entry point def run(): diff --git a/src/stata_linter_utils.py b/src/stata_linter_utils.py index fdacfdd..6a66323 100644 --- a/src/stata_linter_utils.py +++ b/src/stata_linter_utils.py @@ -1,4 +1,4 @@ -# version 1.0 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import re import pandas as pd diff --git a/stata.toc b/stata.toc index 082b2d8..80b95cd 100644 --- a/stata.toc +++ b/stata.toc @@ -1,3 +1,3 @@ -v 1.0 +v 1.1 d DIME Analytics, World Bank Group, Development Economics Research p stata_linter diff --git a/stata_linter.pkg b/stata_linter.pkg index 5cfe318..39c78a7 100644 --- a/stata_linter.pkg +++ b/stata_linter.pkg @@ -1,4 +1,4 @@ -v 1.0 +v 1.1 d DIME Analytics, World Bank Group, Development Economics Research p stata_linter f /src/stata_linter_detect.py From bfcc3fce25fbe821bba39fb0b0de3e74a2a7acf0 Mon Sep 17 00:00:00 2001 From: luisesanmartin Date: Tue, 6 Dec 2022 17:46:32 -0500 Subject: [PATCH 3/3] updated date of v1.1 probable release --- src/lint.ado | 2 +- src/lint.sthlp | 2 +- src/stata_linter_correct.py | 2 +- src/stata_linter_detect.py | 2 +- src/stata_linter_utils.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lint.ado b/src/lint.ado index 11c9dba..4cbf1b3 100644 --- a/src/lint.ado +++ b/src/lint.ado @@ -1,4 +1,4 @@ -*! version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org +*! version 1.1 07dec2022 DIME Analytics dimeanalytics@worldbank.org capture program drop lint program lint diff --git a/src/lint.sthlp b/src/lint.sthlp index ee54dc7..67a3912 100644 --- a/src/lint.sthlp +++ b/src/lint.sthlp @@ -1,5 +1,5 @@ {smcl} -{* 06 Dec 2022}{...} +{* 07 Dec 2022}{...} {hline} help for {hi:lint} {hline} diff --git a/src/stata_linter_correct.py b/src/stata_linter_correct.py index 449aeb4..21bde05 100644 --- a/src/stata_linter_correct.py +++ b/src/stata_linter_correct.py @@ -1,4 +1,4 @@ -# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 07dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ============ import os import re diff --git a/src/stata_linter_detect.py b/src/stata_linter_detect.py index 1630ff4..b24be08 100644 --- a/src/stata_linter_detect.py +++ b/src/stata_linter_detect.py @@ -1,4 +1,4 @@ -# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 07dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import os import re diff --git a/src/stata_linter_utils.py b/src/stata_linter_utils.py index 6a66323..31f604c 100644 --- a/src/stata_linter_utils.py +++ b/src/stata_linter_utils.py @@ -1,4 +1,4 @@ -# version 1.1 06dec2022 DIME Analytics dimeanalytics@worldbank.org +# version 1.1 07dec2022 DIME Analytics dimeanalytics@worldbank.org # Import packages ==================== import re import pandas as pd