puppet-lint-unquoted_string-check 1.0.0 → 2.0.0
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/puppet-lint-unquoted-string-check/version.rb +1 -1
 - data/lib/puppet-lint/plugins/check_unquoted_string_in_case.rb +3 -3
 - data/spec/puppet-lint/plugins/check_unquoted_string_in_case/check_unquoted_string_in_selector_spec.rb +16 -0
 - data/spec/spec_helper.rb +2 -4
 - metadata +4 -18
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 4b74178d306fe7d8673bba37f7589f143e743f1cabf422a99b1b8ebcc875b21f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 03a09e744bdac7f641f27ca688474218ad1d51481c419386dac4320fb9526ef9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7439c28358580769dd50f40418c0bf49e1d8b63228cc88899429fdf73250de5c965452903897a33b1dd437e3b3505c76dae7a621a61dc86e7b11626cb698af2d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d7dce532c741423327245e2a882ff54c8d49bd23158d9d34f5eb7bf195f01e5f00d2ab57fbbf71989913234a2f8c6385d2e6e93540d6256f8209a9d7aa7b0e92
         
     | 
| 
         @@ -36,7 +36,7 @@ def notify_tokens(type, sep_type, message) 
     | 
|
| 
       36 
36 
     | 
    
         
             
                  if r.type == sep_type
         
     | 
| 
       37 
37 
     | 
    
         
             
                    s = r.prev_token
         
     | 
| 
       38 
38 
     | 
    
         
             
                    while (s.type != :NEWLINE) && (s.type != :LBRACE)
         
     | 
| 
       39 
     | 
    
         
            -
                      if  
     | 
| 
      
 39 
     | 
    
         
            +
                      if s.type == :NAME || (s.type == :CLASSREF && !s.value.include?('::'))
         
     | 
| 
       40 
40 
     | 
    
         
             
                        notify :warning, {
         
     | 
| 
       41 
41 
     | 
    
         
             
                          :message => message,
         
     | 
| 
       42 
42 
     | 
    
         
             
                          :line    => s.line,
         
     | 
| 
         @@ -54,7 +54,7 @@ end 
     | 
|
| 
       54 
54 
     | 
    
         
             
            PuppetLint.new_check(:unquoted_string_in_case) do
         
     | 
| 
       55 
55 
     | 
    
         
             
              def check
         
     | 
| 
       56 
56 
     | 
    
         
             
                notify_tokens(:CASE, :COLON, 'unquoted string in case')
         
     | 
| 
       57 
     | 
    
         
            -
              end 
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
              def fix(problem)
         
     | 
| 
       60 
60 
     | 
    
         
             
                problem[:token].type = :SSTRING
         
     | 
| 
         @@ -64,7 +64,7 @@ end 
     | 
|
| 
       64 
64 
     | 
    
         
             
            PuppetLint.new_check(:unquoted_string_in_selector) do
         
     | 
| 
       65 
65 
     | 
    
         
             
              def check
         
     | 
| 
       66 
66 
     | 
    
         
             
                notify_tokens(:QMARK, :FARROW, 'unquoted string in selector')
         
     | 
| 
       67 
     | 
    
         
            -
              end 
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
              def fix(problem)
         
     | 
| 
       70 
70 
     | 
    
         
             
                problem[:token].type = :SSTRING
         
     | 
| 
         @@ -51,6 +51,22 @@ describe 'unquoted_string_in_selector' do 
     | 
|
| 
       51 
51 
     | 
    
         
             
                    expect(problems).to contain_warning(msg).on_line(2).in_column(11)
         
     | 
| 
       52 
52 
     | 
    
         
             
                  end
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                context ':TYPE in case' do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  let(:code) do
         
     | 
| 
      
 57 
     | 
    
         
            +
                    <<-PUPPET
         
     | 
| 
      
 58 
     | 
    
         
            +
                      $listen_socket = $service_bind ? {
         
     | 
| 
      
 59 
     | 
    
         
            +
                        Undef                   => undef,
         
     | 
| 
      
 60 
     | 
    
         
            +
                        Stdlib::IP::Address::V6 => "[${service_bind}]:${service_port}",
         
     | 
| 
      
 61 
     | 
    
         
            +
                        default                 => "${service_bind}:${service_port}",
         
     | 
| 
      
 62 
     | 
    
         
            +
                      }
         
     | 
| 
      
 63 
     | 
    
         
            +
                    PUPPET
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  it 'should not detect any problems' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                    expect(problems).to have(0).problems
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
       54 
70 
     | 
    
         
             
              end
         
     | 
| 
       55 
71 
     | 
    
         | 
| 
       56 
72 
     | 
    
         
             
              context 'with fix enabled' do
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: puppet-lint-unquoted_string-check
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Vox Pupuli
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-03-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: puppet-lint
         
     | 
| 
         @@ -86,20 +86,6 @@ dependencies: 
     | 
|
| 
       86 
86 
     | 
    
         
             
                - - ">="
         
     | 
| 
       87 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       88 
88 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       89 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       90 
     | 
    
         
            -
              name: mime-types
         
     | 
| 
       91 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
     | 
    
         
            -
                requirements:
         
     | 
| 
       93 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       94 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
     | 
    
         
            -
                    version: '1.0'
         
     | 
| 
       96 
     | 
    
         
            -
              type: :development
         
     | 
| 
       97 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       98 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       99 
     | 
    
         
            -
                requirements:
         
     | 
| 
       100 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       101 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
     | 
    
         
            -
                    version: '1.0'
         
     | 
| 
       103 
89 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       104 
90 
     | 
    
         
             
              name: coveralls
         
     | 
| 
       105 
91 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -152,9 +138,9 @@ require_paths: 
     | 
|
| 
       152 
138 
     | 
    
         
             
            - lib
         
     | 
| 
       153 
139 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       154 
140 
     | 
    
         
             
              requirements:
         
     | 
| 
       155 
     | 
    
         
            -
              - - " 
     | 
| 
      
 141 
     | 
    
         
            +
              - - "~>"
         
     | 
| 
       156 
142 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       157 
     | 
    
         
            -
                  version: ' 
     | 
| 
      
 143 
     | 
    
         
            +
                  version: '2.4'
         
     | 
| 
       158 
144 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       159 
145 
     | 
    
         
             
              requirements:
         
     | 
| 
       160 
146 
     | 
    
         
             
              - - ">="
         
     |