ruumba 0.1.12 → 0.1.17
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/README.md +13 -11
- data/bin/ruumba +8 -0
- data/lib/ruumba/analyzer.rb +1 -1
- data/lib/ruumba/correctors.rb +1 -1
- data/lib/ruumba/iterators.rb +5 -4
- data/lib/ruumba/parser.rb +4 -2
- data/lib/ruumba/version.rb +10 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7ac3a58010b7ecef5c03f39431ebe6c52498753c5456b73a1f3a4cf5a6212898
|
4
|
+
data.tar.gz: 3f1937523a324e44791ee63eeb0a2e73393b45948a2273fdba1b0a69993e1fdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccbebf7ed1e410702b9cf33b3564755607c1d5aae913effa2abf218af3352ba9130089c0c42db163a91c92287403c8b1b50518c2b18695087b90fdf5eb591f3e
|
7
|
+
data.tar.gz: 3f153e8bac34c3e0991a8db0c4e45f956ec1b8f91960015e47800c4a18126616d3e1c0e358775a0f65cd99ec2694134fbe7b51c86096e70a674f02ffb08d395f
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Ruumba
|
|
11
11
|
Ruumba is [RuboCop's](https://github.com/bbatsov/rubocop) sidekick, allowing you to lint your .erb Rubies as well as your regular-type ones.
|
12
12
|
|
13
13
|
## Dependencies
|
14
|
-
* Ruby 2.
|
14
|
+
* Ruby 2.4+
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
```bash
|
@@ -44,9 +44,9 @@ Then:
|
|
44
44
|
λ bundle exec rake ruumba
|
45
45
|
```
|
46
46
|
|
47
|
-
## Fix
|
47
|
+
## Fix Paths and Non-Applicable Cops
|
48
48
|
|
49
|
-
By default,
|
49
|
+
By default, RuboCop only scans `.rb` files and so does Ruumba. If you want shown
|
50
50
|
paths to reflect original paths, you can add create a `.ruumba.yml` config file
|
51
51
|
with the following contents:
|
52
52
|
|
@@ -56,41 +56,43 @@ AllCops:
|
|
56
56
|
- '**/*.erb'
|
57
57
|
```
|
58
58
|
|
59
|
-
You can then disable `.rb` extension auto-append and use your config file:
|
59
|
+
You can then disable the `.rb` extension auto-append and use your config file:
|
60
60
|
|
61
61
|
```bash
|
62
62
|
λ ruumba -D -e app/views -c .ruumba.yml
|
63
63
|
```
|
64
64
|
|
65
|
-
Since Ruumba rewrites new files
|
66
|
-
cannot apply
|
65
|
+
Since Ruumba rewrites new files from `.erb` files contents, some formatting cops
|
66
|
+
cannot apply. You can disable them in your Ruumba config file:
|
67
67
|
|
68
68
|
```yaml
|
69
69
|
Style/FrozenStringLiteralComment:
|
70
70
|
Enabled: false
|
71
|
-
Layout/
|
71
|
+
Layout/HashAlignment:
|
72
72
|
Enabled: false
|
73
|
-
Layout/
|
73
|
+
Layout/ParameterAlignment:
|
74
74
|
Enabled: false
|
75
75
|
Layout/IndentationWidth:
|
76
76
|
Enabled: false
|
77
|
-
Layout/
|
77
|
+
Layout/TrailingEmptyLines:
|
78
78
|
Enabled: false
|
79
79
|
```
|
80
80
|
|
81
81
|
You can use `ruumba -a` or `ruumba -D` to look for other cops if this list is
|
82
82
|
missing some.
|
83
83
|
|
84
|
-
You might want to include your existing
|
84
|
+
You might want to include your existing RuboCop config file by appending this in
|
85
85
|
front of your Ruumba config:
|
86
86
|
|
87
87
|
```yaml
|
88
88
|
inherit_from: .rubocop.yml
|
89
89
|
```
|
90
90
|
|
91
|
-
### Editor
|
91
|
+
### Editor Integrations
|
92
92
|
|
93
93
|
* [Atom plugin](https://atom.io/packages/linter-ruumba)
|
94
|
+
* [Vim plugin](https://github.com/dense-analysis/ale)
|
95
|
+
* [Emacs package](https://github.com/flycheck/flycheck)
|
94
96
|
|
95
97
|
## Contributing
|
96
98
|
1. Branch (`git checkout -b fancy-new-feature`)
|
data/bin/ruumba
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
|
4
4
|
require 'optparse'
|
5
5
|
require_relative '../lib/ruumba'
|
6
|
+
require_relative '../lib/ruumba/version'
|
6
7
|
|
7
8
|
options = { arguments: [] }
|
8
9
|
opts_parser = OptionParser.new do |opts|
|
10
|
+
opts.version = Ruumba::Version::STRING
|
11
|
+
|
9
12
|
opts.banner = 'Usage: ruumba path/to/ERBs/'
|
10
13
|
|
11
14
|
opts.on('-h', '--help', 'Display this screen') do
|
@@ -101,6 +104,11 @@ opts_parser = OptionParser.new do |opts|
|
|
101
104
|
options[:arguments] << '--auto-correct'
|
102
105
|
options[:auto_correct] = true
|
103
106
|
end
|
107
|
+
|
108
|
+
opts.on(nil, '--safe-auto-correct', "Run auto-correct only when it's safe.") do
|
109
|
+
options[:arguments] << '--safe-auto-correct'
|
110
|
+
options[:auto_correct] = true
|
111
|
+
end
|
104
112
|
end
|
105
113
|
|
106
114
|
begin
|
data/lib/ruumba/analyzer.rb
CHANGED
@@ -44,7 +44,7 @@ module Ruumba
|
|
44
44
|
if stdin?
|
45
45
|
[Iterators::StdinIterator.new(File.expand_path(stdin_filename)), Correctors::StdinCorrector.new(digestor, parser)]
|
46
46
|
else
|
47
|
-
[Iterators::DirectoryIterator.new(files_or_dirs), Correctors::FileCorrector.new(digestor, parser)]
|
47
|
+
[Iterators::DirectoryIterator.new(files_or_dirs, temp_dir.to_s), Correctors::FileCorrector.new(digestor, parser)]
|
48
48
|
end
|
49
49
|
|
50
50
|
iterator.each do |file, contents|
|
data/lib/ruumba/correctors.rb
CHANGED
data/lib/ruumba/iterators.rb
CHANGED
@@ -26,8 +26,9 @@ module Ruumba
|
|
26
26
|
class DirectoryIterator
|
27
27
|
include Enumerable
|
28
28
|
|
29
|
-
def initialize(files_or_dirs)
|
29
|
+
def initialize(files_or_dirs, temp_dir)
|
30
30
|
@files_or_dirs = files_or_dirs
|
31
|
+
@temp_dir = temp_dir
|
31
32
|
end
|
32
33
|
|
33
34
|
def each(&block)
|
@@ -38,15 +39,15 @@ module Ruumba
|
|
38
39
|
|
39
40
|
private
|
40
41
|
|
41
|
-
attr_reader :files_or_dirs
|
42
|
+
attr_reader :files_or_dirs, :temp_dir
|
42
43
|
|
43
44
|
def files
|
44
45
|
full_list.flat_map do |file_or_dir|
|
45
46
|
if file_or_dir.file?
|
46
47
|
file_or_dir if file_or_dir.to_s.end_with?('.erb')
|
47
48
|
else
|
48
|
-
Dir[
|
49
|
-
Pathname.new(file)
|
49
|
+
Dir[File.join(file_or_dir, '**/*.erb')].map do |file|
|
50
|
+
Pathname.new(file) unless file.start_with?(temp_dir)
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end.compact
|
data/lib/ruumba/parser.rb
CHANGED
@@ -6,7 +6,7 @@ module Ruumba
|
|
6
6
|
# Responsible for extracting interpolated Ruby.
|
7
7
|
class Parser
|
8
8
|
# The regular expression to capture interpolated Ruby.
|
9
|
-
ERB_REGEX = /<%[-=]?(.*?)-?%>/m
|
9
|
+
ERB_REGEX = /<%[-=]?(.*?)-?%>/m.freeze
|
10
10
|
|
11
11
|
def initialize(region_start_marker = nil)
|
12
12
|
@region_start_marker = region_start_marker
|
@@ -115,7 +115,9 @@ module Ruumba
|
|
115
115
|
if region[0] == '#'
|
116
116
|
region.gsub!(/^ /, '#')
|
117
117
|
region.gsub!(/^(?!#)/, '#')
|
118
|
-
|
118
|
+
end
|
119
|
+
|
120
|
+
if match_marker
|
119
121
|
region.prepend("\n", match_marker, "\n")
|
120
122
|
region.concat("\n", match_marker, "\n")
|
121
123
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruumba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Weinstein
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubocop
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/ruumba/parser.rb
|
45
45
|
- lib/ruumba/rake_task.rb
|
46
46
|
- lib/ruumba/rubocop_runner.rb
|
47
|
+
- lib/ruumba/version.rb
|
47
48
|
homepage: https://github.com/ericqweinstein/ruumba
|
48
49
|
licenses:
|
49
50
|
- MIT
|
@@ -63,8 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
64
|
- !ruby/object:Gem::Version
|
64
65
|
version: '0'
|
65
66
|
requirements: []
|
66
|
-
|
67
|
-
rubygems_version: 2.6.14.3
|
67
|
+
rubygems_version: 3.1.3
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Allows users to lint Ruby code in ERB templates the same way they lint source
|