stax-lint 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +4 -0
- data/lib/stax/lint/cfn-lint.rb +25 -0
- data/lib/stax/lint/checkov.rb +23 -0
- data/lib/stax/lint/version.rb +7 -0
- data/lib/stax/lint.rb +5 -0
- data/stax-lint.gemspec +34 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8b95546ccfee9fabdd4de2be0e1817b168f5f65067ad366d7f2d3529295c1f7a
|
4
|
+
data.tar.gz: 6374124cf6d9dc3f91dd7a1951e41e695333ba7bf5f691fbba2c9526dd7b085d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c925d2712922684fe735f0a75115091fe7575564e88084f0fceeb19e60a982f394fa3a321e4898e63acc2242181c09f3a09f5cef5ac4c029a7b93bfe0db4528
|
7
|
+
data.tar.gz: 5de07bd6f6358aefdc55c30c230e5a14ee6645ba354532a9dfb17b7d0c69b358d428ab6567a05f98391378603d8e343dd981c5bfcb79059fe4959e8dac664d75
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at rlister@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Richard Lister
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# stax-lint
|
2
|
+
|
3
|
+
Cloudformation stack linting tasks for [stax](https://github.com/rlister/stax).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add stax-lint
|
10
|
+
|
11
|
+
Require in `Staxfile`:
|
12
|
+
|
13
|
+
require 'stax/lint'
|
14
|
+
|
15
|
+
## Linters
|
16
|
+
|
17
|
+
### cfn-lint
|
18
|
+
|
19
|
+
Install `cfn-lint` from https://github.com/aws-cloudformation/cfn-python-lint, and run for any stack `foo`:
|
20
|
+
|
21
|
+
$ bundle exec stax foo lint
|
22
|
+
|
23
|
+
Run for all stacks in `Staxfile`:
|
24
|
+
|
25
|
+
$ bundle exec stax lint
|
26
|
+
|
27
|
+
### checkov
|
28
|
+
|
29
|
+
Install `checkov` from https://www.checkov.io/, and run for any stack `foo`:
|
30
|
+
|
31
|
+
$ bundle exec stax foo checkov
|
32
|
+
|
33
|
+
Run for all stacks in `Staxfile`:
|
34
|
+
|
35
|
+
$ bundle exec stax checkov
|
36
|
+
|
37
|
+
Ref: [checkov reference](https://www.checkov.io/2.Basics/CLI%20Command%20Reference.html).
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Stax
|
2
|
+
class Stack
|
3
|
+
desc 'lint', 'run cfn-lint on template'
|
4
|
+
def lint
|
5
|
+
require 'open3'
|
6
|
+
debug("cfn-lint #{stack_name}")
|
7
|
+
Open3.popen3('cfn-lint -') do |stdin, stdout|
|
8
|
+
stdin.write(cfn_template)
|
9
|
+
stdin.close
|
10
|
+
puts stdout.read
|
11
|
+
end
|
12
|
+
rescue Errno::ENOENT => e
|
13
|
+
fail_task(e.message)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Stax
|
19
|
+
class Cli
|
20
|
+
desc 'lint', 'run cfn-lint on all templates'
|
21
|
+
def lint
|
22
|
+
stack_objects.each(&:lint)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Stax
|
2
|
+
class Stack
|
3
|
+
desc 'checkov', 'run cfn-checkov on template'
|
4
|
+
def checkov
|
5
|
+
debug("checkov #{stack_name}")
|
6
|
+
file = Tempfile.create(["#{stack_name}-", '.json'])
|
7
|
+
file.write(cfn_template)
|
8
|
+
file.flush
|
9
|
+
Dir.chdir(File.dirname(file.path)) do
|
10
|
+
system "checkov --quiet --compact --framework cloudformation -f #{File.basename(file.path)}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module Stax
|
17
|
+
class Cli
|
18
|
+
desc 'checkov', 'run checkov on all templates'
|
19
|
+
def checkov
|
20
|
+
stack_objects.each(&:checkov)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/stax/lint.rb
ADDED
data/stax-lint.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/stax/lint/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'stax-lint'
|
7
|
+
spec.version = Stax::Lint::VERSION
|
8
|
+
spec.authors = ['Richard Lister']
|
9
|
+
spec.email = ['rlister@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Add support for various linting tools to stax.'
|
12
|
+
spec.description = 'Stax is a flexible set of ruby classes for cloudformation stacks: stax-lint adds support for linting tools.'
|
13
|
+
spec.homepage = 'https://github.com/rlister/stax-lint'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/rlister/stax-lint'
|
21
|
+
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
spec.bindir = 'bin'
|
29
|
+
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_dependency('stax')
|
33
|
+
spec.add_dependency('open3')
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stax-lint
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Lister
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: stax
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: open3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: 'Stax is a flexible set of ruby classes for cloudformation stacks: stax-lint
|
42
|
+
adds support for linting tools.'
|
43
|
+
email:
|
44
|
+
- rlister@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- CODE_OF_CONDUCT.md
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/stax/lint.rb
|
55
|
+
- lib/stax/lint/cfn-lint.rb
|
56
|
+
- lib/stax/lint/checkov.rb
|
57
|
+
- lib/stax/lint/version.rb
|
58
|
+
- stax-lint.gemspec
|
59
|
+
homepage: https://github.com/rlister/stax-lint
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata:
|
63
|
+
allowed_push_host: https://rubygems.org
|
64
|
+
homepage_uri: https://github.com/rlister/stax-lint
|
65
|
+
source_code_uri: https://github.com/rlister/stax-lint
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.6.0
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubygems_version: 3.1.6
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Add support for various linting tools to stax.
|
85
|
+
test_files: []
|