swagcov 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec6ad3768491bc536da30337d3c83dcd649db257dc593372fd3f02120d47ef92
4
- data.tar.gz: 478e23e0ec6b1b09584ad8f39659db1b58a682b046f1b80440ad009a71783302
3
+ metadata.gz: 6fb23130a50afbecb1dc08dba1385d1bb83ee1ba21dbb6f54f24113e352c5a89
4
+ data.tar.gz: 24eceba7559483cb97515d108cc0126596101bed91160f4dce36e7533a0f4e82
5
5
  SHA512:
6
- metadata.gz: 1d0d49382adb3ff5928190d1254d42df6367ebb7bc844270f1f5d94941a98fa44f35c1d4db903e9cf673b3a2ceed911403014f9dfb5825e08e6d147b60d3160c
7
- data.tar.gz: 12dd92e0f41fa78fa31fff91946794f49b4a780ad17d473aa8c4b025be1596cac306a9fe9f7b671ce05186e7f550b655b9913993f7b0faf731860cbb0747713e
6
+ metadata.gz: c1c560d3bd5042d86796c4c2e3318a2ebffcbc300b212d8d460cc1ee9fb6ebefe6d1f67fb7f1dd2a14c890c98120a767e5191d6f746ba17001607b742ab1762b
7
+ data.tar.gz: a410017649fea69d1d32c9e2d66881b09b35036a4e423d8b32dbf36a836f7b5cf584faed059f05a5d8ac9d62f5fb1d040074a2d206286fd77020381dfae2abe7
data/CHANGELOG.md CHANGED
@@ -2,9 +2,19 @@
2
2
  ## main (unreleased)
3
3
  -
4
4
 
