swagcov 1.0.0 → 1.1.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: 142f669b882f17b5a640aa9cd72b0cc12019cda4e4bc48d9fea5d432fcfff505
4
- data.tar.gz: 5eac1740f216095d93ec1d0f69553eab305aa60ac8e8fb3935a9d75446db05ea
3
+ metadata.gz: 25a95a511f8848ad55e88aba10b52e91b98b4a763f3c459e8d7167115846b9b0
4
+ data.tar.gz: 8ef18bdf421bf494882c799d76146804af7dc5b92fc8333c26c80c087231cec2
5
5
  SHA512:
6
- metadata.gz: 283c6d98acb19f7184ba06ef95a184fcb2844062647699a934ffd5ecb1f4f1c34f47df7cd5ede1aae39a4277f84c3237aed655e4268094921b48ac34ef0f1b73
7
- data.tar.gz: 6107ded5f46b2472d38dc4a454ff01bb8da7dcbddc1668b22858031e38a8c3097781b32c794dfbd064a9e13e19d426482d06c1c9935059725069e94255b76cdd
6
+ metadata.gz: 37f8c1fb82a83466f03c3c12026d23f749a8fb6fc84a643030d7e11c9ac44299dc628642a2f2742ca7decd54103aaf2e3567c775378ad940028dac192b329558
7
+ data.tar.gz: 84e0bc9fb5808202680ab6f7ac740f61c8b16edacf7b4b362483ccd727df41e80ac17bf5f3b0f1eb6be8811d7cb027b2c84c2bea7c76686feced9446416e5826
data/CHANGELOG.md CHANGED
@@ -2,7 +2,18 @@
2
2
  ## main (unreleased)
3
3
  -
4
4
 
5
- ## 1.0.0 (2025-05-19)
5
+ ## 1.1.0 (2025-08-07)
6
+ ### Enhancement
7
+ - Exclude `new` and `edit` controller action routes that are non api routes by rails defaults/convention ([#155](https://github.com/smridge/swagcov/pull/155))
8
+ - For example the below routes are now automatically skipped since these are _generally_ `html` formats.
9
+ ```
10
+ Prefix Verb URI Pattern Controller#Action
11
+ new_article GET /articles/new(.:format) articles#new
12
+ edit_article GET /articles/:id/edit(.:format) articles#edit
13
+ ```
14
+ - 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))
15
+
16
+ ## 1.0.0 (2025-05-20)
6
17
  ### Refactor
7
18
  - Default Environment Variable approach ([#143](https://github.com/smridge/swagcov/pull/143))
8
19
  - `swagcov` is considered tested and stable for a version 1.0.0 release, see [README](/README.md) for documentation
@@ -118,7 +129,7 @@
118
129
  ### Code Coverage
119
130
  - 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
131
 
121
- ## 0.4.0 (2022-08-11)
132
+ ## 0.4.0 (2022-08-12)
122
133
  - Improve OpenAPI file processing ([#26](https://github.com/smridge/swagcov/pull/26))
123
134
 
124
135
  ## 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,16 @@ module Swagcov
78
82
  end
79
83
  end
80
84
 
85
+ def turbo_rails_route? route, path
86
+ # TODO: add route.source_location.include?("turbo-rails") - working on local machine but not in test env
87
+ path.include?("_historical_location") && route.name.include?("turbo_")
88
+ end
89
+
90
+ def non_api_route? route, path
91
+ # By default/convention these are non api routes generated by rails
92
+ %w[new edit].include?(route.defaults[:action]) && (path.include?("/new") || path.include?("/edit"))
93
+ end
94
+
81
95
  def update_data key, verb, path, status
82
96
  @data[:"#{key}_count"] += 1
83
97
  @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.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.0.0
4
+ version: 1.1.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.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: []