stylr 0.0.7 → 0.0.8
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 +4 -4
- data/.travis.yml +20 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/stylr/file_parser.rb +1 -1
- data/lib/stylr/lint.rb +2 -1
- data/lib/stylr/version.rb +1 -1
- data/spec/lint_spec.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ae7cc29466cf1d437a0344cb1b4fc845844a596
|
4
|
+
data.tar.gz: 63c2662e200ccc82bf34679aef1b91dd295f0acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c412b8bc12deb3882f95ffde0b917cf56bc06e95db5bd1dba34379cb30f77dfbe3468ef22b544c697b3ebeb2783f13ca0fdc41ccef73fbb8160b115f98c15a4
|
7
|
+
data.tar.gz: 52a166bef116f6fca7f44d181613471c0ea0bb5d5eced8129bb02421c32568da50b5751a17b55d8a9a0a37acf3640e21e095b6bf5a0ec411d2b53648f6087c2a
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: 'bundle exec rake'
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.0
|
7
|
+
- ruby-head
|
8
|
+
env:
|
9
|
+
- RUBY_PLATFORM="x86_64-linux"
|
10
|
+
- RUBY_PLATFORM="x86_64-darwin11.3.0"
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: ruby-head
|
14
|
+
notifications:
|
15
|
+
email:
|
16
|
+
recipients:
|
17
|
+
- mbillie1@gmail.com
|
18
|
+
- ike18t@gmail.com
|
19
|
+
on_success: change
|
20
|
+
on_failure: change
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<h1>stylr</h1>
|
2
2
|
<h4>a Ruby styleguide enforcer</h4>
|
3
|
+
[](https://travis-ci.org/yaaase/stylr)
|
4
|
+
[](https://gemnasium.com/yaaase/stylr)
|
3
5
|
<img src="https://badge.fury.io/rb/stylr.png"/>
|
4
|
-
<img src="http://ike18t.no-ip.biz/job/Stylr/badge/icon"/>
|
5
6
|
|
6
7
|
This gem will check if source code conforms to some elements of the Github Ruby Style Guidelines (https://github.com/styleguide/ruby) - currently supporting Ruby 2.1.0 (although it may work with earlier versions)
|
7
8
|
|
data/lib/stylr/file_parser.rb
CHANGED
@@ -48,7 +48,7 @@ module Stylr
|
|
48
48
|
@file_string = @file_string.gsub(/\n/, UniqueConstant)
|
49
49
|
@file_string = @lint.strip_multiline_strings(@file_string)
|
50
50
|
@file_string = @file_string.gsub(/#{UniqueConstant}/, "#{UniqueConstant}\n")
|
51
|
-
|
51
|
+
@file_string = @file_string.split(/#{UniqueConstant}/)
|
52
52
|
end
|
53
53
|
|
54
54
|
def display_no_error_message
|
data/lib/stylr/lint.rb
CHANGED
@@ -69,7 +69,8 @@ class Lint
|
|
69
69
|
/\bfor\b/ => :the_word_for,
|
70
70
|
/\bif\b.*\bthen\b\n/ => :multiline_if_then,
|
71
71
|
/\(\s|\s\)/ => :paren_spacing,
|
72
|
-
/\[\
|
72
|
+
/\[[^\S\n]/ => :bracket_spacing,
|
73
|
+
/\S.*\s\]/ => :bracket_spacing,
|
73
74
|
/[^\s][{}]|{[^\s]/ => :brace_spacing,
|
74
75
|
/,[^ \n]/ => :comma_spacing,
|
75
76
|
/\t/ => :no_soft_tabs,
|
data/lib/stylr/version.rb
CHANGED
data/spec/lint_spec.rb
CHANGED
@@ -119,6 +119,14 @@ module Stylr
|
|
119
119
|
it "space after open bracket is bad" do
|
120
120
|
l.violation?("list = [ 1, 2, 3]").should be_true
|
121
121
|
end
|
122
|
+
|
123
|
+
it "newline after open bracket is fine" do
|
124
|
+
l.violation?("list = [\n").should be_false
|
125
|
+
end
|
126
|
+
|
127
|
+
it "close bracket fine as only thing on a line" do
|
128
|
+
l.violation?(" ]").should be_false
|
129
|
+
end
|
122
130
|
end
|
123
131
|
|
124
132
|
context "space around { and } is good" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Billie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: main
|
@@ -81,6 +81,7 @@ extensions: []
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
83
|
- ".gitignore"
|
84
|
+
- ".travis.yml"
|
84
85
|
- Gemfile
|
85
86
|
- Gemfile.lock
|
86
87
|
- LICENSE.txt
|