From bafec59b730de01e42b263a3efbac83c28bb4862 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 20:59:10 -0400 Subject: [PATCH] fix(deps): update dependency fr.inria.gforge.spoon:spoon-core to v10.4.2 (#1060) * fix(deps): update dependency fr.inria.gforge.spoon:spoon-core to v10.4.2 * fix: comply with Spoon's pretty printing modification * tests: fix lookup of docs URL * Update python in CI * up * tests: initialize default timezone * Revert "tests: initialize default timezone" This reverts commit bddee37442ae7187051f4a647c7cce3f07d33637. * tests: initialize default timezone * Push resource * Fix achievements test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Aman Sharma --- .github/workflows/tests.yml | 3 ++- experimentation/tools/sorald/prmessage.py | 4 ++-- experimentation/tools/sorald/prrecorder.py | 6 +++--- experimentation/tools/tests/resources/prs_final.json | 6 +++--- experimentation/tools/tests/test_achievements.py | 4 ++-- pom.xml | 2 +- .../main/java/sorald/sonar/SonarProcessorRepository.java | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 776ff3fe0..a5a2f2410 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -79,7 +79,8 @@ jobs: - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: 3.8 + python-version: '3.10.12' + update-environment: false - uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 with: java-version: 11 diff --git a/experimentation/tools/sorald/prmessage.py b/experimentation/tools/sorald/prmessage.py index 158bf2388..44664c7d5 100644 --- a/experimentation/tools/sorald/prmessage.py +++ b/experimentation/tools/sorald/prmessage.py @@ -63,8 +63,8 @@ def get_rule_doc_url(rule_key: int, handled_rules_url: str = HANDLED_RULES_URL) handled_rules = requests.get(handled_rules_url, headers={"Content-Type": "text/html"}).content.decode() markup = BeautifulSoup(handled_rules, features="html.parser") - for a_tag in markup.find_all("a", class_="\\\"anchor\\\""): - if f"sonar-rule-{rule_key}" in a_tag.attrs["id"]: + for a_tag in markup.find_all("a"): + if f"sonar-rule-{rule_key}" in a_tag.get("href"): unescaped_atrr = a_tag.attrs["href"].replace("\\\"", "") return f"{handled_rules_url}{unescaped_atrr}" diff --git a/experimentation/tools/sorald/prrecorder.py b/experimentation/tools/sorald/prrecorder.py index 050e4130d..db9201725 100644 --- a/experimentation/tools/sorald/prrecorder.py +++ b/experimentation/tools/sorald/prrecorder.py @@ -175,9 +175,9 @@ def read_json_if_exists(path: Optional[pathlib.Path], encoding: str) -> dict: def get_pr_state(pr: github.PullRequest.PullRequest) -> dict: return { jsonkeys.PR.URL: pr.html_url, - jsonkeys.PR.CREATED_AT: str(pr.created_at), - jsonkeys.PR.CLOSED_AT: str(pr.closed_at) if pr.closed_at else None, - jsonkeys.PR.MERGED_AT: str(pr.merged_at) if pr.closed_at else None, + jsonkeys.PR.CREATED_AT: str(pr.created_at.replace(tzinfo=datetime.timezone.utc)), + jsonkeys.PR.CLOSED_AT: str(pr.closed_at.replace(tzinfo=datetime.timezone.utc)) if pr.closed_at else None, + jsonkeys.PR.MERGED_AT: str(pr.merged_at.replace(tzinfo=datetime.timezone.utc)) if pr.merged_at else None, jsonkeys.PR.STATE: pr.state, jsonkeys.PR.IS_MERGED: pr.merged, jsonkeys.PR.NUMBER: pr.number, diff --git a/experimentation/tools/tests/resources/prs_final.json b/experimentation/tools/tests/resources/prs_final.json index c388bc7a3..4a392ba4b 100644 --- a/experimentation/tools/tests/resources/prs_final.json +++ b/experimentation/tools/tests/resources/prs_final.json @@ -3,9 +3,9 @@ "repoSlug": "redhat-developer/rsp-server", "prMetadata": { "url": "https://github.com/redhat-developer/rsp-server/pull/619", - "createdAt": "2020-11-25 12:01:06", - "closedAt": "2020-11-30 20:45:38", - "mergedAt": "2020-11-30 20:45:38", + "createdAt": "2020-11-25 12:01:06+00:00", + "closedAt": "2020-11-30 20:45:38+00:00", + "mergedAt": "2020-11-30 20:45:38+00:00", "state": "closed", "isMerged": true, "number": 619 diff --git a/experimentation/tools/tests/test_achievements.py b/experimentation/tools/tests/test_achievements.py index fc9018a9d..a41778fe1 100644 --- a/experimentation/tools/tests/test_achievements.py +++ b/experimentation/tools/tests/test_achievements.py @@ -30,7 +30,7 @@ def test_correctly_renders_merged_pr(tmp_path): This document presents an overview of the pull requests performed with Sorald. ## [redhat-developer/rsp-server#619](https://github.com/redhat-developer/rsp-server/pull/619) -This PR was opened at 2020-11-25 12:01:06 and merged at 2020-11-30 20:45:38. +This PR was opened at 2020-11-25 12:01:06+00:00 and merged at 2020-11-30 20:45:38+00:00. The patch was generated fully automatically with Sorald. It provided the following repairs: @@ -70,7 +70,7 @@ def test_correctly_renders_pr_without_repair_data(tmp_path): This document presents an overview of the pull requests performed with Sorald. ## [redhat-developer/rsp-server#619](https://github.com/redhat-developer/rsp-server/pull/619) -This PR was opened at 2020-11-25 12:01:06 and merged at 2020-11-30 20:45:38. +This PR was opened at 2020-11-25 12:01:06+00:00 and merged at 2020-11-30 20:45:38+00:00. The patch was generated fully automatically with Sorald. Detailed repair information is missing for this PR.""".strip() diff --git a/pom.xml b/pom.xml index 4550145cd..6d7d785b8 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ fr.inria.gforge.spoon spoon-core - 10.3.0 + 10.4.2 com.google.code.findbugs diff --git a/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java b/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java index 7ce5c7ab7..e996101e0 100644 --- a/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java +++ b/sorald/src/main/java/sorald/sonar/SonarProcessorRepository.java @@ -48,7 +48,7 @@ public class SonarProcessorRepository implements ProcessorRepository { // GENERATED FIELD public static final String RULE_DESCRIPTIONS = - "S1068: Unused \"private\" fields should be removed\nS1118: Utility classes should not have public constructors\n\t(incomplete: Only handles implicit public constructor)\nS1132: Strings literals should be placed on the left side when checking for equality\nS1155: Collection.isEmpty() should be used to test for emptiness\nS1217: \"Thread.run()\" should not be called directly\nS1444: \"public static\" fields should be constant\n\t(incomplete: does not fix variable naming)\nS1481: Unused local variables should be removed\nS1596: \"Collections.EMPTY_LIST\", \"EMPTY_MAP\", and \"EMPTY_SET\" should not be used\nS1656: Variables should not be self-assigned\nS1854: Unused assignments should be removed\nS1860: Synchronization should not be based on Strings or boxed primitives\nS1948: Fields in a \"Serializable\" class should either be transient or serializable\nS2057: Every class implementing Serializable should declare a static final serialVersionUID.\n\t(incomplete: This processor does not address the case where the class already has a serialVersionUID with a non long type.)\nS2095: Resources should be closed\nS2097: \"equals(Object obj)\" should test argument type\nS2111: \"BigDecimal(double)\" should not be used\nS2116: \"hashCode\" and \"toString\" should not be called on array instances\nS2142: \"InterruptedException\" should not be ignored\nS2164: Math should not be performed on floats\n\t(incomplete: does not cast the operands to double when the expected type of the result is float.)\nS2167: \"compareTo\" should not return \"Integer.MIN_VALUE\"\nS2184: Math operands should be cast before assignment\nS2204: \".equals()\" should not be used to test the values of \"Atomic\" classes\nS2225: \"toString()\" and \"clone()\" methods should not return null\n\t(incomplete: does not fix null returning clone())\nS2272: \"Iterator.next()\" methods should throw \"NoSuchElementException\"\nS2755: XML parsers should not be vulnerable to XXE attacks\n\t(incomplete: This processor is a WIP and currently supports a subset of rule 2755. See Sorald\'s documentation for details.)\nS3032: JEE applications should not \"getClassLoader\"\nS3067: \"getClass\" should not be used for synchronization\nS3984: Exception should not be created without being thrown\nS4065: \"ThreadLocal.withInitial\" should be preferred\nS4973: Strings and Boxed types should be compared using \"equals()\""; + "S1068: Unused \"private\" fields should be removed\nS1118: Utility classes should not have public constructors\n\t(incomplete: Only handles implicit public constructor)\nS1132: Strings literals should be placed on the left side when checking for equality\nS1155: Collection.isEmpty() should be used to test for emptiness\nS1217: \"Thread.run()\" should not be called directly\nS1444: \"public static\" fields should be constant\n\t(incomplete: does not fix variable naming)\nS1481: Unused local variables should be removed\nS1596: \"Collections.EMPTY_LIST\", \"EMPTY_MAP\", and \"EMPTY_SET\" should not be used\nS1656: Variables should not be self-assigned\nS1854: Unused assignments should be removed\nS1860: Synchronization should not be based on Strings or boxed primitives\nS1948: Fields in a \"Serializable\" class should either be transient or serializable\nS2057: Every class implementing Serializable should declare a static final serialVersionUID.\n\t(incomplete: This processor does not address the case where the class already has a serialVersionUID with a non long type.)\nS2095: Resources should be closed\nS2097: \"equals(Object obj)\" should test argument type\nS2111: \"BigDecimal(double)\" should not be used\nS2116: \"hashCode\" and \"toString\" should not be called on array instances\nS2142: \"InterruptedException\" should not be ignored\nS2164: Math should not be performed on floats\n\t(incomplete: does not cast the operands to double when the expected type of the result is float.)\nS2167: \"compareTo\" should not return \"Integer.MIN_VALUE\"\nS2184: Math operands should be cast before assignment\nS2204: \".equals()\" should not be used to test the values of \"Atomic\" classes\nS2225: \"toString()\" and \"clone()\" methods should not return null\n\t(incomplete: does not fix null returning clone())\nS2272: \"Iterator.next()\" methods should throw \"NoSuchElementException\"\nS2755: XML parsers should not be vulnerable to XXE attacks\n\t(incomplete: This processor is a WIP and currently supports a subset of rule 2755. See Sorald's documentation for details.)\nS3032: JEE applications should not \"getClassLoader\"\nS3067: \"getClass\" should not be used for synchronization\nS3984: Exception should not be created without being thrown\nS4065: \"ThreadLocal.withInitial\" should be preferred\nS4973: Strings and Boxed types should be compared using \"equals()\""; @Override public Class> getProcessor(String key) {