Skip to content

Commit 1e63f11

Browse files
authored
Merge pull request #246 from glennsarti/update-puppet-lint
Update puppet lint - 2.3.5
2 parents 0f8af70 + 94e935b commit 1e63f11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+299
-67
lines changed

server/Rakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ task :gem_revendor do
4141
{
4242
:directory => 'puppet-lint',
4343
:github_repo => 'https://github.com/rodjek/puppet-lint.git',
44-
:github_ref => '2.3.3',
44+
:github_ref => '2.3.5',
4545
}
4646
]
4747

4848
# Clean out the vendor directory first
4949
puts "Clearing the vendor directory..."
5050
vendor_dir = File.join(File.dirname(__FILE__),'vendor')
51-
FileUtils.rm_rf(vendor_dir) if Dir.exists?(vendor_dir)
52-
Dir.mkdir(vendor_dir)
51+
gem_list.each do |vendor|
52+
gem_dir = File.join(vendor_dir,vendor[:directory])
53+
FileUtils.rm_rf(gem_dir) if Dir.exists?(gem_dir)
54+
end
55+
Dir.mkdir(vendor_dir) unless Dir.exists?(vendor_dir)
5356

5457
gem_list.each do |vendor|
5558
puts "Vendoring #{vendor[:directory]}..."
@@ -82,7 +85,7 @@ Gem List
8285
--------
8386
8487
HEREDOC
85-
gem_list.each { |vendor| readme += "* #{vendor[:directory]} (#{vendor[:github_repo]} ref #{vendor[:github_ref]})"}
88+
gem_list.each { |vendor| readme += "* #{vendor[:directory]} (#{vendor[:github_repo]} ref #{vendor[:github_ref]})\n"}
8689
File.open(File.join(vendor_dir,'README.md'), 'wb') { |file| file.write(readme + "\n") }
8790
end
8891

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
class example_manifest_with_multiple_lint_errors
3+
{
4+
5+
# --------------------------------------------------------------------
6+
# Set cipher suites order as secure as possible (Enables Perfect Forward Secrecy)
7+
# Remediation list per CIS IIS 8 Benchmark v1.4.0 - 08-24-2015 (minus 3DES)
8+
# Removed DHE per ITSec on 4/6/16
9+
# TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 and TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
10+
# --------------------------------------------------------------------
11+
$cipherSuitesOrder = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256, \
12+
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256, \
13+
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256, \
14+
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256, \
15+
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384, \
16+
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256"
17+
18+
registry::value { 'Cipher Suites':
19+
key => 'HKLM\\SOFTWARE\\Policies\\Microsoft\\Cryptography\\Configuration\\SSL\\00010002',
20+
type => string,
21+
value => 'Functions',
22+
data => $cipherSuitesOrder,
23+
}
24+
25+
# --------------------------------------------------------------------
26+
# Disable IP Source Routing - Microsoft Security Bulletin MS06-032
27+
# --------------------------------------------------------------------
28+
registry::value { 'DisableIPSourceRouting0':
29+
key => 'HKLM\\System\\CurrentControlSet\\Services\\Tcpip\\Parameters',
30+
type => 'dword',
31+
value => 'DisableIPSourceRouting',
32+
data => 2,
33+
}
34+
35+
# --------------------------------------------------------------------
36+
# Disable IPv6 Source Routing - Microsoft Security Bulletin MS06-032
37+
# --------------------------------------------------------------------
38+
registry_value { 'HKLM\System\CurrentControlSet\Services\Tcpip6\Parameters\DisableIPSourceRouting':
39+
ensure => present,
40+
type => dword,
41+
data => 2,
42+
notify => Reboot['after_run'],
43+
}
44+
45+
#Reboot Computer
46+
reboot { 'after_run':
47+
apply => finished,
48+
}
49+
50+
}

server/spec/languageserver/integration/puppet-languageserver/document_validator_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@
146146
end
147147
end
148148

