rubycritic 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fceb73a4e6b94b34fcfc88f846367c0db8abf85d
4
- data.tar.gz: b1b3714fe7efd0fbcc178139763c894730689b0d
3
+ metadata.gz: bac336ae6297b7cfdb084f9ee1fa9949ad558f37
4
+ data.tar.gz: 943f7a6bf54bd37bdd76a8513c8c8e7ef5b7cfed
5
5
  SHA512:
6
- metadata.gz: a51d03f7b9c0b888496bc18b1366bd15ae43ab92abca874d57aa2625541ba2434502a284e0bb2d649e703a13cb00023079865ba408f2e3f9412fa51a54f5cbd9
7
- data.tar.gz: 77ac17f55cbf455d8bf4419a09bdc75bd8a5db4f69588230979574fcd7a14a35bce36c1c49044676ed9e3c64b6bc148b7b712dc7552187749b8bc178fbbb2ed0
6
+ metadata.gz: 244083a692cd49119bf6d4e56376b84045bed3562544e5c01b92085cfc113cce96dfee13b87f9889fb62deda74aa16138f80f283e231225d0f7cadfb978cb801
7
+ data.tar.gz: 0eb796e93bae55f8f4de65c4e0c4c74609d107758964cd3dca4ca40e62cf673dcf357c7c0a2a8527e29eefba634f07d9dd158c55d4244c35cb1410d227edd935
data/.travis.yml CHANGED
@@ -5,6 +5,6 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1
7
7
  - jruby
8
- - rbx-2
8
+ - rbx-2.2.10
9
9
 
10
10
  script: "bundle exec rake"
data/CONTRIBUTING.md CHANGED
@@ -10,7 +10,7 @@ RubyCritic is open source and contributions from the community are encouraged! N
10
10
  Writing some Code
11
11
  -----------------
12
12
 
13
- If you want to squash a bug or add a new feature, follow these guidelines:
13
+ If you want to squash a bug or add a new feature, please:
14
14
 
15
15
  1. Fork the project.
16
16
 
@@ -31,14 +31,14 @@ Each commit should do one thing and one thing only. For example, all whitespace
31
31
  8. [Hide the sausage making][3]. Squash, split and reorder commits if necessary (`git rebase -i`).
32
32
  For a more in-depth look at interactive rebasing, be sure to check [how to rewrite history][4].
33
33
 
34
- 9. Push to the branch to GitHub (`git push origin my-new-feature`).
34
+ 9. Push the branch to GitHub (`git push origin my-new-feature`).
35
35
 
36
36
  10. Create a new [Pull Request][5] and send it to be merged with the master branch.
37
37
 
38
38
  Improving the Documentation
39
39
  ---------------------------
40
40
 
41
- You are encouraged to clarify how something works or to simply fix a typo. Please include `[ci skip]` on a new line in your commit message. This will signal [Travis][2] that running the test suite is not necessary for these changes.
41
+ You are welcome to clarify how something works or simply fix a typo. Please include `[ci skip]` on a new line in each of your commit messages. This will signal [Travis][2] that running the test suite is not necessary for these changes.
42
42
 
43
43
  Reporting a Bug
44
44
  ---------------
@@ -65,4 +65,4 @@ If you are experiencing unexpected behavior and, after having read Rubycritic's
65
65
  [3]: http://sethrobertson.github.io/GitBestPractices/#sausage
66
66
  [4]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages
67
67
  [5]: https://help.github.com/articles/creating-a-pull-request
68
- [6]: https://github.com/whitesmith/rubycritic/issues
68
+ [6]: https://github.com/whitesmith/rubycritic/search?type=Issues
data/README.md CHANGED
@@ -96,23 +96,24 @@ Alternative Usage Methods
96
96
 
97
97
  If you're fond of Guard you might like [guard-rubycritic][4]. It automatically analyses your Ruby files as they are modified.
98
98
 
