swagcov 1.0.0 → 1.1.1

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: 142f669b882f17b5a640aa9cd72b0cc12019cda4e4bc48d9fea5d432fcfff505
4
- data.tar.gz: 5eac1740f216095d93ec1d0f69553eab305aa60ac8e8fb3935a9d75446db05ea
3
+ metadata.gz: ec6ad3768491bc536da30337d3c83dcd649db257dc593372fd3f02120d47ef92
4
+ data.tar.gz: 478e23e0ec6b1b09584ad8f39659db1b58a682b046f1b80440ad009a71783302
5
5
  SHA512:
6
- metadata.gz: 283c6d98acb19f7184ba06ef95a184fcb2844062647699a934ffd5ecb1f4f1c34f47df7cd5ede1aae39a4277f84c3237aed655e4268094921b48ac34ef0f1b73
7
- data.tar.gz: 6107ded5f46b2472d38dc4a454ff01bb8da7dcbddc1668b22858031e38a8c3097781b32c794dfbd064a9e13e19d426482d06c1c9935059725069e94255b76cdd
6
+ metadata.gz: 1d0d49382adb3ff5928190d1254d42df6367ebb7bc844270f1f5d94941a98fa44f35c1d4db903e9cf673b3a2ceed911403014f9dfb5825e08e6d147b60d3160c
7
+ data.tar.gz: 12dd92e0f41fa78fa31fff91946794f49b4a780ad17d473aa8c4b025be1596cac306a9fe9f7b671ce05186e7f550b655b9913993f7b0faf731860cbb0747713e
data/CHANGELOG.md CHANGED
@@ -2,7 +2,22 @@
2
2
  ## main (unreleased)
3
3
  -
4
4
 
5
- ## 1.0.0 (2025-05-19)
5
+ ## 1.1.1 (2025-08-15)
6
+ ### Fix
7
+ - Better matching for non api and turbo related routes ([#161](https://github.com/smridge/swagcov/pull/161))
8
+
9
+ ## 1.1.0 (2025-08-08)
10
+ ### Enhancement
11
+ - Exclude `new` and `edit` controller action routes that are non api routes by rails defaults/convention ([#155](https://github.com/smridge/swagcov/pull/155))
12
+ - For example the below routes are now automatically skipped since these are _generally_ `html` formats.
13
+ ```
14
+ Prefix Verb URI Pattern Controller#Action
15
+ new_article GET /articles/new(.:format) articles#new
16
+ edit_article GET /articles/:id/edit(.:format) articles#edit
17
+ ```
18
+ - Exclude `turbo-rails` related routes (part of rails frameworks that are not considered part of your OpenAPI documentation) ([#156](https://github.com/smridge/swagcov/pull/156))
19
+
20
+ ## 1.0.0 (2025-05-20)
6
21
  ### Refactor
7
22
  - Default Environment Variable approach ([#143](https://github.com/smridge/swagcov/pull/143))
8
23
  - `swagcov` is considered tested and stable for a version 1.0.0 release, see [README](/README.md) for documentation
@@ -118,7 +133,7 @@
118
133
  ### Code Coverage
119
134
  - Added official support for ruby 3.3 and 3.4 and rails 7.1, 7.2, 8.0. See [tests.yml](/.github/workflows/tests.yml) for detail
120
135
 
121
- ## 0.4.0 (2022-08-11)
136
+ ## 0.4.0 (2022-08-12)
122
137
  - Improve OpenAPI file processing ([#26](https://github.com/smridge/swagcov/pull/26))
123
138
 
124
139
  ## 0.3.0 (2022-02-21)
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Swagcov
2
- [![Gem Version](https://img.shields.io/gem/v/swagcov)](https://rubygems.org/gems/swagcov)
3
- ![Gem Downloads](https://img.shields.io/gem/dt/swagcov)
2
+ [![Gem Version](https://img.shields.io/gem/v/swagcov?logo=rubygems)](https://rubygems.org/gems/swagcov)
3
+ [![GitHub Top Language](https://img.shields.io/github/languages/top/smridge/swagcov)](https://rubygems.org/gems/swagcov)
4
+ [![Gem Downloads](https://img.shields.io/gem/dt/swagcov)](https://rubygems.org/gems/swagcov)
4
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
5
6
  [![GitHub License](https://img.shields.io/github/license/smridge/swagcov.svg)](https://github.com/smridge/swagcov/blob/main/LICENSE)
6
7
 
@@ -23,7 +23,7 @@ module Swagcov
23
23
  path = route_path(route)
24
24
  verb = route_verb(route)
25
25
 
26
- next if third_party_route?(route, path)
26
+ next if default_skipped_route?(route, path)
27
27
 
28
28
  if dotfile.ignore_path?(path, verb: verb)
29
29
  update_data(:ignored, verb, path, "ignored")
@@ -56,6 +56,10 @@ 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)
61
+ end
62
+
59
63
  def third_party_route? route, path
60
64
  # https://github.com/rails/rails/blob/48f3c3e201b57a4832314b2c957a3b303e89bfea/actionpack/lib/action_dispatch/routing/inspector.rb#L105-L107
61
65
  # Skips route paths like ["/rails/info/properties", "/rails/info", "/rails/mailers"]
@@ -64,10 +68,10 @@ module Swagcov
64
68
  # Skips routes like "/sidekiq"
65
69
  route.verb.blank? ||
66
70
 
67
- # Exclude routes that are part of the rails gem that you would not write documentation for
68
- # https://github.com/rails/rails/tree/main/activestorage/app/controllers/active_storage
69
- # https://github.com/rails/rails/tree/main/actionmailbox/app/controllers/action_mailbox
70
- path.include?("/active_storage/") || path.include?("/action_mailbox/")
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/") ||
74
+ turbo_rails_route?(route, path)
71
75
  end
72
76
 
73
77
  def internal_rails_route? route
@@ -78,6 +82,17 @@ module Swagcov
78
82
  end
79
83
  end
80
84
 
85
+ def turbo_rails_route? route, path
86
+ path.end_with?("_historical_location") && route.name.start_with?("turbo_")
87
+ end
88
+
89
+ def non_api_route? route, path
90
+ # By default/convention these are non api routes generated by rails
91
+ %w[new edit].include?(route.defaults[:action]) &&
92
+ path.end_with?("/new", "/edit") &&
93
+ route.name.start_with?("new_", "edit_")
94
+ end
95
+
81
96
  def update_data key, verb, path, status
82
97
  @data[:"#{key}_count"] += 1
83
98
  @data[key] << { verb: verb, path: path, status: status }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Swagcov
4
4
  module Version
5
- STRING = "1.0.0"
5
+ STRING = "1.1.1"
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.0.0
4
+ version: 1.1.1
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.6.9
76
+ rubygems_version: 3.7.0.dev
77
77
  specification_version: 4
78
78
  summary: OpenAPI documentation coverage report for Rails Route endpoints
79
79
  test_files: []