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

feat(docs-linter): add lint for local links #2416

Merged
merged 34 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d578061
add checks for local files
leohhhn Jun 21, 2024
ded07f3
fix links
leohhhn Jun 21, 2024
7122f98
link
leohhhn Jun 21, 2024
937241a
links
leohhhn Jun 21, 2024
16d9d2e
fix comments
leohhhn Jun 21, 2024
d77c3b6
add comments
leohhhn Jun 21, 2024
ec370ac
fix comments
leohhhn Jun 21, 2024
9607c40
Apply suggestions from code review
leohhhn Jun 24, 2024
986d989
Merge branch 'master' into docs/linter-files
leohhhn Jun 24, 2024
25f9634
rename file
leohhhn Jun 24, 2024
3a44230
rename job
leohhhn Jun 24, 2024
66758ef
inline ifs
leohhhn Jun 24, 2024
2061e51
add better embedmd link check
leohhhn Jun 24, 2024
b1382e0
rename and remove redeclaration
leohhhn Jun 24, 2024
c89ef2d
rename maps
leohhhn Jun 24, 2024
b722ecf
org imports
leohhhn Jun 24, 2024
21c700d
redeclare
leohhhn Jun 24, 2024
767d375
lastindex
leohhhn Jun 24, 2024
1ae1b0b
add testcase
leohhhn Jun 24, 2024
8322650
Merge branch 'master' into docs/linter-files
leohhhn Jun 24, 2024
346667f
lastindex case
leohhhn Jun 24, 2024
de8cc5b
add case check for embedmd
leohhhn Jun 24, 2024
ec10dcc
add flow test
leohhhn Jun 25, 2024
d5190a0
rm typo
leohhhn Jun 25, 2024
0f84478
Merge branch 'master' into docs/linter-files
leohhhn Jun 26, 2024
d2ed755
update
leohhhn Jun 26, 2024
172bdba
update help
leohhhn Jun 26, 2024
4ddfd52
save
leohhhn Jun 26, 2024
99249d3
update tests
leohhhn Jun 26, 2024
a971146
add testcase
leohhhn Jun 26, 2024
64d6e5f
org imports
leohhhn Jun 26, 2024
91fb6ca
add lock for writing
leohhhn Jun 28, 2024
77b1e15
Merge branch 'refs/heads/master' into docs/linter-files
leohhhn Jun 28, 2024
04081ac
Merge branch 'refs/heads/master' into docs/linter-files
leohhhn Jun 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions misc/docs-linter/jsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ func extractJSX(fileContent []byte) []string {
return filteredMatches
}

func lintJSX(fileJSXMap map[string][]string) error {
func lintJSX(filepathToJSX map[string][]string) error {
found := false
for filePath, tags := range fileJSXMap {
filePath := filePath
for filePath, tags := range filepathToJSX {
for _, tag := range tags {
if !found {
fmt.Println("Tags that need checking:")
Expand Down
5 changes: 2 additions & 3 deletions misc/docs-linter/links.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ func extractLocalLinks(fileContent []byte) []string {
return links
}

func lintLocalLinks(fileLocalLinkMap map[string][]string, docsPath string) error {
func lintLocalLinks(filepathToLinks map[string][]string, docsPath string) error {
var found bool
for filePath, links := range fileLocalLinkMap {
filePath := filePath
for filePath, links := range filepathToLinks {
for _, link := range links {
path := filepath.Join(docsPath, filepath.Dir(filePath), link)

Expand Down
6 changes: 2 additions & 4 deletions misc/docs-linter/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ func extractUrls(fileContent []byte) []string {
return urls
}

func lintURLs(fileUrlMap map[string][]string, ctx context.Context) error {
// Filter links by prefix & ignore localhost
func lintURLs(filepathToURLs map[string][]string, ctx context.Context) error {
// Setup parallel checking for links
g, _ := errgroup.WithContext(ctx)

Expand All @@ -53,8 +52,7 @@ func lintURLs(fileUrlMap map[string][]string, ctx context.Context) error {
notFoundUrls []string
)

for filePath, urls := range fileUrlMap {
filePath := filePath
deelawn marked this conversation as resolved.
Show resolved Hide resolved
for filePath, urls := range filepathToURLs {
for _, url := range urls {
url := url
g.Go(func() error {
Expand Down
Loading