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

Fix: internal link misrepresented and misused #539

Merged
merged 9 commits into from Nov 17, 2019
Merged

Fix: internal link misrepresented and misused #539

merged 9 commits into from Nov 17, 2019

Conversation

Graborg
Copy link
Contributor

@Graborg Graborg commented Oct 1, 2019

I found some confusing code and followed it down the rabbit hole. I hope this will make the code more maintainable.

@Graborg Graborg requested a review from Floppy as a code owner October 1, 2019 12:26
@codecov-io
Copy link

codecov-io commented Oct 1, 2019

Codecov Report

Merging #539 into master will increase coverage by <.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #539      +/-   ##
==========================================
+ Coverage   98.61%   98.61%   +<.01%     
==========================================
  Files          30       30              
  Lines        1943     1951       +8     
==========================================
+ Hits         1916     1924       +8     
  Misses         27       27
Impacted Files Coverage Δ
spec/html-proofer/links_spec.rb 99.28% <100%> (+0.01%) ⬆️
lib/html-proofer/check/links.rb 98.79% <100%> (ø) ⬆️
lib/html-proofer/element.rb 97.56% <75%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63663a4...d9b1095. Read the comment docs.

Copy link
Owner

@gjtorikian gjtorikian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, some of this stuff, I don't even know how it was left in for so long... thank you.

@@ -49,7 +49,7 @@ def run
next if @link.respond_to?(:rel) && @link.rel == 'dns-prefetch'
add_to_external_urls(@link.href)
next
elsif !@link.internal? && !@link.exists?
elsif !@link.remote? && !@link.exists?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be best as @link.internal? (no !)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would. I tried it and it created some more errors failing. Looks to be some discrepancy there. I will give another go.

lib/html-proofer/check/links.rb Outdated Show resolved Hide resolved
lib/html-proofer/element.rb Show resolved Hide resolved
lib/html-proofer/element.rb Show resolved Hide resolved
instead of forcing it to be nil
@Graborg
Copy link
Contributor Author

Graborg commented Oct 3, 2019

Tuns out #539 (comment) created quite the domino effect, it deserves another PR, if thats okay with you.

@gjtorikian
Copy link
Owner

Thanks!

@gjtorikian gjtorikian merged commit f759f90 into gjtorikian:master Nov 17, 2019
@@ -77,11 +79,11 @@ def path
end

def hash
parts.fragment unless parts.nil?
parts&.fragment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't safe navigation fail for ruby < 2.3.0? and if so, is a minimum version of ruby specified anywhere? cc: @gjtorikian

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

< 2.3 is EOL (in fact, 2.4 is EOL soon) and I don't support dead rubies.

@Graborg Graborg deleted the fix/internal-link-misrepresented-and-misused branch February 20, 2020 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants