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 a linter to validate external links #215

Merged
merged 4 commits into from
Nov 22, 2023

Conversation

dshevtsov
Copy link
Contributor

Purpose of this pull request

This pull request (PR):

  • Adds a plugin remark-lint-no-dead-urls to ensure that external URLs in Markdown pages are working. The linter returns warnings on https://www.php.net/ on working links in some reason (I assume server related issues) so I excluded this domain in the configuration.
  • Replaces or removes dead links

Internal ticket: COMDOX-156

Test

Failed validate job reporting about dead links.

@dshevtsov dshevtsov added the enhancement New feature or request label Nov 21, 2023
@dshevtsov dshevtsov self-assigned this Nov 21, 2023
@dshevtsov
Copy link
Contributor Author

@jeff-matthews please see a report and fix the links.

@jeff-matthews
Copy link
Contributor

Will do @dshevtsov. I'll push directly to this branch unless you say otherwise.

Also, just an FYI that when I run yarn test locally with the new config, I get a bunch of offline warnings:

...
src/pages/tutorials/index.md
              1:1  warning  You are not online and have not set skipOffline: true.                                                                                                                 no-dead-urls  remark-lint

⚠ 512 warnings

I don't know why, but maybe adding the skipOffline option would help. It would be nice to be able to run locally without the noise.

@jeff-matthews
Copy link
Contributor

jeff-matthews commented Nov 22, 2023

Commit d8da865 reduced the warning count from 58 to 19.

The output also matches my local test run after adding the skipOffline: "true" option.

All but two of the remaining 19 are located in MRG files, which I'm reluctant to fix since the source comes from READMEs in code base repos. Fixing them here will only be temporary. The test will start failing again when we regenerate the MRG files from source unless we fix the links in the source READMEs.

@dshevtsov, how do you want to proceed for MRG files?

@dshevtsov
Copy link
Contributor Author

I cannot reproduce the issue with You are not online and have not set skipOffline: true.
I tried both with and without VPN.

As a project owner you are good to go for any changes in the config that work for you.

Any changes to MRG have to be ported to the codebase.

@dshevtsov
Copy link
Contributor Author

dshevtsov commented Nov 22, 2023

I noticed that running the test with and without VPN returns different results. It appears that when I run the test without VPN, my Internet provider blocks the excessive outgoing connections.

@jeff-matthews
Copy link
Contributor

I re-ran the this job because the symfony site was just running slow and the links finally resolved. Test results confirm.

Only 17 warnings left to resolve (MRG topics).

@jeff-matthews
Copy link
Contributor

jeff-matthews commented Nov 22, 2023

Local testing is inconsistent with the latest validation run.

Local testing produces no warnings, but latest validation run produces two warnings. I suspect it has something to do with caching as mentioned in the plugin README:

[check-links](https://github.com/transitive-bullshit/check-links) memoizes results, so on any given run each URL will only be pinged once; subsequent checks will be returned from the cache.

I'm not sure where the cache lives though. Maybe somewhere in the node_modules directory.

Anyway, I'll fix the two remaining warnings and hopefully the validation run will pass.

@dshevtsov dshevtsov marked this pull request as ready for review November 22, 2023 17:28
@dshevtsov dshevtsov merged commit 794bfe4 into AdobeDocs:main Nov 22, 2023
2 checks passed
@dshevtsov dshevtsov deleted the ds_url-linter branch November 22, 2023 17:28
@jeff-matthews jeff-matthews added the internal Differentiates work between external and internal contributors label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal Differentiates work between external and internal contributors
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants