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
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # TODO: when finished, run `rake generate_cops_documentation` to update the docs
4
- module RuboCop
5
- module Cop
6
- module InSpecStyle
7
- # TODO: Write cop description and example of bad / good code. For every
8
- # `SupportedStyle` and unique configuration, there needs to be examples.
9
- # Examples must have valid Ruby syntax. Do not use upticks.
10
- #
11
- # @example EnforcedStyle: bar (default)
12
- # # Description of the `bar` style.
13
- #
14
- # # bad
15
- # bad_bar_method
16
- #
17
- # # bad
18
- # bad_bar_method(args)
19
- #
20
- # # good
21
- # good_bar_method
22
- #
23
- # # good
24
- # good_bar_method(args)
25
- #
26
- # @example EnforcedStyle: foo
27
- # # Description of the `foo` style.
28
- #
29
- # # bad
30
- # bad_foo_method
31
- #
32
- # # bad
33
- # bad_foo_method(args)
34
- #
35
- # # good
36
- # good_foo_method
37
- #
38
- # # good
39
- # good_foo_method(args)
40
- #
41
- class FirstCop < Cop
42
- # TODO: Implement the cop in here.
43
- #
44
- # In many cases, you can use a node matcher for matching node pattern.
45
- # See https://github.com/rubocop-hq/rubocop/blob/master/lib/rubocop/node_pattern.rb
46
- #
47
- # For example
48
- MSG = 'Use `#good_method` instead of `#bad_method`. %<example_insertion>'
49
-
50
- def_node_matcher :bad_method?, <<~PATTERN
51
- (send nil? :bad_method ...)
52
- PATTERN
53
-
54
- def on_send(node)
55
- return unless bad_method?(node)
56
- message = format(MSG, example_insertion: node.first.source)
57
- add_offense(node, message: message)
58
- end
59
-
60
- def autocorrect(node)
61
- ->(corrector) do
62
- corrector.insert_before(node.source_range, 'good_method')
63
- corrector.remove(node.source_range)
64
- end
65
- end
66
- end
67
- end
68
- end
69
- end