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 warning rule for Git links #843

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

apinnick
Copy link
Collaborator

Closes #828

Copy link

github-actions bot commented Jul 25, 2024

🎊 Navigate the preview: https://redhat-documentation-vale-at-red-hat-843.surge.sh 🎊

@apinnick apinnick force-pushed the github-links branch 4 times, most recently from 74396a2 to 7f920d5 Compare July 25, 2024 10:48
@apinnick
Copy link
Collaborator Author

@aireilly I think I need your help. I can't seem to get the validation rules to work.

@apinnick apinnick force-pushed the github-links branch 2 times, most recently from 3de622f to 5e36500 Compare July 25, 2024 13:27
@aireilly
Copy link
Member

I think this needs its own rule. What about:

---
extends: existence
message: Do not include a link to '%s' in documentation source unless it is explicitly approved.
link: https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/github-links/
ignorecase: true
level: error
scope: raw
action:
  name: remove
tokens:
    - 'https:\/\/gitlab\.com\/.*'
    - 'https:\/\/github\.com\/.*'

Note Red Hat rules also need their own small reference page: https://redhat-documentation.github.io/vale-at-red-hat/docs/main/reference-guide/reference-guide/

@apinnick
Copy link
Collaborator Author

I think this needs its own rule. What about:

...

I can give it a try.

@apinnick apinnick force-pushed the github-links branch 8 times, most recently from c5adec3 to 1468a56 Compare July 28, 2024 12:01
@apinnick apinnick changed the title Add warning about GitHub links Add rule about Git links Jul 28, 2024
@apinnick
Copy link
Collaborator Author

@aireilly Can you look at this? I'm still not sure about how to fix the validation rules.

@aireilly
Copy link
Member

So your rules are looking for a slug after the URL, there will fire the rule:

https://github.com/project
https://gitlab.com/project

these will not:

https://github.com
https://gitlab.com

@apinnick
Copy link
Collaborator Author

So your rules are looking for a slug after the URL, there will fire the rule:

It worked! Will this rule really work?

@aireilly
Copy link
Member

Are we sure that this directive (No Git links) applies to all projects under the Red Hat umbrella?

@apinnick
Copy link
Collaborator Author

apinnick commented Jul 31, 2024

Are we sure that this directive (No Git links) applies to all projects under the Red Hat umbrella?

It's in the RHSSG: External links.

@apinnick
Copy link
Collaborator Author

Shouldn't I be able to see this new rule in the surge.sh preview?

@aireilly
Copy link
Member

No you need to create a page + update the nav.adoc. See #634 for reference

Copy link
Member

@aireilly aireilly 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 think this is nearly ready. Added a few small comments

.vale/styles/RedHat/GitLinks.yml Outdated Show resolved Hide resolved
.vale/styles/RedHat/GitLinks.yml Outdated Show resolved Hide resolved
@apinnick apinnick changed the title Add rule about Git links Add warning rule for Git links Aug 27, 2024
@apinnick apinnick requested a review from aireilly August 27, 2024 08:54
@aireilly
Copy link
Member

aireilly commented Aug 27, 2024

If you search for https://github.com/ in openshift-docs there are a lot of hits. I wonder if we set scope: sentence will that "tune" for less false positives? openshift-docs are allowed to use https://github.com/openshift/* links.

Maybe add some exceptions?

exceptions:
  - 'https://github.com/openshift/*'

@apinnick apinnick force-pushed the github-links branch 3 times, most recently from 3559d53 to a7316a5 Compare August 29, 2024 08:17
Copy link
Member

@aireilly aireilly left a comment

Choose a reason for hiding this comment

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

/lgtm

@apinnick apinnick merged commit a90d4a0 into redhat-documentation:main Aug 29, 2024
4 checks passed
@apinnick apinnick deleted the github-links branch August 29, 2024 14:15
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.

Add error or warning for GitHub links
2 participants