Skip to content

Conversation

@abikouo
Copy link
Contributor

@abikouo abikouo commented Feb 23, 2023

This changelog validates that the PR contains a valid changelog file if needed.

@abikouo abikouo changed the title DNM - add cloud detailed changelog Enhance changelog job with more validation steps Mar 6, 2023
Copy link
Contributor

@gravesm gravesm left a comment

Choose a reason for hiding this comment

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

What's the difference between this PR and the existing changelog workflow? Can we work with the network team to try and incorporate these changes into the other workflow?

@abikouo
Copy link
Contributor Author

abikouo commented Mar 13, 2023

What's the difference between this PR and the existing changelog workflow? Can we work with the network team to try and incorporate these changes into the other workflow?

The existing workflow has been updated

@abikouo abikouo requested review from GomathiselviS and gravesm and removed request for GomathiselviS and gravesm March 13, 2023 09:51
Copy link
Contributor

@gravesm gravesm left a comment

Choose a reason for hiding this comment

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

Could you describe how this is different from the current solution? There are likely people already using the existing action and if this changes the behavior we need to know how it is changing.

Copy link
Contributor

@Qalthos Qalthos left a comment

Choose a reason for hiding this comment

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

I think I'm convinced that this does what is needed more precisely than before, though it is a great deal more complicated now. I think we can merge this, but I would love @cidrblock's eyes on it as well.

@cidrblock
Copy link
Member

I think this is fine, although in the case of a failure (sys.exit(1)) I'd like to see a bunch of debug level information printed out about what happened during the run. Doc strings, type hints, black and pylint/flake8 erros resolved. Here's some I found with a quick run:

validate_changelog.py:45:38: C0303: Trailing whitespace (trailing-whitespace)
validate_changelog.py:82:0: C0301: Line too long (111/100) (line-too-long)
validate_changelog.py:86:0: C0301: Line too long (104/100) (line-too-long)
validate_changelog.py:149:0: C0304: Final newline missing (missing-final-newline)
validate_changelog.py:15:47: W1401: Anomalous backslash in string: '\.'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
validate_changelog.py:1:0: C0114: Missing module docstring (missing-module-docstring)
validate_changelog.py:14:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:17:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:40:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:47:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:50:7: R1729: Use a generator instead 'any(is_module_or_plugin(x) for x in changes['A'])' (use-a-generator)
validate_changelog.py:55:7: R1729: Use a generator instead 'all(is_documentation_file(x) for x in all_files)' (use-a-generator)
validate_changelog.py:60:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:82:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:86:24: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:95:14: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:98:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:104:11: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
validate_changelog.py:108:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:109:10: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:110:10: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:111:4: C0103: Variable name "rc" doesn't conform to snake_case naming style (invalid-name)
validate_changelog.py:117:8: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
validate_changelog.py:122:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:1:1: D100 Missing docstring in public module
validate_changelog.py:14:1: D103 Missing docstring in public function
validate_changelog.py:15:48: W605 invalid escape sequence '\.'
validate_changelog.py:17:1: D103 Missing docstring in public function
validate_changelog.py:17:1: E302 expected 2 blank lines, found 1
validate_changelog.py:40:1: D103 Missing docstring in public function
validate_changelog.py:45:39: W291 trailing whitespace
validate_changelog.py:47:1: D103 Missing docstring in public function
validate_changelog.py:47:1: E302 expected 2 blank lines, found 1
validate_changelog.py:60:1: D103 Missing docstring in public function
validate_changelog.py:60:1: E302 expected 2 blank lines, found 1
validate_changelog.py:82:101: E501 line too long (111 > 100 characters)
validate_changelog.py:86:101: E501 line too long (104 > 100 characters)
validate_changelog.py:95:84: E231 missing whitespace after ','
validate_changelog.py:98:1: D103 Missing docstring in public function
validate_changelog.py:98:1: E302 expected 2 blank lines, found 1
validate_changelog.py:108:1: D103 Missing docstring in public function
validate_changelog.py:108:1: E302 expected 2 blank lines, found 1
validate_changelog.py:122:1: D103 Missing docstring in public function
validate_changelog.py:122:1: E302 expected 2 blank lines, found 1
validate_changelog.py:130:80: E502 the backslash is redundant between brackets
validate_changelog.py:135:83: E502 the backslash is redundant between brackets
validate_changelog.py:142:1: E305 expected 2 blank lines after class or function definition, found 1
validate_changelog.py:149:39: W292 no newline at end of file
1     D100 Missing docstring in public module
8     D103 Missing docstring in public function
1     E231 missing whitespace after ','
6     E302 expected 2 blank lines, found 1
1     E305 expected 2 blank lines after class or function definition, found 1
2     E501 line too long (111 > 100 characters)
2     E502 the backslash is redundant between brackets
1     W291 trailing whitespace
1     W292 no newline at end of file
1     W605 invalid escape sequence '\.'
24

@cidrblock
Copy link
Member

minor comment, isort is helpful to get consistency across projects for the import statement, this is the recommandation based on my local config


import argparse
import os
import re
import subprocess
import sys

from collections import defaultdict

import yaml

@Qalthos Qalthos self-requested a review March 22, 2023 14:13
@abikouo
Copy link
Contributor Author

abikouo commented Mar 22, 2023

I think this is fine, although in the case of a failure (sys.exit(1)) I'd like to see a bunch of debug level information printed out about what happened during the run. Doc strings, type hints, black and pylint/flake8 erros resolved. Here's some I found with a quick run:

