rubocop-oneoff_codemod 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a877f8417cb16bb7c0956b657be916ca5003ce80af7e1f8133d615537945bb8b
4
- data.tar.gz: e9970c705d8fb1da22cad3857d9cd1514102e923960bc22861ab53b2ded07e84
3
+ metadata.gz: 6e7fa1b4623ac56f647fc7e9d77ddac8e1b8b678fac0d944395475abae0ed7dc
4
+ data.tar.gz: 972a11490e731f8d5919640822c66ba7fd8bf3fd20141ce53d185a216ceb578b
5
5
  SHA512:
6
- metadata.gz: 6b74d4ef24b06d8d103335083fefb6b5f385e59efaea0e04f05f9430461ce406ffcbbc08c2cf2fad6ce661a5cf309d6a31c7d50aa7fe05045da191a9d6804c9d
7
- data.tar.gz: 4fb48a4585b45dce3ec3dce95fbdb6dc511693f024f55365dc9581ded263cccfeaaef7198c74096cdb390f45ea5a0a67448d30b69222e1b3dc539cd9bac4141e
6
+ metadata.gz: c110b18f1c259d1083c17e1c9539c9f453317691d2720f1a18d46f8add0dc8e342ce91cd42ff9c927cd82bba9ec459ca285039f4955698b11130f2d46500d1f8
7
+ data.tar.gz: b9b940027490fcd74fff864f8a704be2df4998363b94e656f77e8e0eb427aa5bb05e6c983d30684513f79032b48394f8affc60ca11cb1f811f857451fcd8aba9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RuboCop::OneoffCodemod
2
2
 
3
- A RuboCop plugin implementing comment-as-command for one-off codemod, inspired by eslint-plugin-command.
3
+ A RuboCop plugin implementing comment-as-command for one-off codemod, inspired by [eslint-plugin-command](https://eslint-plugin-command.antfu.me/).
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,6 +16,52 @@ If bundler is not being used to manage dependencies, install the gem by executin
16
16
  gem install rubocop-oneoff_codemod
17
17
  ```
18
18
 
19
+ ## Loading the plugin
20
+
21
+ To use this plugin, tell RuboCop to load it by adding the following to your `.rubocop.yml`:
22
+
23
+ ```yml
24
+ plugins: rubocop-oneoff_codemod
25
+ ```
26
+
27
+ If you're using multiple plugins, use the array notation:
28
+
29
+ ```yml
30
+ plugins:
31
+ - rubocop-other-plugin
32
+ - rubocop-oneoff_codemod
33
+ ```
34
+
35
+ RuboCop will now automatically load this plugin when you run it.
36
+
37
+ > [!NOTE]
38
+ > The plugin system is supported in RuboCop 1.72+.
39
+
40
+ ## Usage
41
+
42
+ The `OneoffCodemod` cop is a special kind of RuboCop plugin. By default, does nothing.
43
+ Rather than checking code quality, it acts as a micro-codemod tool that is triggered by special comments.
44
+ It reuses RuboCop’s infrastructure to perform transformations on demand.
45
+
46
+ For example, the comment `# @keep-unique` transforms an array by removing duplicate elements:
47
+
48
+ ```rb
49
+ # @keep-unique
50
+ ary = [1, 2, 3, 2, 4]
51
+ ```
52
+
53
+ After running `rubocop -a` or saving the file in your editor, the array will be transformed and the comment will be removed:
54
+
55
+ ```rb
56
+ #
57
+ ary = [1, 2, 3, 4]
58
+ ```
59
+
60
+ ## Available Commands
61
+
62
+ - `# @keep-unique` - Keep array items unique, removing duplicates.
63
+ - `# @rbs-prototype` - Run rbs prototype and generates boilerplate signature declaration.
64
+
19
65
  ## Development
20
66
 
21
67
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -24,7 +70,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
24
70
 
25
71
  ## Contributing
26
72
 
27
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubocop-oneoff_codemod. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rubocop-oneoff_codemod/blob/master/CODE_OF_CONDUCT.md).
73
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kozy4324/rubocop-oneoff_codemod. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rubocop-oneoff_codemod/blob/master/CODE_OF_CONDUCT.md).
28
74
 
29
75
  ## License
30
76
 
@@ -32,4 +78,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
32
78
 
33
79
  ## Code of Conduct
34
80
 
35
- Everyone interacting in the RuboCop::OneoffCodemod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rubocop-oneoff_codemod/blob/master/CODE_OF_CONDUCT.md).
81
+ Everyone interacting in the RuboCop::OneoffCodemod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kozy4324/rubocop-oneoff_codemod/blob/master/CODE_OF_CONDUCT.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module OneoffCodemod
5
- VERSION = "0.0.7"
5
+ VERSION = "0.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-oneoff_codemod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koji NAKAMURA