Skip to content

Commit

Permalink
Linting, automated
Browse files Browse the repository at this point in the history
Signed-off-by: Clinton Wolfe <[email protected]>
  • Loading branch information
clintoncwolfe authored and alexpop committed Mar 2, 2020
1 parent d3dbf3a commit 1b54436
Show file tree
Hide file tree
Showing 29 changed files with 42 additions and 56 deletions.
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
#
# Author:: Stephan Renatus <[email protected]>
# Copyright (c) 2016-2019, Chef Software Inc. <[email protected]>
# Copyright:: (c) 2016-2019, Chef Software Inc. <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions examples/automate_win/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name 'automate_win'
maintainer 'Chef Software, Inc'
maintainer_email '[email protected]'
license 'Apache-2'
license 'Apache-2.0'
description 'Sample cookbook for configuring Chef Automate direct reporting'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.0'

depends 'chef-client'
2 changes: 1 addition & 1 deletion examples/automate_win/recipes/chef_client_config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: automate_win
# Cookbook:: automate_win
# Recipe:: chef_client_config

# Create client.d directory in the chef client folder
Expand Down
2 changes: 1 addition & 1 deletion examples/automate_win/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: automate_win
# Cookbook:: automate_win
# Recipe:: default

include_recipe 'automate_win::chef_client_config'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: automate_ingest
# Cookbook:: automate_ingest
# Spec:: chef_client_config

# THIS IS NOT A WORKING EXAMPLE.
Expand Down
2 changes: 1 addition & 1 deletion examples/automate_win/spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: automate_win
# Cookbook:: automate_win
# Spec:: default

require 'spec_helper'
Expand Down
3 changes: 1 addition & 2 deletions examples/wrapper_audit/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name 'wrapper_audit'
maintainer 'Chef Software, Inc'
maintainer_email '[email protected]'
license 'Apache-2'
license 'Apache-2.0'
description 'Wrapper cookbook that runs Audit cookbook.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.0'

# Put whatever operating systems your company supports where you may want
Expand Down
2 changes: 1 addition & 1 deletion examples/wrapper_audit/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: wrapper_audit
# Cookbook:: wrapper_audit
# Recipe:: default

# This includes statement is to include the chef_client_config recipe in the
Expand Down
2 changes: 1 addition & 1 deletion examples/wrapper_audit/spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: wrapper_audit
# Cookbook:: wrapper_audit
# Spec:: default

require 'spec_helper'
Expand Down
2 changes: 1 addition & 1 deletion libraries/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ def get_reporters(audit)
end
end

::Chef::Recipe.send(:include, ReportHelpers)
::Chef::DSL::Recipe.send(:include, ReportHelpers)
9 changes: 0 additions & 9 deletions libraries/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# encoding: utf-8

# used by ChefSpec
if defined?(ChefSpec)

ChefSpec.define_matcher :compliance_profile
ChefSpec.define_matcher :inspec_gem

def install_inspec_gem(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:inspec_gem, :install, resource_name)
end
end
3 changes: 1 addition & 2 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Allows for fetching and executing compliance profiles, and reporting their results'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '9.0.1'

source_url 'https://github.com/chef-cookbooks/audit'
issues_url 'https://github.com/chef-cookbooks/audit/issues'

chef_version '>= 12.20' if respond_to?(:chef_version)
chef_version '>= 12.20'

supports 'aix'
supports 'amazon'
Expand Down
4 changes: 2 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Recipe:: default
#
# Copyright 2016-2019 Chef Software, Inc.
# Copyright:: 2016-2019 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions recipes/inspec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Recipe:: inspec
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/inspec_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def uninstall_inspec_gem

def inspec_info
require 'rubygems'
Gem::Specification.find { |s| ['inspec', 'inspec-core'].include?(s.name) }
Gem::Specification.find { |s| %w(inspec inspec-core).include?(s.name) }
rescue LoadError
nil
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/libraries/audit_enforcer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: automate_spec
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/libraries/automate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: automate_spec
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/libraries/cs_automate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: cs_automate_spec

require 'spec_helper'
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/libraries/helpers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: helpers

require 'spec_helper'
Expand All @@ -21,8 +21,8 @@
end

it 'handle_reporters returns array of reporters when given array' do
reporters = ['chef-compliance', 'json-file']
expect(@helpers.handle_reporters(reporters)).to eq(['chef-compliance', 'json-file'])
reporters = %w(chef-compliance json-file)
expect(@helpers.handle_reporters(reporters)).to eq(%w(chef-compliance json-file))
end

it 'handle_reporters returns array of reporters when given string' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/libraries/json_file_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: json-file

require 'spec_helper'
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: compliance
# Cookbook:: compliance
# Spec:: default
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -157,7 +157,7 @@
context 'When specifying multiple reporters' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.9')
runner.node.override['audit']['collector'] = ['chef-compliance', 'json-file']
runner.node.override['audit']['collector'] = %w(chef-compliance json-file)
runner.node.override['audit']['profiles'] = [
{ 'name': 'linux', 'compliance': 'base/linux' },
{ 'name': 'apache', 'compliance': 'base/apache' },
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/report/audit_report_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: default
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/report/fetcher_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# encoding: utf-8
#
# Cookbook Name:: audit
# Cookbook:: audit
# Spec:: fetcher
#
# Copyright 2016 Chef Software, Inc.
# Copyright:: 2016 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions tasks/changelog.rake
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ begin
config.future_release = "v#{metadata.version}"
config.user = 'chef-cookbooks'
config.project = 'audit'
config.bug_labels = %w{bug Bug Type:\ Bug }
config.enhancement_labels = %w{enhancement Enhancement Type:\ Enhancement }
config.bug_labels = %w(bug Bug Type:\ Bug )
config.enhancement_labels = %w(enhancement Enhancement Type:\ Enhancement )
end
rescue LoadError
puts 'Problem loading gems please install chef and github_changelog_generator'
Expand Down
7 changes: 3 additions & 4 deletions test/cookbooks/test_helper/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name 'test_helper'
maintainer 'The Authors'
maintainer_email '[email protected]'
license 'all_rights'
maintainer 'The InSpec Team'
maintainer_email '[email protected]'
license 'all rights reserved'
description 'Installs/Configures test_helper'
long_description 'Installs/Configures test_helper'
version '0.1.0'

# If you upload to Supermarket you should set this so your cookbook
Expand Down
4 changes: 2 additions & 2 deletions test/cookbooks/test_helper/recipes/setup.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# Cookbook Name:: test_helper
# Cookbook:: test_helper
# Recipe:: setup
#
# Copyright (c) 2016 The Authors, All Rights Reserved.
# Copyright:: (c) 2016 The Authors, All Rights Reserved.

# needed to fetch github profiles
include_recipe 'git::default'
Expand Down
1 change: 0 additions & 1 deletion test/kitchen-automate/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
maintainer_email '[email protected]'
license 'All rights reserved'
description 'Installs/Configures kitchen-automate'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'

depends 'audit'
Expand Down
2 changes: 1 addition & 1 deletion test/kitchen-automate/recipes/bootstrap_localhost.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
directory '/root/.chef' do
mode 00770
mode '770'
action :create
end

Expand Down
4 changes: 2 additions & 2 deletions test/kitchen-automate/recipes/converge_localhost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
}
EOH
mode 00600
mode '600'
end

# Not needed for 'chef-server-visibility' collector converge
Expand Down Expand Up @@ -61,7 +61,7 @@
}
}
EOH
mode 00600
mode '600'
end

# Collector 'chef-visibility' needs these client.rb settings:
Expand Down

0 comments on commit 1b54436

Please sign in to comment.