checker 0.7.0 → 0.8.0.beta
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 +5 -5
- data/.travis.yml +5 -6
- data/Gemfile +1 -1
- data/Gemfile.lock +89 -45
- data/Guardfile +16 -0
- data/Rakefile +2 -2
- data/bin/checker +2 -2
- data/checker.gemspec +13 -11
- data/lib/checker.rb +14 -16
- data/lib/checker/cli.rb +19 -22
- data/lib/checker/core_ext.rb +7 -9
- data/lib/checker/helper.rb +1 -1
- data/lib/checker/installator.rb +8 -8
- data/lib/checker/modules/base.rb +42 -44
- data/lib/checker/modules/coffeescript.rb +5 -3
- data/lib/checker/modules/conflict.rb +4 -4
- data/lib/checker/modules/console_log.rb +4 -3
- data/lib/checker/modules/haml.rb +4 -2
- data/lib/checker/modules/javascript.rb +5 -3
- data/lib/checker/modules/multifile.rb +16 -0
- data/lib/checker/modules/pry.rb +4 -4
- data/lib/checker/modules/rubocop.rb +12 -4
- data/lib/checker/modules/ruby.rb +6 -3
- data/lib/checker/modules/sass.rb +16 -14
- data/lib/checker/modules/slim.rb +4 -2
- data/lib/checker/modules/yaml.rb +5 -3
- data/lib/checker/options.rb +1 -1
- data/lib/checker/results/console_log.rb +1 -1
- data/lib/checker/rvm.rb +2 -2
- data/lib/checker/version.rb +1 -1
- data/spec/checker/cli_spec.rb +10 -8
- data/spec/checker/fixtures/conflict/without_conflict.rb +1 -2
- data/spec/checker/fixtures/pry/with_both.rb +1 -2
- data/spec/checker/fixtures/pry/with_pry.rb +1 -1
- data/spec/checker/fixtures/pry/with_pry_remote.rb +1 -1
- data/spec/checker/fixtures/pry/without_pry.rb +1 -2
- data/spec/checker/fixtures/ruby/good.rb +1 -1
- data/spec/checker/modules/base_spec.rb +15 -15
- data/spec/checker/modules/coffeescript_spec.rb +11 -11
- data/spec/checker/modules/conflict_spec.rb +8 -8
- data/spec/checker/modules/console_log_spec.rb +13 -13
- data/spec/checker/modules/haml_spec.rb +13 -13
- data/spec/checker/modules/javascript_spec.rb +22 -22
- data/spec/checker/modules/pry_spec.rb +10 -10
- data/spec/checker/modules/ruby_spec.rb +9 -10
- data/spec/checker/modules/sass_spec.rb +46 -46
- data/spec/checker/modules/slim_spec.rb +12 -12
- data/spec/checker/modules/yaml_spec.rb +12 -12
- data/spec/spec_helper.rb +6 -14
- metadata +39 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 32d58b397ad1392c8595d09090c6c0a9c5d03637df304970a68756fa9efc586e
|
4
|
+
data.tar.gz: 622bd7942aa11799a1804df167992e8ffe90516e09143c71f94850ae0f6b4b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c53203b594c3b81c38fc265d264c4b8f1aad6cdb7486fca264769c37c28444ae12fbf73fc2bae800eae7794cbb649432e4523431bb1a3f98d128d50907c9ef1d
|
7
|
+
data.tar.gz: 48db5d9b52793e71c0e7168a94dc20c234c751493a5a9c4d8f047253c42eb645ad0a62ab57cdc3347c756149ae28900140f26c3c325d64bdcd554524e6233c37
|
data/.travis.yml
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
-
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.2.0
|
3
|
+
- 2.5.0
|
4
|
+
- 2.4.3
|
5
|
+
- 2.3.6
|
6
|
+
- 2.2.9
|
8
7
|
notifications:
|
9
8
|
email:
|
10
9
|
recipients:
|
11
10
|
- jacek.jakubik@netguru.pl
|
12
|
-
- tomasz.pewinski@netguru.pl
|
13
11
|
|
12
|
+
before_install: gem update --system
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,59 +1,98 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
checker (0.
|
5
|
-
colorize (~> 0.
|
6
|
-
rubocop (~> 0.
|
4
|
+
checker (0.8.0.beta)
|
5
|
+
colorize (~> 0.8.0)
|
6
|
+
rubocop (~> 0.52.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ast (2.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
rest-client (>= 1.6.8, < 2)
|
18
|
-
simplecov (~> 0.9.1)
|
11
|
+
ast (2.3.0)
|
12
|
+
coderay (1.1.1)
|
13
|
+
colorize (0.8.1)
|
14
|
+
coveralls (0.8.21)
|
15
|
+
json (>= 1.8, < 3)
|
16
|
+
simplecov (~> 0.14.1)
|
19
17
|
term-ansicolor (~> 1.3)
|
20
|
-
thor (~> 0.19.
|
21
|
-
|
18
|
+
thor (~> 0.19.4)
|
19
|
+
tins (~> 1.6)
|
20
|
+
diff-lcs (1.3)
|
22
21
|
docile (1.1.5)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
ffi (1.9.18)
|
23
|
+
formatador (0.2.5)
|
24
|
+
guard (2.14.1)
|
25
|
+
formatador (>= 0.2.4)
|
26
|
+
listen (>= 2.7, < 4.0)
|
27
|
+
lumberjack (~> 1.0)
|
28
|
+
nenv (~> 0.1)
|
29
|
+
notiffany (~> 0.0)
|
30
|
+
pry (>= 0.9.12)
|
31
|
+
shellany (~> 0.0)
|
32
|
+
thor (>= 0.18.1)
|
33
|
+
guard-compat (1.2.1)
|
34
|
+
guard-rspec (4.7.3)
|
35
|
+
guard (~> 2.1)
|
36
|
+
guard-compat (~> 1.1)
|
37
|
+
rspec (>= 2.99.0, < 4.0)
|
38
|
+
json (2.1.0)
|
39
|
+
listen (3.1.5)
|
40
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
41
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
42
|
+
ruby_dep (~> 1.2)
|
43
|
+
lumberjack (1.0.11)
|
44
|
+
method_source (0.8.2)
|
45
|
+
nenv (0.3.0)
|
46
|
+
notiffany (0.1.1)
|
47
|
+
nenv (~> 0.1)
|
48
|
+
shellany (~> 0.0)
|
49
|
+
parallel (1.12.1)
|
50
|
+
parser (2.4.0.2)
|
51
|
+
ast (~> 2.3)
|
52
|
+
powerpack (0.1.1)
|
53
|
+
pry (0.10.4)
|
54
|
+
coderay (~> 1.1.0)
|
55
|
+
method_source (~> 0.8.1)
|
56
|
+
slop (~> 3.4)
|
57
|
+
rainbow (3.0.0)
|
58
|
+
rake (12.3.0)
|
59
|
+
rb-fsevent (0.9.8)
|
60
|
+
rb-inotify (0.9.8)
|
61
|
+
ffi (>= 0.5.0)
|
62
|
+
rspec (3.7.0)
|
63
|
+
rspec-core (~> 3.7.0)
|
64
|
+
rspec-expectations (~> 3.7.0)
|
65
|
+
rspec-mocks (~> 3.7.0)
|
66
|
+
rspec-core (3.7.1)
|
67
|
+
rspec-support (~> 3.7.0)
|
68
|
+
rspec-expectations (3.7.0)
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
+
rspec-support (~> 3.7.0)
|
71
|
+
rspec-mocks (3.7.0)
|
72
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
73
|
+
rspec-support (~> 3.7.0)
|
74
|
+
rspec-support (3.7.0)
|
75
|
+
rubocop (0.52.1)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 2.4.0.2, < 3.0)
|
78
|
+
powerpack (~> 0.1)
|
79
|
+
rainbow (>= 2.2.2, < 4.0)
|
80
|
+
ruby-progressbar (~> 1.7)
|
81
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
82
|
+
ruby-progressbar (1.9.0)
|
83
|
+
ruby_dep (1.3.1)
|
84
|
+
shellany (0.0.1)
|
85
|
+
simplecov (0.14.1)
|
49
86
|
docile (~> 1.1.0)
|
50
|
-
|
51
|
-
simplecov-html (~> 0.
|
52
|
-
simplecov-html (0.
|
53
|
-
|
87
|
+
json (>= 1.8, < 3)
|
88
|
+
simplecov-html (~> 0.10.0)
|
89
|
+
simplecov-html (0.10.2)
|
90
|
+
slop (3.6.0)
|
91
|
+
term-ansicolor (1.6.0)
|
54
92
|
tins (~> 1.0)
|
55
|
-
thor (0.19.
|
56
|
-
tins (1.3
|
93
|
+
thor (0.19.4)
|
94
|
+
tins (1.16.3)
|
95
|
+
unicode-display_width (1.3.0)
|
57
96
|
|
58
97
|
PLATFORMS
|
59
98
|
ruby
|
@@ -61,4 +100,9 @@ PLATFORMS
|
|
61
100
|
DEPENDENCIES
|
62
101
|
checker!
|
63
102
|
coveralls
|
103
|
+
guard-rspec
|
104
|
+
rake
|
64
105
|
rspec
|
106
|
+
|
107
|
+
BUNDLED WITH
|
108
|
+
1.12.5
|
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# Feel free to open issues for suggestions and improvements
|
6
|
+
|
7
|
+
# RSpec files
|
8
|
+
rspec = dsl.rspec
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
watch(rspec.spec_files)
|
12
|
+
|
13
|
+
# Ruby files
|
14
|
+
ruby = dsl.ruby
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
16
|
+
end
|
data/Rakefile
CHANGED
data/bin/checker
CHANGED
data/checker.gemspec
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
require File.expand_path(
|
1
|
+
|
2
|
+
require File.expand_path("../lib/checker/version", __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
5
|
+
s.name = "checker"
|
6
6
|
s.version = Checker::VERSION
|
7
|
-
s.date =
|
7
|
+
s.date = "2018-01-17"
|
8
8
|
s.summary = "Syntax checker for various files"
|
9
9
|
s.description = "A collection of modules which every is designed to check syntax for specific files."
|
10
10
|
s.authors = ["Jacek Jakubik", "Tomasz Pewiński"]
|
11
|
-
s.email = [
|
11
|
+
s.email = ["jacek.jakubik@netguru.pl", "tomasz.pewinski@netguru.pl"]
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
14
|
s.require_paths = ["lib"]
|
15
|
-
s.homepage
|
16
|
-
s.add_dependency
|
17
|
-
s.add_dependency
|
18
|
-
s.add_development_dependency
|
19
|
-
s.add_development_dependency
|
15
|
+
s.homepage = "http://github.com/netguru/checker"
|
16
|
+
s.add_dependency "colorize", "~> 0.8.0"
|
17
|
+
s.add_dependency "rubocop", "~> 0.52.0"
|
18
|
+
s.add_development_dependency "coveralls"
|
19
|
+
s.add_development_dependency "guard-rspec"
|
20
|
+
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "rspec"
|
20
22
|
end
|
data/lib/checker.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "English"
|
2
|
+
require "colorize"
|
3
|
+
require "digest/md5"
|
4
|
+
require "erb"
|
4
5
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
6
|
+
require "checker/core_ext"
|
7
|
+
require "checker/rvm"
|
8
|
+
require "checker/version"
|
9
|
+
require "checker/installator"
|
10
|
+
require "checker/helper"
|
11
|
+
require "checker/options"
|
12
|
+
require "checker/result"
|
12
13
|
|
13
|
-
%w[base ruby haml slim pry coffeescript javascript sass yaml conflict console_log rubocop].each do |mod|
|
14
|
+
%w[base multifile ruby haml slim pry coffeescript javascript sass yaml conflict console_log rubocop].each do |mod|
|
14
15
|
require "checker/modules/#{mod}"
|
15
16
|
end
|
16
17
|
|
@@ -19,14 +20,11 @@ end
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def debug_mode?
|
22
|
-
ENV[
|
23
|
+
ENV["CHECKER_DEBUG"].to_s == "1"
|
23
24
|
end
|
24
25
|
|
25
|
-
if debug_mode?
|
26
|
-
puts "Running checker with debug mode!".colorize(:yellow)
|
27
|
-
end
|
26
|
+
puts "Running checker with debug mode!".colorize(:yellow) if debug_mode?
|
28
27
|
|
29
28
|
def debug(msg)
|
30
29
|
puts "[DEBUG] - #{msg}".colorize(:yellow) if debug_mode?
|
31
30
|
end
|
32
|
-
|
data/lib/checker/cli.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "checker"
|
2
2
|
|
3
3
|
module Checker
|
4
4
|
class CLI
|
@@ -6,7 +6,7 @@ module Checker
|
|
6
6
|
def execute
|
7
7
|
directory_to_check = nil
|
8
8
|
|
9
|
-
if ARGV.
|
9
|
+
if ARGV.empty?
|
10
10
|
modules = get_modules_to_check
|
11
11
|
else
|
12
12
|
if ARGV[0] == "install"
|
@@ -16,32 +16,30 @@ module Checker
|
|
16
16
|
elsif ARGV[0] == "help"
|
17
17
|
Checker::Helper.show_help!
|
18
18
|
elsif ARGV[0] == "modules"
|
19
|
-
Checker::Helper.show_modules!(
|
19
|
+
Checker::Helper.show_modules!(available_modules)
|
20
20
|
elsif File.exist?(ARGV[0]) && File.directory?(ARGV[0])
|
21
|
-
directory_to_check = ARGV[0].gsub /\/+$/,
|
22
|
-
modules =
|
21
|
+
directory_to_check = ARGV[0].gsub /\/+$/, ""
|
22
|
+
modules = "all"
|
23
23
|
else
|
24
24
|
modules = ARGV.map(&:downcase)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
if modules.empty? || modules.include?(
|
29
|
-
modules = available_modules
|
30
|
-
end
|
28
|
+
modules = available_modules if modules.empty? || modules.include?("all")
|
31
29
|
|
32
30
|
check_module_availability(modules) do |result|
|
33
|
-
puts "Modules not available: #{result.join(
|
34
|
-
puts "Available: all, #{available_modules.join(
|
31
|
+
puts "Modules not available: #{result.join(', ')}.\n"
|
32
|
+
puts "Available: all, #{available_modules.join(', ')}\n"
|
35
33
|
puts "Check your git config checker.check\n"
|
36
34
|
exit 1
|
37
35
|
end
|
38
36
|
|
39
37
|
module_instances = []
|
40
|
-
if !directory_to_check.nil?
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
files = if !directory_to_check.nil?
|
39
|
+
Dir["#{directory_to_check}/**/*"]
|
40
|
+
else
|
41
|
+
modified_files
|
42
|
+
end
|
45
43
|
modules.each do |mod|
|
46
44
|
klass = "Checker::Modules::#{mod.classify}".constantize
|
47
45
|
module_instances << klass.new(files.dup)
|
@@ -56,16 +54,15 @@ module Checker
|
|
56
54
|
end
|
57
55
|
|
58
56
|
protected
|
57
|
+
|
59
58
|
def available_modules
|
60
|
-
Checker::Modules.constants.map(&:to_s).map(&:underscore) - [
|
59
|
+
Checker::Modules.constants.map(&:to_s).map(&:underscore) - ["base"]
|
61
60
|
end
|
62
61
|
|
63
62
|
def check_module_availability(modules)
|
64
63
|
result = modules - available_modules
|
65
64
|
unless result.empty?
|
66
|
-
if block_given?
|
67
|
-
yield(result)
|
68
|
-
end
|
65
|
+
yield(result) if block_given?
|
69
66
|
end
|
70
67
|
end
|
71
68
|
|
@@ -77,10 +74,10 @@ module Checker
|
|
77
74
|
@modified_files ||= `git status --porcelain | egrep "^(A|M|R).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`.split
|
78
75
|
end
|
79
76
|
|
80
|
-
def show_full_status
|
81
|
-
full_status = {:
|
77
|
+
def show_full_status(modules)
|
78
|
+
full_status = { total: 0, ok: 0, warning: 0, fail: 0 }
|
82
79
|
modules.each do |m|
|
83
|
-
full_status = full_status.merge(m.full_results) { |
|
80
|
+
full_status = full_status.merge(m.full_results) { |_k, v1, v2| v1 + v2 }
|
84
81
|
end
|
85
82
|
puts "-" * 80
|
86
83
|
print "#{full_status[:total]} checks preformed, "
|
data/lib/checker/core_ext.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class CoreExt
|
2
2
|
def self.constantize(camel_cased_word)
|
3
|
-
names = camel_cased_word.split(
|
3
|
+
names = camel_cased_word.split("::")
|
4
4
|
names.shift if names.empty? || names.first.empty?
|
5
5
|
|
6
6
|
constant = Object
|
@@ -12,16 +12,14 @@ class CoreExt
|
|
12
12
|
|
13
13
|
def self.classify(underscored_word)
|
14
14
|
words = underscored_word.split("_")
|
15
|
-
words.each
|
16
|
-
word.capitalize!
|
17
|
-
end.join("")
|
15
|
+
words.each(&:capitalize!).join("")
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.underscore(camel_cased_word)
|
21
19
|
word = camel_cased_word.to_s.dup
|
22
|
-
word.gsub!(/::/,
|
23
|
-
word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
24
|
-
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
20
|
+
word.gsub!(/::/, "/")
|
21
|
+
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
22
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
25
23
|
word.tr!("-", "_")
|
26
24
|
word.downcase!
|
27
25
|
word
|
@@ -43,12 +41,12 @@ class String
|
|
43
41
|
|
44
42
|
def ends_with?(patt)
|
45
43
|
patt = Regexp.new(Regexp.escape(patt) + "$")
|
46
|
-
|
44
|
+
match patt
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
48
|
class Array
|
51
49
|
def all_true?
|
52
|
-
|
50
|
+
all? { |o| o == true }
|
53
51
|
end
|
54
52
|
end
|