rails-route-checker 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/exe/rails-route-checker +2 -1
- data/lib/rails-route-checker.rb +2 -0
- data/lib/rails-route-checker/app_interface.rb +3 -1
- data/lib/rails-route-checker/config_file.rb +2 -0
- data/lib/rails-route-checker/loaded_app.rb +4 -2
- data/lib/rails-route-checker/parsers/erb_parser.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/document.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/ruby_extractor.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/tree/filter_node.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/tree/node.rb +3 -1
- data/lib/rails-route-checker/parsers/haml_parser/tree/root_node.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/tree/script_node.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/tree/silent_script_node.rb +2 -0
- data/lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb +2 -0
- data/lib/rails-route-checker/parsers/loader.rb +2 -0
- data/lib/rails-route-checker/parsers/ruby_parser.rb +2 -0
- data/lib/rails-route-checker/runner.rb +4 -2
- data/lib/rails-route-checker/version.rb +3 -1
- data/rails-route-checker.gemspec +5 -3
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91a3036bc852166e6e8d63efc1f3d319932bba5f3bbd361c5dbb08994e7878ad
|
4
|
+
data.tar.gz: 77345a3517d9812ad4a9d8357ed3cc170c129a0a1641925e5fda4fb9dda65ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '019c96a2f0cd7b618f5356f11a11f6eabce34cbc0735d91d500b31e8082a0749f5047fdb6f4e1394025b4a19d993a48e5e7f9846f51de10319ec428f88f54791'
|
7
|
+
data.tar.gz: bdd94456a37c71846c2d878238e226097273728c69ac74b198533d9fa232e5893badd844209b34940b28a0b7a4dc4586a437db78fc48ab36f341f2f49f2934bd
|
data/Gemfile
CHANGED
data/exe/rails-route-checker
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rails-route-checker'
|
4
5
|
require 'optparse'
|
@@ -24,6 +25,6 @@ end.parse!
|
|
24
25
|
|
25
26
|
options[:config_file] = '.rails-route-checker.yml' if File.exist?('.rails-route-checker.yml') && !options[:config_file]
|
26
27
|
|
27
|
-
rrc = RailsRouteChecker::Runner.new(options)
|
28
|
+
rrc = RailsRouteChecker::Runner.new(**options)
|
28
29
|
puts rrc.output
|
29
30
|
exit rrc.issues? ? 1 : 0
|
data/lib/rails-route-checker.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsRouteChecker
|
2
4
|
class AppInterface
|
3
5
|
def initialize(**opts)
|
@@ -42,7 +44,7 @@ module RailsRouteChecker
|
|
42
44
|
|
43
45
|
info = controller_information[controller]
|
44
46
|
return true if info[:actions].include?(action)
|
45
|
-
return true if info[:lookup_context]
|
47
|
+
return true if info[:lookup_context]&.template_exists?("#{controller}/#{action}")
|
46
48
|
|
47
49
|
false
|
48
50
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsRouteChecker
|
2
4
|
class LoadedApp
|
3
5
|
def initialize
|
@@ -85,7 +87,7 @@ module RailsRouteChecker
|
|
85
87
|
end
|
86
88
|
|
87
89
|
def attempt_to_load_default_controllers
|
88
|
-
# rubocop:disable Lint/
|
90
|
+
# rubocop:disable Lint/SuppressedException
|
89
91
|
begin
|
90
92
|
::Rails::InfoController
|
91
93
|
rescue NameError # ignored
|
@@ -98,7 +100,7 @@ module RailsRouteChecker
|
|
98
100
|
::Rails::MailersController
|
99
101
|
rescue NameError # ignored
|
100
102
|
end
|
101
|
-
# rubocop:enable Lint/
|
103
|
+
# rubocop:enable Lint/SuppressedException
|
102
104
|
end
|
103
105
|
|
104
106
|
def reject_route?(route)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsRouteChecker
|
2
4
|
module Parsers
|
3
5
|
module HamlParser
|
@@ -68,7 +70,7 @@ module RailsRouteChecker
|
|
68
70
|
next_sibling = siblings.next(self)
|
69
71
|
return next_sibling if next_sibling
|
70
72
|
|
71
|
-
parent
|
73
|
+
parent&.successor
|
72
74
|
end
|
73
75
|
|
74
76
|
def next_node
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsRouteChecker
|
2
4
|
class Runner
|
3
5
|
def initialize(**opts)
|
@@ -14,7 +16,7 @@ module RailsRouteChecker
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def issues?
|
17
|
-
issues.values.flatten(1).count
|
19
|
+
issues.values.flatten(1).count.positive?
|
18
20
|
end
|
19
21
|
|
20
22
|
def output
|
@@ -31,7 +33,7 @@ module RailsRouteChecker
|
|
31
33
|
private
|
32
34
|
|
33
35
|
def app_interface
|
34
|
-
@app_interface ||= RailsRouteChecker::AppInterface.new(
|
36
|
+
@app_interface ||= RailsRouteChecker::AppInterface.new(**@options)
|
35
37
|
end
|
36
38
|
|
37
39
|
def missing_actions_output
|
data/rails-route-checker.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'rails-route-checker/version'
|
@@ -21,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
24
|
spec.require_paths = ['lib']
|
23
25
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
26
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.86'
|
27
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-route-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Allie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.86'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.86'
|
55
55
|
description: A linting tool that helps you find any routes defined in your routes.rb
|
56
56
|
file that don't have a corresponding controller action, and find any _path or _url
|
57
57
|
calls that don't have a corresponding route in the routes.rb file.
|
@@ -102,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
|
106
|
-
rubygems_version: 2.7.9
|
105
|
+
rubygems_version: 3.1.2
|
107
106
|
signing_key:
|
108
107
|
specification_version: 4
|
109
108
|
summary: A linting tool for your Rails routes
|