validate_changelog.py:45:38: C0303: Trailing whitespace (trailing-whitespace)
validate_changelog.py:82:0: C0301: Line too long (111/100) (line-too-long)
validate_changelog.py:86:0: C0301: Line too long (104/100) (line-too-long)
validate_changelog.py:149:0: C0304: Final newline missing (missing-final-newline)
validate_changelog.py:15:47: W1401: Anomalous backslash in string: '\.'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
validate_changelog.py:1:0: C0114: Missing module docstring (missing-module-docstring)
validate_changelog.py:14:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:17:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:40:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:47:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:50:7: R1729: Use a generator instead 'any(is_module_or_plugin(x) for x in changes['A'])' (use-a-generator)
validate_changelog.py:55:7: R1729: Use a generator instead 'all(is_documentation_file(x) for x in all_files)' (use-a-generator)
validate_changelog.py:60:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:82:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:86:24: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:95:14: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:98:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:104:11: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
validate_changelog.py:108:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:109:10: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:110:10: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
validate_changelog.py:111:4: C0103: Variable name "rc" doesn't conform to snake_case naming style (invalid-name)
validate_changelog.py:117:8: C0103: Variable name "v" doesn't conform to snake_case naming style (invalid-name)
validate_changelog.py:122:0: C0116: Missing function or method docstring (missing-function-docstring)
validate_changelog.py:1:1: D100 Missing docstring in public module
validate_changelog.py:14:1: D103 Missing docstring in public function
validate_changelog.py:15:48: W605 invalid escape sequence '\.'
validate_changelog.py:17:1: D103 Missing docstring in public function
validate_changelog.py:17:1: E302 expected 2 blank lines, found 1
validate_changelog.py:40:1: D103 Missing docstring in public function
validate_changelog.py:45:39: W291 trailing whitespace
validate_changelog.py:47:1: D103 Missing docstring in public function
validate_changelog.py:47:1: E302 expected 2 blank lines, found 1
validate_changelog.py:60:1: D103 Missing docstring in public function
validate_changelog.py:60:1: E302 expected 2 blank lines, found 1
validate_changelog.py:82:101: E501 line too long (111 > 100 characters)
validate_changelog.py:86:101: E501 line too long (104 > 100 characters)
validate_changelog.py:95:84: E231 missing whitespace after ','
validate_changelog.py:98:1: D103 Missing docstring in public function
validate_changelog.py:98:1: E302 expected 2 blank lines, found 1
validate_changelog.py:108:1: D103 Missing docstring in public function
validate_changelog.py:108:1: E302 expected 2 blank lines, found 1
validate_changelog.py:122:1: D103 Missing docstring in public function
validate_changelog.py:122:1: E302 expected 2 blank lines, found 1
validate_changelog.py:130:80: E502 the backslash is redundant between brackets
validate_changelog.py:135:83: E502 the backslash is redundant between brackets
validate_changelog.py:142:1: E305 expected 2 blank lines after class or function definition, found 1
validate_changelog.py:149:39: W292 no newline at end of file
1     D100 Missing docstring in public module
8     D103 Missing docstring in public function
1     E231 missing whitespace after ','
6     E302 expected 2 blank lines, found 1
1     E305 expected 2 blank lines after class or function definition, found 1
2     E501 line too long (111 > 100 characters)
2     E502 the backslash is redundant between brackets
1     W291 trailing whitespace
1     W292 no newline at end of file
1     W605 invalid escape sequence '\.'
24

if all these check are performed we need to introduce them as a workflow for this repository

@Qalthos
Copy link
Contributor

Qalthos commented Mar 22, 2023

if all these check are performed we need to introduce them as a workflow for this repository

Yes, absolutely. This is the first Python file in the repo, so we should definitely be using this opportunity to set some checks.

@abikouo
Copy link
Contributor Author

abikouo commented Mar 22, 2023

@Qalthos please try to suggest a commit and do not push the commit directly to the PR, otherwise, it is a pain to rebase it locally if there is a local modification

@abikouo
Copy link
Contributor Author

abikouo commented Mar 22, 2023

@Qalthos why using another ci system for this repository instead of GitHub actions?

@abikouo abikouo requested a review from Qalthos March 22, 2023 16:36
@Qalthos
Copy link
Contributor

Qalthos commented Mar 22, 2023

@Qalthos why using another ci system for this repository instead of GitHub actions?

Only because it was already set up, just not enforcing or checking Python files. It's not necessarily a complete or permanent solution, and the fact that it fails to autofix issues in workflows is an unexpected pain, so may require a revisit.

Copy link
Contributor

@Qalthos Qalthos left a comment

Choose a reason for hiding this comment

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

This adds mypy, flake8, and pylint checking, which should match @cidrblock's previous comment. Errors don't look too arduous to implement, but let me know if there you have any concerns.

abikouo and others added 2 commits March 22, 2023 18:41
Co-authored-by: Kate Case <[email protected]>
@abikouo abikouo requested a review from Qalthos March 22, 2023 17:41
@abikouo
Copy link
Contributor Author

abikouo commented Mar 23, 2023

@Qalthos pull request is ready for merge
Once merged, I can proceed with other pull request, Thx

Copy link
Contributor

@Qalthos Qalthos left a comment

Choose a reason for hiding this comment

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

Looks good otherwise.

@abikouo abikouo requested a review from Qalthos March 24, 2023 13:13
@Qalthos Qalthos merged commit 15d5f1b into ansible-network:main Mar 24, 2023
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.

5 participants