99
- For continuous integration, you can give [Jenkins CI][5] a spin. With it, you can easily build your own (poor-man's) Code Climate!
99
+ For continuous integration, you can give [Jenkins CI][5] a spin. With it, you can [easily build your own (poor-man's) Code Climate][6]!
100
100
 
101
101
  Improving RubyCritic
102
102
  --------------------
103
103
 
104
104
  RubyCritic doesn't have to remain a second choice to other code quality analysis services. Together, we can improve it and continue to build on the great code metric tools that are available in the Ruby ecosystem.
105
105
 
106
- Arguably, the [better_errors gem][6] only got popular after receiving a [(pretty awesome) Pull Request][7] that changed its page design.
106
+ Arguably, the [better_errors gem][7] only got popular after receiving a [(pretty awesome) Pull Request][8] that changed its page design.
107
107
 
108
108
  Similarly, Pull Requests that improve the look and feel of the gem, that tweak the calculation of ratings or that fix existing issues will be most welcome. This is my first gem, so just commenting on an issue and giving some insight into how something should work will be appreciated. No contribution is too small.
109
109
 
110
- See RubyCritic's [contribution guidelines](CONTRIBUTING.md) about how to proceed.
110
+ See RubyCritic's [contributing guidelines](CONTRIBUTING.md) about how to proceed.
111
111
 
112
112
  [1]: https://github.com/troessner/reek
113
113
  [2]: https://github.com/seattlerb/flay
114
114
  [3]: https://github.com/seattlerb/flog
115
115
  [4]: https://github.com/whitesmith/guard-rubycritic
116
116
  [5]: http://jenkins-ci.org/
117
- [6]: https://github.com/charliesome/better_errors
118
- [7]: https://github.com/charliesome/better_errors/pull/22
117
+ [6]: https://github.com/whitesmith/rubycritic/wiki/Building-your-own-Code-Climate
118
+ [7]: https://github.com/charliesome/better_errors
119
+ [8]: https://github.com/charliesome/better_errors/pull/22
@@ -25,6 +25,8 @@ module Rubycritic
25
25
 
26
26
  def parse_content(content)
27
27
  Parser::CurrentRuby.parse(content) || AST::EmptyNode.new
28
+ rescue Parser::SyntaxError => error
29
+ AST::EmptyNode.new
28
30
  end
29
31
  end
30
32
 
@@ -1,5 +1,5 @@
1
1
  require "rubycritic/report_generators/base"
2
- require "rubycritic/turbulence"
2
+ require "rubycritic/report_generators/turbulence"
3
3
 
4
4
  module Rubycritic
5
5
  module Generator
@@ -1,3 +1,3 @@
1
1
  module Rubycritic
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -17,4 +17,14 @@ describe Rubycritic::Analyser::Stats do
17
17
  analysed_file.methods_count.must_equal 0
18
18
  end
19
19
  end
20
+
21
+ context "when a file is unparsable" do
22
+ it "does not blow up" do
23
+ analysed_file = AnalysedFileDouble.new(:path => "test/samples/stats/unparsable_example.rb")
24
+ capture_output_streams do
25
+ Rubycritic::Analyser::Stats.new([analysed_file]).run
26
+ end
27
+ analysed_file.methods_count.must_equal 0
28
+ end
29
+ end
20
30
  end
@@ -1,5 +1,5 @@
1
1
  require "test_helper"
2
- require "rubycritic/turbulence"
2
+ require "rubycritic/report_generators/turbulence"
3
3
 
4
4
  describe Rubycritic::Turbulence do
5
5
  describe "#data" do
@@ -16,5 +16,14 @@ describe Rubycritic::SourceControlSystem do
16
16
  system.must_be_instance_of Rubycritic::SourceControlSystem::Git
17
17
  end
18
18
  end
19
+
20
+ describe "when no source control system is found" do
21
+ it "creates a source control system double" do
22
+ capture_output_streams do
23
+ system = Rubycritic::SourceControlSystem::Base.create
24
+ system.must_be_instance_of Rubycritic::SourceControlSystem::Double
25
+ end
26
+ end
27
+ end
19
28
  end
20
29
  end
@@ -0,0 +1,2 @@
1
+ factory :<%= singular_name %> do
2
+ end
data/test/test_helper.rb CHANGED
@@ -6,3 +6,12 @@ require "ostruct"
6
6
  def context(*args, &block)
7
7
  describe(*args, &block)
8
8
  end
9
+
10
+ def capture_output_streams
11
+ $stdout = StringIO.new
12
+ $stderr = StringIO.new
13
+ yield
14
+ ensure
15
+ $stdout = STDOUT
16
+ $stderr = STDERR
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Simoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-13 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -198,6 +198,7 @@ files:
198
198
  - lib/rubycritic/report_generators/templates/overview.html.erb
199
199
  - lib/rubycritic/report_generators/templates/smells_index.html.erb
200
200
  - lib/rubycritic/report_generators/templates/smelly_line.html.erb
201
+ - lib/rubycritic/report_generators/turbulence.rb
201
202
  - lib/rubycritic/report_generators/view_helpers.rb
202
203
  - lib/rubycritic/reporters/base.rb
203
204
  - lib/rubycritic/reporters/main.rb
@@ -209,7 +210,6 @@ files:
209
210
  - lib/rubycritic/source_control_systems/double.rb
210
211
  - lib/rubycritic/source_control_systems/git.rb
211
212
  - lib/rubycritic/source_locator.rb
212
- - lib/rubycritic/turbulence.rb
213
213
  - lib/rubycritic/version.rb
214
214
  - rubycritic.gemspec
215
215
  - test/analysers_test_helper.rb
@@ -224,11 +224,11 @@ files:
224
224
  - test/lib/rubycritic/core/location_test.rb
225
225
  - test/lib/rubycritic/core/smell_test.rb
226
226
  - test/lib/rubycritic/core/smells_array_test.rb
227
+ - test/lib/rubycritic/report_generators/turbulence_test.rb
227
228
  - test/lib/rubycritic/report_generators/view_helpers_test.rb
228
229
  - test/lib/rubycritic/smells_status_setter_test.rb
229
230
  - test/lib/rubycritic/source_control_systems/source_control_system_test.rb
230
231
  - test/lib/rubycritic/source_locator_test.rb
231
- - test/lib/rubycritic/turbulence_test.rb
232
232
  - test/lib/rubycritic/version_test.rb
233
233
  - test/samples/flay/smelly.rb
234
234
  - test/samples/flog/complex.rb
@@ -241,6 +241,7 @@ files:
241
241
  - test/samples/reek/smelly.rb
242
242
  - test/samples/stats/empty_example.rb
243
243
  - test/samples/stats/example.rb
244
+ - test/samples/stats/unparsable_example.rb
244
245
  - test/test_helper.rb
245
246
  homepage: https://github.com/whitesmith/rubycritic
246
247
  licenses:
@@ -262,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
263
  version: '0'
263
264
  requirements: []
264
265
  rubyforge_project:
265
- rubygems_version: 2.2.2
266
+ rubygems_version: 2.4.1
266
267
  signing_key:
267
268
  specification_version: 4
268
269
  summary: Ruby code smell detector
@@ -279,11 +280,11 @@ test_files:
279
280
  - test/lib/rubycritic/core/location_test.rb
280
281
  - test/lib/rubycritic/core/smell_test.rb
281
282
  - test/lib/rubycritic/core/smells_array_test.rb
283
+ - test/lib/rubycritic/report_generators/turbulence_test.rb
282
284
  - test/lib/rubycritic/report_generators/view_helpers_test.rb
283
285
  - test/lib/rubycritic/smells_status_setter_test.rb
284
286
  - test/lib/rubycritic/source_control_systems/source_control_system_test.rb
285
287
  - test/lib/rubycritic/source_locator_test.rb
286
- - test/lib/rubycritic/turbulence_test.rb
287
288
  - test/lib/rubycritic/version_test.rb
288
289
  - test/samples/flay/smelly.rb
289
290
  - test/samples/flog/complex.rb
@@ -296,4 +297,5 @@ test_files:
296
297
  - test/samples/reek/smelly.rb
297
298
  - test/samples/stats/empty_example.rb
298
299
  - test/samples/stats/example.rb
300
+ - test/samples/stats/unparsable_example.rb
299
301
  - test/test_helper.rb