5
+ ## 1.2.0 (2025-12-20)
6
+ ### Fix
7
+ - Improve check for skipping mounted applications for Rails 4.2 applications ([#179](https://github.com/smridge/swagcov/pull/179))
8
+ - Resolve constants for loading rake task ([#181](https://github.com/smridge/swagcov/pull/181))
9
+
10
+ ### Enhancement
11
+ - Update dotfile template generated for install with better suggestions for ignoring certain endpoints ([#184](https://github.com/smridge/swagcov/pull/184))
12
+ - Add support for Ruby 4.0 ([#176](https://github.com/smridge/swagcov/pull/176))
13
+ - Add support for Rails 8.1 ([#167](https://github.com/smridge/swagcov/pull/167))
14
+
5
15
  ## 1.1.1 (2025-08-15)
6
16
  ### Fix
7
- - Better matching for non api and turbo related routes ([#161](https://github.com/smridge/swagcov/pull/161))
17
+ - Improve matching for non api and turbo related routes ([#161](https://github.com/smridge/swagcov/pull/161))
8
18
 
9
19
  ## 1.1.0 (2025-08-08)
10
20
  ### Enhancement
data/README.md CHANGED
@@ -65,17 +65,19 @@ For example `SWAGCOV_DOTFILE=".openapi_coverage_config.yml" bundle exec swagcov`
65
65
 
66
66
  ## Ruby and Rails Version Support
67
67
  Versioning support from a test coverage perspective, see [tests.yml](/.github/workflows/tests.yml) for detail
68
- | `ruby -v` | `rails 4.2` | `rails 5.0` | `rails 5.1` | `rails 5.2` | `rails 6.0` | `rails 6.1` | `rails 7.0` | `rails 7.1` | `rails 7.2` | `rails 8.0` |
69
- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
70
- | `2.5` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | ❌ |
71
- | `2.6` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | ❌ |
72
- | `2.7` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ❌ |
73
- | `3.0` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ❌ |
74
- | `3.1` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
75
- | `3.2` | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
76
- | `3.3` | ❌ | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
77
- | `3.4` | ❌ | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
78
- | `3.5` | ❌ | | | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
68
+ | `ruby -v` | `rails 8.1` | `rails 8.0` | `rails 7.2` | `rails 7.1` | `rails 7.0` | `rails 6.1` | `rails 6.0` | `rails 5.2` | `rails 5.1` | `rails 5.0` | `rails 4.2` |
69
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
70
+ | `4.0` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | ✅ | ❌ |
71
+ | `3.5` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | | | ✅ | ❌ |
72
+ | `3.4` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ✅ | ❌ |
73
+ | `3.3` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ✅ | ❌ |
74
+ | `3.2` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
75
+ | `3.1` | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
76
+ | `3.0` | ❌ | | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
77
+ | `2.7` | ❌ | | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
78
+ | `2.6` | ❌ | | | | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
79
+ | `2.5` | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
80
+
79
81
 
80
82
  ## Installation
81
83
  - Add this line to your application's Gemfile:
@@ -106,9 +108,13 @@ Versioning support from a test coverage perspective, see [tests.yml](/.github/wo
106
108
  # only:
107
109
  # - ^/v2 # only track v2 endpoints
108
110
  # ignore:
111
+ # - /: # root
112
+ # - GET
113
+ # - /up: # health check
114
+ # - GET
109
115
  # - /v2/users # do not track certain endpoints
110
116
  # - /v2/users/:id: # ignore only certain actions (verbs)
111
- # - GET
117
+ # - PUT
112
118
  ```
113
119
 
114
120
  - Execute one of the following commands:
@@ -31,9 +31,13 @@ module Swagcov
31
31
  # only:
32
32
  # - ^/v2 # only track v2 endpoints
33
33
  # ignore:
34
+ # - /: # root
35
+ # - GET
36
+ # - /up: # health check
37
+ # - GET
34
38
  # - /v2/users # do not track certain endpoints
35
39
  # - /v2/users/:id: # ignore only certain actions (verbs)
36
- # - GET
40
+ # - PUT
37
41
  YAML
38
42
  )
39
43
 
@@ -23,7 +23,7 @@ module Swagcov
23
23
  path = route_path(route)
24
24
  verb = route_verb(route)
25
25
 
26
- next if default_skipped_route?(route, path)
26
+ next if default_skipped_route?(route, path, verb)
27
27
 
28
28
  if dotfile.ignore_path?(path, verb: verb)
29
29
  update_data(:ignored, verb, path, "ignored")
@@ -56,25 +56,20 @@ module Swagcov
56
56
  rails_version > "5" ? route.verb : route.verb.inspect.gsub(%r{[$^/]}, "")
57
57
  end
58
58
 
59
- def default_skipped_route? route, path
60
- third_party_route?(route, path) || non_api_route?(route, path)
59
+ def default_skipped_route? route, path, verb
60
+ third_party_route?(route, path, verb) || non_api_route?(route, path)
61
61
  end
62
62
 
63
- def third_party_route? route, path
64
- # https://github.com/rails/rails/blob/48f3c3e201b57a4832314b2c957a3b303e89bfea/actionpack/lib/action_dispatch/routing/inspector.rb#L105-L107
65
- # Skips route paths like ["/rails/info/properties", "/rails/info", "/rails/mailers"]
63
+ def third_party_route? route, path, verb
66
64
  internal_rails_route?(route) ||
67
-
68
- # Skips routes like "/sidekiq"
69
- route.verb.blank? ||
70
-
71
- # Exclude routes that are part of the rails frameworks that you would not write documentation for
72
- path.include?("/active_storage/") ||
73
- path.include?("/action_mailbox/") ||
65
+ mounted_route?(verb) ||
66
+ rails_framework_route?(path) ||
74
67
  turbo_rails_route?(route, path)
75
68
  end
76
69
 
77
70
  def internal_rails_route? route
71
+ # https://github.com/rails/rails/blob/48f3c3e201b57a4832314b2c957a3b303e89bfea/actionpack/lib/action_dispatch/routing/inspector.rb#L105-L107
72
+ # Skips route paths like ["/rails/info/properties", "/rails/info", "/rails/mailers"]
78
73
  if rails_version > "5"
79
74
  route.internal
80
75
  else
@@ -82,6 +77,16 @@ module Swagcov
82
77
  end
83
78
  end
84
79
 
80
+ def mounted_route? verb
81
+ # Skips routes like "/sidekiq"
82
+ verb.blank?
83
+ end
84
+
85
+ def rails_framework_route? path
86
+ # Exclude routes that are part of the rails frameworks that you would not write documentation for
87
+ path.include?("/active_storage/") || path.include?("/action_mailbox/")
88
+ end
89
+
85
90
  def turbo_rails_route? route, path
86
91
  path.end_with?("_historical_location") && route.name.start_with?("turbo_")
87
92
  end
@@ -3,9 +3,9 @@
3
3
  module Swagcov
4
4
  class Railtie < ::Rails::Railtie
5
5
  rake_tasks do
6
- path = File.expand_path("..", __dir__)
6
+ path = ::File.expand_path("..", __dir__)
7
7
 
8
- Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
8
+ ::Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
9
9
  end
10
10
  end
11
11
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Swagcov
4
4
  module Version
5
- STRING = "1.1.1"
5
+ STRING = "1.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagcov
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sarah Ridge
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.7.0.dev
76
+ rubygems_version: 4.0.2
77
77
  specification_version: 4
78
78
  summary: OpenAPI documentation coverage report for Rails Route endpoints
79
79
  test_files: []