From d4dc69c95fd275ab495a10eeffdf338184690b9a Mon Sep 17 00:00:00 2001 From: aegilops <41705651+aegilops@users.noreply.github.com> Date: Tue, 18 Nov 2025 17:34:17 +0000 Subject: [PATCH 1/2] Fixed list secrets script and test to avoid quality warnings --- list_secret_scanning_alerts.py | 2 +- test_tls_cert_support.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 test_tls_cert_support.py diff --git a/list_secret_scanning_alerts.py b/list_secret_scanning_alerts.py index d6eadf1..ec1c815 100755 --- a/list_secret_scanning_alerts.py +++ b/list_secret_scanning_alerts.py @@ -65,7 +65,7 @@ def make_result( if alert.get("commit") is not None: commit_info = alert["commit"] result["first_commit_date"] = commit_info["committer"]["date"] - result["first_commit_author"] = f"{commit_info["author"]["name"]} <{commit_info["author"]["email"]}>" + result["first_commit_author"] = f"{commit_info['author']['name']} <{commit_info['author']['email']}>" if include_locations: # use decorated alert info, if it's there diff --git a/test_tls_cert_support.py b/test_tls_cert_support.py old mode 100644 new mode 100755 index 835c589..80fabcb --- a/test_tls_cert_support.py +++ b/test_tls_cert_support.py @@ -15,6 +15,7 @@ def test_github_verify_default(): from githubapi import GitHub gh = GitHub() + gh = gh # to avoid unused variable warning # Verify that session.verify is set to True by default assert mock_session.verify == True @@ -30,6 +31,7 @@ def test_github_verify_false(): from githubapi import GitHub gh = GitHub(verify=False) + gh = gh # to avoid unused variable warning # Verify that session.verify is set to False assert mock_session.verify == False @@ -46,6 +48,7 @@ def test_github_verify_cert_bundle(): cert_path = "/path/to/cert.pem" gh = GitHub(verify=cert_path) + gh = gh # to avoid unused variable warning # Verify that session.verify is set to the certificate path assert mock_session.verify == cert_path @@ -57,6 +60,7 @@ def test_github_token_required(): with pytest.raises(ValueError, match="GITHUB_TOKEN environment variable must be set"): from githubapi import GitHub gh = GitHub() + gh = gh # to avoid unused variable warning def test_github_hostname_validation(): @@ -65,7 +69,7 @@ def test_github_hostname_validation(): with pytest.raises(ValueError, match="Invalid server hostname"): from githubapi import GitHub gh = GitHub(hostname="invalid hostname with spaces") - + gh = gh # to avoid unused variable warning if __name__ == "__main__": pytest.main([__file__, "-v"]) From 8e0c4d681214b6c52c2602e5ef214486815c100c Mon Sep 17 00:00:00 2001 From: aegilops <41705651+aegilops@users.noreply.github.com> Date: Tue, 18 Nov 2025 17:38:31 +0000 Subject: [PATCH 2/2] Adjusted fix for test warnings --- test_tls_cert_support.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test_tls_cert_support.py b/test_tls_cert_support.py index 80fabcb..0966ff9 100755 --- a/test_tls_cert_support.py +++ b/test_tls_cert_support.py @@ -14,8 +14,7 @@ def test_github_verify_default(): from githubapi import GitHub - gh = GitHub() - gh = gh # to avoid unused variable warning + _gh = GitHub() # Verify that session.verify is set to True by default assert mock_session.verify == True @@ -30,8 +29,7 @@ def test_github_verify_false(): from githubapi import GitHub - gh = GitHub(verify=False) - gh = gh # to avoid unused variable warning + _gh = GitHub(verify=False) # Verify that session.verify is set to False assert mock_session.verify == False @@ -47,8 +45,7 @@ def test_github_verify_cert_bundle(): from githubapi import GitHub cert_path = "/path/to/cert.pem" - gh = GitHub(verify=cert_path) - gh = gh # to avoid unused variable warning + _gh = GitHub(verify=cert_path) # Verify that session.verify is set to the certificate path assert mock_session.verify == cert_path @@ -59,8 +56,7 @@ def test_github_token_required(): with patch.dict(os.environ, {}, clear=True): with pytest.raises(ValueError, match="GITHUB_TOKEN environment variable must be set"): from githubapi import GitHub - gh = GitHub() - gh = gh # to avoid unused variable warning + _gh = GitHub() def test_github_hostname_validation(): @@ -68,8 +64,7 @@ def test_github_hostname_validation(): with patch.dict(os.environ, {"GITHUB_TOKEN": "test_token"}): with pytest.raises(ValueError, match="Invalid server hostname"): from githubapi import GitHub - gh = GitHub(hostname="invalid hostname with spaces") - gh = gh # to avoid unused variable warning + _gh = GitHub(hostname="invalid hostname with spaces") if __name__ == "__main__": pytest.main([__file__, "-v"])