pyright-to-gitlab 1.0.1__py3-none-any.whl → 1.1.0__py3-none-any.whl
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.
- pyright_to_gitlab-1.1.0.dist-info/METADATA +59 -0
- pyright_to_gitlab-1.1.0.dist-info/RECORD +6 -0
- pyright_to_gitlab.py +33 -7
- pyright_to_gitlab-1.0.1.dist-info/METADATA +0 -59
- pyright_to_gitlab-1.0.1.dist-info/RECORD +0 -6
- {pyright_to_gitlab-1.0.1.dist-info → pyright_to_gitlab-1.1.0.dist-info}/WHEEL +0 -0
- {pyright_to_gitlab-1.0.1.dist-info → pyright_to_gitlab-1.1.0.dist-info}/entry_points.txt +0 -0
- {pyright_to_gitlab-1.0.1.dist-info → pyright_to_gitlab-1.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyright-to-gitlab
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Convert Pyright JSON output to GitLab CI/CD format
|
|
5
|
+
Project-URL: homepage, https://github.com/schollm/pyright-to-gitlab/
|
|
6
|
+
Project-URL: repository, https://github.com/schollm/pyright-to-gitlab/
|
|
7
|
+
Project-URL: pypi, https://pypi.org/project/pyright-to-gitlab
|
|
8
|
+
Author: Micha Schöll
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ci/cd,gitlab,pyright
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Software Development :: Testing
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.6
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# pyright to gitlab
|
|
31
|
+
Simple zero-dependency Python script to convert a pyright --outputjson to a gitlab
|
|
32
|
+
code-quality report.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
Run the script with the path to the pyright output file:
|
|
36
|
+
```shell
|
|
37
|
+
$ pip install pyright-to-gitlab
|
|
38
|
+
$ pyright . --outputjson | pyright-to-gitlab > code-quality.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Alternatively, the module can be called:
|
|
42
|
+
```shell
|
|
43
|
+
$ pip install pyright-to-gitlab
|
|
44
|
+
$ pyright . --outputjson | python -m pyright_to_gitlab > code-quality.json
|
|
45
|
+
```
|
|
46
|
+
### Custom path prefix
|
|
47
|
+
The `--prefix` option adds a custom prefix to the file paths in the output. This is
|
|
48
|
+
useful if the paths in the pyright output are not relative to the root of the repository.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
$ pyright . --outputjson | pyright-to-gitlab --prefix my-app/ > code-quality.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
To run the tests, execute
|
|
57
|
+
```shell
|
|
58
|
+
$ uv run pytest tests/
|
|
59
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
pyright_to_gitlab.py,sha256=i_54FlXg4RD1_1dr5Kq6onIAua2zRsi9hs_uejB_SK0,3150
|
|
2
|
+
pyright_to_gitlab-1.1.0.dist-info/METADATA,sha256=9WGRB8rUH9ylhs98la_TMihlgQ6VNBe_gTAtrFOGjJk,2034
|
|
3
|
+
pyright_to_gitlab-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
4
|
+
pyright_to_gitlab-1.1.0.dist-info/entry_points.txt,sha256=MbNff91bPuO2XhW0P03N9O1Z7xtlr3x9duU5BftRbZo,60
|
|
5
|
+
pyright_to_gitlab-1.1.0.dist-info/licenses/LICENSE,sha256=tY29-MdtyUNoC3XN4IBzu_jxmb8U82z9UvLkQJuBiJM,1070
|
|
6
|
+
pyright_to_gitlab-1.1.0.dist-info/RECORD,,
|
pyright_to_gitlab.py
CHANGED
|
@@ -4,10 +4,11 @@ import argparse
|
|
|
4
4
|
import hashlib
|
|
5
5
|
import json
|
|
6
6
|
import sys
|
|
7
|
-
|
|
7
|
+
import textwrap
|
|
8
|
+
from typing import TextIO, cast
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
11
|
+
def _pyright_to_gitlab(input_: TextIO, prefix: str = "") -> str:
|
|
11
12
|
"""Convert pyright.json output to GitLab Code Quality report format.
|
|
12
13
|
|
|
13
14
|
:arg prefix: A string to prepend to each file path in the output.
|
|
@@ -17,7 +18,7 @@ def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
|
17
18
|
Pyright format at https://github.com/microsoft/pyright/blob/main/docs/command-line.md
|
|
18
19
|
Gitlab format at https://docs.gitlab.com/ci/testing/code_quality/#code-quality-report-format
|
|
19
20
|
"""
|
|
20
|
-
data = cast("dict", json.load(
|
|
21
|
+
data = cast("dict", json.load(input_))
|
|
21
22
|
|
|
22
23
|
issues = []
|
|
23
24
|
for issue in data.get("generalDiagnostics", []):
|
|
@@ -49,17 +50,42 @@ def _pyright_to_gitlab(prefix: str = "") -> str:
|
|
|
49
50
|
def main() -> None:
|
|
50
51
|
"""Parse arguments and call the conversion function."""
|
|
51
52
|
parser = argparse.ArgumentParser(
|
|
52
|
-
description=
|
|
53
|
+
description=textwrap.dedent("""
|
|
54
|
+
Convert pyright.json to GitLab Code Quality report.
|
|
55
|
+
By default, reads from stdin and writes to stdout."""),
|
|
56
|
+
epilog=textwrap.dedent(
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
Example usage:
|
|
60
|
+
> python pyright . --outputjson | pyright-to-gitlab > gitlab_code_quality.json
|
|
61
|
+
> pyright-to-gitlab -i pyright.json -o gitlab_code_quality.json
|
|
62
|
+
"""
|
|
63
|
+
),
|
|
64
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
65
|
+
)
|
|
66
|
+
parser.add_argument(
|
|
67
|
+
"-i",
|
|
68
|
+
"--input",
|
|
69
|
+
type=argparse.FileType("r"),
|
|
70
|
+
default=sys.stdin,
|
|
71
|
+
help="Input file (default: stdin)",
|
|
72
|
+
)
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"-o",
|
|
75
|
+
"--output",
|
|
76
|
+
type=argparse.FileType("w"),
|
|
77
|
+
default=sys.stdout,
|
|
78
|
+
help="Output file (default: stdout)",
|
|
53
79
|
)
|
|
54
80
|
parser.add_argument(
|
|
55
81
|
"--prefix",
|
|
56
82
|
type=str,
|
|
57
83
|
default="",
|
|
58
|
-
help="Prefix to add to each file
|
|
84
|
+
help="Prefix to add to each file entry. This can be used if pyright is run"
|
|
85
|
+
" from a subdirectory of the repository. (default: empty string)",
|
|
59
86
|
)
|
|
60
87
|
args = parser.parse_args()
|
|
61
|
-
|
|
62
|
-
print(_pyright_to_gitlab(prefix=args.prefix)) # noqa: T201
|
|
88
|
+
args.output.write(_pyright_to_gitlab(input_=args.input, prefix=args.prefix))
|
|
63
89
|
|
|
64
90
|
|
|
65
91
|
if __name__ == "__main__": # pragma: no cover
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pyright-to-gitlab
|
|
3
|
-
Version: 1.0.1
|
|
4
|
-
Summary: Convert Pyright JSON output to GitLab CI/CD format
|
|
5
|
-
Author: Micha Schöll
|
|
6
|
-
License: MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Micha Schöll
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
Requires-Python: >=3.6
|
|
29
|
-
Description-Content-Type: text/markdown
|
|
30
|
-
|
|
31
|
-
# pyright to gitlab
|
|
32
|
-
Simple Python script to convert a pyright --outputjson to a gitlab code-quality report.
|
|
33
|
-
|
|
34
|
-
## Usage
|
|
35
|
-
Run the script with the path to the pyright output file:
|
|
36
|
-
```shell
|
|
37
|
-
$ pip install pyright-to-gitlab
|
|
38
|
-
$ pyright . --outputjson | pyright-to-gitlab > code-quality.json
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Alternatively, the module can be called:
|
|
42
|
-
```shell
|
|
43
|
-
$ pip install pyright-to-gitlab
|
|
44
|
-
$ pyright . --outputjson | python -m pyright_to_gitlab > code-quality.json
|
|
45
|
-
```
|
|
46
|
-
### Custom path prefix
|
|
47
|
-
The `--prefix` option adds a custom prefix to the file paths in the output. This is
|
|
48
|
-
useful if the paths in the pyright output are not relative to the root of the repository.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```shell
|
|
52
|
-
$ pyright . --outputjson | pyright-to-gitlab --prefix my-app/ > code-quality.json
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Testing
|
|
56
|
-
To run the tests, execute
|
|
57
|
-
```shell
|
|
58
|
-
$ uv run pytest tests/
|
|
59
|
-
```
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
pyright_to_gitlab.py,sha256=LbPxle60_JFBGMtPZszoNaFmnXEzfWBhc67PuZ1669g,2251
|
|
2
|
-
pyright_to_gitlab-1.0.1.dist-info/METADATA,sha256=oztGH-gx0w-OAgVZ6_ezwqTHSAcXkAvhw-wnBLRxsew,2289
|
|
3
|
-
pyright_to_gitlab-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
4
|
-
pyright_to_gitlab-1.0.1.dist-info/entry_points.txt,sha256=MbNff91bPuO2XhW0P03N9O1Z7xtlr3x9duU5BftRbZo,60
|
|
5
|
-
pyright_to_gitlab-1.0.1.dist-info/licenses/LICENSE,sha256=tY29-MdtyUNoC3XN4IBzu_jxmb8U82z9UvLkQJuBiJM,1070
|
|
6
|
-
pyright_to_gitlab-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|