fasterer 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.fasterer.yml +0 -1
- data/.travis.yml +9 -2
- data/CHANGELOG.md +4 -0
- data/README.md +0 -1
- data/lib/fasterer/file_traverser.rb +5 -5
- data/lib/fasterer/version.rb +1 -1
- data/spec/lib/fasterer/file_traverser_spec.rb +20 -0
- data/spec/support/output/sample_code.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dad76ac74cc33d9e1f82e23005cef6f1bd60532e
|
4
|
+
data.tar.gz: ff12c05326d55e9e10b4c07f09bc9206e4994a11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c54c879d1264f00f6a783ddf42f0bd973c2fac6bfd7cea52857659215ea0fc7cd5f7937e683a6e8ef8f9bb3e99ae81b75d081d3c2a3c4fed588ce5a6f997e0ae
|
7
|
+
data.tar.gz: 5e0c03c6cbb14319cd8c3e1f1971cbe94962c3e97e5d2b522f639c875d424f9f602586d05bfa89537bcc02c359fd62690277b51021dffede35841244fa9dc1b5
|
data/.fasterer.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install:
|
3
|
-
# Travis bundler versions are quite out of date and can cause install errors
|
4
|
-
# see: https://github.com/rubygems/rubygems/issues/1419
|
5
3
|
- gem update bundler
|
6
4
|
rvm:
|
7
5
|
- 1.9.3
|
@@ -15,3 +13,12 @@ rvm:
|
|
15
13
|
env:
|
16
14
|
global:
|
17
15
|
secure: MBTxmpWCjrsNKPlOoFwJUMHze3GPMz8YCXQFQG3zJBh3WGNQnz4z91ra/1P/DClyVCxHGSFCOswxCNe4kJ2zAnPyQLqGSinXy9uDpqZQUEdaRoQbPnh4/bguZNSJ429gtTpMdDSNOgQ+Hra2EFnWwHA+rLF6ImksMsu3XGKGxGE=
|
16
|
+
- CC_TEST_REPORTER_ID=86c5edffe4c38e16cb1467e3220a4f3dfa0a0ac8fa6ee8fddd62e200245f4b77
|
17
|
+
before_script:
|
18
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
19
|
+
- chmod +x ./cc-test-reporter
|
20
|
+
- ./cc-test-reporter before-build
|
21
|
+
script:
|
22
|
+
- bundle exec rspec
|
23
|
+
after_script:
|
24
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
[![Code Climate](https://codeclimate.com/github/DamirSvrtan/fasterer/badges/gpa.svg)](https://codeclimate.com/github/DamirSvrtan/fasterer)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/fasterer.svg)](http://badge.fury.io/rb/fasterer)
|
4
4
|
[![Test Coverage](https://codeclimate.com/github/DamirSvrtan/fasterer/badges/coverage.svg)](https://codeclimate.com/github/DamirSvrtan/fasterer/coverage)
|
5
|
-
[![Dependency Status](https://gemnasium.com/DamirSvrtan/fasterer.svg)](https://gemnasium.com/DamirSvrtan/fasterer)
|
6
5
|
|
7
6
|
# Fasterer
|
8
7
|
|
@@ -80,14 +80,14 @@ module Fasterer
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def output(analyzer)
|
83
|
-
puts analyzer.file_path.colorize(:red)
|
84
|
-
|
85
83
|
offenses_grouped_by_type(analyzer).each do |error_group_name, error_occurences|
|
86
|
-
|
87
|
-
|
84
|
+
error_occurences.map(&:line_number).each do |line|
|
85
|
+
file_and_line = "#{analyzer.file_path}:#{line}"
|
86
|
+
print "#{file_and_line.colorize(:red)} #{Fasterer::Offense::EXPLANATIONS[error_group_name]}.\n"
|
87
|
+
end
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
print "\n"
|
91
91
|
end
|
92
92
|
|
93
93
|
def offenses_grouped_by_type(analyzer)
|
data/lib/fasterer/version.rb
CHANGED
@@ -334,4 +334,24 @@ describe Fasterer::FileTraverser do
|
|
334
334
|
.to match_array(['user.rb - RubyParser::SyntaxError - unterminated string meets end of file. near line 1: ""'])
|
335
335
|
end
|
336
336
|
end
|
337
|
+
|
338
|
+
describe 'output' do
|
339
|
+
let(:test_file_path) { RSpec.root.join('support', 'output', 'sample_code.rb') }
|
340
|
+
let(:analyzer) { Fasterer::Analyzer.new(test_file_path) }
|
341
|
+
let(:file_traverser) { Fasterer::FileTraverser.new('.') }
|
342
|
+
|
343
|
+
before do
|
344
|
+
analyzer.scan
|
345
|
+
end
|
346
|
+
|
347
|
+
context "when print offenses" do
|
348
|
+
let(:explanation) { Fasterer::Offense::EXPLANATIONS[:for_loop_vs_each] }
|
349
|
+
|
350
|
+
it 'should print offense' do
|
351
|
+
match = "\e[0;31;49m#{test_file_path}:1\e[0m #{explanation}.\n\n"
|
352
|
+
|
353
|
+
expect { file_traverser.send(:output, analyzer) }.to output(match).to_stdout
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
337
357
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fasterer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damir Svrtan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- spec/support/method_definition/simple_method.rb
|
221
221
|
- spec/support/method_definition/simple_method_omitted_parenthesis.rb
|
222
222
|
- spec/support/method_definition/simple_method_with_argument.rb
|
223
|
+
- spec/support/output/sample_code.rb
|
223
224
|
- spec/support/rescue_call/plain_rescue.rb
|
224
225
|
- spec/support/rescue_call/rescue_with_class.rb
|
225
226
|
- spec/support/rescue_call/rescue_with_class_and_variable.rb
|
@@ -325,6 +326,7 @@ test_files:
|
|
325
326
|
- spec/support/method_definition/simple_method.rb
|
326
327
|
- spec/support/method_definition/simple_method_omitted_parenthesis.rb
|
327
328
|
- spec/support/method_definition/simple_method_with_argument.rb
|
329
|
+
- spec/support/output/sample_code.rb
|
328
330
|
- spec/support/rescue_call/plain_rescue.rb
|
329
331
|
- spec/support/rescue_call/rescue_with_class.rb
|
330
332
|
- spec/support/rescue_call/rescue_with_class_and_variable.rb
|