inspecstyle 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +12 -7
  5. data/README.md +39 -1
  6. data/Rakefile +3 -0
  7. data/config/default.yml +95 -2
  8. data/doc/RuboCop.html +128 -0
  9. data/doc/RuboCop/Cop.html +117 -0
  10. data/doc/RuboCop/Cop/InSpecStyle.html +117 -0
  11. data/doc/RuboCop/Cop/InSpecStyle/AzureGenericResource.html +249 -0
  12. data/doc/RuboCop/Cop/InSpecStyle/DeprecatedAttributes.html +310 -0
  13. data/doc/RuboCop/Cop/InSpecStyle/FirstCop.html +345 -0
  14. data/doc/RuboCop/InSpecStyle.html +140 -0
  15. data/doc/RuboCop/InSpecStyle/Error.html +124 -0
  16. data/doc/RuboCop/InSpecStyle/Inject.html +195 -0
  17. data/doc/_index.html +211 -0
  18. data/doc/class_list.html +51 -0
  19. data/doc/css/common.css +1 -0
  20. data/doc/css/full_list.css +58 -0
  21. data/doc/css/style.css +496 -0
  22. data/doc/file.README.html +131 -0
  23. data/doc/file_list.html +56 -0
  24. data/doc/frames.html +17 -0
  25. data/doc/index.html +131 -0
  26. data/doc/js/app.js +314 -0
  27. data/doc/js/full_list.js +216 -0
  28. data/doc/js/jquery.js +4 -0
  29. data/doc/method_list.html +99 -0
  30. data/doc/top-level-namespace.html +110 -0
  31. data/lib/rubocop/cop/inspecstyle/apache.rb +57 -0
  32. data/lib/rubocop/cop/inspecstyle/aws_iam_user_property.rb +96 -0
  33. data/lib/rubocop/cop/inspecstyle/azure_generic_resource.rb +35 -0
  34. data/lib/rubocop/cop/inspecstyle/deprecated_attributes.rb +16 -16
  35. data/lib/rubocop/cop/inspecstyle/file_be_mounted.rb +65 -0
  36. data/lib/rubocop/cop/inspecstyle/file_size.rb +77 -0
  37. data/lib/rubocop/cop/inspecstyle/host_proto.rb +71 -0
  38. data/lib/rubocop/cop/inspecstyle/iis_website.rb +36 -0
  39. data/lib/rubocop/cop/inspecstyle/linux_kernel_parameter.rb +41 -0
  40. data/lib/rubocop/cop/inspecstyle/mssql_session_pass.rb +59 -0
  41. data/lib/rubocop/cop/inspecstyle/oracle_db_session_pass.rb +59 -0
  42. data/lib/rubocop/cop/inspecstyle/ppa_resource.rb +36 -0
  43. data/lib/rubocop/cop/inspecstyle/processes_list.rb +77 -0
  44. data/lib/rubocop/cop/inspecstyle/script_resource.rb +48 -0
  45. data/lib/rubocop/cop/inspecstyle/shadow_properties.rb +83 -0
  46. data/lib/rubocop/cop/inspecstyle/users_resource_matchers.rb +98 -0
  47. data/lib/rubocop/cop/inspecstyle/windows_registry_key.rb +36 -0
  48. data/lib/rubocop/cop/inspecstyle/wmi_wmis_class.rb +37 -0
  49. data/lib/rubocop/cop/inspecstyle_cops.rb +17 -1
  50. data/lib/rubocop/inspecstyle/version.rb +1 -1
  51. data/notes-for-development.md +10 -0
  52. data/tasks/cops_documentation.rake +300 -0
  53. metadata +43 -3
  54. data/lib/rubocop/cop/inspecstyle/first_cop.rb +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b906208d63efff19eb182ce0a3b066206556695ca72e229b6b0afa60d74d91e4
4
- data.tar.gz: e9a707ede42ac3da35c82019fd24cc8bb3dcf495a4853df54fead8bfa003bb85
3
+ metadata.gz: c51bedfaba90e6e4cf18d3a51f66198bf2fa16a497b49b0df0463090f8405104
4
+ data.tar.gz: '090fe9248bb711be0f8c77c845317c98a1acc66dd377c6f7f24923338afd9638'
5
5
  SHA512:
