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

Kczernik/papp 34959: added hook to generate readme in pre-commit #79

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

kczernik-splunk
Copy link
Collaborator

@kczernik-splunk kczernik-splunk commented Nov 12, 2024

To make connector development more fluid we can add readme generation as a part of pre-commit, so that there will be less automatically generated commits, which makes git history more messy and hide latest test pipeline results.

PR adds new hook and handling lack of .json file
For now hook is in github-actions/start-release/readme_check.py.

Test on connector without .json file:
Screenshot 2024-11-13 at 16 44 27

Test on connector with .json file:
Screenshot 2024-11-13 at 16 44 04

@@ -9,3 +9,8 @@
language: script
entry: pre-commit/package_app_dependencies
verbose: true
- id: readme_check
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this place over an org-wide hooks? Just wondering where should we have this

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is good, I think this is the same "level" as packaging dependencies

app_json_name = [f for f in os.listdir(app_json_dir)
if f.endswith(".json")
and "postman_collection" not in f][0]
app_json_name = ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant? We either set this or exit below

Choose a reason for hiding this comment

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

If you need to make sure it is set, you can always put the code after try:except into else: block.

@@ -9,3 +9,8 @@
language: script
entry: pre-commit/package_app_dependencies
verbose: true
- id: readme_check
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is good, I think this is the same "level" as packaging dependencies


def validate_dir_path(path):
if not Path(path).is_dir():
raise argparse.ArgumentTypeError(f"Provided value: {path} is not a directory.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise argparse.ArgumentTypeError(f"Provided value: {path} is not a directory.")
raise argparse.ArgumentTypeError(f"{path} is not a directory.")

import argparse
import sys
import logging
from build_docs import main
Copy link
Collaborator

Choose a reason for hiding this comment

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

from build_docs import main as build_docs would be more readable imho

@@ -9,3 +9,8 @@
language: script
entry: pre-commit/package_app_dependencies
verbose: true
- id: readme_check
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps name readme-check would be more consistent

Copy link
Collaborator

@bbielinski-splunk bbielinski-splunk 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, I have nothing more to add than what others have noticed

try:
app_json_name = [f for f in os.listdir(app_json_dir)
if f.endswith(".json")
and "postman_collection" not in f][0]

Choose a reason for hiding this comment

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

I don't know where this is coming from, but... what if I have another json file in the app dir?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a lot of pretty much this logic all over the place, I'd leave this as is but having a better way to tell which json is the json would be kewl

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.

6 participants