sas-linter 0.2.2 → 0.2.3
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/lib/sas_linter/rules/inconsistent_variable_case.rb +12 -2
- data/lib/sas_linter/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: 144b602b9b4eff14c301d9c04852f07f490e9557802f897eb4dd08acbf3d3fa4
|
|
4
|
+
data.tar.gz: 4aa7e953e1ed8a05cd1f4b94cf698086438a529604019120be0bcc0bb0530be3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74e7303ebdcfcfc616cd6e520f8984494d687b3c0c3af6dcba4efba91f7cbfefd61f511bfa535ae4ee9c4f6a481d4774a96b7a4ff20803ce2768782f2b39f5e6
|
|
7
|
+
data.tar.gz: 7a1dab42267ac076c9d992d7770871c386d52d6f4c6c2cc088372151b6f586e1ff12b963dcab26a47aa0b427396eef989c9f837805a4183e35c43a734b8fbd41
|
|
@@ -61,9 +61,19 @@ class SasLinter
|
|
|
61
61
|
def autofix(source)
|
|
62
62
|
return source if source.nil? || source.empty?
|
|
63
63
|
|
|
64
|
+
# If a previous rule's autofix returned ASCII-8BIT (e.g.
|
|
65
|
+
# EncodingIssues#autofix walks bytes and returns binary), tag
|
|
66
|
+
# it UTF-8 before slicing. The lexer treats the bytes as UTF-8
|
|
67
|
+
# and reports character offsets either way; only Ruby's
|
|
68
|
+
# `String#[]=` cares about the encoding label, and it indexes
|
|
69
|
+
# by bytes for ASCII-8BIT but by characters for UTF-8 — so a
|
|
70
|
+
# binary tag plus any multi-byte sequence earlier in the file
|
|
71
|
+
# would shift every replacement by the byte/char gap.
|
|
72
|
+
src = source.encoding == Encoding::UTF_8 ? source : source.dup.force_encoding("UTF-8")
|
|
73
|
+
|
|
64
74
|
lexer = SasLexer::Lexer.new
|
|
65
75
|
begin
|
|
66
|
-
all_tokens = lexer.tokenize(
|
|
76
|
+
all_tokens = lexer.tokenize(src)
|
|
67
77
|
ensure
|
|
68
78
|
lexer.free
|
|
69
79
|
end
|
|
@@ -78,7 +88,7 @@ class SasLinter
|
|
|
78
88
|
end
|
|
79
89
|
|
|
80
90
|
# Apply right-to-left so earlier offsets stay valid.
|
|
81
|
-
out =
|
|
91
|
+
out = src.dup
|
|
82
92
|
edits.sort_by! { |start, _, _| -start }
|
|
83
93
|
edits.each { |start, finish, repl| out[start...finish] = repl }
|
|
84
94
|
out
|
data/lib/sas_linter/version.rb
CHANGED