-
-
Couldn't load subscription status.
- Fork 12.7k
Implement comprehensive tagging system for project categorization #5861
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
base: main
Are you sure you want to change the base?
Conversation
- Add optional tags for project categorization ([lib]/[app], [active]/[stalled]/[unmaintained]) - Enhance site generator with tag parsing and validation - Update templates to display color-coded tag badges - Add CSS styling for visual tag distinction - Update documentation with tagging guidelines and examples - Add robust error handling for navigation structure parsing - Maintain full backwards compatibility with existing entries Addresses issue avelino#5823: Add tags to distinguish between libraries/applications and maintenance status
|
Automated Quality Checks (from CONTRIBUTING minimum standards)
These checks are a best-effort automation and do not replace human review. |
WalkthroughAdds optional inline tags for project type and maintenance status to CONTRIBUTING.md and README, extends parsing in main.go to extract tags into a new Link.Tags field, updates templates to render tag badges and title/description ordering, exposes an upper() template helper, and adds CSS for tag badges. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Parser as main.go
participant Template as tmpl/*
participant CSS as awesome-go.css
participant HTML as Output
User->>Parser: build/run site
Parser->>Parser: load README/CONTRIBUTING content
Parser->>Parser: extractCategories() (try details-based selector, else ul-based)
loop per category
Parser->>Parser: extractCategory() → for each link
Parser->>Parser: read link Title and URL
Parser->>Parser: collect inline code elements matching `[tag]`
Parser->>Parser: isValidTag(tag) → append to Link.Tags
Parser->>Parser: remove tag code from Description, trim
Parser-->>Parser: assemble Link{Title,URL,Description,Tags}
end
Parser-->>Template: pass data (Categories with Links including Tags)
Template->>Template: register func "upper"
Template->>HTML: render Title, iterate Tags → output .tag badges, optionally show Description
HTML->>CSS: apply .tag and variant styles
User-->>HTML: view page with tag badges
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
CONTRIBUTING.md(2 hunks)README.md(3 hunks)main.go(6 hunks)tmpl/assets/awesome-go.css(1 hunks)tmpl/category-index.tmpl.html(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.md
📄 CodeRabbit inference engine (AGENTS.md)
Keep documentation in English
Files:
CONTRIBUTING.mdREADME.md
README.md
📄 CodeRabbit inference engine (AGENTS.md)
README.md: When modifying the Awesome list, keep categories with at least three entries
Descriptions in the Awesome list must end with a period
Avoid promotional copy; keep descriptions concise and neutral in the Awesome list
Do not remove existing list content unless removal is requested and justified
Files:
README.md
{README.md,COVERAGE.md}
📄 CodeRabbit inference engine (AGENTS.md)
Align rendered documentation (README.md, COVERAGE.md, etc.) with behavior changes in main.go or helper packages
Files:
README.md
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code
Files:
main.go
{**/*.go,.github/scripts/**/*.js}
📄 CodeRabbit inference engine (AGENTS.md)
Use American English spelling in code comments
Files:
main.go
🪛 markdownlint-cli2 (0.18.1)
README.md
61-61: Spaces inside code span elements
(MD038, no-space-in-code)
61-61: Spaces inside code span elements
(MD038, no-space-in-code)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
- Preserve inline code like `net/http` when removing tag elements - Fix WCAG AA contrast issues in CSS (.tag-lib and .tag-stalled) - Fix markdown formatting in README example - Add regexp import for tag pattern matching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md(3 hunks)main.go(6 hunks)tmpl/assets/awesome-go.css(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
README.md
📄 CodeRabbit inference engine (AGENTS.md)
README.md: When modifying the Awesome list, keep categories with at least three entries
Descriptions in the Awesome list must end with a period
Avoid promotional copy; keep descriptions concise and neutral in the Awesome list
Do not remove existing list content unless removal is requested and justified
Files:
README.md
**/*.md
📄 CodeRabbit inference engine (AGENTS.md)
Keep documentation in English
Files:
README.md
{README.md,COVERAGE.md}
📄 CodeRabbit inference engine (AGENTS.md)
Align rendered documentation (README.md, COVERAGE.md, etc.) with behavior changes in main.go or helper packages
Files:
README.md
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code
Files:
main.go
{**/*.go,.github/scripts/**/*.js}
📄 CodeRabbit inference engine (AGENTS.md)
Use American English spelling in code comments
Files:
main.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
tmpl/assets/awesome-go.css (1)
122-156: Tag palette meets accessibility.Checked each foreground/background pair for
.tag-*; all now clear the 4.5:1 AA threshold at 0.7 em. Nice cleanup.
- Replace broad regex pattern with precise isValidTag() validation - Preserve legitimate inline code like [1], [gin], net/http - Remove unused regexp import - Ensure only approved tags ([lib], [app], [active], [stalled], [unmaintained]) are removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
main.go (1)
291-297: Critical: Strip brackets before validating tags.Line 294 calls
isValidTag(codeText)wherecodeTextstill includes the surrounding brackets (e.g.,[lib]), butisValidTagexpects the tag name without brackets (e.g.,lib). This causes the validation to always fail, so no tag code elements are removed and tags remain visible in descriptions.Apply this diff to strip brackets before validation:
clonedLi.Find("code").Each(func(i int, codeEl *goquery.Selection) { codeText := strings.TrimSpace(codeEl.Text()) - if isValidTag(codeText) { - codeEl.Remove() - } + if len(codeText) > 2 && codeText[0] == '[' && codeText[len(codeText)-1] == ']' { + tag := strings.ToLower(strings.TrimSpace(codeText[1 : len(codeText)-1])) + if isValidTag(tag) { + codeEl.Remove() + } + } })
🧹 Nitpick comments (1)
main.go (1)
114-124: Consider extracting validTags to package level.While functional, recreating the
validTagsmap on every call adds minor overhead. Since the valid tags are constant, consider extracting it to a package-level variable for better performance in loops.Apply this diff to move the map to package level:
+var validTags = map[string]bool{ + "lib": true, + "app": true, + "active": true, + "stalled": true, + "unmaintained": true, +} + // isValidTag checks if a tag is in the allowed list func isValidTag(tag string) bool { - validTags := map[string]bool{ - "lib": true, - "app": true, - "active": true, - "stalled": true, - "unmaintained": true, - } return validTags[tag] }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
main.go(6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code
Files:
main.go
{**/*.go,.github/scripts/**/*.js}
📄 CodeRabbit inference engine (AGENTS.md)
Use American English spelling in code comments
Files:
main.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
main.go (3)
216-226: LGTM! Robust fallback logic.The multi-selector approach with explicit error handling when no navigation structure is found is a solid improvement for gracefully handling different README structures.
275-288: LGTM! Tag extraction logic is correct.The tag extraction correctly strips brackets, validates against the allowed list, and collects valid tags. The length check on line 282 prevents out-of-bounds slicing.
298-303: LGTM! Description extraction logic is sound.The approach of removing the title prefix and leading dash from the cloned (tag-cleaned) text correctly isolates the description.
TrimPrefixsafely handles cases where the prefix is absent.
|
@avelino @dukex This PR: Implements a comprehensive tagging system for awesome-go (#5823) with full backwards compatibility, accessibility compliance, and production-ready code. Request: Could I create a separate issue to fix the quality check script for infrastructure PRs, and then have this PR merged once that's addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but the [active] tag doesn't make sense
if the project is no longer active we should remove it from awesome-go - this is one of the biggest challenges in maintaining the project hehe
for your implementation to be accepted we need to "auto classify" all projects by adding tags, so it won't be just some projects with tags - we can use the Github API to help with this and extract the tags that the project maintainer added
|
@phanirithvij what do you think about the implementation? |
|
Hi @harikrishna-au, the automated checks for this PR failed. Please review the build logs and fix the issues. Specifically, the |
Implement comprehensive tagging system for awesome-go
Addresses issue #5823: Add tags to distinguish between libraries/applications and maintenance status
We want to ensure high quality of the packages. Make sure that you've checked the boxes below before sending a pull request.
Note: This PR implements a feature enhancement to the awesome-go infrastructure rather than adding a new package, so the package-specific requirements below don't apply to this contribution.
The repo documentation has a pkg.go.dev link.(N/A - This enhances awesome-go itself)The repo documentation has a coverage service link.(N/A - This enhances awesome-go itself)The repo documentation has a goreportcard link.(N/A - This enhances awesome-go itself)The repo has a version-numbered release and a go.mod file.(N/A - This enhances awesome-go itself)The repo has a continuous integration process that automatically runs tests that must pass before new pull requests are merged.(N/A - This enhances awesome-go itself)Continuous integration is used to attempt to catch issues prior to releasing this package to end-users.(N/A - This enhances awesome-go itself)Please provide some links to your package to ease the review
This contribution enhances the awesome-go repository infrastructure rather than adding a new package:
pkg.go.dev:(N/A - Infrastructure enhancement)goreportcard.com:(N/A - Infrastructure enhancement)coverage service link:(N/A - Infrastructure enhancement)Pull Request content
This PR implements infrastructure improvements rather than adding packages:
The package has been added to the list in alphabetical order.(N/A - Feature enhancement)The package has an appropriate description with correct grammar.(N/A - Feature enhancement)As far as I know, the package has not been listed here before.(N/A - Feature enhancement)Actual Changes Made:
Category quality
Note that new categories can be added only when there are 3 packages or more.
This contribution doesn't add or modify package listings but enhances the infrastructure:
Summary
This PR addresses issue #5823 by implementing a comprehensive tagging system that allows optional categorization of projects by type ([lib]/[app]) and maintenance status ([active]/[stalled]/[unmaintained]). The implementation includes:
Features
Technical Details
[lib][active]Benefits
Thanks for your PR, you're awesome! 😎
Summary by CodeRabbit
New Features
Style
Documentation