rfix 1.2.6.pre.198 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +3 -1
- data/.travis.yml +1 -3
- data/Gemfile.lock +11 -4
- data/README.md +4 -11
- data/Rakefile +4 -0
- data/lib/rfix.rb +1 -0
- data/lib/rfix/formatter.rb +5 -3
- data/lib/rfix/indentation.rb +39 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +4 -13
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c6a5221d4beb6a82e2ec5993f4e6710f6797d44c5132804cb07963b8e1afd5
|
4
|
+
data.tar.gz: 36466eb65888062cba7c5b58a972ec546670d6c997aae5dac3f7df6aa6403a61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e6e043ae89ed1cfaac1ff174f772e07d180d1e5e2f0fc178a2f3e7db8f4a5cc991ace2118eb8ecc21ee92f7c7d5947a821f7e75a962d46c36c3623aae67c2b
|
7
|
+
data.tar.gz: c1a48cb3b3372c82645c680123e83f7ec9551307fe723b194f99cd073001fd921eab4abf2a04bbff533f41f524c079bda1dfd5dfcfc21ef224e8c58fe400ab3c
|
data/.github/workflows/main.yml
CHANGED
@@ -21,4 +21,6 @@ jobs:
|
|
21
21
|
- run: rake libgit2:install
|
22
22
|
|
23
23
|
- run: bundle install --path vendor/bundle
|
24
|
-
- run:
|
24
|
+
- run: bundle exec rake travis:setup
|
25
|
+
- run: bundle exec rake travis:spec
|
26
|
+
- run: bundle exec rake travis:verify
|
data/.travis.yml
CHANGED
@@ -3,16 +3,14 @@ rvm:
|
|
3
3
|
- 2.5.0
|
4
4
|
- 2.6.2
|
5
5
|
- 2.7.1
|
6
|
+
- 3.0.0
|
6
7
|
os:
|
7
8
|
- osx
|
8
9
|
- linux
|
9
10
|
gemfile:
|
10
11
|
- ci/Gemfile.rubocop-0.80
|
11
|
-
- ci/Gemfile.rubocop-0.81
|
12
12
|
- ci/Gemfile.rubocop-0.82
|
13
|
-
- ci/Gemfile.rubocop-0.83
|
14
13
|
- ci/Gemfile.rubocop-0.84
|
15
|
-
- ci/Gemfile.rubocop-0.85
|
16
14
|
- ci/Gemfile.rubocop-0.85.1
|
17
15
|
before_install:
|
18
16
|
- yes | gem update --system --force
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rfix (1.
|
4
|
+
rfix (1.4.1)
|
5
5
|
cri (~> 2.15.10)
|
6
|
+
dry-core (~> 0.5.0)
|
6
7
|
listen (~> 3.0)
|
7
8
|
rainbow (~> 3.0)
|
8
9
|
require_all (~> 3.0.0)
|
@@ -33,7 +34,7 @@ GEM
|
|
33
34
|
colorize (0.8.1)
|
34
35
|
concurrent-ruby (1.1.6)
|
35
36
|
contracts (0.16.0)
|
36
|
-
cri (2.15.
|
37
|
+
cri (2.15.11)
|
37
38
|
cucumber (4.0.1)
|
38
39
|
builder (~> 3.2, >= 3.2.3)
|
39
40
|
cucumber-core (~> 7.0, >= 7.0.0)
|
@@ -62,6 +63,8 @@ GEM
|
|
62
63
|
cucumber-cucumber-expressions (~> 10.1, >= 10.1.0)
|
63
64
|
cucumber-messages (~> 12.1, >= 12.1.1)
|
64
65
|
diff-lcs (1.3)
|
66
|
+
dry-core (0.5.0)
|
67
|
+
concurrent-ruby (~> 1.0)
|
65
68
|
faker (2.13.0)
|
66
69
|
i18n (>= 1.6, < 2)
|
67
70
|
ffi (1.13.1)
|
@@ -121,7 +124,7 @@ GEM
|
|
121
124
|
regexp_parser (1.7.1)
|
122
125
|
require_all (3.0.0)
|
123
126
|
rexml (3.2.4)
|
124
|
-
rouge (3.
|
127
|
+
rouge (3.26.0)
|
125
128
|
rspec (3.9.0)
|
126
129
|
rspec-core (~> 3.9.0)
|
127
130
|
rspec-expectations (~> 3.9.0)
|
@@ -131,6 +134,9 @@ GEM
|
|
131
134
|
rspec-expectations (3.9.2)
|
132
135
|
diff-lcs (>= 1.2.0, < 2.0)
|
133
136
|
rspec-support (~> 3.9.0)
|
137
|
+
rspec-its (1.3.0)
|
138
|
+
rspec-core (>= 3.0.0)
|
139
|
+
rspec-expectations (>= 3.0.0)
|
134
140
|
rspec-mocks (3.9.1)
|
135
141
|
diff-lcs (>= 1.2.0, < 2.0)
|
136
142
|
rspec-support (~> 3.9.0)
|
@@ -175,7 +181,8 @@ DEPENDENCIES
|
|
175
181
|
rake (~> 12.3)
|
176
182
|
rfix!
|
177
183
|
rspec (~> 3.0)
|
184
|
+
rspec-its (~> 1.3.0)
|
178
185
|
rubocop (~> 0.85)
|
179
186
|
|
180
187
|
BUNDLED WITH
|
181
|
-
2.
|
188
|
+
2.2.5
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# :bug:
|
1
|
+
# :bug: rfix [![Build Status](https://travis-ci.org/oleander/rfix-rb.svg?branch=master)](https://travis-ci.org/oleander/rfix-rb) [![Gem](https://img.shields.io/gem/dt/rfix)](https://rubygems.org/gems/rfix)
|
2
2
|
|
3
3
|
RuboCop CLI that only lints and auto-fixes code you committed by utilizing `git-log` and `git-diff`. Rfix CLI makes it possible to lint (`rfix lint`) and auto-fix (`rfix local|origin|branch`) code changes since a certain point in history. You can auto-fix code committed since creating the current branch (`rfix origin`) or since pushing to upstream (`rfix local`).
|
4
4
|
|
@@ -42,17 +42,10 @@ $ rfix # Displays this list of supported commands
|
|
42
42
|
|
43
43
|
### Setup
|
44
44
|
|
45
|
-
1. Download repository
|
46
|
-
- `$ git clone https://github.com/oleander/rfix-rb`
|
47
|
-
- `$ cd rfix-rb`
|
48
|
-
2. Downloads fixtures and run time dependencies
|
49
|
-
- `$ make dir fetch`
|
50
|
-
- `$ bundle install`
|
51
|
-
|
52
|
-
### Install from repository
|
53
|
-
|
54
45
|
``` shell
|
55
|
-
|
46
|
+
git clone https://github.com/oleander/rfix-rb
|
47
|
+
cd rfix-rb
|
48
|
+
bundle install
|
56
49
|
```
|
57
50
|
|
58
51
|
### Run tests
|
data/Rakefile
CHANGED
data/lib/rfix.rb
CHANGED
data/lib/rfix/formatter.rb
CHANGED
@@ -113,13 +113,15 @@ module Rfix
|
|
113
113
|
def report_line(_file, offense, _location, highlighted_area)
|
114
114
|
extra = " "
|
115
115
|
src = highlighted_source_line(offense).lines.map { |line| extra + line }.join("\n")
|
116
|
+
indent = Indentation.new(src, extra_indentation: 2)
|
117
|
+
src = indent.call
|
116
118
|
lines = @formatter.format(@lexer.lex(src)).gsub('\\e', CLI::UI::ANSI::ESC).lines.map(&:chomp)
|
117
119
|
out("\n\n")
|
118
120
|
out(lines.join("\n"), format: false)
|
119
|
-
b_pos = highlighted_area.begin_pos + extra.length
|
120
|
-
e_pos = highlighted_area.end_pos + extra.length
|
121
|
+
b_pos = highlighted_area.begin_pos + extra.length * 2 - indent.min_indentation
|
122
|
+
e_pos = highlighted_area.end_pos + extra.length * 2 - indent.min_indentation
|
121
123
|
size = e_pos - b_pos
|
122
|
-
out((" " * b_pos) + Rainbow((" " * size)).underline.bold)
|
124
|
+
out((" " * b_pos) + Rainbow((" " * [size, 0].max)).underline.bold)
|
123
125
|
out("\n\n")
|
124
126
|
end
|
125
127
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "dry/core/memoizable"
|
2
|
+
|
3
|
+
module Rfix
|
4
|
+
class Indentation
|
5
|
+
include Dry::Core::Memoizable
|
6
|
+
SPACE = " ".freeze
|
7
|
+
|
8
|
+
attr_reader :extra_indentation, :input
|
9
|
+
|
10
|
+
def initialize(input, extra_indentation: 0)
|
11
|
+
@input = input
|
12
|
+
@extra_indentation = extra_indentation
|
13
|
+
end
|
14
|
+
|
15
|
+
def stripped
|
16
|
+
lines.map do |line|
|
17
|
+
line.sub(/^\s{#{min_indentation}}/, "")
|
18
|
+
end.map do |line|
|
19
|
+
[SPACE * extra_indentation, line].join
|
20
|
+
end.join
|
21
|
+
end
|
22
|
+
|
23
|
+
alias call stripped
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def min_indentation
|
28
|
+
lines.map do |line|
|
29
|
+
line.match(/^\s*/)[0].length
|
30
|
+
end.min || 0
|
31
|
+
end
|
32
|
+
|
33
|
+
def lines
|
34
|
+
input.lines
|
35
|
+
end
|
36
|
+
|
37
|
+
memoize :min_indentation, :lines
|
38
|
+
end
|
39
|
+
end
|
data/lib/rfix/version.rb
CHANGED
data/rfix.gemspec
CHANGED
@@ -5,22 +5,11 @@ require_relative "lib/rfix/version"
|
|
5
5
|
# require_relative "lib/rfix/gem_helper"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
# extend GemHelper
|
9
|
-
|
10
8
|
spec.name = "rfix"
|
11
|
-
|
12
|
-
if ENV["TRAVIS"]
|
13
|
-
spec.version = "#{Rfix::VERSION}-#{ENV.fetch('TRAVIS_BUILD_NUMBER')}"
|
14
|
-
elsif ENV["GITHUB_RUN_ID"]
|
15
|
-
spec.version = "#{Rfix::VERSION}-#{ENV.fetch('GITHUB_RUN_ID')}"
|
16
|
-
else
|
17
|
-
# rubocop:disable Gemspec/DuplicatedAssignment
|
18
|
-
spec.version = Rfix::VERSION
|
19
|
-
# rubocop:enable Gemspec/DuplicatedAssignment
|
20
|
-
end
|
21
|
-
|
9
|
+
spec.version = Rfix::VERSION
|
22
10
|
spec.authors = ["Linus Oleander"]
|
23
11
|
spec.email = ["linus@oleander.nu"]
|
12
|
+
# rubocop:disable Layout/LineLength
|
24
13
|
spec.summary = "RuboCop CLI that only lints and auto-fixes code you committed by utilizing `git-log` and `git-diff`"
|
25
14
|
# rubocop:enable Layout/LineLength
|
26
15
|
|
@@ -52,6 +41,7 @@ Gem::Specification.new do |spec|
|
|
52
41
|
spec.requirements << "git, v2.0+"
|
53
42
|
|
54
43
|
spec.add_runtime_dependency "cri", "~> 2.15.10"
|
44
|
+
spec.add_runtime_dependency "dry-core", "~> 0.5.0"
|
55
45
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
56
46
|
spec.add_runtime_dependency "rainbow", "~> 3.0"
|
57
47
|
spec.add_runtime_dependency "require_all", "~> 3.0.0"
|
@@ -60,6 +50,7 @@ Gem::Specification.new do |spec|
|
|
60
50
|
spec.add_runtime_dependency "rugged", "~> 1.0.0"
|
61
51
|
|
62
52
|
spec.add_development_dependency "rspec", "~> 3.0"
|
53
|
+
spec.add_development_dependency "rspec-its", "~> 1.3.0"
|
63
54
|
spec.add_development_dependency "aruba", "~> 1.0"
|
64
55
|
spec.add_development_dependency "colorize", "~> 0.8.1"
|
65
56
|
spec.add_development_dependency "git", "~> 1.7.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.15.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.5.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: listen
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +142,20 @@ dependencies:
|
|
128
142
|
- - "~>"
|
129
143
|
- !ruby/object:Gem::Version
|
130
144
|
version: '3.0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rspec-its
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.3.0
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 1.3.0
|
131
159
|
- !ruby/object:Gem::Dependency
|
132
160
|
name: aruba
|
133
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -281,6 +309,7 @@ files:
|
|
281
309
|
- lib/rfix/file_cache.rb
|
282
310
|
- lib/rfix/formatter.rb
|
283
311
|
- lib/rfix/git_helper.rb
|
312
|
+
- lib/rfix/indentation.rb
|
284
313
|
- lib/rfix/loader/bundler.rb
|
285
314
|
- lib/rfix/loader/env.rb
|
286
315
|
- lib/rfix/loader/spec.rb
|
@@ -346,9 +375,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
346
375
|
version: 2.5.0
|
347
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
348
377
|
requirements:
|
349
|
-
- - "
|
378
|
+
- - ">="
|
350
379
|
- !ruby/object:Gem::Version
|
351
|
-
version:
|
380
|
+
version: '0'
|
352
381
|
requirements:
|
353
382
|
- git, v2.0+
|
354
383
|
rubygems_version: 3.0.3
|