jscop 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 2cc2232c173339355f33b21707cdee6063a15a0fdce311f67fe2727e7a09dd1a
4
- data.tar.gz: b9d78f2dd4071da98d8e081ca4a4bb5473c169362226460fb3cbb6fd1a03f483
3
+ metadata.gz: 11a58c121a44379f5c4cf6117db6ae5034eb1ba3ce86ab5c60236ae572808136
4
+ data.tar.gz: 43282861b0fb49e9dac054cb014e406d9ce164d0860229209b0ace26d7c1c0ed
5
5
  SHA512:
6
- metadata.gz: b6ae88acec4fdc5ba41b6020d2931318494311c8d2709245d2bea6c664fd047cd40cd0aa43b399948e43d68d89081f845f40dc1feca2be1dbb75c3546cbb9c9e
7
- data.tar.gz: 89f46e2cd210c120fba2dcd17a7d2daaddfb32f01f25b35991cedb2381204d383cba96a351d0698a4c2e388df331854946d932e483ce7df1020549ba9db57581
6
+ metadata.gz: 7296b4d12c6d2796cdb566e322c2bcee6bad26d3e5f0abd6d0ff6191744c56ed5800a47ba0a13b34ee2c59f5410332317acb081c49c0d7aa3fd2e3f12edc8759
7
+ data.tar.gz: 777abcca2f151e8bbb955d241447763cc37ce9a1c0987cc7e863f8ab81b82886b6b8c51a975044dca235c27e4c55a34e82d8d227ae696bd5ec2396212bdaa3a2
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jscop (0.1.4)
5
+ colorize (~> 0.8)
6
+ tty-font (~> 0.5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.0)
12
+ colorize (0.8.1)
13
+ diff-lcs (1.3)
14
+ jaro_winkler (1.5.4)
15
+ parallel (1.19.1)
16
+ parser (2.7.1.1)
17
+ ast (~> 2.4.0)
18
+ rainbow (3.0.0)
19
+ rake (12.3.2)
20
+ rexml (3.2.4)
21
+ rspec (3.9.0)
22
+ rspec-core (~> 3.9.0)
23
+ rspec-expectations (~> 3.9.0)
24
+ rspec-mocks (~> 3.9.0)
25
+ rspec-core (3.9.1)
26
+ rspec-support (~> 3.9.1)
27
+ rspec-expectations (3.9.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.9.0)
30
+ rspec-mocks (3.9.1)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.9.0)
33
+ rspec-support (3.9.2)
34
+ rubocop (0.82.0)
35
+ jaro_winkler (~> 1.5.1)
36
+ parallel (~> 1.10)
37
+ parser (>= 2.7.0.1)
38
+ rainbow (>= 2.2.2, < 4.0)
39
+ rexml
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 2.0)
42
+ ruby-progressbar (1.10.1)
43
+ tty-font (0.5.0)
44
+ unicode-display_width (1.7.0)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.17)
51
+ colorize (~> 0.8.1)
52
+ jscop!
53
+ rake (~> 12.3)
54
+ rspec
55
+ rubocop
56
+ tty-font (~> 0.5.0)
57
+
58
+ BUNDLED WITH
59
+ 1.17.2
data/README.md CHANGED
@@ -111,6 +111,7 @@ Everyone interacting in the Jscop project’s codebases, issue trackers, chat ro
111
111
  - Github: [@codecell](https://github.com/codecell)
112
112
  - Twitter: [@the_codecell](https://twitter.com/the_codecell)
113
113
  - Linkedin: [ezaka alfred](https://www.linkedin.com/in/alfrednoble/)
114
+
114
115
  ## License
115
116
 
116
117
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -16,11 +16,15 @@ module ClassCount
16
16
 
17
17
  def self.class_count(file)
18
18
  pat = /(class)/
19
+ commented_line = %r{^\W+[\/\/]}
19
20
 
20
21
  lines_with_class = []
21
22
  err_type = 'CLASS_COUNT_ERR'
22
23
 
23
- file.lines.each { |line| lines_with_class << line.number if pat.match?(line.content) }
24
+ file.lines.each { |line|
25
+ needed_lines_with_class = pat.match?(line.content) && !line.content.match?(commented_line)
26
+ lines_with_class << line.number if needed_lines_with_class
27
+ }
24
28
  raise_err(lines_with_class, err_type, file.filename) if lines_with_class.length > 1
25
29
 
26
30
  lines_with_class
@@ -18,7 +18,9 @@ module ClassName
18
18
  fes_pat = /[\s]*(class)[\s]*[\d]*[\-]*[a-z]+[\-]*[\w\W]*/
19
19
  sec_pat = /[\s]*(class)[\s]*[\p{Alpha}]+[\-]+[\p{Alpha}]+/
20
20
 
21
- fes_pat.match?(crime) || sec_pat.match?(crime)
21
+ commented_line = crime.match?(%r{^\W+[\/\/]})
22
+
23
+ !commented_line && (fes_pat.match?(crime) || sec_pat.match?(crime))
22
24
  end
23
25
 
24
26
  def self.check_class_name(file)
@@ -16,7 +16,9 @@ module NamingChecker
16
16
 
17
17
  def self.bad_var_case(bad_case)
18
18
  bad_var_start = /(var|let|const|[\s])[\s]*([[:upper:]]{1,}|\d)+(([\w]+[\s][\w]+)|[\w]+)[\s]*[\=][\s]*[\w]*/
19
- bad_var_start.match?(bad_case)
19
+ commented_line = bad_case.match?(%r{^\W+[\/\/]})
20
+
21
+ bad_var_start.match?(bad_case) && !commented_line
20
22
  end
21
23
 
22
24
  def self.check_naming(fpath)
@@ -20,11 +20,13 @@ module SpacingChecker
20
20
  spaced_console = /[\s]+(function|(console.log)[\(][\w]*[\)])[\s]*/
21
21
  closing_line = /[\s]+[\}][\s]*/
22
22
 
23
+ commented_line = cont.match?(%r{^\W+[\/\/]})
24
+
23
25
  a = spaces_before.match?(cont)
24
26
  b = spaces_after.match?(cont)
25
27
  c = spaced_console.match?(cont)
26
28
 
27
- a || b || c || closing_line.match?(cont)
29
+ !commented_line && (a || b || c || closing_line.match?(cont))
28
30
  end
29
31
 
30
32
  def self.check_spaces(file)
@@ -1,3 +1,3 @@
1
1
  module Jscop
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jscop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezaka Alfred
@@ -96,6 +96,7 @@ files:
96
96
  - ".travis.yml"
97
97
  - CODE_OF_CONDUCT.md
98
98
  - Gemfile
99
+ - Gemfile.lock
99
100
  - LICENSE.txt
100
101
  - README.md
101
102
  - Rakefile