Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments for gh issues #800

Merged
merged 2 commits into from
May 22, 2024
Merged

Add comments for gh issues #800

merged 2 commits into from
May 22, 2024

Conversation

maccelf
Copy link
Member

@maccelf maccelf commented Apr 15, 2024

@maccelf maccelf force-pushed the add_comments_for_gh_issues branch 2 times, most recently from 6f10590 to 0840f68 Compare April 18, 2024 07:38
@AlmaLinux AlmaLinux deleted a comment from github-actions bot Apr 23, 2024
@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from 0840f68 to 8dce9bf Compare April 23, 2024 15:03
@@ -510,7 +510,8 @@ async def get_matching_albs_packages(
errata_package: models.NewErrataPackage,
prod_repos_cache,
module,
) -> List[models.ErrataToALBSPackage]:
) -> Tuple[List[models.ErrataToALBSPackage], dict]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ErrataToALBSPackage/NewErrataToALBSPackage/


comments = set()
build_ids = set()
for pack in find_packages_types:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use either pkg or package instead of pack

@@ -540,17 +541,24 @@ async def get_matching_albs_packages(
errata_package.source_srpm = src_nevra.name
items_to_insert.append(mapping)
errata_package.albs_packages.append(mapping)
return items_to_insert
package_type["type"] = "prod"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical, just a personal taste, I'd prefer to use an enum here rather than checking on either prod or build strings later on.

@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from 8dce9bf to a6d8fa2 Compare May 13, 2024 11:56
Copy link
Contributor

@anfimovdm anfimovdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but please fix that comment

@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from a6d8fa2 to 5e0fc93 Compare May 15, 2024 08:02
requirements.txt Outdated
@@ -32,4 +32,4 @@ uvicorn==0.29.0
websockets==12.0
git+https://github.com/AlmaLinux/immudb-wrapper.git@0.1.2#egg=immudb_wrapper
git+https://github.com/AlmaLinux/errata2osv.git@0.0.3#egg=errata2osv
git+https://github.com/AlmaLinux/albs-github-integration.git@0.3.0#egg=albs_github
git+https://github.com/AlmaLinux/albs-github-integration.git@0.4.0#egg=albs_github
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ship AlmaLinux/albs-github-integration#5 and see if that makes CI happier

@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from 5e0fc93 to 6426aab Compare May 22, 2024 09:08
Copy link

github-actions bot commented May 22, 2024

71 passed, 11 skipped

Code Coverage Summary

Package Line Rate
alws 76%
alws.auth 77%
alws.auth.oauth 100%
alws.crud 39%
alws.dramatiq 60%
alws.middlewares 93%
alws.perms 86%
alws.routers 56%
alws.schemas 80%
alws.utils 41%
Summary 56% (5610 / 10010)

Linter reports

Pylint report
************* Module alws.config
alws/config.py:7:0: C0115: Missing class docstring (missing-class-docstring)
************* Module alws.constants
alws/constants.py:223:0: C0301: Line too long (95/88) (line-too-long)
alws/constants.py:122:4: C0103: Class constant name "proposal" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:123:4: C0103: Class constant name "skipped" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:124:4: C0103: Class constant name "released" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:125:4: C0103: Class constant name "approved" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:129:4: C0103: Class constant name "cve" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:130:4: C0103: Class constant name "rhsa" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:131:4: C0103: Class constant name "self_ref" doesn't conform to UPPER_CASE naming style (invalid-name)
alws/constants.py:132:4: C0103: Class constant name "bugzilla" doesn't conform to UPPER_CASE naming style (invalid-name)
************* Module alws.crud.build_node
alws/crud/build_node.py:1:0: C0302: Too many lines in module (1142/1000) (too-many-lines)
alws/crud/build_node.py:49:9: W0511: TODO: here should be config value (fixme)
alws/crud/build_node.py:527:1: W0511: TODO: Improve readability (fixme)
alws/crud/build_node.py:681:9: W0511: TODO: Beholder doesn't have authorization right now (fixme)
alws/crud/build_node.py:1128:5: W0511: TODO: ALBS-705: Temporary solution that fixes integrity error with missing srpm, (fixme)
alws/crud/build_node.py:93:4: W0613: Unused argument 'db' (unused-argument)
alws/crud/build_node.py:121:4: C0206: Consider iterating with .items() (consider-using-dict-items)
alws/crud/build_node.py:130:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/build_node.py:130:0: R0914: Too many local variables (16/15) (too-many-locals)
alws/crud/build_node.py:321:0: R0914: Too many local variables (43/15) (too-many-locals)
alws/crud/build_node.py:369:12: W0707: Consider explicitly re-raising using 'raise ArtifactConversionError(f'Cannot put RPM packages into Pulp storage: {e}') from e' (raise-missing-from)
alws/crud/build_node.py:381:12: W0707: Consider explicitly re-raising using 'except Exception as exc' and 'raise RepositoryAddError(f'Cannot add RPM packages to the repository {str(repo)}') from exc' (raise-missing-from)
alws/crud/build_node.py:459:15: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/build_node.py:479:12: W0715: Exception arguments suggest string formatting might be intended (raising-format-tuple)
alws/crud/build_node.py:321:0: R0912: Too many branches (26/12) (too-many-branches)
alws/crud/build_node.py:321:0: R0915: Too many statements (76/50) (too-many-statements)
alws/crud/build_node.py:499:8: W0707: Consider explicitly re-raising using 'raise ArtifactConversionError(f'Cannot create log files for {str(repository)}, error: {str(e)}') from e' (raise-missing-from)
alws/crud/build_node.py:521:8: W0707: Consider explicitly re-raising using 'raise RepositoryAddError('Cannot save build log into Pulp repository: %s', str(e)) from e' (raise-missing-from)
alws/crud/build_node.py:521:8: W0715: Exception arguments suggest string formatting might be intended (raising-format-tuple)
alws/crud/build_node.py:530:0: R0914: Too many local variables (39/15) (too-many-locals)
alws/crud/build_node.py:714:17: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
alws/crud/build_node.py:715:17: W1309: Using an f-string that does not have any interpolated variables (f-string-without-interpolation)
alws/crud/build_node.py:778:24: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
alws/crud/build_node.py:530:0: R0912: Too many branches (15/12) (too-many-branches)
alws/crud/build_node.py:530:0: R0915: Too many statements (102/50) (too-many-statements)
alws/crud/build_node.py:892:19: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
alws/crud/build_node.py:968:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/build_node.py:984:11: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/build_node.py:1037:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/build_node.py:1037:0: R0914: Too many local variables (16/15) (too-many-locals)
alws/crud/build_node.py:16:0: W0611: Unused GitHubIssueStatus imported from alws.constants (unused-import)
************* Module alws.crud.errata
alws/crud/errata.py:1:0: C0302: Too many lines in module (1661/1000) (too-many-lines)
alws/crud/errata.py:70:5: W0511: FIXME: ovallib dependency should stay optional (fixme)
alws/crud/errata.py:215:29: W0511: TODO: Add test mapping here (fixme)
alws/crud/errata.py:1280:1: W0511: TODO: Check db_record (fixme)
alws/crud/errata.py:623:29: W1401: Anomalous backslash in string: '\d'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:31: W1401: Anomalous backslash in string: '\w'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:33: W1401: Anomalous backslash in string: '\-'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:35: W1401: Anomalous backslash in string: '\_'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:41: W1401: Anomalous backslash in string: '\d'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:43: W1401: Anomalous backslash in string: '\.'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:623:45: W1401: Anomalous backslash in string: '\w'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
alws/crud/errata.py:96:0: R0903: Too few public methods (1/2) (too-few-public-methods)
alws/crud/errata.py:153:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:153:0: R0914: Too many local variables (34/15) (too-many-locals)
alws/crud/errata.py:169:4: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
alws/crud/errata.py:153:0: R0912: Too many branches (46/12) (too-many-branches)
alws/crud/errata.py:153:0: R0915: Too many statements (118/50) (too-many-statements)
alws/crud/errata.py:400:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:400:0: R0912: Too many branches (13/12) (too-many-branches)
alws/crud/errata.py:483:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:483:0: R0914: Too many local variables (25/15) (too-many-locals)
alws/crud/errata.py:603:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:603:0: R0914: Too many local variables (27/15) (too-many-locals)
alws/crud/errata.py:765:11: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/errata.py:603:0: R0915: Too many statements (51/50) (too-many-statements)
alws/crud/errata.py:799:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:827:23: E1102: func.count is not callable (not-callable)
alws/crud/errata.py:896:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:896:0: R0914: Too many local variables (25/15) (too-many-locals)
alws/crud/errata.py:1021:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1086:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1148:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1148:0: R0914: Too many local variables (19/15) (too-many-locals)
alws/crud/errata.py:1201:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1331:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1361:15: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/errata.py:1389:19: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/errata.py:1397:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1430:0: W1404: Implicit string concatenation found in call (implicit-str-concat)
alws/crud/errata.py:1446:19: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/errata.py:1472:23: W0718: Catching too general exception Exception (broad-exception-caught)
alws/crud/errata.py:1491:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/crud/errata.py:1491:0: R0914: Too many local variables (19/15) (too-many-locals)
alws/crud/errata.py:1531:16: E1205: Too many arguments for logging format string (logging-too-many-args)
alws/crud/errata.py:1534:24: E0602: Undefined variable 'exc' (undefined-variable)
alws/crud/errata.py:1606:34: E1101: Module 'createrepo_c' has no 'SHA256' member (no-member)
alws/crud/errata.py:1491:0: R0912: Too many branches (18/12) (too-many-branches)
************* Module alws.utils.github_integration_helper
alws/utils/github_integration_helper.py:32:8: W0719: Raising too general exception: Exception (broad-exception-raised)
alws/utils/github_integration_helper.py:235:0: C0116: Missing function or method docstring (missing-function-docstring)
alws/utils/github_integration_helper.py:235:0: R0914: Too many local variables (24/15) (too-many-locals)

-----------------------------------
Your code has been rated at 9.29/10


Black report
--- alws/crud/errata.py	2024-05-22 12:09:35.443668+00:00
+++ alws/crud/errata.py	2024-05-22 12:11:40.527925+00:00
@@ -371,13 +371,11 @@
                 if obj["id"] != var["arithmetic"]["object_component"]["object_ref"]:
                     continue
                 if obj["id"] in objects:
                     continue
                 objects.add(obj["id"])
-                oval.append_object(
-                    get_object_cls_by_tag(obj["type"]).from_dict(obj)
-                )
+                oval.append_object(get_object_cls_by_tag(obj["type"]).from_dict(obj))
     # Almalinux8 have multiple GPG keys.
     # https://almalinux.org/blog/2023-12-20-almalinux-8-key-update/
     # So this platfrom requires additional oval processing
     if platform_name.lower() == 'almalinux-8':
         oval = add_multiple_gpg_keys_to_oval(oval)

Isort report
--- /code/alws/crud/errata.py:before	2024-05-22 12:09:35.443668
+++ /code/alws/crud/errata.py:after	2024-05-22 12:11:41.153935
@@ -56,6 +56,7 @@
     create_github_issue,
     get_github_client,
 )
