Skip to content

Commit 36ff40f

Browse files
authored
refactor: renamed data directory to mismatch_data (#4356)
* fixes #4350 Signed-off-by: Meet Soni <[email protected]>
1 parent bceb2c0 commit 36ff40f

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

cve_bin_tool/mismatch_loader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
db_path = DISK_LOCATION_DEFAULT / DBNAME
2626
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
27-
data_dir = os.path.join(parent_dir, "data")
27+
data_dir = os.path.join(parent_dir, "mismatch_data")
2828

2929

3030
def setup_sqlite(data_dir: str, db_file: str) -> bool:

doc/mismatch_cli.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ The script operates within a specific directory structure as shown below:
2222
```
2323
project_root/
2424
25-
├── data/ # Directory containing the mismatch relations
25+
├── mismatch_data/ # Directory containing the mismatch relations
2626
2727
└── mismatch/ # Directory containing the script
2828
└── cli.py # The main script file
2929
```
3030

3131
## Data Directory
3232

33-
The `data/` directory is a key component of the Mismatch Database Management Tool. It houses the structured data files that are used to populate or refresh the mismatch database.
33+
The `mismatch_data/` directory is a key component of the Mismatch Database Management Tool. It houses the structured data files that are used to populate or refresh the mismatch database.
3434

3535
### Directory Structure
3636

37-
The structure of the `data/` directory is organized as follows:
37+
The structure of the `mismatch_data/` directory is organized as follows:
3838

3939
```
40-
data/
40+
mismatch_data/
4141
└── namespace/
4242
└── product/
4343
└── mismatch_relations.yml
@@ -95,7 +95,7 @@ python -m mismatch.cli loader [--dir <data_dir>] [--database <db_file>]
9595
```
9696

9797
**Parameters:**
98-
- `--dir`: (Optional) Directory containing the data files to be loaded. Defaults to the \`data/\` directory in the project root.
98+
- `--dir`: (Optional) Directory containing the data files to be loaded. Defaults to the `mismatch_data/` directory in the project root.
9999
- `--database`: (Optional) Path to the SQLite database file. Defaults to the pre-configured location if not provided.
100100

101101
**Example:**

doc/mismatch_data.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ database.
55

66
This document details the steps for adding data to the mismatch database.
77

8-
## 1. Update `data/` directory
8+
## 1. Update `mismatch_data/` directory
99

10-
1. Make a new file with `namespace/product_name/mismatch_relations.yml` name under the `data/` directory. For example, `pypi/zstandard/mismatch_relations.yml` for zstandard
10+
1. Make a new file with `namespace/product_name/mismatch_relations.yml` name under the `mismatch_data/` directory. For example, `pypi/zstandard/mismatch_relations.yml` for zstandard
1111
from pypi namespace.
1212
2. Populate the file with `purl-invalid_vendor` information.
1313

@@ -20,13 +20,13 @@ from pypi namespace.
2020
2121
## 2. Run the populator script
2222
23-
The [`mismatch_loader`](../cve_bin_tool/mismatch_loader.py) script populates the the mismatch database with the contents of `data/` directory.
23+
The [`mismatch_loader`](../cve_bin_tool/mismatch_loader.py) script populates the the mismatch database with the contents of `mismatch_data/` directory.
2424

2525
```python
2626
python -m cve_bin_tool.mismatch_loader
2727
```
2828

29-
The default directory is `data/`, and default database file is `cve.db`.
29+
The default directory is `mismatch_data/`, and default database file is `cve.db`.
3030

3131
To use a specific directory, use `--dir` flag:
3232
```python
@@ -43,5 +43,5 @@ To use a specific database file, use `--database` flag:
4343
If you find invalid relationship, please do following:
4444

4545
- Fork the [repo](https://github.com/intel/cve-bin-tool)
46-
- Update the `data/` directory with purl-invalid_vendor information like [this](../data/pypi/zstandard/mismatch_relations.yml)
46+
- Update the `mismatch_data/` directory with purl-invalid_vendor information like [this](../data/pypi/zstandard/mismatch_relations.yml)
4747
- Create a pull request with the details of update. [Reference](https://github.com/intel/cve-bin-tool/pull/4239)

mismatch/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
DBNAME = "cve.db"
99
DISK_LOCATION_DEFAULT = Path("~").expanduser() / ".cache" / "cve-bin-tool"
1010
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
11-
data_dir = os.path.join(parent_dir, "data")
11+
data_dir = os.path.join(parent_dir, "mismatch_data")
1212
dbpath = DISK_LOCATION_DEFAULT / DBNAME
1313

1414

test/test_mismatch_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_lookup(capsys, monkeypatch, test_db):
5454

5555
def test_loader(monkeypatch, tmpdir, test_db):
5656
# Test with custom directory and database path using the --dir and --database flags
57-
data_dir = Path(__file__).resolve().parent.parent / "data"
57+
data_dir = Path(__file__).resolve().parent.parent / "mismatch_data"
5858
monkeypatch.setattr(
5959
"sys.argv", ["main", "loader", "--dir", str(data_dir), "--database", test_db]
6060
)

test/test_mismatch_loader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_mismatch_loader():
1111
temp_db = tempfile.NamedTemporaryFile(suffix=".db", delete=False)
1212
temp_db_path = Path(temp_db.name)
1313

14-
data_dir = Path(__file__).resolve().parent.parent / "data"
14+
data_dir = Path(__file__).resolve().parent.parent / "mismatch_data"
1515
setup_sqlite(data_dir, temp_db_path)
1616

1717
# Connect to the database and check if zstandard is present

0 commit comments

Comments
 (0)