rubocop-stylecheck 0.1.1 → 0.1.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a660893931884643cf4ae2aebb2e377dd559131b
|
4
|
+
data.tar.gz: 7b5e3aaf96fe5b3d5c581fb9f723a8da0a80d75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8f70943ffdead8492f6f2df8b92f2be3aa9ea3ff3f70f0ff6fa28c7d51f1a9bbfca2defa6fb1ecbb1951a83ee07c2523f1d598e616e7196d48da1cbae6ae13b
|
7
|
+
data.tar.gz: fdd19e53cef94df422cc179258da8f2af822b6afaf39b52aab2d1d3a546a790d18934f6135ebf383ee0df7f158d58b4166f4a2b69a8ad40555cf4269fd49f6c3
|
@@ -2,6 +2,35 @@ module Rubocop
|
|
2
2
|
module Stylecheck
|
3
3
|
module Cli
|
4
4
|
class << self
|
5
|
+
def run(options)
|
6
|
+
if Rubocop::Stylecheck.direct
|
7
|
+
direct_run(options)
|
8
|
+
else
|
9
|
+
run_via_sh(options)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def direct_run(options)
|
14
|
+
require "rubocop"
|
15
|
+
require "benchmark"
|
16
|
+
|
17
|
+
cli = RuboCop::CLI.new
|
18
|
+
result = 0
|
19
|
+
|
20
|
+
time = Benchmark.realtime do
|
21
|
+
result = cli.run(options)
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "Finished in #{time} seconds" if cli.options[:debug]
|
25
|
+
exit result
|
26
|
+
end
|
27
|
+
|
28
|
+
def run_via_sh(options)
|
29
|
+
system "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
|
30
|
+
abort "Fix code style errors" unless ok
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
5
34
|
def options
|
6
35
|
options = ["--fail-level", "refactor"]
|
7
36
|
options += ["--rails"] if defined?(Rails)
|
@@ -1,22 +1,20 @@
|
|
1
1
|
require "rubocop/stylecheck"
|
2
2
|
require "fileutils"
|
3
3
|
|
4
|
-
def run(options)
|
5
|
-
sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
|
6
|
-
abort "Fix code style errors" unless ok
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
namespace :style do
|
11
5
|
namespace :rubocop do
|
12
6
|
desc "Run RuboCop with auto_correct"
|
13
7
|
task :with_auto_correct do
|
14
|
-
|
8
|
+
Rubocop::Stylecheck::Cli.run(
|
9
|
+
Rubocop::Stylecheck::Cli.options_with_auto_correct
|
10
|
+
)
|
15
11
|
end
|
16
12
|
|
17
13
|
desc "Run RuboCop without auto_correct"
|
18
14
|
task :without_auto_correct do
|
19
|
-
|
15
|
+
Rubocop::Stylecheck::Cli.run(
|
16
|
+
Rubocop::Stylecheck::Cli.options_with_cop
|
17
|
+
)
|
20
18
|
end
|
21
19
|
|
22
20
|
desc "Generate local RuboCop config"
|
@@ -27,7 +25,8 @@ namespace :style do
|
|
27
25
|
if template_config_path && File.exist?(template_config_path)
|
28
26
|
FileUtils.cp(template_config_path, project_config_path)
|
29
27
|
else
|
30
|
-
abort "Config file doesn't exist, please use
|
28
|
+
abort "Config file doesn't exist, please use" \
|
29
|
+
"Robocop::Stylecheck.config_path = ..."
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
data/lib/rubocop/stylecheck.rb
CHANGED
data/lib/rubocop-stylecheck.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "rubocop/stylecheck"
|
1
|
+
require "rubocop/stylecheck"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-stylecheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wawer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|