barking_iguana-cf_lint 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3a8b9fb349c3de683109d78d43afbb0147fae089
4
+ data.tar.gz: 2ac2a22aa987453a1614d05d36528d69fefb06ee
5
+ SHA512:
6
+ metadata.gz: 11efcb297bd8a0a1feac78ec4a840475d5c03dd67d4ef62d015d1b77297a10f6db48bc4850f4b6922182ff4513f032b129d2f6bdab94a9e7dd6152b68d7ccd9d
7
+ data.tar.gz: 5500d972c4c6ac3fd533c995fffc0f40385a81fe666ceab8e86b7df1c9f53241dc94249d1cdd53a8612f2600fe491765b59353e5bcc0d511d35f21d26ebf62e0
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.4
5
+ before_install: gem install bundler -v 1.16.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in cf_lint.gemspec
6
+ gemspec
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ barking_iguana-cf_lint (0.0.1)
5
+ barking_iguana-benchmark
6
+ barking_iguana-logging
7
+ cfn-model
8
+ colorize
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ barking_iguana-benchmark (0.1.1)
14
+ barking_iguana-logging (0.1.7)
15
+ barking_iguana-otk
16
+ term-ansicolor
17
+ barking_iguana-otk (0.1.0)
18
+ cfn-model (0.1.12)
19
+ kwalify (= 0.7.2)
20
+ colorize (0.8.1)
21
+ diff-lcs (1.3)
22
+ docile (1.1.5)
23
+ json (2.1.0)
24
+ kwalify (0.7.2)
25
+ rake (10.5.0)
26
+ rspec (3.7.0)
27
+ rspec-core (~> 3.7.0)
28
+ rspec-expectations (~> 3.7.0)
29
+ rspec-mocks (~> 3.7.0)
30
+ rspec-core (3.7.0)
31
+ rspec-support (~> 3.7.0)
32
+ rspec-expectations (3.7.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.7.0)
35
+ rspec-mocks (3.7.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.7.0)
38
+ rspec-support (3.7.0)
39
+ simplecov (0.15.1)
40
+ docile (~> 1.1.0)
41
+ json (>= 1.8, < 3)
42
+ simplecov-html (~> 0.10.0)
43
+ simplecov-html (0.10.2)
44
+ term-ansicolor (1.6.0)
45
+ tins (~> 1.0)
46
+ tins (1.14.0)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ barking_iguana-cf_lint!
53
+ bundler (~> 1.13)
54
+ rake (~> 10.0)
55
+ rspec (~> 3.0)
56
+ simplecov
57
+
58
+ BUNDLED WITH
59
+ 1.16.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Craig R Webster, Barking Iguana Ltd <craig@barkingiguana.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # CF Lint
2
+
3
+ For docs see [`docs/index.md`][0].
4
+
5
+ [0]: https://barkingiguana.github.io/cf_lint/
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'barking_iguana/cf_lint/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'barking_iguana-cf_lint'
8
+ spec.version = BarkingIguana::CfLint::VERSION
9
+ spec.authors = ['Craig R Webster']
10
+ spec.email = ['craig@barkingiguana.com']
11
+ spec.license = 'MIT'
12
+
13
+ spec.summary = 'Linting framework for CloudFoundation'
14
+ spec.description = spec.summary
15
+ spec.homepage = 'https://github.com/barkingiguana.com/cf_lint'
16
+
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
22
+ else
23
+ raise "RubyGems 2.0 or newer is required to protect against " \
24
+ "public gem pushes."
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.13"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency 'simplecov'
38
+
39
+ spec.required_ruby_version = '~> 2.2'
40
+
41
+ spec.add_runtime_dependency 'barking_iguana-logging'
42
+ spec.add_runtime_dependency 'barking_iguana-benchmark'
43
+ spec.add_runtime_dependency 'colorize'
44
+ spec.add_runtime_dependency 'cfn-model'
45
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "barking_iguana/cf_lint"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,11 @@
1
+ # CHANGELOG
2
+
3
+ Entries are in reverse chronological order.
4
+
5
+ ## *0.0.2* (Current Development)
6
+
7
+ * ...
8
+
9
+ ## *0.0.1* (2017-12-20)
10
+
11
+ * Initial release.
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-minimal
@@ -0,0 +1,29 @@
1
+ # BarkingIguana::CfLint
2
+
3
+ Linter for CloudFoundation templates.
4
+
5
+ Documentation coming soon!
6
+
7
+ ## Development
8
+
9
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
10
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
11
+ prompt that will allow you to experiment.
12
+
13
+ To install this gem onto your local machine, run `bundle exec rake install`. To
14
+ release a new version, update the version number in `version.rb`, and then run
15
+ `bundle exec rake release`, which will create a git tag for the version, push
16
+ git commits and tags, and push the `.gem` file to [rubygems.org][0].
17
+
18
+ ## Contributing
19
+
20
+ Bug reports and pull requests are welcome on [the project at GitHub][1].
21
+
22
+ If you'd like to contribute features, please do discuss them by opening an issue on GitHub.
23
+
24
+ Please keep [docs/CHANGELOG.md][2] updated as you add/remove/change things.
25
+
26
+
27
+ [0]: https://rubygems.org
28
+ [1]: http://barkingiguana.com/cf_lint
29
+ [2]: http://barkingiguana.com/cf_lint/CHANGELOG
@@ -0,0 +1,6 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Resources:
3
+ S3Bucket:
4
+ Type: AWS::S3::Bucket
5
+ Properties:
6
+ AccessControl: LogDeliveryWrite
@@ -0,0 +1 @@
1
+ BARKINGIGUANA/S3/NO_PUBLIC_READ_WRITE_ACL CRITICAL
@@ -0,0 +1,6 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Resources:
3
+ S3Bucket:
4
+ Type: AWS::S3::Bucket
5
+ Properties:
6
+ AccessControl: PublicRead
@@ -0,0 +1,6 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Resources:
3
+ S3Bucket:
4
+ Type: AWS::S3::Bucket
5
+ Properties:
6
+ AccessControl: PublicReadWrite
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ cd $(dirname $0)/..
4
+ bundle
5
+ exec bundle exec ./exe/cf-lint -t ./examples/log-delivery-s3-bucket.yml -t ./examples/public-read-s3-bucket.yml -t ./examples/public-read-write-s3-bucket.yml -r examples/ -p examples/profile
@@ -0,0 +1,22 @@
1
+ class S3BucketPublicReadWriteAclRule
2
+ include BarkingIguana::CfLint::Rule
3
+
4
+ def id
5
+ 'BARKINGIGUANA/S3/NO_PUBLIC_READ_WRITE_ACL'
6
+ end
7
+
8
+ def description
9
+ 'S3 buckets must not have a public read-write ACL'
10
+ end
11
+
12
+ def apply_to model
13
+ identifiers = []
14
+
15
+ model.resources_by_type('AWS::S3::Bucket').each do |bucket|
16
+ next unless bucket.accessControl == 'PublicReadWrite'
17
+ identifiers << bucket.logical_resource_id
18
+ end
19
+
20
+ identifiers
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'barking_iguana/cf_lint'
3
+
4
+ BarkingIguana::CfLint::Cli.new(ARGV).run
@@ -0,0 +1,27 @@
1
+ require 'time'
2
+ require 'optparse'
3
+ require 'cfn-model'
4
+ require 'barking_iguana/logging'
5
+ require 'barking_iguana/benchmark'
6
+ require 'barking_iguana/cf_lint/version'
7
+ require 'barking_iguana/cf_lint/cli'
8
+ require 'barking_iguana/cf_lint/console_output'
9
+ require 'barking_iguana/cf_lint/factory'
10
+ require 'barking_iguana/cf_lint/template'
11
+ require 'barking_iguana/cf_lint/linter'
12
+ require 'barking_iguana/cf_lint/profile'
13
+ require 'barking_iguana/cf_lint/profile_loader'
14
+ require 'barking_iguana/cf_lint/report'
15
+ require 'barking_iguana/cf_lint/rule'
16
+ require 'barking_iguana/cf_lint/rule_set'
17
+ require 'barking_iguana/cf_lint/rule_loader'
18
+ require 'barking_iguana/cf_lint/rule_in_profile'
19
+ require 'barking_iguana/cf_lint/rule_result'
20
+
21
+ module BarkingIguana
22
+ module CfLint
23
+ def self.factory options
24
+ Factory.new options
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,66 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Cli < Struct.new(:argv)
4
+ include BarkingIguana::Logging::Helper
5
+
6
+ def options
7
+ @options ||= parse_options
8
+ end
9
+
10
+ def parse_options
11
+ opts = {
12
+ warning: false,
13
+ critical: true,
14
+ log_level: 2,
15
+ rule_directory: [],
16
+ profile: [],
17
+ template: []
18
+ }
19
+
20
+ parser = OptParse.new do |opt|
21
+ opt.on '-w', '--[no-]warning', 'Exit non-zero on warnings' do |value|
22
+ opts[:warning] = value
23
+ end
24
+ opt.on '-c', '--[no-]critical', 'Exit non-zero on criticals' do |value|
25
+ opts[:critical] = value
26
+ end
27
+ opt.on '-v', '--verbose', 'Increase verbosity' do
28
+ opts[:log_level] -= 1
29
+ end
30
+ opt.on '-q', '--quiet', 'Decrease verbosity' do
31
+ opts[:log_level] += 1
32
+ end
33
+ opt.on '-r', '--rule-directory RULE_DIRECTORY' do |value|
34
+ opts[:rule_directory] << value
35
+ end
36
+ opt.on '-p', '--profile PROFILE' do |value|
37
+ opts[:profile] << value
38
+ end
39
+ opt.on '-t', '--template TEMPLATE' do |value|
40
+ opts[:template] << value
41
+ end
42
+ end
43
+ parser.parse! argv
44
+ opts
45
+ end
46
+
47
+ def run
48
+ configure_logging
49
+ logger.debug { "Running with options: #{options.inspect}" }
50
+ factory = BarkingIguana::CfLint.factory options
51
+ output = BarkingIguana::CfLint::ConsoleOutput.new options
52
+ output.start
53
+ options[:template].each do |t|
54
+ output.add_report factory.build(Template.load(t)).run
55
+ end
56
+ output.finish
57
+ end
58
+
59
+ private
60
+
61
+ def configure_logging
62
+ BarkingIguana::Logging.default_level = [ 0, [ 4, options[:log_level] ].min ].max
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,56 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class ConsoleOutput < Struct.new(:options)
4
+ EXIT_CRITICAL = 2
5
+ EXIT_WARNING = 1
6
+ EXIT_NORMAL = 0
7
+
8
+ attr_accessor :reports
9
+ private :reports=, :reports
10
+
11
+ def start
12
+ self.reports = []
13
+ $stdout.puts "Processing #{options[:template].size} template files..."
14
+ end
15
+
16
+ def add_report report
17
+ reports << report
18
+ message = if report.results.empty?
19
+ "no issues"
20
+ else
21
+ report.results.map(&:to_s).join("\n ")
22
+ end
23
+ $stdout.puts "#{report.template.name}:\n #{message}"
24
+ end
25
+
26
+ def finish
27
+ $stdout.puts "Finished"
28
+ exit exit_code
29
+ end
30
+
31
+ private
32
+
33
+ def exit_code
34
+ return EXIT_CRITICAL if exit_critical? && report_critical?
35
+ return EXIT_WARNING if exit_warning? && report_warning?
36
+ EXIT_NORMAL
37
+ end
38
+
39
+ def exit_critical?
40
+ options[:critical]
41
+ end
42
+
43
+ def exit_warning?
44
+ options[:warning]
45
+ end
46
+
47
+ def report_critical?
48
+ reports.any?(&:critical?)
49
+ end
50
+
51
+ def report_warning?
52
+ reports.any?(&:warning?)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Factory < Struct.new(:options)
4
+ include BarkingIguana::Logging::Helper
5
+ def build template
6
+ logger.debug { "Building linter for template #{template.inspect}" }
7
+ Linter.new(template, rules)
8
+ end
9
+
10
+ private
11
+
12
+ def profile
13
+ ProfileLoader.new(options[:profile]).run
14
+ end
15
+
16
+ def rules
17
+ RuleLoader.new(options[:rule_directory], profile).run
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Linter < Struct.new(:template, :rule_set)
4
+ include BarkingIguana::Logging::Helper
5
+
6
+ def run
7
+ report = Report.new template
8
+ rule_set.each do |rule|
9
+ result = rule.apply_to template
10
+ next if result.empty?
11
+ report.add result
12
+ end
13
+ report
14
+ end
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,26 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Profile
4
+ LEVELS = %w(CRITICAL WARNING INFO)
5
+
6
+ include BarkingIguana::Logging::Helper
7
+
8
+ attr_accessor :rules
9
+ private :rules=, :rules
10
+
11
+ def initialize
12
+ self.rules = {}
13
+ end
14
+
15
+ def []= rule_id, level
16
+ logger.debug { "Setting #{rule_id.inspect} to #{level.inspect}, was #{rules[rule_id].inspect}" }
17
+ raise "#{level.inspect} for rule #{rule_id.inspect} need to be one of #{LEVELS.sort.join(', ')}" unless LEVELS.include? level
18
+ rules[rule_id] = level
19
+ end
20
+
21
+ def [] rule_id
22
+ rules[rule_id]
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,30 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class ProfileLoader < Struct.new(:paths)
4
+ include BarkingIguana::Logging::Helper
5
+ include BarkingIguana::Benchmark
6
+
7
+ def run
8
+ benchmark "Loading profile..." do
9
+ paths.inject(Profile.new) do |profile, path|
10
+ benchmark "Processing #{path}..." do
11
+ File.readlines(path).each do |entry|
12
+ logger.debug { "Processing #{entry.inspect}" }
13
+ next if entry =~ /^#/
14
+ next if entry.to_s.strip == ''
15
+ rule, level = entry.split(/ /, 2).map(&:strip)
16
+ logger.debug { "Rule = #{rule.inspect}, level = #{level.inspect}" }
17
+ begin
18
+ profile[rule] = level
19
+ rescue => e
20
+ raise "Error processing #{path.inspect}: #{e.message}"
21
+ end
22
+ end
23
+ end
24
+ profile
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Report
4
+ attr_accessor :template
5
+ private :template=
6
+
7
+ attr_accessor :results
8
+ private :results=
9
+
10
+ def initialize template
11
+ self.template = template
12
+ self.results = []
13
+ end
14
+
15
+ def add result
16
+ results << result
17
+ end
18
+
19
+ Profile::LEVELS.each do |l|
20
+ define_method "#{l.downcase}?" do
21
+ results.any? { |r| r.public_send "#{l.downcase}?" }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ module Rule
4
+ def description
5
+ "Sorry, this rule has no description"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class RuleInProfile < Struct.new(:rule, :level)
4
+ def apply_to template
5
+ identifiers = rule.apply_to template
6
+ RuleResult.new rule, identifiers, level
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class RuleLoader < Struct.new(:directories, :profile)
4
+ include BarkingIguana::Logging::Helper
5
+ include BarkingIguana::Benchmark
6
+
7
+ def run
8
+ benchmark "Loading rules..." do
9
+ directories.each do |directory|
10
+ benchmark "Processing #{directory}..." do
11
+ files = Dir[File.expand_path('./**/*_rule.rb', directory)]
12
+ files.each do |f|
13
+ require f
14
+ end
15
+ end
16
+ end
17
+
18
+ logger.debug { "Registering Rule module children" }
19
+ rule_set = RuleSet.new profile
20
+ ObjectSpace.each_object(Class) do |rule|
21
+ next unless rule.included_modules.include? Rule
22
+ instance = rule.new
23
+ logger.debug { "Registring #{instance}" }
24
+ rule_set.add instance
25
+ end
26
+ rule_set
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class RuleResult < Struct.new(:rule, :identifiers, :level)
4
+ Profile::LEVELS.each do |l|
5
+ define_method "#{l.downcase}?" do
6
+ return false if identifiers.empty?
7
+ level == l
8
+ end
9
+ end
10
+
11
+ def empty?
12
+ identifiers.empty?
13
+ end
14
+
15
+ def to_s
16
+ "[#{level}] #{identifiers.sort.join(", ")}: #{rule.description}"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class RuleSet
4
+ include BarkingIguana::Logging::Helper
5
+
6
+ attr_accessor :profile
7
+ private :profile=, :profile
8
+
9
+ attr_accessor :rules
10
+ private :rules=, :rules
11
+
12
+ def initialize profile
13
+ self.profile = profile
14
+ self.rules = {}
15
+ end
16
+
17
+ def add rule
18
+ logger.debug { "RuleSet registering rule #{rule}" }
19
+ rules[rule.id] = rule
20
+ end
21
+
22
+ def each
23
+ rules.each_pair do |id, rule|
24
+ pr = RuleInProfile.new(rule, profile[rule.id])
25
+ yield pr
26
+ end
27
+ end
28
+
29
+ include Enumerable
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,18 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ class Template < Struct.new(:name, :body)
4
+ def self.load file
5
+ new file, File.read(file)
6
+ end
7
+
8
+ def model
9
+ @model ||= CfnParser.new.parse(body)
10
+ end
11
+
12
+ def method_missing name, *args
13
+ super unless model.respond_to? name
14
+ model.public_send name, *args
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module BarkingIguana
2
+ module CfLint
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barking_iguana-cf_lint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Craig R Webster
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: barking_iguana-logging
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: barking_iguana-benchmark
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: colorize
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: cfn-model
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Linting framework for CloudFoundation
126
+ email:
127
+ - craig@barkingiguana.com
128
+ executables:
129
+ - cf-lint
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".travis.yml"
136
+ - Gemfile
137
+ - Gemfile.lock
138
+ - LICENSE.md
139
+ - README.md
140
+ - Rakefile
141
+ - barking_iguana-cf_lint.gemspec
142
+ - bin/console
143
+ - bin/setup
144
+ - docs/CHANGELOG.md
145
+ - docs/_config.yml
146
+ - docs/index.md
147
+ - examples/log-delivery-s3-bucket.yml
148
+ - examples/profile
149
+ - examples/public-read-s3-bucket.yml
150
+ - examples/public-read-write-s3-bucket.yml
151
+ - examples/run.sh
152
+ - examples/whatever_rule.rb
153
+ - exe/cf-lint
154
+ - lib/barking_iguana/cf_lint.rb
155
+ - lib/barking_iguana/cf_lint/cli.rb
156
+ - lib/barking_iguana/cf_lint/console_output.rb
157
+ - lib/barking_iguana/cf_lint/factory.rb
158
+ - lib/barking_iguana/cf_lint/linter.rb
159
+ - lib/barking_iguana/cf_lint/profile.rb
160
+ - lib/barking_iguana/cf_lint/profile_loader.rb
161
+ - lib/barking_iguana/cf_lint/report.rb
162
+ - lib/barking_iguana/cf_lint/rule.rb
163
+ - lib/barking_iguana/cf_lint/rule_in_profile.rb
164
+ - lib/barking_iguana/cf_lint/rule_loader.rb
165
+ - lib/barking_iguana/cf_lint/rule_result.rb
166
+ - lib/barking_iguana/cf_lint/rule_set.rb
167
+ - lib/barking_iguana/cf_lint/template.rb
168
+ - lib/barking_iguana/cf_lint/version.rb
169
+ homepage: https://github.com/barkingiguana.com/cf_lint
170
+ licenses:
171
+ - MIT
172
+ metadata:
173
+ allowed_push_host: https://rubygems.org
174
+ post_install_message:
175
+ rdoc_options: []
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '2.2'
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ requirements: []
189
+ rubyforge_project:
190
+ rubygems_version: 2.4.5.1
191
+ signing_key:
192
+ specification_version: 4
193
+ summary: Linting framework for CloudFoundation
194
+ test_files: []