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 flag to ignore some results #4

Open
DawidOskwarek opened this issue Jun 23, 2022 · 7 comments
Open

Add a flag to ignore some results #4

DawidOskwarek opened this issue Jun 23, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@DawidOskwarek
Copy link

Example:
I scan the website
One of the offsite links returns 404
Add a flag to ignore this specific offsite link so it doesn't show in the results

Would this be possible?

@sidvishnoi
Copy link
Owner

sidvishnoi commented Jun 23, 2022

Not as of now, but it's something I want to support. Both ignoring errors/warnings and ability to not test specific link/patterns. Will need some time and energy for that. PRs welcome.

BTW, you can ignore the result by using the node library (instead of CLI).

(This project is unmaintained as of now)

@sidvishnoi sidvishnoi added the enhancement New feature or request label Jun 23, 2022
@DawidOskwarek
Copy link
Author

Thanks for the response, do you have an example of how link can be ignored using the node library? Thanks again!

@sidvishnoi
Copy link
Owner

From the README, something like following:

const { checkLinks } = require("href-checker");

for await (const result of checkLinks(url, options)) {
	console.log(result.type);
	// -> "samePage", "sameSite", "offSite"

	console.log(result.input);
	// -> {
	//     "link": string,           // URL of page being visited.
	//     "count": number,          // Number of occurences of URL.
	// }

	console.log(result.output);
	// -> {
	//     "pageExists": boolean,   // Page resolved with HTTP 20* code.
	//     "status": number,        // HTTP status code.
	//     "fragExists": boolean,   // Element corresponding to fragment exists.
	//     "error": Error,          // Error, if any.
	// }

        if (!result.output.pageExists) {
                if (result.output.link === SOME_LINK) {
                        // do nothing
                } else {
                        // log warning/error
                }
        }
}

You can also check how the CLI does it: https://github.com/sidvishnoi/href-checker/blob/main/cli.ts

@DawidOskwarek
Copy link
Author

Thank you, will play around with it

@sidvishnoi
Copy link
Owner

Keeping it open for future.

@sidvishnoi sidvishnoi reopened this Jun 23, 2022
@DawidOskwarek
Copy link
Author

@sidvishnoi

I was playing around with the tool and found few issues which make it not reliable. Not sure if this tool will be supported in the future but I'm just leaving the two main issues here if anyone wants to ever look into it.

  1. Sometimes the tool doesn't scan the website at all, it will run the command and return nothing. The scan did not occur and there is no error code. Basically it returns as success without a scan. It will usually happen twice for every 10 tries/scans for me
  2. When you set concurrency option to 1 then it will not scan all the pages on the website, but if you set it to 2 or higher then it will scan everything

Great tool overall, I think it would be useful for a lot of people but at the moment I believe it needs few fixes. Thanks for your help

@sidvishnoi
Copy link
Owner

  1. Sometimes the tool doesn't scan the website at all, it will run the command and return nothing. The scan did not occur and there is no error code. Basically it returns as success without a scan. It will usually happen twice for every 10 tries/scans for me

Can you share the URL? Or does it happen with almost every URL?

Can you file separate issues for above? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants