Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Ruby (2.7)
- name: Install Ruby (3.4)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.4
- uses: amancevice/setup-code-climate@v0
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, edited, synchronize]
jobs:
danger:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ jobs:
fail-fast: false
matrix:
entry:
- { ruby: '2.7', allowed-failure: false }
- { ruby: '3.0', allowed-failure: false }
- { ruby: '3.1', allowed-failure: false }
- { ruby: '3.2', allowed-failure: false }
- { ruby: '2.7' }
- { ruby: '3.0' }
- { ruby: '3.1' }
- { ruby: '3.2' }
- { ruby: '3.3' }
- { ruby: '3.4' }
name: test (${{ matrix.entry.ruby }})
steps:
- uses: actions/checkout@v3
Expand All @@ -20,4 +22,3 @@ jobs:
ruby-version: ${{ matrix.entry.ruby }}
- run: bundle install --jobs=3 --retry=3 --path=vendor/bundle
- run: bundle exec rake spec
continue-on-error: ${{ matrix.entry.allowed-failure }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Gemfile.lock
pkg
coverage
.DS_Store
8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
require:
- rubocop-rake
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Expand All @@ -20,4 +16,8 @@ Style/HashTransformValues:
Metrics:
Enabled: false

plugins:
- rubocop-rake
- rubocop-rspec

inherit_from: .rubocop_todo.yml
78 changes: 58 additions & 20 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-04-03 00:36:28 UTC using RuboCop version 1.48.1.
# on 2025-07-05 14:01:58 UTC using RuboCop version 1.77.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -81,6 +81,7 @@ Lint/NonDeterministicRequireOrder:
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'lib/ruby-link-checker.rb'

# Offense count: 1
Expand All @@ -107,13 +108,13 @@ RSpec/BeNil:
# Offense count: 2
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- '**/spec/spec_helper.rb'
- '**/spec/rails_helper.rb'
- '**/spec/support/**/*.rb'
- 'spec/ruby-link-checker/net/http/checker_spec.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'

# Offense count: 34
# Offense count: 35
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -127,7 +128,7 @@ RSpec/ContextWording:

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle.
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
Expand All @@ -151,18 +152,6 @@ RSpec/ExpectInHook:
- 'spec/ruby-link-checker/net/http/checker_spec.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'

# Offense count: 6
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/ruby-link-checker/callbacks_spec.rb'
- 'spec/ruby-link-checker/checker_spec.rb'
- 'spec/ruby-link-checker/config_spec.rb'
- 'spec/ruby-link-checker/net/http/checker_spec.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'
- 'spec/ruby-link-checker/version_spec.rb'

# Offense count: 6
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Expand All @@ -187,7 +176,7 @@ RSpec/MessageSpies:
RSpec/MultipleExpectations:
Max: 9

# Offense count: 57
# Offense count: 58
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand All @@ -202,6 +191,19 @@ RSpec/NamedSubject:
RSpec/NestedGroups:
Max: 6

# Offense count: 6
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/ruby-link-checker/callbacks_spec.rb'
- 'spec/ruby-link-checker/checker_spec.rb'
- 'spec/ruby-link-checker/config_spec.rb'
- 'spec/ruby-link-checker/net/http/checker_spec.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'
- 'spec/ruby-link-checker/version_spec.rb'

# Offense count: 39
RSpec/SubjectStub:
Exclude:
Expand All @@ -216,6 +218,13 @@ Style/CaseEquality:
Exclude:
- 'spec/support/link_checker.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/ComparableBetween:
Exclude:
- 'lib/ruby-link-checker/net/http/result.rb'
- 'lib/ruby-link-checker/typhoeus/hydra/result.rb'

# Offense count: 20
# Configuration parameters: AllowedConstants.
Style/Documentation:
Expand All @@ -237,12 +246,21 @@ Style/Documentation:
- 'lib/ruby-link-checker/typhoeus/hydra/config.rb'
- 'lib/ruby-link-checker/typhoeus/hydra/result.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: trailing_conditional, ternary
Style/EmptyStringInsideInterpolation:
Exclude:
- 'lib/ruby-link-checker/result.rb'

# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- '**/*.arb'
- 'benchmarks/check.rb'
- 'lib/ruby-link-checker/errors.rb'
- 'lib/ruby-link-checker/net/http.rb'
Expand Down Expand Up @@ -304,9 +322,29 @@ Style/StringLiterals:
Exclude:
- 'lib/ruby-link-checker/checker.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Style/SuperArguments:
Exclude:
- 'lib/ruby-link-checker/net/http/checker.rb'
- 'lib/ruby-link-checker/typhoeus/hydra/checker.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'

# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Style/SuperWithArgsParentheses:
Exclude:
- 'lib/ruby-link-checker/errors/redirect_loop_error.rb'
- 'lib/ruby-link-checker/net/http/checker.rb'
- 'lib/ruby-link-checker/net/http/result.rb'
- 'lib/ruby-link-checker/result.rb'
- 'lib/ruby-link-checker/typhoeus/hydra/checker.rb'
- 'lib/ruby-link-checker/typhoeus/hydra/result.rb'
- 'spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 123
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.2.1 (Next)
### 0.3.0 (Next)

* [#10](https://github.com/dblock/ruby-link-checker/pull/10): Add a space after `:` to help rendering in GHA - [@dblock](https://github.com/dblock).
* Your contribution here.

### 0.2.0 (2023-04-03)
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ A fast Ruby link checker with support for multiple HTTP libraries. Does not pars
- [LinkChecker::Net::HTTP](#linkcheckernethttp)
- [Options](#options)
- [Retries](#retries)
- [Retry After](#retry-after)
- [Results](#results)
- [Methods](#methods)
- [Logger](#logger)
Expand Down Expand Up @@ -170,6 +171,14 @@ By default link checkers do not retry. You can set a number of times to retry al
checker = LinkChecker::Net::HTTP::Checker.new(retry: 1)
```

#### Retry After

If retry is enabled, link checkers can wait for a number of seconds before retrying.

```ruby
checker = LinkChecker::Net::HTTP::Checker.new(retry_after: 1) # wait for 1 second before retrying
```

#### Results

By default checkers collect results.
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-link-checker/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def to_s
else
'ERROR'
end
"#{method} #{uri}#{result_uri == uri ? nil : ' (' + result_uri.to_s + ')'}: #{status_s} (#{code})"
"#{method} #{uri}#{result_uri == uri ? nil : ' (' + result_uri.to_s + ')'} : #{status_s} (#{code})"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-link-checker/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LinkChecker
VERSION = '0.2.1'
VERSION = '0.3.0'
end
2 changes: 1 addition & 1 deletion spec/ruby-link-checker/net/http/checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
it 'times out' do
expect(result.success?).to be false
expect(result.error?).to be true
expect(result.to_s).to eq 'GET https://www.example.org: ERROR (Net::OpenTimeout)'
expect(result.to_s).to eq 'GET https://www.example.org : ERROR (Net::OpenTimeout)'
end

context 'with metadata' do
Expand Down
2 changes: 1 addition & 1 deletion spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def check(url, options = {})
it 'times out' do
expect(result.success?).to be false
expect(result.error?).to be true
expect(result.to_s).to eq 'GET https://www.example.org: ERROR (Timeout::Error)'
expect(result.to_s).to eq 'GET https://www.example.org : ERROR (Timeout::Error)'
end

context 'with metadata' do
Expand Down