6
- metadata.gz: 589110f446bf5b0dc7ebf5538619a3e3d67717f27cebaaa6042730b2e88bef920d2344bbfbcd1631be42476961ddf5bb99533a1ed16ed6f4e3efc1dd0b154617
7
- data.tar.gz: f14685e321ef3919d3bcbab64a87a703fbf799e314bd4064851500c1dac4d21d16457a8b7a025a858406be363522f8f6a0cb3f321307543ba6cb03881a95ac17
6
+ metadata.gz: 0fa18de10357a081e004f385a8635d658eb878779468db447d2584f8bc4697a6b6a6a7f348811a697cfce61cd61c7928669dbd779331bc0585f93b4079ac42a6
7
+ data.tar.gz: b3082f4bc9201180cd09aa31bcfde73e2ec6c6ac157da1b6307e50eb83161cc97c8943ba4eec6ebeb691e4296a31846bc5322c4adca85789170471be5a9ebbe1
data/.gitignore CHANGED
@@ -2,7 +2,6 @@
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /coverage/
5
- /doc/
6
5
  /pkg/
7
6
  /spec/reports/
8
7
  /tmp/
data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gemspec
6
6
  gem "rake", "~> 12.0"
7
7
  gem "minitest", "~> 5.0"
8
8
  gem 'rspec'
9
+ gem 'yard'
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inspecstyle (0.1.0)
4
+ inspecstyle (0.2.0)
5
5
  rubocop
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.0)
10
+ ast (2.4.1)
11
11
  diff-lcs (1.3)
12
- jaro_winkler (1.5.4)
13
12
  minitest (5.14.1)
14
13
  parallel (1.19.1)
15
- parser (2.7.1.2)
14
+ parser (2.7.1.3)
16
15
  ast (~> 2.4.0)
17
16
  rainbow (3.0.0)
18
17
  rake (12.3.3)
18
+ regexp_parser (1.7.1)
19
19
  rexml (3.2.4)
20
20
  rspec (3.9.0)
21
21
  rspec-core (~> 3.9.0)
@@ -30,25 +30,30 @@ GEM
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
31
  rspec-support (~> 3.9.0)
32
32
  rspec-support (3.9.3)
33
- rubocop (0.81.0)
34
- jaro_winkler (~> 1.5.1)
33
+ rubocop (0.85.1)
35
34
  parallel (~> 1.10)
36
35
  parser (>= 2.7.0.1)
37
36
  rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.7)
38
38
  rexml
39
+ rubocop-ast (>= 0.0.3)
39
40
  ruby-progressbar (~> 1.7)
40
41
  unicode-display_width (>= 1.4.0, < 2.0)
42
+ rubocop-ast (0.0.3)
43
+ parser (>= 2.7.0.1)
41
44
  ruby-progressbar (1.10.1)
42
45
  unicode-display_width (1.7.0)
46
+ yard (0.9.25)
43
47
 
44
48
  PLATFORMS
45
49
  ruby
46
50
 
47
51
  DEPENDENCIES
52
+ inspecstyle!
48
53
  minitest (~> 5.0)
49
54
  rake (~> 12.0)
50
55
  rspec
51
- inspecstyle!
56
+ yard
52
57
 
53
58
  BUNDLED WITH
54
59
  2.1.4
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
+ # WIP: This gem is __not__ live, but we would love your help and input! Core issue here: https://github.com/inspec/inspec/issues/5095
2
+
3
+
1
4
  # InSpecStyle
2
5
 
3
6
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rubocop/inspecstyle`. To experiment with that code, run `bin/console` for an interactive prompt.
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+ ## Full Documentation
9
+ https://rubydoc.info/gems/inspecstyle
6
10
 
7
11
  ## Installation
8
12
 
@@ -39,6 +43,40 @@ To only run these cops on your local rubocop run, execute:
39
43
  ## TODO:
40
44
 
41
45
  - Instead of referencing issues in the cops, point to a general `inspecstyle.guide`
46
+ - Known issue, resources that work on manual runs but not in `atom` package: [
47
+ - AzureGenericResource
48
+ ]
49
+ - Cop ideas:
50
+ ```
51
+ its('minimum_days_between_password_change') { should eq 0 } becomes 'mindays'
52
+ its('maximum_days_between_password_change') { should eq 0 } becomes 'maxdays'
53
+ Inspec.deprecate(:resource_user_serverspec_compat, "The user resource `has_home_directory?` matcher is deprecated. Please use `its('home')`.")
54
+ Inspec.deprecate(:resource_user_serverspec_compat, "The user resource `has_authorized_key?` matcher is deprecated. There is no currently implemented alternative")
55
+
56
+
57
+ shadow resource deprecations
58
+ (e.g.)
59
+ describe shadow('/etc/my-custom-place/shadow') do
60
+ its('count') { should eq 32 }
61
+ end
62
+
63
+ property deprecations:
64
+
65
+ user -> users
66
+ password -> passwords
67
+ last_change -> last_changes
68
+ expiry_date -> expiry_dates
69
+ lines (no replacement)
70
+
71
+ e.g.
72
+
73
+ sql = oracledb_session(user: 'my_user', pass: 'password')
74
+ describe sql.query(\"SELECT UPPER(VALUE) AS VALUE FROM V$PARAMETER WHERE UPPER(NAME)='AUDIT_SYS_OPERATIONS'\").row(0).column('value') do
75
+ its('value') { should eq 'TRUE' }
76
+ end
77
+
78
+ oracledb_session deprecated `pass`, use `password` instead
79
+ ```
42
80
 
43
81
  ## Development
44
82
 
data/Rakefile CHANGED
@@ -15,6 +15,9 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
15
15
  spec.pattern = FileList['spec/**/*_spec.rb']
16
16
  end
17
17
 
18
+ require 'yard'
19
+ YARD::Rake::YardocTask.new
20
+
18
21
  desc 'Generate a new cop with a template'
19
22
  task :new_cop, [:cop] do |_task, args|
20
23
  require 'rubocop'
@@ -1,10 +1,103 @@
1
+ InSpecStyle/Apache:
2
+ Description: 'Use apache_conf instead of apache'
3
+ Enabled: true
4
+ VersionAdded: '0.82'
5
+ PreferredReplacement: 'apache_conf'
6
+
7
+ InSpecStyle/AwsIamUserProperty:
8
+ Description: 'For the aws_iam_users resource name and user properties are deprecated. Use username and aws_user_struct instead'
9
+ Enabled: true
10
+ VersionAdded: '0.82'
11
+
12
+ InSpecStyle/AzureGenericResource:
13
+ Description: 'Do not use azure_generic_resource'
14
+ Enabled: true
15
+ VersionAdded: '0.82'
16
+ StyleGuide: 'https://github.com/inspec/inspec/issues/3131'
17
+
1
18
  InSpecStyle/DeprecatedAttributes:
2
19
  Description: 'Attributes are deprecated in favor of inputs'
3
20
  Enabled: true
4
21
  VersionAdded: '0.82'
5
22
  StyleGuide: 'https://github.com/inspec/inspec/issues/3802'
23
+ PreferredReplacement: 'input'
24
+
25
+ InSpecStyle/FileBeMounted:
26
+ Description: 'aws_iam_users resource name and user properties are deprecated for username and aws_user_struct'
27
+ Enabled: true
28
+ VersionAdded: '0.82'
29
+
30
+ InSpecStyle/FileSize:
31
+ Description: '`size` property for `file` resource is deprecated for `size_kb` and will be removed in InSpec5'
32
+ Enabled: true
33
+ VersionAdded: '0.82'
34
+ PreferredReplacement: 'size_kb'
35
+
36
+ InSpecStyle/HostProto:
37
+ Description: 'Proto property for host has been deprecated for protocol'
38
+ Enabled: true
39
+ VersionAdded: '0.82'
40
+ PreferredReplacement: 'protocol'
41
+
42
+ InSpecStyle/IisWebsite:
43
+ Description: 'iis_website resource has been deprecated for iis_site'
44
+ Enabled: true
45
+ VersionAdded: '0.82'
46
+ PreferredReplacement: 'iis_site'
47
+
48
+ InSpecStyle/LinuxKernelParameter:
49
+ Description: 'linux_kernel_parameter resource has been deprecated for kernel_parameter'
50
+ Enabled: true
51
+ VersionAdded: '0.82'
52
+ PreferredReplacement: 'kernel_parameter'
53
+
54
+ InSpecStyle/MSSQLSessionPass:
55
+ Description: 'mssql_session resource parameter pass is deprecated for password'
56
+ Enabled: true
57
+ VersionAdded: '0.82'
58
+
59
+ InSpecStyle/OracleDbSessionPass:
60
+ Description: 'Use `password` instead of `pass`'
61
+ Enabled: true
62
+ VersionAdded: '0.82'
63
+ PreferredReplacement: 'password'
64
+
65
+ InSpecStyle/PPAResource:
66
+ Description: 'The ppa resource is deprecated in favor of the apt resource'
67
+ Enabled: true
68
+ VersionAdded: '0.82'
69
+ PreferredReplacement: 'apt'
70
+
71
+ InSpecStyle/ProcessesList:
72
+ Description: 'list property on processes resource is deprecated for entries'
73
+ Enabled: true
74
+ VersionAdded: '0.82'
75
+ PreferredReplacement: 'entries'
76
+
77
+ InSpecStyle/ScriptResource:
78
+ Description: 'Use powershell instead of script'
79
+ Enabled: true
80
+ VersionAdded: '0.82'
81
+ PreferredReplacement: 'powershell'
82
+
83
+ InSpecStyle/ShadowProperties:
84
+ Description: 'Deprecated properties for the shadow resource'
85
+ Enabled: true
86
+ VersionAdded: '0.82'
87
+
88
+ InSpecStyle/UsersResourceMatchers:
89
+ Description: 'Deprecated matchers for the users resource'
90
+ Enabled: true
91
+ VersionAdded: '0.82'
92
+
93
+ InSpecStyle/WindowsRegistryKey:
94
+ Description: 'The windows_registry_key resource is deprecated for registry_key'
95
+ Enabled: true
96
+ VersionAdded: '0.82'
97
+ PreferredReplacement: 'registry_key'
6
98
 
7
- InspecStyle/FirstCop:
8
- Description: 'This first cop is a sandbox for exploring new InspecStyle cops.'
99
+ InSpecStyle/WmiWmisClass:
100
+ Description: "wmi('wmisclass') is deprecated for wmi({class: wmisclass})"
9
101
  Enabled: true
10
102
  VersionAdded: '0.82'
103
+ PreferredReplacement: "wmi({class: 'wmisclass'})"
@@ -0,0 +1,128 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: RuboCop
8
+
9
+ &mdash; Documentation by YARD 0.9.25
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "RuboCop";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (R)</a> &raquo;
40
+
41
+
42
+ <span class="title">RuboCop</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: RuboCop
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/rubocop/inspecstyle/inject.rb<span class="defines">,<br />
82
+ lib/rubocop/inspecstyle.rb,<br /> lib/rubocop/inspecstyle/version.rb,<br /> lib/rubocop/cop/inspecstyle/first_cop.rb,<br /> lib/rubocop/cop/inspecstyle/deprecated_attributes.rb,<br /> lib/rubocop/cop/inspecstyle/azure_generic_resource.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>TODO: when finished, run `rake generate_cops_documentation` to update the docs</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
100
+ <p class="children">
101
+
102
+
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="RuboCop/Cop.html" title="RuboCop::Cop (module)">Cop</a></span>, <span class='object_link'><a href="RuboCop/InSpecStyle.html" title="RuboCop::InSpecStyle (module)">InSpecStyle</a></span>
104
+
105
+
106
+
107
+
108
+ </p>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ </div>
119
+
120
+ <div id="footer">
121
+ Generated on Thu Jun 11 11:57:48 2020 by
122
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
+ 0.9.25 (ruby-2.6.6).
124
+ </div>
125
+
126
+ </div>
127
+ </body>
128
+ </html>
@@ -0,0 +1,117 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: RuboCop::Cop
8
+
9
+ &mdash; Documentation by YARD 0.9.25
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "RuboCop::Cop";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (C)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../RuboCop.html" title="RuboCop (module)">RuboCop</a></span></span>
41
+ &raquo;
42
+ <span class="title">Cop</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: RuboCop::Cop
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/rubocop/cop/inspecstyle/first_cop.rb<span class="defines">,<br />
82
+ lib/rubocop/cop/inspecstyle/deprecated_attributes.rb,<br /> lib/rubocop/cop/inspecstyle/azure_generic_resource.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Defined Under Namespace</h2>
89
+ <p class="children">
90
+
91
+
92
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Cop/InSpecStyle.html" title="RuboCop::Cop::InSpecStyle (module)">InSpecStyle</a></span>
93
+
94
+
95
+
96
+
97
+ </p>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ </div>
108
+
109
+ <div id="footer">
110
+ Generated on Thu Jun 11 11:57:48 2020 by
111
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
+ 0.9.25 (ruby-2.6.6).
113
+ </div>
114
+
115
+ </div>
116
+ </body>
117
+ </html>