diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4ff3538..c2a5378 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 }} diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index c643c4b..8109d16 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -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: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c75974d..5faa4f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 }} diff --git a/.gitignore b/.gitignore index 70c558c..163ea08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Gemfile.lock pkg coverage +.DS_Store \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 9097c2a..1e2b453 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,3 @@ -require: - - rubocop-rake - - rubocop-rspec - AllCops: TargetRubyVersion: 2.7 NewCops: enable @@ -20,4 +16,8 @@ Style/HashTransformValues: Metrics: Enabled: false +plugins: + - rubocop-rake + - rubocop-rspec + inherit_from: .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4a615c0..041c32f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 @@ -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 @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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' @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a2d4ebd..cfdc84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 8a1d963..6da5274 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. diff --git a/lib/ruby-link-checker/result.rb b/lib/ruby-link-checker/result.rb index 9c9525f..d6d808b 100644 --- a/lib/ruby-link-checker/result.rb +++ b/lib/ruby-link-checker/result.rb @@ -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 diff --git a/lib/ruby-link-checker/version.rb b/lib/ruby-link-checker/version.rb index b7fc8a3..859f396 100644 --- a/lib/ruby-link-checker/version.rb +++ b/lib/ruby-link-checker/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module LinkChecker - VERSION = '0.2.1' + VERSION = '0.3.0' end diff --git a/spec/ruby-link-checker/net/http/checker_spec.rb b/spec/ruby-link-checker/net/http/checker_spec.rb index 1e6f3a5..04f44b6 100644 --- a/spec/ruby-link-checker/net/http/checker_spec.rb +++ b/spec/ruby-link-checker/net/http/checker_spec.rb @@ -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 diff --git a/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb b/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb index d758c75..4c72449 100644 --- a/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb +++ b/spec/ruby-link-checker/typhoeus/hydra/checker_spec.rb @@ -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