stylr 0.0.14 → 0.0.15
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/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/stylr/lint.rb +1 -1
- data/lib/stylr/version.rb +1 -1
- data/spec/lint_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c38522363f3e8964f9c37bcd3fe9f12fa6838111
|
4
|
+
data.tar.gz: c267f67af3f5d65d703bb7cdcbc21e8bbc9c30a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceb8c4938d076cb1c5d1eb9f0204a6a78a611b1f9b26fe0b60f337f27a75ee28109f8bd66f1d281f26ff3b5bd7bdccf8423b0328e3e3f7721f6bea95772d789f
|
7
|
+
data.tar.gz: 7155e7cb3db60f1d1d3a846e1a17c0112a6a3edb9693b87c9e401cd69e6f7252b6655f1cb9a4f3a3cad8aeeab077d6750cfc49c836167626c02dc561f642af87
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,8 @@ Kind of raw still. Currently supports checking against the following:
|
|
21
21
|
* Using tab characters instead of soft tabs
|
22
22
|
* Spacing around math operators (<code>+</code>, <code>*</code>, etc)
|
23
23
|
* Use of <code>===</code> (instead of <code>is_a?</code> or <code>kind_of?</code>)
|
24
|
+
* Spacing after the negation (<code>!</code>) operator
|
25
|
+
* Nesting of (one-line) ternary expressions
|
24
26
|
|
25
27
|
Optionally checks for some metaprogramming, which you might not want in a large, enterprise codebase with varied levels of skill on your development team. This is not a condemnation of these practices - most of them are good, idiomatic Ruby. You might not, however, want your junior developers checking in lots of metaprogrammed code. Pass the '--meta' flag to enable these checks.
|
26
28
|
|
data/lib/stylr/lint.rb
CHANGED
@@ -90,7 +90,7 @@ class Lint
|
|
90
90
|
/[^\s]\+/ => :no_operator_spaces,
|
91
91
|
/\+[^\s=]/ => :no_operator_spaces,
|
92
92
|
/[^\s]-/ => :no_operator_spaces,
|
93
|
-
/![^\S\n]/
|
93
|
+
/![^\S\n][^do\s]/ => :space_after_bang,
|
94
94
|
/\s\?\s.*\s\?\s/ => :nested_ternary
|
95
95
|
}.delete_if { |_, v| !@config[v.to_s] }
|
96
96
|
|
data/lib/stylr/version.rb
CHANGED
data/spec/lint_spec.rb
CHANGED
@@ -109,6 +109,10 @@ module Stylr
|
|
109
109
|
it "line ending with ! is fine" do
|
110
110
|
l.violation?("shitty_rails_object.save!").should be_false
|
111
111
|
end
|
112
|
+
|
113
|
+
it "bang methods followed by a block is not an error" do
|
114
|
+
l.violation?("things.reject! do |foo|").should be_false
|
115
|
+
end
|
112
116
|
end
|
113
117
|
|
114
118
|
context "nested ternaries" do
|