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: db94405eb8ee7f4c24d7ae32f9f7fd257f2ec433
4
- data.tar.gz: ca47c10e5dac8c86e45d91ff5d7ab269b1601a72
3
+ metadata.gz: dc0cdd19118e86642e05ef4265d61ca248d4bfaa
4
+ data.tar.gz: 12686eb3b86f97358ebd8ee70412f8af4bd29da2
5
5
  SHA512:
6
- metadata.gz: b05377e9b9e0e030479cdd828fa01d88ce717c36189d684d192fb31b36da9d978fe6de93ce71b407bec079ae4da53a2bae0a575a8981b1563400da0be678a0ac
7
- data.tar.gz: c8e95833cf002804d5564818302bffb9e43e0bbf9c41ff1573bc79168874f6865feb1a156255cf90d603d1846f79e5331a136491fda12c56e1895e24c6d0b551
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
- if manifest_lines.length < 2
3
+ last_line = manifest_lines.last
4
+ unless last_line.start_with?('# vim:')
4
5
  notify :warning, {
5
- :message => 'expected vim modeline at the end of the file',
6
- :line => tokens.last.line,
7
- :column => manifest_lines.last.length,
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 at the end of the file' }
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:\n'\n" }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-vim_modeline-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Pearce