rubocop-kata 0.10.0 → 0.10.1
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/CHANGELOG.md +16 -0
- data/lib/rubocop/cop/kata/class_in_module.rb +1 -1
- data/lib/rubocop/cop/kata/no_redundant_variable.rb +1 -5
- data/lib/rubocop/kata/checkup.rb +1 -1
- data/lib/rubocop/kata/plan.rb +1 -1
- data/lib/rubocop/kata/variable/gap.rb +0 -1
- data/lib/rubocop/kata/variable/inlining.rb +2 -6
- data/lib/rubocop/kata/variable/ledger.rb +4 -5
- data/lib/rubocop/kata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67fd1df1d6f816ac27f7969320250449416c2b71980ef0dadd39a1d78207f4cb
|
|
4
|
+
data.tar.gz: f83bb88a676abf910f72fbbedf3dfc9dfc9176eded439eb8023c6a27d8d71cf1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2afc835dcecd65616f50ebb5f5eb192fafb21260e934053277b92f960f8d00823e717e3267de944ad83fa4a23669c22a531afe60bdad608afef4ef4f81905bbd
|
|
7
|
+
data.tar.gz: 2ff3ae8982141f62ed38135363951b2d911bc0c1c46158dd7a691f2092a08f771c2d32411d24444beb2ec143b138f7d78518f2b7968e44cebe6462ec62f7f7db
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.10.1] - 2026-09-26
|
|
6
|
+
|
|
7
|
+
- `Kata/ClassInModule` names the class in its message again: it read
|
|
8
|
+
`Class {name: "Foo"} must be…` because the name went in as a keyword.
|
|
9
|
+
- `rubocop-kata plan` keeps its "these mint the names `naming` then prices"
|
|
10
|
+
note for the `structure` stage; it was also printed when `naming` or `prose`
|
|
11
|
+
came next, where it does not hold.
|
|
12
|
+
- Mutation testing with Kimera (`.kimera.yml`, `bundle exec kimera run`) now
|
|
13
|
+
kills every mutant in `lib/`; the specs that got there pin the argument and
|
|
14
|
+
class-variable hooks, the boundaries, and the correctors' edge cases. Dead
|
|
15
|
+
guards it surfaced in `NoRedundantVariable`'s helpers and `doctor` are gone.
|
|
16
|
+
CI keeps it there with `kimera ci`: pull requests gate on the lines they
|
|
17
|
+
change, pushes to `main` on the full run.
|
|
18
|
+
|
|
3
19
|
## [0.10.0] - 2026-08-30
|
|
4
20
|
|
|
5
21
|
- `Elegant/NoRedundantVariable`, `Elegant/PairedBrackets`, and
|
|
@@ -11,7 +11,7 @@ class RuboCop::Cop::Kata::ClassInModule < RuboCop::Cop::Base
|
|
|
11
11
|
def on_class(node)
|
|
12
12
|
return if namespaced?(node)
|
|
13
13
|
return if scoped?(node)
|
|
14
|
-
add_offense(node, message: format(MSG,
|
|
14
|
+
add_offense(node, message: format(MSG, label(node)))
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
private
|
|
@@ -38,15 +38,11 @@ class RuboCop::Cop::Kata::NoRedundantVariable < RuboCop::Cop::Base
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def swallows?(assign, singles)
|
|
41
|
-
|
|
42
|
-
singles.any? do |_, read|
|
|
43
|
-
read.source_range.begin_pos > range.begin_pos && read.source_range.end_pos <= range.end_pos
|
|
44
|
-
end
|
|
41
|
+
singles.any? { |_, read| assign.source_range.contains?(read.source_range) }
|
|
45
42
|
end
|
|
46
43
|
|
|
47
44
|
def solo?(assign)
|
|
48
45
|
range = assign.source_range
|
|
49
|
-
return false unless range.first_line == range.last_line
|
|
50
46
|
range.source_buffer.source_line(range.first_line).strip == range.source.strip
|
|
51
47
|
end
|
|
52
48
|
end
|
data/lib/rubocop/kata/checkup.rb
CHANGED
|
@@ -40,7 +40,7 @@ class RuboCop::Kata::Checkup
|
|
|
40
40
|
|
|
41
41
|
def off?(key) = project.dig(key, "Enabled") == false
|
|
42
42
|
|
|
43
|
-
def project = @_project ||=
|
|
43
|
+
def project = @_project ||= YAML.safe_load_file(file, aliases: true) || {}
|
|
44
44
|
|
|
45
45
|
def dead = targets.flat_map { directives(it) }
|
|
46
46
|
|
data/lib/rubocop/kata/plan.rb
CHANGED
|
@@ -69,7 +69,7 @@ class RuboCop::Kata::Plan
|
|
|
69
69
|
format(NEXT, stage, picked.length, plural(picked), files.length, plural(files), note(stage))
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
def note(stage) = stage ==
|
|
72
|
+
def note(stage) = stage == "structure" ? MINTS : ""
|
|
73
73
|
|
|
74
74
|
def hottest(picked) = picked.map { it.fetch("path") }.tally.max_by(&:last)
|
|
75
75
|
|
|
@@ -36,7 +36,6 @@ class RuboCop::Kata::Variable::Gap
|
|
|
36
36
|
def before(parent, child, assign)
|
|
37
37
|
kids = parent.children
|
|
38
38
|
stop = kids.index { it.equal?(child) }
|
|
39
|
-
return [] if stop.nil?
|
|
40
39
|
kids[(parent.equal?(assign.parent) ? kids.index { it.equal?(assign) } + 1 : 0)...stop]
|
|
41
40
|
end
|
|
42
41
|
|
|
@@ -23,14 +23,10 @@ class RuboCop::Kata::Variable::Inlining
|
|
|
23
23
|
|
|
24
24
|
def pair
|
|
25
25
|
parent = @read.parent
|
|
26
|
-
|
|
27
|
-
key, value = parent.children
|
|
28
|
-
parent if value.equal?(@read) && key.source_range == value.source_range
|
|
26
|
+
parent if parent.pair_type? && parent.value_omission?
|
|
29
27
|
end
|
|
30
28
|
|
|
31
|
-
def value = wrap? ? "(#{
|
|
32
|
-
|
|
33
|
-
def braced = @rhs.hash_type? && @rhs.loc.begin.nil? ? "{ #{@rhs.source} }" : @rhs.source
|
|
29
|
+
def value = wrap? ? "(#{@rhs.source})" : @rhs.source
|
|
34
30
|
|
|
35
31
|
def wrap? = !primary? || (@rhs.hash_type? && bare?)
|
|
36
32
|
|
|
@@ -31,20 +31,19 @@ class RuboCop::Kata::Variable::Ledger
|
|
|
31
31
|
|
|
32
32
|
def tainted
|
|
33
33
|
nodes.select { it.op_asgn_type? || it.or_asgn_type? || it.and_asgn_type? }.map { it.children.first }
|
|
34
|
-
.select
|
|
34
|
+
.select(&:lvasgn_type?).map { it.children.first }
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def nodes(node = @body, found = [])
|
|
38
|
-
return found
|
|
38
|
+
return found if node.def_type? || node.defs_type?
|
|
39
39
|
found << node
|
|
40
40
|
node.each_child_node { nodes(it, found) }
|
|
41
41
|
found
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def statement?(node)
|
|
45
|
-
return false unless node.children.size == 2
|
|
46
45
|
parent = node.parent
|
|
47
|
-
parent = parent.parent while
|
|
48
|
-
|
|
46
|
+
parent = parent.parent while parent.type == :begin && parent.children.size == 1
|
|
47
|
+
STATEMENT_PARENTS.include?(parent.type)
|
|
49
48
|
end
|
|
50
49
|
end
|
data/lib/rubocop/kata/version.rb
CHANGED