From 266848d3385efc9eb62a26759cf559de94d722df Mon Sep 17 00:00:00 2001 From: Villon CHEN Date: Mon, 17 Nov 2025 12:09:45 +0100 Subject: [PATCH 1/4] chore(release): bump project version This commit is a follow-up to PR #14. Refs #14. --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 168d496..51097ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "CodeSecTools" -version = "0.12.2" +version = "0.12.3" description = "A framework for code security that provides abstractions for static analysis tools and datasets to support their integration, testing, and evaluation." readme = "README.md" license = "AGPL-3.0-only" diff --git a/uv.lock b/uv.lock index 4eff334..efa70d9 100644 --- a/uv.lock +++ b/uv.lock @@ -221,7 +221,7 @@ wheels = [ [[package]] name = "codesectools" -version = "0.12.2" +version = "0.12.3" source = { editable = "." } dependencies = [ { name = "gitpython" }, From f6b4a4478c00ba3004757dd39fbff1a4c774d5d9 Mon Sep 17 00:00:00 2001 From: Villon CHEN Date: Mon, 17 Nov 2025 11:53:15 +0100 Subject: [PATCH 2/4] fix(BenchmarkJava): check if file exist to avoid error --- .../datasets/BenchmarkJava/dataset.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/codesectools/datasets/BenchmarkJava/dataset.py b/codesectools/datasets/BenchmarkJava/dataset.py index ec25095..1dd192a 100644 --- a/codesectools/datasets/BenchmarkJava/dataset.py +++ b/codesectools/datasets/BenchmarkJava/dataset.py @@ -148,16 +148,17 @@ def load_dataset(self) -> list[TestCode]: for row in reader: filename = f"{row[0]}.java" filepath = testcode_dir / filename - content = filepath.read_text() - cwes = [CWEs.from_id(int(row[3]))] - has_vuln = True if row[2] == "true" else False - files.append( - TestCode( - filepath.relative_to(self.directory), - content, - cwes, - has_vuln, + if filepath.is_file(): + content = filepath.read_text() + cwes = [CWEs.from_id(int(row[3]))] + has_vuln = True if row[2] == "true" else False + files.append( + TestCode( + filepath.relative_to(self.directory), + content, + cwes, + has_vuln, + ) ) - ) return files From f43a316400e4f7a94d467fd6fbcae655b2d612fc Mon Sep 17 00:00:00 2001 From: Villon CHEN Date: Mon, 17 Nov 2025 12:07:02 +0100 Subject: [PATCH 3/4] feat(datasets): load dataset only when necessary to reduce blocking time --- codesectools/datasets/core/dataset.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/codesectools/datasets/core/dataset.py b/codesectools/datasets/core/dataset.py index 97ed03e..e582023 100644 --- a/codesectools/datasets/core/dataset.py +++ b/codesectools/datasets/core/dataset.py @@ -57,12 +57,17 @@ def __init__(self, lang: str | None = None) -> None: """ self.directory = USER_CACHE_DIR / self.name self.lang = lang + self._files = [] if self.lang: self.full_name = f"{self.name}_{self.lang}" assert self.full_name in self.list_dataset_full_names() - self.files: list[File] = self.load_dataset() - else: - self.files = [] + + @property + def files(self) -> list: + """Get the list of dataset files, loading them if necessary.""" + if self.lang: + self._files = self.load_dataset() + return self._files @classmethod def is_cached(cls) -> bool: From 29689652d44b672e5825925f68149fd1a3c6f6e3 Mon Sep 17 00:00:00 2001 From: Villon CHEN Date: Mon, 17 Nov 2025 12:12:03 +0100 Subject: [PATCH 4/4] chore(release): bump project version --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 51097ec..a997f14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "CodeSecTools" -version = "0.12.3" +version = "0.12.4" description = "A framework for code security that provides abstractions for static analysis tools and datasets to support their integration, testing, and evaluation." readme = "README.md" license = "AGPL-3.0-only" diff --git a/uv.lock b/uv.lock index efa70d9..de3b98f 100644 --- a/uv.lock +++ b/uv.lock @@ -221,7 +221,7 @@ wheels = [ [[package]] name = "codesectools" -version = "0.12.3" +version = "0.12.4" source = { editable = "." } dependencies = [ { name = "gitpython" },