yardcheck 0.0.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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +214 -0
  5. data/.rubocop_todo.yml +69 -0
  6. data/.ruby-version +1 -0
  7. data/Gemfile +22 -0
  8. data/Guardfile +5 -0
  9. data/README.md +83 -0
  10. data/bin/yardcheck +6 -0
  11. data/lib/yardcheck.rb +26 -0
  12. data/lib/yardcheck/color.rb +27 -0
  13. data/lib/yardcheck/const.rb +39 -0
  14. data/lib/yardcheck/documentation.rb +29 -0
  15. data/lib/yardcheck/documentation/method_object.rb +111 -0
  16. data/lib/yardcheck/method_call.rb +38 -0
  17. data/lib/yardcheck/method_tracer.rb +86 -0
  18. data/lib/yardcheck/observation.rb +72 -0
  19. data/lib/yardcheck/proxy.rb +33 -0
  20. data/lib/yardcheck/runner.rb +93 -0
  21. data/lib/yardcheck/source_lines.rb +29 -0
  22. data/lib/yardcheck/spec_observer.rb +28 -0
  23. data/lib/yardcheck/test_runner.rb +27 -0
  24. data/lib/yardcheck/test_value.rb +82 -0
  25. data/lib/yardcheck/typedef.rb +122 -0
  26. data/lib/yardcheck/typedef/parser.rb +82 -0
  27. data/lib/yardcheck/version.rb +5 -0
  28. data/lib/yardcheck/violation.rb +156 -0
  29. data/lib/yardcheck/warning.rb +14 -0
  30. data/spec/integration/yardcheck_spec.rb +57 -0
  31. data/spec/spec_helper.rb +51 -0
  32. data/spec/unit/yardcheck/const_spec.rb +48 -0
  33. data/spec/unit/yardcheck/documentation_spec.rb +148 -0
  34. data/spec/unit/yardcheck/method_tracer_spec.rb +59 -0
  35. data/spec/unit/yardcheck/runner_spec.rb +183 -0
  36. data/spec/unit/yardcheck/test_value_spec.rb +25 -0
  37. data/spec/unit/yardcheck/typedef/parser_spec.rb +37 -0
  38. data/spec/unit/yardcheck/typedef_spec.rb +32 -0
  39. data/test_app/.rspec +1 -0
  40. data/test_app/Gemfile +7 -0
  41. data/test_app/Gemfile.lock +66 -0
  42. data/test_app/lib/test_app.rb +119 -0
  43. data/test_app/spec/test_app_spec.rb +49 -0
  44. data/yardcheck.gemspec +24 -0
  45. metadata +158 -0
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './../lib/test_app'
4
+
5
+ RSpec.describe TestApp::Namespace do
6
+ it 'does math with instance method' do
7
+ expect(TestApp::Namespace.new.add(2, 3)).to be(5)
8
+ end
9
+
10
+ it 'does math with singleton method' do
11
+ expect(TestApp::Namespace.add(2, 3)).to be(5)
12
+ end
13
+
14
+ it 'has an undocumented method and that is fine' do
15
+ expect(TestApp::Namespace.new.undocumented).to be(nil)
16
+ end
17
+
18
+ it 'documents returning the parent but returns child' do
19
+ expect(TestApp::Namespace.new.returns_generic).to be_an_instance_of(TestApp::Namespace::Child)
20
+ end
21
+
22
+ it 'documents returning a relative namespace incorrectly' do
23
+ expect(TestApp::Namespace.new.documents_relative).to be_a(String)
24
+ end
25
+
26
+ it 'incorrectly documents a method as accepting Enumerable<String>' do
27
+ expect(TestApp::Namespace.new.enumerable_param('hi')).to be(nil)
28
+ end
29
+
30
+ it 'properly tests a method with an instance double' do
31
+ expect(TestApp::Namespace.new.properly_tested_with_instance_double(instance_double(String))).to be(nil)
32
+ end
33
+
34
+ it 'improperly tests a method with an instance double' do
35
+ expect(TestApp::Namespace.new.improperly_tested_with_instance_double(instance_double(Integer))).to be(nil)
36
+ end
37
+
38
+ it 'tests a method that raises an error instead of returning' do
39
+ expect { TestApp::Namespace.new.always_raise }.to raise_error(TestApp::Namespace::AppError)
40
+ end
41
+
42
+ it 'improperly documents the param with an invalid const' do
43
+ expect(TestApp::Namespace.new.ignoring_invalid_types('hi')).to be(nil)
44
+ end
45
+
46
+ it 'returns a literal symbol' do
47
+ expect(TestApp::Namespace.new.returns_literal_symbol).to be(:foo)
48
+ end
49
+ end
data/yardcheck.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('../lib/yardcheck/version', __FILE__)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'yardcheck'
7
+ spec.version = Yardcheck::VERSION
8
+ spec.authors = %w[John Backus]
9
+ spec.email = %w[johncbackus@gmail.com]
10
+
11
+ spec.summary = 'Validate YARD docs by running specs'
12
+ spec.description = 'Verify that your YARD @param and @return types are correct'
13
+ spec.homepage = 'https://github.com/backus/yardcheck'
14
+
15
+ spec.files = `git ls-files`.split("\n")
16
+ spec.require_paths = %w[lib]
17
+ spec.executables = %w[yardcheck]
18
+
19
+ spec.add_dependency 'yard', '~> 0.9'
20
+ spec.add_dependency 'concord', '~> 0.1'
21
+ spec.add_dependency 'anima', '~> 0.3'
22
+ spec.add_dependency 'rspec', '~> 3.4'
23
+ spec.add_dependency 'coderay', '~> 1.1'
24
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yardcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John
8
+ - Backus
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-03-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: yard
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.9'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.9'
28
+ - !ruby/object:Gem::Dependency
29
+ name: concord
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.1'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.1'
42
+ - !ruby/object:Gem::Dependency
43
+ name: anima
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.3'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.3'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.4'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.4'
70
+ - !ruby/object:Gem::Dependency
71
+ name: coderay
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.1'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.1'
84
+ description: Verify that your YARD @param and @return types are correct
85
+ email:
86
+ - johncbackus@gmail.com
87
+ executables:
88
+ - yardcheck
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".rubocop.yml"
95
+ - ".rubocop_todo.yml"
96
+ - ".ruby-version"
97
+ - Gemfile
98
+ - Guardfile
99
+ - README.md
100
+ - bin/yardcheck
101
+ - lib/yardcheck.rb
102
+ - lib/yardcheck/color.rb
103
+ - lib/yardcheck/const.rb
104
+ - lib/yardcheck/documentation.rb
105
+ - lib/yardcheck/documentation/method_object.rb
106
+ - lib/yardcheck/method_call.rb
107
+ - lib/yardcheck/method_tracer.rb
108
+ - lib/yardcheck/observation.rb
109
+ - lib/yardcheck/proxy.rb
110
+ - lib/yardcheck/runner.rb
111
+ - lib/yardcheck/source_lines.rb
112
+ - lib/yardcheck/spec_observer.rb
113
+ - lib/yardcheck/test_runner.rb
114
+ - lib/yardcheck/test_value.rb
115
+ - lib/yardcheck/typedef.rb
116
+ - lib/yardcheck/typedef/parser.rb
117
+ - lib/yardcheck/version.rb
118
+ - lib/yardcheck/violation.rb
119
+ - lib/yardcheck/warning.rb
120
+ - spec/integration/yardcheck_spec.rb
121
+ - spec/spec_helper.rb
122
+ - spec/unit/yardcheck/const_spec.rb
123
+ - spec/unit/yardcheck/documentation_spec.rb
124
+ - spec/unit/yardcheck/method_tracer_spec.rb
125
+ - spec/unit/yardcheck/runner_spec.rb
126
+ - spec/unit/yardcheck/test_value_spec.rb
127
+ - spec/unit/yardcheck/typedef/parser_spec.rb
128
+ - spec/unit/yardcheck/typedef_spec.rb
129
+ - test_app/.rspec
130
+ - test_app/Gemfile
131
+ - test_app/Gemfile.lock
132
+ - test_app/lib/test_app.rb
133
+ - test_app/spec/test_app_spec.rb
134
+ - yardcheck.gemspec
135
+ homepage: https://github.com/backus/yardcheck
136
+ licenses: []
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.5.2
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Validate YARD docs by running specs
158
+ test_files: []