rubocopfmt 0.1.0.beta5 → 0.1.0.beta6

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: 0fa9af7cf679b86a5ef27cf338e97c13b8bda718
4
- data.tar.gz: bc0456f52025e46daa569daa4c6057a38c95f853
3
+ metadata.gz: 7416aa6f1bb92c2310a5bf78538f2b2b2f174527
4
+ data.tar.gz: 76f35e8e1e202652ff0261fc27c25c3b3b110eb4
5
5
  SHA512:
6
- metadata.gz: 6a761e3295527c8d8f39ce6e31b6ddd29263cd5d79ebba0bb9616e5765be22957c87ea428a3a7f022f77945fd780a55c121aeb029c3ecdad22467bb780c64ba5
7
- data.tar.gz: 717eeb9ee0c8134293c07876f8c7e2eac7e729ab75d2ad611f87858627317d7c6cd7e4f9bbe161aa60392d05896d41ff3fac8354e4d2618df0d3d1a49b2567d1
6
+ metadata.gz: 416b970fe9e5c57460750db621f13047387acd43d5666fa45210321ae7888382aeb71bda2d783c9d23acfb67f7b320613a83897e9037b9a5197f48bd14c43cc5
7
+ data.tar.gz: c3dd70a67e708707bc458abbafc9efdf51fc5f2e07edf0a85b5a93528acf1c4009d9e432b4f0f8ae81a14245769a05aac0841d0a0866ab715681f9e4e7c0cc0e
@@ -4,65 +4,54 @@ require 'rubocopfmt/rubocop_formatter'
4
4
 
5
5
  module RuboCopFMT
6
6
  class AutoCorrector
7
- DISABLED_COPS = [
8
- 'Lint/Debugger',
9
- 'Lint/UnusedMethodArgument',
10
- 'Lint/UnusedBlockArgument'
11
- ].freeze
12
-
13
- RUBOCOP_ARGV = [
14
- '--auto-correct',
15
- '--cache', 'false',
16
- '--format', 'RuboCopFMT::RubocopFormatter',
17
- '--except', DISABLED_COPS.join(',')
18
- ].freeze
19
-
20
- attr_reader :source
7
+ attr_reader :input
21
8
  attr_reader :runner
22
9
 
23
- def initialize(source, path = nil)
24
- @source = source
10
+ def initialize(input, path = nil)
11
+ @input = input
25
12
  @path = path
26
13
  end
27
14
 
28
15
  def correct
29
16
  Rainbow.enabled = false if defined?(Rainbow)
17
+
30
18
  @runner = ::RuboCop::Runner.new(options, config_store)
31
19
  @runner.run(paths)
20
+
32
21
  options[:stdin]
33
22
  end
34
23
 
35
24
  private
36
25
 
37
- def config_store
38
- return @config_store if @config_store
39
-
40
- @config_store = ::RuboCop::ConfigStore.new
41
- @config_store.options_config = options[:config] if options[:config]
42
- @config_store.force_default_config! if options[:force_default_config]
43
- @config_store
26
+ def paths
27
+ @paths ||= [@path || 'fake.rb']
44
28
  end
45
29
 
46
30
  def options
47
- return @options if @options
48
-
49
- set_options_and_paths
50
- @options
31
+ @options ||= {
32
+ stdin: @input,
33
+ auto_correct: true,
34
+ cache: 'false',
35
+ formatters: [['RuboCopFMT::RubocopFormatter']],
36
+ except: disabled_cops
37
+ }
51
38
  end
52
39
 
53
- def paths
54
- return @paths if @paths
55
-
56
- set_options_and_paths
57
- @paths
40
+ def disabled_cops
41
+ [
42
+ 'Lint/Debugger',
43
+ 'Lint/UnusedMethodArgument',
44
+ 'Lint/UnusedBlockArgument'
45
+ ]
58
46
  end
59
47
 
60
- def set_options_and_paths
61
- argv = RUBOCOP_ARGV + [@path || 'fake.rb']
62
- @options, @paths = ::RuboCop::Options.new.parse(argv)
63
- @options[:stdin] = source
48
+ def config_store
49
+ return @config_store if @config_store
64
50
 
65
- [@options, @paths]
51
+ @config_store = ::RuboCop::ConfigStore.new
52
+ @config_store.options_config = options[:config] if options[:config]
53
+ @config_store.force_default_config! if options[:force_default_config]
54
+ @config_store
66
55
  end
67
56
  end
68
57
  end
@@ -27,9 +27,7 @@ module RuboCopFMT
27
27
  diff: diff_opts(format)
28
28
  )
29
29
 
30
- out = diff.to_s(:text)
31
- out << "\n" if rcs?(format)
32
- out
30
+ diff.diff
33
31
  end
34
32
 
35
33
  private
@@ -1,3 +1,3 @@
1
1
  module RuboCopFMT
2
- VERSION = '0.1.0.beta5'.freeze
2
+ VERSION = '0.1.0.beta6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocopfmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta5
4
+ version: 0.1.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Myhrberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler