rsmetacheck 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rsmetacheck-0.2.1/LICENSE +21 -0
- rsmetacheck-0.2.1/PKG-INFO +181 -0
- rsmetacheck-0.2.1/README.md +163 -0
- rsmetacheck-0.2.1/pyproject.toml +19 -0
- rsmetacheck-0.2.1/src/metacheck/__init__.py +2 -0
- rsmetacheck-0.2.1/src/metacheck/cli.py +91 -0
- rsmetacheck-0.2.1/src/metacheck/detect_pitfalls_main.py +480 -0
- rsmetacheck-0.2.1/src/metacheck/run_analyzer.py +29 -0
- rsmetacheck-0.2.1/src/metacheck/run_somef.py +64 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/__init__.py +0 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/__init__.py +0 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p001.py +95 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p002.py +88 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p003.py +90 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p004.py +80 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p005.py +66 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p006.py +78 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p007.py +50 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p008.py +177 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p009.py +113 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p010.py +129 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p011.py +67 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p012.py +139 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p013.py +68 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p014.py +65 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p015.py +89 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p016.py +80 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p017.py +94 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p018.py +61 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/pitfalls/p019.py +145 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/log.txt +43 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/log_verbose.txt +1375 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p001.py +240 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p002.py +226 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p003.py +259 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p004.py +315 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p005.py +331 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p006.py +406 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p007.py +379 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p008.py +506 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p009.py +454 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p010.py +514 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p011.py +375 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p012.py +503 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p013.py +502 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p014.py +437 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p015.py +368 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p016.py +390 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p017.py +527 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p018.py +373 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_p019.py +595 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w001.py +367 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w002.py +365 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w003.py +584 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w004.py +476 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w005.py +358 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w006.py +395 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w007.py +312 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w008.py +382 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w009.py +470 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/tests/test_w010.py +440 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/__init__.py +0 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w001.py +129 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w002.py +146 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w003.py +65 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w004.py +50 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w005.py +100 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w006.py +155 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w007.py +36 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w008.py +55 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w009.py +63 -0
- rsmetacheck-0.2.1/src/metacheck/scripts/warnings/w010.py +74 -0
- rsmetacheck-0.2.1/src/metacheck/utils/__init__.py +0 -0
- rsmetacheck-0.2.1/src/metacheck/utils/json_ld_utils.py +596 -0
- rsmetacheck-0.2.1/src/metacheck/utils/pitfall_utils.py +95 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Anas El Hounsri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rsmetacheck
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Detect metadata pitfalls in software repositories
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Anas El Hounsri
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: somef
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
[](https://doi.org/10.5281/zenodo.18313677)
|
|
19
|
+
|
|
20
|
+
# Research Software MetaCheck (a Pitfall/Warning Detection Tool)
|
|
21
|
+
|
|
22
|
+
This project provides an automated tool for detecting common metadata quality issues (pitfalls & Warnings)
|
|
23
|
+
in software repositories. The tool analyzes SoMEF (Software Metadata Extraction Framework) output
|
|
24
|
+
files to identify various problems in repository metadata
|
|
25
|
+
files such as `codemeta.json`, `package.json`, `setup.py`, `DESCRIPTION`, and others.
|
|
26
|
+
|
|
27
|
+
## Overview
|
|
28
|
+
|
|
29
|
+
MetaCheck identifies **29 different types of metadata quality issues** across multiple programming languages
|
|
30
|
+
(Python, Java, C++, C, R, Rust). These pitfalls range from version mismatches and
|
|
31
|
+
license template placeholders to broken URLs and improperly formatted metadata fields.
|
|
32
|
+
|
|
33
|
+
### Supported Pitfall Types
|
|
34
|
+
|
|
35
|
+
The tool detects the following categories of issues:
|
|
36
|
+
|
|
37
|
+
- **Version-related pitfalls**: Version mismatches between metadata files and releases
|
|
38
|
+
- **License-related pitfalls**: Template placeholders, copyright-only licenses, missing version specifications
|
|
39
|
+
- **URL validation pitfalls**: Broken links for CI, software requirements, download URLs
|
|
40
|
+
- **Metadata format pitfalls**: Improper field formatting, multiple authors in single fields, etc...
|
|
41
|
+
- **Identifier pitfalls**: Invalid or missing unique identifiers, bare DOIs
|
|
42
|
+
- **Repository reference pitfalls**: Mismatched code repositories, Git shorthand usage
|
|
43
|
+
|
|
44
|
+
## Requirements
|
|
45
|
+
|
|
46
|
+
- **Python 3.10**
|
|
47
|
+
- Required Python packages:
|
|
48
|
+
- `requests` (for URL validation)
|
|
49
|
+
- `pathlib` (built-in)
|
|
50
|
+
- `json` (built-in)
|
|
51
|
+
- `re` (built-in)
|
|
52
|
+
- `somef` (For extracting metadata from the repositories)
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Using Poetry (Recommended)
|
|
57
|
+
|
|
58
|
+
1. **Clone the repository**:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/SoftwareUnderstanding/RsMetaCheck.git
|
|
62
|
+
cd RsMetaCheck
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. **Install with Poetry**:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
poetry install
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
3. **Configure SoMEF** (optional but recommended):
|
|
72
|
+
Initially, the installation process will run `somef configure -a` to automatically set it up and install the necessary packages but the rate limit will be low. If you need more, you should reconfigure SoMEF, you can run the following command:
|
|
73
|
+
```bash
|
|
74
|
+
poetry run somef configure
|
|
75
|
+
```
|
|
76
|
+
Then add your GitHub authentication token to avoid API rate limits when analyzing repositories in batches.
|
|
77
|
+
|
|
78
|
+
### Using pip
|
|
79
|
+
|
|
80
|
+
Alternatively, you can install directly from GitHub:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install git+https://github.com/SoftwareUnderstanding/RsMetaCheck.git
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
### Run the Detection Tool
|
|
89
|
+
|
|
90
|
+
#### Analyze a Single Repository
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
poetry run rsmetacheck --input https://github.com/tidyverse/tidyverse
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Analyze Multiple Repositories from a JSON File
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
poetry run rsmetacheck --input repositories.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The `repositories.json` file should be structured as follows:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"repositories": [
|
|
107
|
+
"https://gitlab.com/example/example_repo_1",
|
|
108
|
+
"https://gitlab.com/example/example_repo_2",
|
|
109
|
+
"https://github.com/example/example_repo_3"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Customize Output Paths
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
poetry run rsmetacheck --input repositories.json \
|
|
118
|
+
--somef-output ./results/somef \
|
|
119
|
+
--pitfalls-output ./results/pitfalls \
|
|
120
|
+
--analysis-output ./results/summary.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Skip SoMEF and Analyze Existing Outputs
|
|
124
|
+
|
|
125
|
+
If you've already run SoMEF separately:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
poetry run rsmetacheck --skip-somef --input somef_outputs/*.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Or for multiple paths:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
poetry run rsmetacheck --skip-somef --input my_somef_outputs_1/*.json my_somef_outputs_2/*.json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Verbose Output for Passed Checks
|
|
138
|
+
|
|
139
|
+
By default, the JSON-LD files generated by RsMetaCheck will only contain information about pitfalls and warnings that were actually detected. If you want to include all tests in the final JSON-LD, even tests that the repository successfully passed, use the `--verbose` flag:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
poetry run rsmetacheck --input https://github.com/tidyverse/tidyverse --verbose
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Output
|
|
146
|
+
|
|
147
|
+
The tool will:
|
|
148
|
+
|
|
149
|
+
- Process all JSON files in the SoMEF output directory (by default `somef_outputs` created by the tool)
|
|
150
|
+
- Display progress messages showing detected pitfalls
|
|
151
|
+
- Generate JSON-LD files of detailed Pitfalls and Warnings detected by the tool in `output_1_pitfalls.jsonld`,
|
|
152
|
+
`output_2_pitfalls.jsonld`, etc... in `pitfalls` (by default created by the tool) directory
|
|
153
|
+
- Generate a comprehensive report in `all_pitfalls_results.json`
|
|
154
|
+
|
|
155
|
+
The output file contains:
|
|
156
|
+
|
|
157
|
+
- EVERSE standardized JSON-LD output of each repository
|
|
158
|
+
- Summary statistics of analyzed repositories
|
|
159
|
+
- Count and percentage for each pitfall type
|
|
160
|
+
- Language-specific breakdown for repositories with target languages
|
|
161
|
+
|
|
162
|
+
## Troubleshooting
|
|
163
|
+
|
|
164
|
+
### Common Issues
|
|
165
|
+
|
|
166
|
+
1. **"There is no valid repository URL" error**: Ensure the JSON file that contains the repositories
|
|
167
|
+
has a valid structure and that you are inputing the correct path
|
|
168
|
+
2. **Network timeouts**: Some pitfalls validate URLs and may time out this is normal behavior
|
|
169
|
+
|
|
170
|
+
### Performance Notes
|
|
171
|
+
|
|
172
|
+
- URL validation pitfalls may take longer due to network requests
|
|
173
|
+
- Large datasets may require several minutes to complete analysis
|
|
174
|
+
- Progress is displayed in real-time showing which pitfalls are found
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
The system is designed with modularity in mind. Each pitfall detector is implemented as a
|
|
179
|
+
separate module in the `scripts/` directory, making it easy to add new pitfall types or modify
|
|
180
|
+
existing detection logic.
|
|
181
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
[](https://doi.org/10.5281/zenodo.18313677)
|
|
2
|
+
|
|
3
|
+
# Research Software MetaCheck (a Pitfall/Warning Detection Tool)
|
|
4
|
+
|
|
5
|
+
This project provides an automated tool for detecting common metadata quality issues (pitfalls & Warnings)
|
|
6
|
+
in software repositories. The tool analyzes SoMEF (Software Metadata Extraction Framework) output
|
|
7
|
+
files to identify various problems in repository metadata
|
|
8
|
+
files such as `codemeta.json`, `package.json`, `setup.py`, `DESCRIPTION`, and others.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
MetaCheck identifies **29 different types of metadata quality issues** across multiple programming languages
|
|
13
|
+
(Python, Java, C++, C, R, Rust). These pitfalls range from version mismatches and
|
|
14
|
+
license template placeholders to broken URLs and improperly formatted metadata fields.
|
|
15
|
+
|
|
16
|
+
### Supported Pitfall Types
|
|
17
|
+
|
|
18
|
+
The tool detects the following categories of issues:
|
|
19
|
+
|
|
20
|
+
- **Version-related pitfalls**: Version mismatches between metadata files and releases
|
|
21
|
+
- **License-related pitfalls**: Template placeholders, copyright-only licenses, missing version specifications
|
|
22
|
+
- **URL validation pitfalls**: Broken links for CI, software requirements, download URLs
|
|
23
|
+
- **Metadata format pitfalls**: Improper field formatting, multiple authors in single fields, etc...
|
|
24
|
+
- **Identifier pitfalls**: Invalid or missing unique identifiers, bare DOIs
|
|
25
|
+
- **Repository reference pitfalls**: Mismatched code repositories, Git shorthand usage
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
- **Python 3.10**
|
|
30
|
+
- Required Python packages:
|
|
31
|
+
- `requests` (for URL validation)
|
|
32
|
+
- `pathlib` (built-in)
|
|
33
|
+
- `json` (built-in)
|
|
34
|
+
- `re` (built-in)
|
|
35
|
+
- `somef` (For extracting metadata from the repositories)
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### Using Poetry (Recommended)
|
|
40
|
+
|
|
41
|
+
1. **Clone the repository**:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/SoftwareUnderstanding/RsMetaCheck.git
|
|
45
|
+
cd RsMetaCheck
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. **Install with Poetry**:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
poetry install
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. **Configure SoMEF** (optional but recommended):
|
|
55
|
+
Initially, the installation process will run `somef configure -a` to automatically set it up and install the necessary packages but the rate limit will be low. If you need more, you should reconfigure SoMEF, you can run the following command:
|
|
56
|
+
```bash
|
|
57
|
+
poetry run somef configure
|
|
58
|
+
```
|
|
59
|
+
Then add your GitHub authentication token to avoid API rate limits when analyzing repositories in batches.
|
|
60
|
+
|
|
61
|
+
### Using pip
|
|
62
|
+
|
|
63
|
+
Alternatively, you can install directly from GitHub:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install git+https://github.com/SoftwareUnderstanding/RsMetaCheck.git
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
### Run the Detection Tool
|
|
72
|
+
|
|
73
|
+
#### Analyze a Single Repository
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
poetry run rsmetacheck --input https://github.com/tidyverse/tidyverse
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Analyze Multiple Repositories from a JSON File
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
poetry run rsmetacheck --input repositories.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The `repositories.json` file should be structured as follows:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"repositories": [
|
|
90
|
+
"https://gitlab.com/example/example_repo_1",
|
|
91
|
+
"https://gitlab.com/example/example_repo_2",
|
|
92
|
+
"https://github.com/example/example_repo_3"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Customize Output Paths
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
poetry run rsmetacheck --input repositories.json \
|
|
101
|
+
--somef-output ./results/somef \
|
|
102
|
+
--pitfalls-output ./results/pitfalls \
|
|
103
|
+
--analysis-output ./results/summary.json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Skip SoMEF and Analyze Existing Outputs
|
|
107
|
+
|
|
108
|
+
If you've already run SoMEF separately:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
poetry run rsmetacheck --skip-somef --input somef_outputs/*.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Or for multiple paths:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
poetry run rsmetacheck --skip-somef --input my_somef_outputs_1/*.json my_somef_outputs_2/*.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Verbose Output for Passed Checks
|
|
121
|
+
|
|
122
|
+
By default, the JSON-LD files generated by RsMetaCheck will only contain information about pitfalls and warnings that were actually detected. If you want to include all tests in the final JSON-LD, even tests that the repository successfully passed, use the `--verbose` flag:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
poetry run rsmetacheck --input https://github.com/tidyverse/tidyverse --verbose
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Output
|
|
129
|
+
|
|
130
|
+
The tool will:
|
|
131
|
+
|
|
132
|
+
- Process all JSON files in the SoMEF output directory (by default `somef_outputs` created by the tool)
|
|
133
|
+
- Display progress messages showing detected pitfalls
|
|
134
|
+
- Generate JSON-LD files of detailed Pitfalls and Warnings detected by the tool in `output_1_pitfalls.jsonld`,
|
|
135
|
+
`output_2_pitfalls.jsonld`, etc... in `pitfalls` (by default created by the tool) directory
|
|
136
|
+
- Generate a comprehensive report in `all_pitfalls_results.json`
|
|
137
|
+
|
|
138
|
+
The output file contains:
|
|
139
|
+
|
|
140
|
+
- EVERSE standardized JSON-LD output of each repository
|
|
141
|
+
- Summary statistics of analyzed repositories
|
|
142
|
+
- Count and percentage for each pitfall type
|
|
143
|
+
- Language-specific breakdown for repositories with target languages
|
|
144
|
+
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
### Common Issues
|
|
148
|
+
|
|
149
|
+
1. **"There is no valid repository URL" error**: Ensure the JSON file that contains the repositories
|
|
150
|
+
has a valid structure and that you are inputing the correct path
|
|
151
|
+
2. **Network timeouts**: Some pitfalls validate URLs and may time out this is normal behavior
|
|
152
|
+
|
|
153
|
+
### Performance Notes
|
|
154
|
+
|
|
155
|
+
- URL validation pitfalls may take longer due to network requests
|
|
156
|
+
- Large datasets may require several minutes to complete analysis
|
|
157
|
+
- Progress is displayed in real-time showing which pitfalls are found
|
|
158
|
+
|
|
159
|
+
## Contributing
|
|
160
|
+
|
|
161
|
+
The system is designed with modularity in mind. Each pitfall detector is implemented as a
|
|
162
|
+
separate module in the `scripts/` directory, making it easy to add new pitfall types or modify
|
|
163
|
+
existing detection logic.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "rsmetacheck"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
description = "Detect metadata pitfalls in software repositories"
|
|
5
|
+
authors = ["Anas El Hounsri"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
packages = [{include = "metacheck", from = "src"}]
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.10"
|
|
11
|
+
requests = "*"
|
|
12
|
+
somef = "*"
|
|
13
|
+
|
|
14
|
+
[tool.poetry.scripts]
|
|
15
|
+
rsmetacheck = "metacheck.cli:cli"
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["poetry-core"]
|
|
19
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from metacheck.run_somef import run_somef_batch, run_somef_single, ensure_somef_configured
|
|
5
|
+
from metacheck.run_analyzer import run_analysis
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def cli():
|
|
9
|
+
parser = argparse.ArgumentParser(description="Detect metadata pitfalls in software repositories using SoMEF.")
|
|
10
|
+
parser.add_argument(
|
|
11
|
+
"--input",
|
|
12
|
+
nargs="+",
|
|
13
|
+
required=True,
|
|
14
|
+
help="One or more: GitHub/GitLab URLs, JSON files containing repositories, OR existing SoMEF output files when using --skip-somef."
|
|
15
|
+
)
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"--skip-somef",
|
|
18
|
+
action="store_true",
|
|
19
|
+
help="Skip SoMEF execution and analyze existing SoMEF output files directly. --input should point to SoMEF JSON files."
|
|
20
|
+
)
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
"--pitfalls-output",
|
|
23
|
+
default=os.path.join(os.getcwd(), "pitfalls_outputs"),
|
|
24
|
+
help="Directory to store pitfall JSON-LD files (default: ./pitfalls_outputs)."
|
|
25
|
+
)
|
|
26
|
+
parser.add_argument(
|
|
27
|
+
"--somef-output",
|
|
28
|
+
default=os.path.join(os.getcwd(), "somef_outputs"),
|
|
29
|
+
help="Directory to store SoMEF output files (default: ./somef_outputs)."
|
|
30
|
+
)
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"--analysis-output",
|
|
33
|
+
default=os.path.join(os.getcwd(), "analysis_results.json"),
|
|
34
|
+
help="File path for summary results (default: ./analysis_results.json)."
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"--threshold",
|
|
38
|
+
type=float,
|
|
39
|
+
default=0.8,
|
|
40
|
+
help="SoMEF confidence threshold (default: 0.8). Only used when running SoMEF."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--verbose",
|
|
45
|
+
action="store_true",
|
|
46
|
+
help="Include both detected AND undetected pitfalls in the output JSON-LD."
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
args = parser.parse_args()
|
|
50
|
+
|
|
51
|
+
if args.skip_somef:
|
|
52
|
+
print(f"Skipping SoMEF execution. Analyzing {len(args.input)} existing SoMEF output files...")
|
|
53
|
+
|
|
54
|
+
somef_json_paths = []
|
|
55
|
+
for json_path in args.input:
|
|
56
|
+
if not os.path.exists(json_path):
|
|
57
|
+
print(f"Warning: File not found, skipping: {json_path}")
|
|
58
|
+
continue
|
|
59
|
+
somef_json_paths.append(Path(json_path))
|
|
60
|
+
|
|
61
|
+
if not somef_json_paths:
|
|
62
|
+
print("Error: No valid SoMEF output files found.")
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
print(f"Analyzing {len(somef_json_paths)} SoMEF output files...")
|
|
66
|
+
run_analysis(somef_json_paths, args.pitfalls_output, args.analysis_output, verbose=args.verbose)
|
|
67
|
+
|
|
68
|
+
else:
|
|
69
|
+
ensure_somef_configured()
|
|
70
|
+
|
|
71
|
+
threshold = args.threshold
|
|
72
|
+
somef_output_dir = args.somef_output
|
|
73
|
+
|
|
74
|
+
print(f"Detected {len(args.input)} input(s):")
|
|
75
|
+
|
|
76
|
+
for input_item in args.input:
|
|
77
|
+
if input_item.startswith("http://") or input_item.startswith("https://"):
|
|
78
|
+
print(f"Processing repository URL: {input_item}")
|
|
79
|
+
run_somef_single(input_item, somef_output_dir, threshold)
|
|
80
|
+
elif os.path.exists(input_item):
|
|
81
|
+
print(f"Processing repositories from file: {input_item}")
|
|
82
|
+
run_somef_batch(input_item, somef_output_dir, threshold)
|
|
83
|
+
else:
|
|
84
|
+
print(f"Warning: Skipping invalid input (not a URL or existing file): {input_item}")
|
|
85
|
+
|
|
86
|
+
print(f"\nRunning analysis on outputs in {somef_output_dir}...")
|
|
87
|
+
run_analysis(somef_output_dir, args.pitfalls_output, args.analysis_output, verbose=args.verbose)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
cli()
|