puppet-lint-vim_modeline-check 0.0.1 → 0.0.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc0cdd19118e86642e05ef4265d61ca248d4bfaa
|
4
|
+
data.tar.gz: 12686eb3b86f97358ebd8ee70412f8af4bd29da2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 852317ee116b1e24725950def06f3399cf88587366f3c89a3f8f809c5b0e91faac49cdf2ba987bf20c5826844b2a87aaf0eb141a87ab32a6f4065caf9c479778
|
7
|
+
data.tar.gz: 6fe5954c0eab8b006b665e65716c7d6e158bd7ca4c870f44f75bfd662b510100bfcffd8f6e54c34077610cb1004a400cc135bfc1c349523896175cb311637585
|
@@ -1,20 +1,12 @@
|
|
1
1
|
PuppetLint.new_check(:vim_modeline) do
|
2
2
|
def check
|
3
|
-
|
3
|
+
last_line = manifest_lines.last
|
4
|
+
unless last_line.start_with?('# vim:')
|
4
5
|
notify :warning, {
|
5
|
-
:message => 'expected vim modeline
|
6
|
-
:line =>
|
7
|
-
:column =>
|
6
|
+
:message => 'expected vim modeline as last line of file',
|
7
|
+
:line => manifest_lines.length,
|
8
|
+
:column => last_line.length,
|
8
9
|
}
|
9
|
-
else
|
10
|
-
last_real_line = manifest_lines[-2]
|
11
|
-
unless last_real_line.start_with?('# vim:')
|
12
|
-
notify :warning, {
|
13
|
-
:message => 'expected vim modeline at the end of the file',
|
14
|
-
:line => (manifest_lines.length - 1),
|
15
|
-
:column => last_real_line.length,
|
16
|
-
}
|
17
|
-
end
|
18
10
|
end
|
19
11
|
end
|
20
12
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'vim_modeline' do
|
4
|
-
let(:msg) { 'expected vim modeline
|
4
|
+
let(:msg) { 'expected vim modeline as last line of file' }
|
5
5
|
|
6
6
|
context 'with fix disabled' do
|
7
7
|
context 'code not ending with a vim modeline' do
|
@@ -17,7 +17,7 @@ describe 'vim_modeline' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'code ending with a vim modeline' do
|
20
|
-
let(:code) { "'blah\nblah\n# vim: set ts=2 sw=2 tw=0 et
|
20
|
+
let(:code) { "'blah\nblah\n# vim: set ts=2 sw=2 tw=0 et:'\n" }
|
21
21
|
|
22
22
|
it 'should not detect any problems' do
|
23
23
|
expect(problems).to have(0).problems
|