rubocop-sorted_methods_by_call 1.0.0 → 1.0.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -3
- data/config/default.yml +1 -1
- data/lib/rubocop/sorted_methods_by_call/extensions/util.rb +1 -1
- data/lib/rubocop/sorted_methods_by_call/version.rb +1 -1
- data/rakelib/docs.rake +73 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb5b1320e0c36ea11d3931c04aad10d03a3c909cf16added71b537bb540e9851
|
|
4
|
+
data.tar.gz: c2e121be2bfa362e5e6b8f7acaae7378d82158fbecdcb0c6b562e9eb4f4f1b0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45b61992be6ad19b714eaa67929b0782c0cfb6b237cfb0a9770aca073f5672b817586305b8588052d636556e73afcd54826112d19ec67cb3d13df9af554a6e2b
|
|
7
|
+
data.tar.gz: 2983a3c4e99c5c58cb4361b2ac93b588230df3e318e79c1f4ec8b0b0f16d49ac69ff0e9f2fd443ecf5ac3ef8be3d673f3116f18854498590f129d23093079da8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* [Release Process](#release-process)
|
|
21
21
|
* [Requirements](#requirements)
|
|
22
22
|
* [Contributing](#contributing)
|
|
23
|
+
* [Documentation](#documentation)
|
|
23
24
|
* [License](#license)
|
|
24
25
|
* [Code of Conduct](#code-of-conduct)
|
|
25
26
|
|
|
@@ -82,7 +83,6 @@ SortedMethodsByCall/Waterfall:
|
|
|
82
83
|
### Good Code (waterfall order)
|
|
83
84
|
|
|
84
85
|
```ruby
|
|
85
|
-
|
|
86
86
|
class Service
|
|
87
87
|
def call
|
|
88
88
|
do_smth
|
|
@@ -103,7 +103,6 @@ end
|
|
|
103
103
|
### Bad Code (violates waterfall order)
|
|
104
104
|
|
|
105
105
|
```ruby
|
|
106
|
-
|
|
107
106
|
class Service
|
|
108
107
|
def call
|
|
109
108
|
do_smth
|
|
@@ -132,7 +131,6 @@ bundle exec rubocop -A
|
|
|
132
131
|
This will reorder the methods while preserving comments and visibility modifiers:
|
|
133
132
|
|
|
134
133
|
```ruby
|
|
135
|
-
|
|
136
134
|
class Service
|
|
137
135
|
def call
|
|
138
136
|
do_smth
|
|
@@ -207,6 +205,11 @@ Bug reports and pull requests are welcome! Please follow these guidelines:
|
|
|
207
205
|
|
|
208
206
|
Please ensure your code passes all tests and follows the existing style.
|
|
209
207
|
|
|
208
|
+
## Documentation
|
|
209
|
+
|
|
210
|
+
Code is covered with YARD docs, you can access online docs
|
|
211
|
+
at https://unurgunite.github.io/rubocop-sorted_methods_by_call_docs/
|
|
212
|
+
|
|
210
213
|
## License
|
|
211
214
|
|
|
212
215
|
The gem is available as open source under the terms of
|
data/config/default.yml
CHANGED
|
@@ -18,7 +18,7 @@ module RuboCop
|
|
|
18
18
|
# RuboCop::SortedMethodsByCall::Util.deep_merge(base, other)
|
|
19
19
|
# #=> { main: [:abc], class_T: [:hi, :h1] }
|
|
20
20
|
#
|
|
21
|
-
# @param [Hash]
|
|
21
|
+
# @param [Hash] h The base hash to merge from.
|
|
22
22
|
# @param [Hash] other The hash to merge into +hash+.
|
|
23
23
|
# @return [Hash] A new hash with accumulated values per key.
|
|
24
24
|
# @see Hash#merge
|
data/rakelib/docs.rake
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'English'
|
|
4
|
+
require 'yard'
|
|
5
|
+
require 'fileutils'
|
|
6
|
+
|
|
7
|
+
GEM_NAME = Bundler.load_gemspec(Dir.glob('*.gemspec').first).name
|
|
8
|
+
DOCS_REPO_NAME = "#{GEM_NAME}_docs".freeze
|
|
9
|
+
DOCS_REPO_PATH = "../#{DOCS_REPO_NAME}".freeze
|
|
10
|
+
|
|
11
|
+
namespace :docs do # rubocop:disable Metrics/BlockLength
|
|
12
|
+
desc 'Generate new docs and push them to repo'
|
|
13
|
+
task generate: :clean do
|
|
14
|
+
puts 'Generating docs...'
|
|
15
|
+
YARD::CLI::Yardoc.run
|
|
16
|
+
puts 'OK!'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc 'Clean existing docs'
|
|
20
|
+
task :clean do
|
|
21
|
+
if File.directory?('doc')
|
|
22
|
+
FileUtils.rm_rf('doc')
|
|
23
|
+
puts 'Cleaned existing docs directory'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc 'Pushes docs to github'
|
|
28
|
+
task push: :generate do
|
|
29
|
+
unless File.directory?(DOCS_REPO_PATH)
|
|
30
|
+
puts "Error: Docs repo not found at #{DOCS_REPO_PATH}"
|
|
31
|
+
puts 'Please clone the docs repo first:'
|
|
32
|
+
puts " git clone git@github.com:unurgunite/#{DOCS_REPO_NAME}.git #{DOCS_REPO_PATH}"
|
|
33
|
+
exit 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
puts "Copying docs to #{DOCS_REPO_PATH}..."
|
|
37
|
+
FileUtils.mkdir_p('doc') unless File.directory?('doc')
|
|
38
|
+
FileUtils.cp_r('doc/.', DOCS_REPO_PATH)
|
|
39
|
+
|
|
40
|
+
puts 'Changing dir...'
|
|
41
|
+
Dir.chdir(DOCS_REPO_PATH) do
|
|
42
|
+
puts 'Checking git status...'
|
|
43
|
+
status_output = `git status --porcelain`
|
|
44
|
+
|
|
45
|
+
if status_output.strip.empty?
|
|
46
|
+
puts 'No changes to commit'
|
|
47
|
+
else
|
|
48
|
+
puts 'Committing git changes...'
|
|
49
|
+
puts `git add .`
|
|
50
|
+
commit_result = `git commit -m "Update docs for #{GEM_NAME} #{Time.now.utc.strftime('%Y-%m-%d %H:%M:%S UTC')}"`
|
|
51
|
+
puts commit_result
|
|
52
|
+
|
|
53
|
+
if $CHILD_STATUS.success?
|
|
54
|
+
puts 'Pushing to GitHub...'
|
|
55
|
+
push_result = `git push origin master 2>&1`
|
|
56
|
+
puts push_result
|
|
57
|
+
if $CHILD_STATUS.success?
|
|
58
|
+
puts 'Docs successfully pushed!'
|
|
59
|
+
else
|
|
60
|
+
puts 'Push failed!'
|
|
61
|
+
exit 1
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
puts 'Commit failed!'
|
|
65
|
+
exit 1
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
desc 'Generate and push docs in one command'
|
|
72
|
+
task deploy: :push
|
|
73
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-sorted_methods_by_call
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- unurgunite
|
|
@@ -160,6 +160,7 @@ files:
|
|
|
160
160
|
- lib/rubocop/sorted_methods_by_call/extensions/util.rb
|
|
161
161
|
- lib/rubocop/sorted_methods_by_call/plugin.rb
|
|
162
162
|
- lib/rubocop/sorted_methods_by_call/version.rb
|
|
163
|
+
- rakelib/docs.rake
|
|
163
164
|
- test_project/.rubocop.test.yml
|
|
164
165
|
- test_project/Gemfile
|
|
165
166
|
homepage: https://github.com/unurgunite/rubocop-sorted_methods_by_call
|