pyright-to-gitlab 1.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyright-to-gitlab
3
- Version: 1.0.2
3
+ Version: 1.1.0
4
4
  Summary: Convert Pyright JSON output to GitLab CI/CD format
5
5
  Project-URL: homepage, https://github.com/schollm/pyright-to-gitlab/
6
6
  Project-URL: repository, https://github.com/schollm/pyright-to-gitlab/
@@ -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
- from typing import cast
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(sys.stdin))
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="Convert pyright.json to GitLab Code Quality report."
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 (default: empty string)",
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,6 +0,0 @@
1
- pyright_to_gitlab.py,sha256=LbPxle60_JFBGMtPZszoNaFmnXEzfWBhc67PuZ1669g,2251
2
- pyright_to_gitlab-1.0.2.dist-info/METADATA,sha256=zxP5XyJcirFWi-yPy09oPOgHM0fkF1eVeg-eHxMhxnM,2034
3
- pyright_to_gitlab-1.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- pyright_to_gitlab-1.0.2.dist-info/entry_points.txt,sha256=MbNff91bPuO2XhW0P03N9O1Z7xtlr3x9duU5BftRbZo,60
5
- pyright_to_gitlab-1.0.2.dist-info/licenses/LICENSE,sha256=tY29-MdtyUNoC3XN4IBzu_jxmb8U82z9UvLkQJuBiJM,1070
6
- pyright_to_gitlab-1.0.2.dist-info/RECORD,,