sqlint 0.0.4 → 0.0.5
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/README.md +5 -3
- data/bin/sqlint +14 -1
- data/lib/sqlint/version.rb +1 -1
- 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: efe566a4b8ebe9684a0f16fad5069040ea7c71b3
|
4
|
+
data.tar.gz: f56d2b20dfa6d9f4615551a4711fa196c4ab11f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e88ab080386db0601b5bf0b8a146dc0cb7d62faeb927413e92f1b8fa3119f49fa39ab0b27997c66df644734a49e28826c61560001e4c1573c74370882361c715
|
7
|
+
data.tar.gz: 6bc32615630fc20a39047560cb7752f7d28480dbd392cf388f8d59fee0fe19c298cc6954766fdb274806aad7f3fb1ef2e896d33c691a98ed44cabce5aa8034cc
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://travis-ci.org/purcell/sqlint)
|
2
|
+
|
1
3
|
## SQLint - a simple SQL linter
|
2
4
|
|
3
5
|
### About
|
@@ -29,9 +31,9 @@ sqlint filename.sql
|
|
29
31
|
|
30
32
|
Support for `sqlint` is provided for the following editors:
|
31
33
|
|
32
|
-
- Emacs, via Flycheck (submission pending)
|
33
|
-
- VIM, via Syntastic (submission pending)
|
34
|
-
- SublimeText, via the SublimeLinter package (submission pending)
|
34
|
+
- Emacs, via Flycheck ([submission pending](https://github.com/flycheck/flycheck/pull/691))
|
35
|
+
- VIM, via Syntastic ([submission pending](https://github.com/scrooloose/syntastic/pull/1477))
|
36
|
+
- SublimeText, via the SublimeLinter package ([submission pending](https://github.com/SublimeLinter/SublimeLinter3/issues/297))
|
35
37
|
|
36
38
|
### Authors
|
37
39
|
|
data/bin/sqlint
CHANGED
@@ -14,13 +14,26 @@ if ARGV.include?("--version")
|
|
14
14
|
exit 0
|
15
15
|
end
|
16
16
|
|
17
|
+
if ARGV.empty? || ARGV.include?("--help") || ARGV.include?("-h")
|
18
|
+
puts "Usage: sqlint file.sql ..."
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
|
17
22
|
ERROR_TYPES = {error: "ERROR", warning: "WARNING"}
|
18
23
|
|
24
|
+
class String
|
25
|
+
def sanitise
|
26
|
+
gsub(/[[:cntrl:]+]/) do |bad|
|
27
|
+
bad.codepoints.map { |c| "\\%04d" % c }.join
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
ARGV.each do |filename|
|
20
33
|
File.open(filename, 'r') do |file|
|
21
34
|
results = SQLint::Linter.new(filename, file).run
|
22
35
|
results.each do |lint|
|
23
|
-
message_lines = lint.message.split("\n")
|
36
|
+
message_lines = lint.message.sanitise.split("\n")
|
24
37
|
puts [
|
25
38
|
lint.filename,
|
26
39
|
lint.line,
|
data/lib/sqlint/version.rb
CHANGED