stevenvachon / broken-link-checker

Find broken links, missing images, etc within your HTML.
MIT License
1.97k stars 305 forks source link

Summary at the end #169

Open honzajavorek opened 5 years ago

honzajavorek commented 5 years ago

Is your feature request related to a problem? Please describe. I'm running the link checker in the CI and when the CI job fails, I want to quickly see what's wrong. Currently that means scanning the whole output for -- BROKEN --, because I like to keep --verbose history of which linkes worked before or whether it was skipped for some reason.

Describe the solution you'd like There could be a summary of all broken links at the end of the output.

Describe alternatives you've considered Maybe there is a combination of options which would work for me? Perhaps removing --verbose would solve it all?

Additional context I'm mostly thinking out loud here whether my idea would be the best solution to my problem, whether there are other people wanting this, and if you'd like this feature in the project. If it's reasonably easy to add, I could try to send a PR.

pavelloz commented 4 years ago

This is how i handle summary report (its on jenkins, thats why im saving it a file, jenkins cats it to a slack message later):

end: function() {
    console.log('');
    if (customData.failed.length === 0) {
      const summary = `All links are working correctly at ${siteUrl}`;
      fs.writeFileSync('test-summary.txt', summary); // summary will be forwarded to slack by jenkins
      process.exit(0);
    } else {
      const summary = `Correct: ${customData.succeeded.length} \nBroken: ${customData.failed.length}`;
      fs.writeFileSync('test-summary.txt', summary); // summary will be forwarded to slack by jenkins
      process.exit(1);
    }
  }

And of course in link method, you can echo whatever you want into the CI console (for history/skipping comparisons purposes).

idvorkin commented 4 years ago

This impacts me as well, would love a summary at the end via command line.

josephkerkhof commented 4 years ago

I too would love a summary at the end via CLI.

pavelloz commented 4 years ago

I dont know if you guys noticed, but last code changing commit here was around 4 years ago, so my advice would be to improvise instead of waiting ;-)

stevenvachon commented 4 years ago

I dont know if you guys noticed, but last code changing commit here was around 4 years ago, so my advice would be to improvise instead of waiting ;-)

Check the other branches.

kokarn commented 4 years ago

I would also like to get a summary at the end from the CLI, would be very useful.

PS: Looking forward to 0.8

chadoh commented 4 years ago

Addressed by #148. Also, #137 helps with this use-case.