pull-request-fixer 0.1.8__tar.gz → 0.1.9__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.
Files changed (21) hide show
  1. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/PKG-INFO +3 -3
  2. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/README.md +2 -2
  3. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/pyproject.toml +24 -8
  4. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/_version.py +2 -2
  5. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/cli.py +7 -4
  6. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/git_config.py +36 -15
  7. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/github_client.py +1 -0
  8. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/pr_file_fixer.py +11 -5
  9. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/.gitignore +0 -0
  10. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/LICENSE +0 -0
  11. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/LICENSES/Apache-2.0.txt +0 -0
  12. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/scripts/README.md +0 -0
  13. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/__init__.py +0 -0
  14. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/blocked_pr_scanner.py +0 -0
  15. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/exceptions.py +0 -0
  16. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/file_fixer.py +0 -0
  17. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/graphql_queries.py +0 -0
  18. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/models.py +0 -0
  19. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/pr_scanner.py +0 -0
  20. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/progress_tracker.py +0 -0
  21. {pull_request_fixer-0.1.8 → pull_request_fixer-0.1.9}/src/pull_request_fixer/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pull-request-fixer
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Fix GitHub pull request titles, descriptions and files, for one pull request or across an organization
5
5
  Project-URL: Homepage, https://github.com/lfreleng-actions/pull-request-fixer
6
6
  Project-URL: Repository, https://github.com/lfreleng-actions/pull-request-fixer.git
@@ -306,8 +306,8 @@ These flags apply to the `git` method only:
306
306
  <noreply@linuxfoundation.org>` without signing
307
307
 
308
308
  If your global Git configuration has no `user.name` or `user.email`, the
309
- tool falls back to the bot identity. You cannot combine `--bot-identity`
310
- with `--disable-signing`.
309
+ tool falls back to the bot identity, without signing. You cannot combine
310
+ `--bot-identity` with `--disable-signing`.
311
311
 
312
312
  ### Previewing changes
313
313
 
@@ -264,8 +264,8 @@ These flags apply to the `git` method only:
264
264
  <noreply@linuxfoundation.org>` without signing
265
265
 
266
266
  If your global Git configuration has no `user.name` or `user.email`, the
267
- tool falls back to the bot identity. You cannot combine `--bot-identity`
268
- with `--disable-signing`.
267
+ tool falls back to the bot identity, without signing. You cannot combine
268
+ `--bot-identity` with `--disable-signing`.
269
269
 
270
270
  ### Previewing changes
271
271
 
@@ -118,9 +118,17 @@ skip-magic-trailing-comma = false
118
118
  line-ending = "auto"
119
119
 
120
120
  [tool.basedpyright]
121
- pythonVersion = "3.12"
121
+ # Check against the oldest supported Python (requires-python >= 3.10), so
122
+ # use of a newer standard library API is reported rather than hidden.
123
+ pythonVersion = "3.10"
122
124
  pythonPlatform = "All"
123
125
  typeCheckingMode = "standard"
126
+ # Scope a bare ``basedpyright`` invocation to our own code. The
127
+ # pre-commit hook passes these same paths as explicit targets with
128
+ # ``pass_filenames: false`` (explicit arguments override ``include``);
129
+ # this list governs the runs that supply no targets --- a bare
130
+ # ``basedpyright`` on the command line, and an editor's language server
131
+ # --- so those analyse the same set the hook does.
124
132
  include = ["src", "tests", "scripts", "test_blocked_pr_logic.py", "test_integration.py"]
125
133
  exclude = [
126
134
  "src/pull_request_fixer/_version.py",
@@ -130,17 +138,25 @@ exclude = [
130
138
  ]
131
139
 
132
140
  # --- Errors we want to catch and fix ---
133
- reportMissingTypeArgument = "warning"
134
- reportOptionalMemberAccess = "warning"
135
- reportCallIssue = "warning"
136
- reportAssignmentType = "warning"
137
- reportReturnType = "warning"
138
- reportGeneralTypeIssues = "warning"
139
- reportUninitializedInstanceVariable = "warning"
141
+ # These are genuine type defects, so they fail the build. The
142
+ # ``--warnings`` flag on the pre-commit hook additionally fails on any
143
+ # rule still classified as a warning, so a newly introduced diagnostic
144
+ # cannot slip through by virtue of its default severity.
145
+ reportMissingTypeArgument = "error"
146
+ reportOptionalMemberAccess = "error"
147
+ reportCallIssue = "error"
148
+ reportAssignmentType = "error"
149
+ reportReturnType = "error"
150
+ reportGeneralTypeIssues = "error"
151
+ reportUninitializedInstanceVariable = "error"
140
152
 
141
153
  # --- Intentional patterns we suppress ---
142
154
  # Third-party imports cannot be resolved in pre-commit.ci sandbox
143
155
  reportMissingImports = false
156
+ # Same cause, different symptom: a typed stub can resolve in the sandbox
157
+ # without the package source. An artefact of where the check runs, not
158
+ # of the code.
159
+ reportMissingModuleSource = false
144
160
  # Typer uses Option() calls in parameter defaults by design
145
161
  reportCallInDefaultInitializer = false
146
162
  # Typer parameters are consumed by the framework, not the function body
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.1.8'
22
- __version_tuple__ = version_tuple = (0, 1, 8)
21
+ __version__ = version = '0.1.9'
22
+ __version_tuple__ = version_tuple = (0, 1, 9)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -146,6 +146,7 @@ app = typer.Typer(
146
146
 
147
147
  # aislop-ignore-next-line complexity/function-too-long -- top-level CLI command
148
148
  def main(
149
+ *,
149
150
  target: str = typer.Argument(
150
151
  None,
151
152
  help="GitHub organization name/URL or PR URL (e.g., 'myorg', 'https://github.com/myorg', or 'https://github.com/owner/repo/pull/123')",
@@ -695,8 +696,8 @@ async def process_single_pr(
695
696
  owner,
696
697
  repo_name,
697
698
  pr_number,
698
- result,
699
- command_args,
699
+ result=result,
700
+ command_args=command_args,
700
701
  )
701
702
 
702
703
  return
@@ -945,8 +946,8 @@ async def _process_pr_files(
945
946
  owner,
946
947
  repo_name,
947
948
  pr_number,
948
- result,
949
- command_args,
949
+ result=result,
950
+ command_args=command_args,
950
951
  )
951
952
 
952
953
  return result_dict
@@ -1278,6 +1279,7 @@ async def scan_and_fix_organization(
1278
1279
  # aislop-ignore-next-line complexity/function-too-long -- single-PR processing flow
1279
1280
  async def process_pr(
1280
1281
  client: GitHubClient,
1282
+ *,
1281
1283
  owner: str,
1282
1284
  repo_name: str,
1283
1285
  pr_data: dict[str, Any],
@@ -1737,6 +1739,7 @@ async def create_file_fix_comment(
1737
1739
  owner: str,
1738
1740
  repo: str,
1739
1741
  pr_number: int,
1742
+ *,
1740
1743
  result: GitHubFixResult,
1741
1744
  command_args: dict[str, Any],
1742
1745
  ) -> None:
@@ -74,6 +74,34 @@ def _set_repo_git_config(repo_dir: Path, key: str, value: str) -> bool:
74
74
  return False
75
75
 
76
76
 
77
+ def _apply_bot_identity(
78
+ repo_dir: Path, bot_name: str, bot_email: str, mode: str
79
+ ) -> dict[str, str]:
80
+ """Configure the bot identity with commit signing disabled.
81
+
82
+ Signing is switched off explicitly so a global ``commit.gpgsign=true``
83
+ cannot make the bot attempt to sign with a key it does not have.
84
+
85
+ Args:
86
+ repo_dir: Repository directory path
87
+ bot_name: Bot name to commit as
88
+ bot_email: Bot email to commit as
89
+ mode: Mode label recorded in the returned configuration
90
+
91
+ Returns:
92
+ Dict with applied configuration details
93
+ """
94
+ _set_repo_git_config(repo_dir, "user.name", bot_name)
95
+ _set_repo_git_config(repo_dir, "user.email", bot_email)
96
+ _set_repo_git_config(repo_dir, "commit.gpgsign", "false")
97
+ return {
98
+ "user.name": bot_name,
99
+ "user.email": bot_email,
100
+ "commit.gpgsign": "false",
101
+ "mode": mode,
102
+ }
103
+
104
+
77
105
  def configure_git_identity(
78
106
  repo_dir: Path,
79
107
  mode: str = GitConfigMode.USER_INHERIT,
@@ -99,17 +127,11 @@ def configure_git_identity(
99
127
  msg = f"Invalid mode: {mode}"
100
128
  raise ValueError(msg)
101
129
 
102
- applied_config: dict[str, str] = {}
103
-
104
130
  if mode == GitConfigMode.BOT_IDENTITY:
105
- # Use bot identity without signing
106
131
  logger.debug("Configuring git with bot identity (no signing)")
107
- _set_repo_git_config(repo_dir, "user.name", bot_name)
108
- _set_repo_git_config(repo_dir, "user.email", bot_email)
109
- applied_config["user.name"] = bot_name
110
- applied_config["user.email"] = bot_email
111
- applied_config["mode"] = "bot_identity"
112
- return applied_config
132
+ return _apply_bot_identity(
133
+ repo_dir, bot_name, bot_email, "bot_identity"
134
+ )
113
135
 
114
136
  # For USER_INHERIT and USER_NO_SIGN modes, try to get user's config
115
137
  user_name = _get_global_git_config("user.name")
@@ -119,12 +141,11 @@ def configure_git_identity(
119
141
  logger.warning(
120
142
  "User git config not found, falling back to bot identity"
121
143
  )
122
- _set_repo_git_config(repo_dir, "user.name", bot_name)
123
- _set_repo_git_config(repo_dir, "user.email", bot_email)
124
- applied_config["user.name"] = bot_name
125
- applied_config["user.email"] = bot_email
126
- applied_config["mode"] = "bot_identity_fallback"
127
- return applied_config
144
+ return _apply_bot_identity(
145
+ repo_dir, bot_name, bot_email, "bot_identity_fallback"
146
+ )
147
+
148
+ applied_config: dict[str, str] = {}
128
149
 
129
150
  # Set user identity
130
151
  _set_repo_git_config(repo_dir, "user.name", user_name)
@@ -550,6 +550,7 @@ class GitHubClient:
550
550
  owner: str,
551
551
  repo: str,
552
552
  path: str,
553
+ *,
553
554
  content: str,
554
555
  message: str,
555
556
  branch: str,
@@ -788,7 +788,12 @@ class PRFileFixer:
788
788
 
789
789
  for file_data in matching_files:
790
790
  result = await self._apply_fix_to_file(
791
- fixer, file_data, owner, repo, branch, spec
791
+ fixer,
792
+ file_data,
793
+ owner=owner,
794
+ repo=repo,
795
+ branch=branch,
796
+ spec=spec,
792
797
  )
793
798
  if result is None:
794
799
  continue
@@ -811,6 +816,7 @@ class PRFileFixer:
811
816
  self,
812
817
  fixer: FileFixer,
813
818
  file_data: dict[str, Any],
819
+ *,
814
820
  owner: str,
815
821
  repo: str,
816
822
  branch: str,
@@ -946,10 +952,10 @@ class PRFileFixer:
946
952
  owner,
947
953
  repo,
948
954
  file_info["path"],
949
- file_info["content"],
950
- commit_message,
951
- branch,
952
- current_sha,
955
+ content=file_info["content"],
956
+ message=commit_message,
957
+ branch=branch,
958
+ sha=current_sha,
953
959
  )
954
960
  self.logger.debug(
955
961
  f"Successfully updated {file_info['path']} (fallback)"