From e87772821b9d624017e39a5ec053c6092d969c69 Mon Sep 17 00:00:00 2001 From: Tiago Ferreira Date: Thu, 28 Sep 2023 14:12:50 +0100 Subject: [PATCH 1/3] refactor: reviewpad configuration --- reviewpad.yaml | 103 +++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 46 deletions(-) diff --git a/reviewpad.yaml b/reviewpad.yaml index f9f489b95fc..c8054b94e18 100644 --- a/reviewpad.yaml +++ b/reviewpad.yaml @@ -1,64 +1,75 @@ groups: - name: ignored-patterns spec: '["*.lock","*.csv","*.yaml","*.txt"]' + - name: ignored-prs + description: | + List of PRs numbers that should be ignored by Reviewpad + Reviewpad will not run on these PRs + spec: '["5225"]' rules: - name: changes-requirements - spec: $hasFileName("requirements.txt") && $hasFileName("requirements-full.txt") + spec: $containsFileName("requirements.txt") && $containsFileName("requirements-full.txt") + - name: should-run-reviewpad + spec: $isElementOf($selectFromContext("$.number"), $group("ignored-prs")) == false workflows: - name: label-pull-request-with-size description: Label pull request based on the number of lines changed - always-run: true - if: - # Calculate size while ignoring patterns in the "ignored-patterns" group - # For more details about size follow https://docs.reviewpad.com/guides/built-ins/#size - - rule: $size($group("ignored-patterns")) <= 100 - extra-actions: + run: + - if: $rule("should-run-reviewpad") + then: + # Calculate size while ignoring patterns in the "ignored-patterns" group + # For more details about size follow https://docs.reviewpad.com/guides/built-ins/#size + - if: $getSize($group("ignored-patterns")) <= 100 + then: - $removeLabels(["feat S", "feat M", "feat L", "feat XL"]) - $addLabel("feat XS") - - rule: $size($group("ignored-patterns")) > 100 && $size($group("ignored-patterns")) <= 300 - extra-actions: - - $removeLabels(["feat XS", "feat M", "feat L", "feat XL"]) - - $addLabel("feat S") - - rule: $size($group("ignored-patterns")) > 300 && $size($group("ignored-patterns")) <= 900 - extra-actions: - - $removeLabels(["feat XS", "feat S", "feat L", "feat XL"]) - - $addLabel("feat M") - - rule: $size($group("ignored-patterns")) > 900 && $size($group("ignored-patterns")) <= 1800 - extra-actions: - - $removeLabels(["feat XS", "feat S", "feat M", "feat XL"]) - - $addLabel("feat L") - - rule: $size($group("ignored-patterns")) > 1800 - extra-actions: - - $removeLabels(["feat XS", "feat S", "feat M", "feat L"]) - - $addLabel("feat XL") + - if: $getSize($group("ignored-patterns")) > 100 && $getSize($group("ignored-patterns")) <= 300 + then: + - $removeLabels(["feat XS", "feat M", "feat L", "feat XL"]) + - $addLabel("feat S") + - if: $getSize($group("ignored-patterns")) > 300 && $getSize($group("ignored-patterns")) <= 900 + then: + - $removeLabels(["feat XS", "feat S", "feat L", "feat XL"]) + - $addLabel("feat M") + - if: $getSize($group("ignored-patterns")) > 900 && $getSize($group("ignored-patterns")) <= 1800 + then: + - $removeLabels(["feat XS", "feat S", "feat M", "feat XL"]) + - $addLabel("feat L") + - if: $getSize($group("ignored-patterns")) > 1800 + then: + - $removeLabels(["feat XS", "feat S", "feat M", "feat L"]) + - $addLabel("feat XL") - name: sanity description: Verify pull request sanity - always-run: true - if: - - rule: $hasFileExtensions([".py"]) && $size() > 1000 - extra-actions: - - $fail("This PR is very large and hard to review. Please split PR into multiple") - - rule: $hasBinaryFile() - extra-actions: - - $fail("Images are not allowed in the repository, please remove images from the PR") + run: + - if: $rule("should-run-reviewpad") + then: + - if: $containsOnlyFileExtensions([".py"]) && $getSize() > 1000 + then: + - $failCheckStatus("This PR is very large and hard to review. Please split PR into multiple") + - if: $containsBinaryFiles() + then: + - $failCheckStatus("Images are not allowed in the repository, please remove images from the PR") - name: dependencies description: Verify pull request dependency changes - always-run: true - if: - - rule: '!$isDraft() && $hasFileName("poetry.lock") && !$rule("changes-requirements")' - extra-actions: - - $review("REQUEST_CHANGES", "The `poetry.lock` file has been changed. Please update both `requirements.txt` and `requirements-full.txt` files") - - rule: '!$isDraft() && $hasFileName("pyproject.toml") && !$rule("changes-requirements")' - extra-actions: - - $warn("The `pyproject.toml` file has been changed. Please make sure that the files `requirements.txt` and `requirements-full.txt` do not need to be updated") + run: + - if: $rule("should-run-reviewpad") + then: + - if: '!$isDraft() && $containsFileName("poetry.lock") && !$rule("changes-requirements")' + then: + - $review("REQUEST_CHANGES", "The `poetry.lock` file has been changed. Please update both `requirements.txt` and `requirements-full.txt` files") + - if: '!$isDraft() && $containsFileName("pyproject.toml") && !$rule("changes-requirements")' + then: + - $reportWarning("The `pyproject.toml` file has been changed. Please make sure that the files `requirements.txt` and `requirements-full.txt` do not need to be updated") - name: EOF description: Verify files EOF - always-run: true - if: - # By default, Reviewpad splits each file in the patch using the line feed character (\n or LF). - # This means that if a file has a carriage return character (\r) at the end, it indicates that the file has CRLF line endings instead. - - rule: $hasCodePattern("\r$$") - extra-actions: - - $warn("It looks like you have files with `CRLF` line endings. Please make sure that all files have `LF` line endings") + run: + - if: $rule("should-run-reviewpad") + then: + # By default, Reviewpad splits each file in the patch using the line feed character (\n or LF). + # This means that if a file has a carriage return character (\r) at the end, it indicates that the file has CRLF line endings instead. + - if: $containsCodePattern("\r$$") + then: + - $reportWarning("It looks like you have files with `CRLF` line endings. Please make sure that all files have `LF` line endings") From 788c78242e01db89a069e6c8cca3e067a58fec91 Mon Sep 17 00:00:00 2001 From: Tiago Ferreira Date: Thu, 28 Sep 2023 14:27:17 +0100 Subject: [PATCH 2/3] chore: update rule should run reviewpad --- reviewpad.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/reviewpad.yaml b/reviewpad.yaml index c8054b94e18..dba44e70b30 100644 --- a/reviewpad.yaml +++ b/reviewpad.yaml @@ -1,17 +1,12 @@ groups: - name: ignored-patterns spec: '["*.lock","*.csv","*.yaml","*.txt"]' - - name: ignored-prs - description: | - List of PRs numbers that should be ignored by Reviewpad - Reviewpad will not run on these PRs - spec: '["5225"]' rules: - name: changes-requirements spec: $containsFileName("requirements.txt") && $containsFileName("requirements-full.txt") - name: should-run-reviewpad - spec: $isElementOf($selectFromContext("$.number"), $group("ignored-prs")) == false + spec: '!$isElementOf("reviewpad-ignore", $getLabels())' workflows: - name: label-pull-request-with-size From 40ae229494fce65fe638b32d89f896beee9bbb88 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Thu, 28 Sep 2023 07:38:45 -0700 Subject: [PATCH 3/3] Fix bug that doesn't allow to iterate through tickers with a dot (#5489) --- openbb_terminal/routine_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbb_terminal/routine_functions.py b/openbb_terminal/routine_functions.py index f29cb58c1d4..5b2098b0612 100644 --- a/openbb_terminal/routine_functions.py +++ b/openbb_terminal/routine_functions.py @@ -411,7 +411,7 @@ def parse_openbb_script( # noqa: PLR0911,PLR0912 for line in lines_with_vars_replaced: # Found 'foreach' header associated with loop match = re.search( - r"foreach \$\$([A-Za-z\_]+) in ([A-Za-z0-9,-]+)", line, re.IGNORECASE + r"foreach \$\$([A-Za-z\_]+) in ([A-Za-z0-9,-.]+)", line, re.IGNORECASE ) if match: varname = match.group(1)