+from alws.utils.oval_add_al8_gpg_keys import add_multiple_gpg_keys_to_oval
 from alws.utils.parsing import clean_release, parse_rpm_nevra
 from alws.utils.pulp_client import PulpClient
 from alws.utils.pulp_utils import (
@@ -64,7 +65,6 @@
     get_rpm_packages_from_repository,
     get_uuid_from_pulp_href,
 )
-from alws.utils.oval_add_al8_gpg_keys import add_multiple_gpg_keys_to_oval
 
 try:
     # FIXME: ovallib dependency should stay optional

Bandit report
Run started:2024-05-22 12:11:42.195479

Test results:
	No issues identified.

Code scanned:
	Total lines of code: 3085
	Total lines skipped (#nosec): 0
	Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
	Total issues (by severity):
		Undefined: 0
		Low: 0
		Medium: 0
		High: 0
	Total issues (by confidence):
		Undefined: 0
		Low: 0
		Medium: 0
		High: 0
Files skipped (0):

View full reports on the Job Summary page.

@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from 6426aab to 046f25b Compare May 22, 2024 10:41
@maccelf maccelf force-pushed the add_comments_for_gh_issues branch from 046f25b to 7a79cd8 Compare May 22, 2024 10:44
@maccelf
Copy link
Member Author

maccelf commented May 22, 2024

Blocked by AlmaLinux/albs-github-integration#6

@maccelf maccelf merged commit c002b54 into master May 22, 2024
2 checks passed
@maccelf maccelf deleted the add_comments_for_gh_issues branch May 22, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create comments in GH Issues Use GitHub App token instead of personal one
5 participants