149+
describe "Given a complete manifest with linting errors" do
150+
let(:manifest_fixture) { File.join($fixtures_dir,'manifest_with_lint_errors.pp') }
151+
let(:manifest_lf) { File.open(manifest_fixture, 'r') { |file| file.read } }
152+
let(:manifest_crlf) { File.open(manifest_fixture, 'r') { |file| file.read }.gsub("\n","\r\n") }
153+
154+
it "should return same errors for both LF and CRLF line endings" do
155+
lint_error_lf = subject.validate(manifest_lf, nil)
156+
lint_error_crlf = subject.validate(manifest_crlf, nil)
157+
expect(lint_error_crlf).to eq(lint_error_lf)
158+
end
159+
end
160+
149161
describe "Given a complete manifest with a single linting error" do
150162
let(:manifest) { "
151163
user { 'Bob':

server/spec/languageserver/spec_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
$LOAD_PATH.unshift(File.join(root,'vendor','puppet-lint','lib'))
88

99
require 'puppet-languageserver'
10-
fixtures_dir = File.join(File.dirname(__FILE__),'fixtures')
10+
$fixtures_dir = File.join(File.dirname(__FILE__),'fixtures')
1111

1212
# Currently there is no way to re-initialize the puppet loader so for the moment
1313
# all tests must run off the single puppet config settings instead of per example setting
1414
server_options = PuppetLanguageServer::CommandLineParser.parse([])
15-
server_options[:puppet_settings] = ['--vardir',File.join(fixtures_dir,'cache'),
16-
'--confdir',File.join(fixtures_dir,'confdir')]
15+
server_options[:puppet_settings] = ['--vardir',File.join($fixtures_dir,'cache'),
16+
'--confdir',File.join($fixtures_dir,'confdir')]
1717
PuppetLanguageServer::init_puppet(server_options)
1818

1919
def wait_for_puppet_loading

server/vendor/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ Note - To improve the packaging size, test files etc. were stripped from the Gem
1111
Gem List
1212
--------
1313

14-
* puppet-lint (https://github.com/rodjek/puppet-lint.git ref 2.3.3)
14+
* puppet-lint (https://github.com/rodjek/puppet-lint.git ref 2.3.5)
15+

server/vendor/puppet-lint/.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Metrics/LineLength:
6060
# Offense count: 65
6161
# Configuration parameters: CountComments.
6262
Metrics/MethodLength:
63-
Max: 94
63+
Max: 105
6464

6565
# Offense count: 18
6666
Metrics/PerceivedComplexity:

server/vendor/puppet-lint/CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Change Log
22

3+
## [2.3.5](https://github.com/rodjek/puppet-lint/tree/2.3.5) (2018-03-27)
4+
[Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.4...2.3.5)
5+
6+
**Fixed bugs:**
7+
8+
- v2.3.4 breakage - 'wrong number of arguments' when using Rake task [\#812](https://github.com/rodjek/puppet-lint/issues/812)
9+
10+
**Merged pull requests:**
11+
12+
- Make PuppetLint::OptParser.build argument optional [\#813](https://github.com/rodjek/puppet-lint/pull/813) ([rodjek](https://github.com/rodjek))
13+
14+
## [2.3.4](https://github.com/rodjek/puppet-lint/tree/2.3.4) (2018-03-26)
15+
[Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.3...2.3.4)
16+
17+
**Implemented enhancements:**
18+
19+
- Allow ignoring default configurations files on the command line [\#787](https://github.com/rodjek/puppet-lint/issues/787)
20+
- Implement --list-checks feature, to list the names of all available checks from the cli. [\#804](https://github.com/rodjek/puppet-lint/pull/804) ([xraystyle](https://github.com/xraystyle))
21+
- Option to disable loading default configurations files [\#789](https://github.com/rodjek/puppet-lint/pull/789) ([dioni21](https://github.com/dioni21))
22+
- Allow passing ignore\_paths from cli [\#783](https://github.com/rodjek/puppet-lint/pull/783) ([keymone](https://github.com/keymone))
23+
24+
**Fixed bugs:**
25+
26+
- Bad value for range [\#801](https://github.com/rodjek/puppet-lint/issues/801)
27+
- puppet-lint doesn't handle CRLFs very well [\#778](https://github.com/rodjek/puppet-lint/issues/778)
28+
- Configuration's ignore\_paths is not respected [\#774](https://github.com/rodjek/puppet-lint/issues/774)
29+
- Error when including class and missing a colon [\#507](https://github.com/rodjek/puppet-lint/issues/507)
30+
31+
**Merged pull requests:**
32+
33+
- Handle single colon in resource name syntax error [\#809](https://github.com/rodjek/puppet-lint/pull/809) ([rodjek](https://github.com/rodjek))
34+
- \(\#778\) Don't include line ending in single line comment token values [\#782](https://github.com/rodjek/puppet-lint/pull/782) ([rodjek](https://github.com/rodjek))
35+
- Fix setting ignore\_paths in Rake task [\#777](https://github.com/rodjek/puppet-lint/pull/777) ([alzabo](https://github.com/alzabo))
36+
- Add support for passing backslash separated paths to puppet-lint [\#769](https://github.com/rodjek/puppet-lint/pull/769) ([rodjek](https://github.com/rodjek))
37+
338
## [2.3.3](https://github.com/rodjek/puppet-lint/tree/2.3.3) (2017-09-28)
439
[Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.2...2.3.3)
540

server/vendor/puppet-lint/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Status](https://secure.travis-ci.org/rodjek/puppet-lint.png)](http://travis-ci.o
55
[![Inline docs](http://inch-ci.org/github/rodjek/puppet-lint.png?branch=master)](http://inch-ci.org/github/rodjek/puppet-lint)
66

77
Puppet Lint tests Puppet code against the recommended [Puppet language style
8-
guide](http://docs.puppet.com/puppet/latest/style_guide.html). Puppet Lint validates only code style; it does not validate syntax. To test syntax, use Puppet's `puppet parser validate` command.
8+
guide](http://puppet.com/docs/puppet/latest/style_guide.html). Puppet Lint validates only code style; it does not validate syntax. To test syntax, use Puppet's `puppet parser validate` command.
99

1010
## Compatibility warning
1111

@@ -45,6 +45,10 @@ puppet-lint --fix /modules
4545

4646
Puppet Lint options allow you to modify which checks to run. You can disable any of the checks temporarily or permanently, or you can limit testing to specific checks.
4747

48+
#### List all available checks
49+
50+
To list all available checks along with basic usage documentation, use the `--list-checks` option.
51+
4852
#### Run specific checks
4953

5054
To run only specific checks, use the `--only-checks` option, with a comma-separated list of arguments specifying which checks to make:
@@ -65,7 +69,7 @@ You can disable specific Lint checks on the command line, disable them permanent
6569

6670
#### Disable checks on the command line
6771

68-
To disable any of the checks when running the `puppet-lint` command, add a `--no-<check name>-check` flag to the command. For example, to skip the 140-character check, run:
72+
To disable any of the checks when running the `puppet-lint` command, add a `--no-<check_name>-check` flag to the command. For example, to skip the 140-character check, run:
6973

7074
```
7175
puppet-lint --no-140chars-check modules/

server/vendor/puppet-lint/Rakefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ begin
1212
GitHubChangelogGenerator::RakeTask.new(:changelog) do |config|
1313
version = PuppetLint::VERSION
1414
config.future_release = version.to_s
15-
config.exclude_labels = %w[duplicate question invalid wontfix release-pr]
15+
config.exclude_labels = %w[duplicate question invalid wontfix release-pr documentation]
16+
config.enhancement_labels = %w[feature]
1617
end
1718
rescue LoadError
1819
$stderr.puts 'Changelog generation requires Ruby 2.0 or higher'
@@ -23,6 +24,14 @@ begin
2324

2425
RuboCop::RakeTask.new(:rubocop) do |task|
2526
task.options = %w[-D -E]
27+
task.patterns = [
28+
'lib/**/*.rb',
29+
'spec/**/*.rb',
30+
'bin/*',
31+
'*.gemspec',
32+
'Gemfile',
33+
'Rakefile',
34+
]
2635
end
2736
rescue LoadError
2837
$stderr.puts 'Rubocop is not available for this version of Ruby.'

server/vendor/puppet-lint/lib/puppet-lint.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
class PuppetLint::NoCodeError < StandardError; end
1414
class PuppetLint::NoFix < StandardError; end
1515

16+
# Parser Syntax Errors
17+
class PuppetLint::SyntaxError < StandardError
18+
attr_reader :token
19+
20+
def initialize(token)
21+
@token = token
22+
end
23+
end
24+
1625
# Public: The public interface to puppet-lint.
1726
class PuppetLint
1827
# Public: Gets/Sets the String manifest code to be checked.
@@ -75,7 +84,7 @@ def file=(path)
7584
return unless File.exist?(path)
7685

7786
@path = path
78-
File.open(path, 'r:UTF-8') do |f|
87+
File.open(path, 'rb:UTF-8') do |f|
7988
@code = f.read
8089
end
8190

0 commit comments

Comments
 (0)