rubocop-yayoi 0.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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rubocop/cop/.DS_Store +0 -0
- data/lib/rubocop/cop/layout/def_end_alignment.rb +12 -0
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +11 -0
- data/lib/rubocop/cop/layout/empty_lines.rb +11 -0
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +11 -0
- data/lib/rubocop/cop/layout/indentation_consistency.rb +11 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +12 -0
- data/lib/rubocop/cop/layout/initial_indentation.rb +11 -0
- data/lib/rubocop/cop/layout/space_around_operators.rb +20 -0
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +37 -0
- data/lib/rubocop/cop/lint/unused_method_argument.rb +31 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +12 -0
- data/lib/rubocop/cop/metrics/line_length.rb +11 -0
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +12 -0
- data/lib/rubocop/cop/mixin/.DS_Store +0 -0
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +13 -0
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +10 -0
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +19 -0
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +11 -0
- data/lib/rubocop/cop/naming/predicate_name.rb +13 -0
- data/lib/rubocop/cop/naming/uncommunicative_method_param_name.rb +11 -0
- data/lib/rubocop/cop/naming/variable_name.rb +11 -0
- data/lib/rubocop/cop/style/and_or.rb +11 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +11 -0
- data/lib/rubocop/cop/style/colon_method_call.rb +11 -0
- data/lib/rubocop/cop/style/documentation.rb +11 -0
- data/lib/rubocop/cop/style/double_negation.rb +11 -0
- data/lib/rubocop/cop/style/string_literals.rb +17 -0
- data/lib/rubocop/cop/style/unneeded_condition.rb +12 -0
- data/lib/rubocop/formatter/progress_formatter.rb +29 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +43 -0
- data/lib/rubocop/yayoi/version.rb +5 -0
- data/lib/rubocop/yayoi.rb +6 -0
- data/lib/rubocop-yayoi.rb +37 -0
- data/rubocop-yayoi.gemspec +24 -0
- data/spec/rubocop/yayoi_spec.rb +5 -0
- data/spec/spec_helper.rb +14 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 59fec0f321a3661ec067f41b4b8e68e9c8ef0f5a798ad68a437d34055d1d7717
|
4
|
+
data.tar.gz: 22f3e7bbb91f44959582665628a665685a621db192e67979cf600491a2370d4a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d7cd44b71dc770b86972f0526deb530d903d04ec844a77f2065b311bec25a6d91684012f946e457790092fb919d25b747d15989dcb9c601476ce161414497be5
|
7
|
+
data.tar.gz: 8e5c218b8ccb858ab528d4c13a3ecad50a4329a811f85c3123dc701b411e17cc4f22a7789e375b565efd643c4e34e8eb7068647ff6490d5f54acbcae2ad38a39
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at you.goto.510@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rubocop-yayoi (0.0.1)
|
5
|
+
rubocop (>= 0.67.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
jaro_winkler (1.5.2)
|
13
|
+
parallel (1.17.0)
|
14
|
+
parser (2.6.3.0)
|
15
|
+
ast (~> 2.4.0)
|
16
|
+
rainbow (3.0.0)
|
17
|
+
rake (10.5.0)
|
18
|
+
rspec (3.8.0)
|
19
|
+
rspec-core (~> 3.8.0)
|
20
|
+
rspec-expectations (~> 3.8.0)
|
21
|
+
rspec-mocks (~> 3.8.0)
|
22
|
+
rspec-core (3.8.0)
|
23
|
+
rspec-support (~> 3.8.0)
|
24
|
+
rspec-expectations (3.8.3)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-mocks (3.8.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.8.0)
|
30
|
+
rspec-support (3.8.0)
|
31
|
+
rubocop (0.68.1)
|
32
|
+
jaro_winkler (~> 1.5.1)
|
33
|
+
parallel (~> 1.10)
|
34
|
+
parser (>= 2.5, != 2.5.1.1)
|
35
|
+
rainbow (>= 2.2.2, < 4.0)
|
36
|
+
ruby-progressbar (~> 1.7)
|
37
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
38
|
+
ruby-progressbar (1.10.0)
|
39
|
+
unicode-display_width (1.5.0)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
rake (~> 10.0)
|
46
|
+
rspec (~> 3.0)
|
47
|
+
rubocop-yayoi!
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 YutaGoto
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Rubocop::Yayoi
|
2
|
+
|
3
|
+
`ζ*'ヮ')ζ<うっうー!`
|
4
|
+
|
5
|
+
このgemは [rubocop](https://github.com/rubocop-hq/rubocop) 実行後に表示されるテキストがアイドルマスター 765プロ所属の高槻やよい風に指摘してくれるgemです!
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rubocop-yayoi'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rubocop-yayoi
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### RuboCop configuration file
|
26
|
+
|
27
|
+
Put this into your `.rubocop.yml`.
|
28
|
+
|
29
|
+
```
|
30
|
+
require: rubocop-yayoi
|
31
|
+
```
|
32
|
+
|
33
|
+
Now you can run `rubocop` and it will automatically load the RuboCop RSpec
|
34
|
+
cops together with the standard cops.
|
35
|
+
|
36
|
+
### Command line
|
37
|
+
|
38
|
+
```bash
|
39
|
+
rubocop --require rubocop-yayoi
|
40
|
+
```
|
41
|
+
|
42
|
+
### Rake task
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
RuboCop::RakeTask.new do |task|
|
46
|
+
task.requires << 'rubocop-yayoi'
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
## Development
|
52
|
+
|
53
|
+
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.
|
54
|
+
|
55
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/YutaGoto/rubocop-yayoi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
64
|
+
|
65
|
+
## Code of Conduct
|
66
|
+
|
67
|
+
Everyone interacting in the Rubocop::Yayoi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/YutaGoto/rubocop-yayoi/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rubocop/yayoi'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Layout
|
6
|
+
class SpaceAroundOperators < Cop
|
7
|
+
def offense_message(operator, with_space, right_operand)
|
8
|
+
if operator.is?('**')
|
9
|
+
"ζ*'ヮ')ζ<うっうー!`**`のまわりにスペースがありますよー!" unless with_space.is?('**')
|
10
|
+
elsif with_space.source !~ /^\s.*\s$/
|
11
|
+
"ζ*'ヮ')ζ<うっうー!`#{operator.source}`のまわりにスペースがありませんよー!"
|
12
|
+
elsif excess_leading_space?(operator, with_space) ||
|
13
|
+
excess_trailing_space?(right_operand, with_space)
|
14
|
+
"ζ*'ヮ')ζ<うっうー!`#{operator.source}`のまわりはスペース1こあけましょうねー!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
class AmbiguousBlockAssociation < Cop
|
7
|
+
MSG = "ζ*'ヮ')ζ<うっうー!" \
|
8
|
+
'ブロックが`%<method>s`メソッドの呼び出しにちゃんと関連連れられているかわからないですー。' \
|
9
|
+
'ちゃんと`%<param>s`にカッコを使いましょうねー!'.freeze
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
class UnusedBlockArgument < Cop
|
7
|
+
def message(variable)
|
8
|
+
message = "ζ*'ヮ')ζ<うっうー!#{variable_type(variable)}が使われてないですよー!" \
|
9
|
+
" - `#{variable.name}`"
|
10
|
+
|
11
|
+
if variable.explicit_block_local_variable?
|
12
|
+
message
|
13
|
+
else
|
14
|
+
augment_message(message, variable)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def variable_type(variable)
|
19
|
+
if variable.explicit_block_local_variable?
|
20
|
+
'ブロック内のローカル変数'
|
21
|
+
else
|
22
|
+
'ブロック変数'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def message_for_normal_block(variable, all_arguments)
|
27
|
+
if all_arguments.none?(&:referenced?) &&
|
28
|
+
!define_method_call?(variable)
|
29
|
+
'引数を省略できますよー!'
|
30
|
+
else
|
31
|
+
"使っていないものは `_` か `_#{variable.name}` にしましょうねー!"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
class UnusedMethodArgument < Cop
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
def message(variable)
|
9
|
+
message = String.new(
|
10
|
+
"ζ*'ヮ')ζ<うっうー!使っていない引数がありますよー `#{variable.name}`!"
|
11
|
+
)
|
12
|
+
|
13
|
+
unless variable.keyword_argument?
|
14
|
+
message << " もし使わないなら、`_`か`_#{variable.name}`のようにしましょうねー!"
|
15
|
+
end
|
16
|
+
|
17
|
+
scope = variable.scope
|
18
|
+
all_arguments = scope.variables.each_value.select(&:method_argument?)
|
19
|
+
|
20
|
+
if all_arguments.none?(&:referenced?)
|
21
|
+
message << ' 引数がなんでもいいなら、' \
|
22
|
+
"メソッド名を `#{scope.name}(*)` に変えてもいいですよー!"
|
23
|
+
end
|
24
|
+
|
25
|
+
message
|
26
|
+
end
|
27
|
+
# rubocop:enable Metrics/MethodLength
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Layout
|
6
|
+
module EmptyLinesAroundBody
|
7
|
+
MSG_EXTRA = "ζ*'ヮ')ζ<うっうー!%<kind>sに空行が見つかりましたよー!".freeze
|
8
|
+
MSG_MISSING = "ζ*'ヮ')ζ<うっうー!%<kind>sのまわりに空行がないですよー!".freeze
|
9
|
+
MSG_DEFERRED = "ζ*'ヮ')ζ<うっうー!%<type>sの前に空行がないですよー!".freeze
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module UncommunicativeName
|
6
|
+
LENGTH_MSG = "ζ*'ヮ')ζ<うっうー!" \
|
7
|
+
'%<name_type>sの長さは最低でも%<min>s文字以上にしましょうねー!'.freeze
|
8
|
+
|
9
|
+
def name_type(node)
|
10
|
+
@name_type ||= begin
|
11
|
+
case node.type
|
12
|
+
when :block then 'ブロックのパラメータ'
|
13
|
+
when :def, :defs then 'メソッドのパラメータ'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Style
|
6
|
+
class StringLiterals < Cop
|
7
|
+
def message(_node)
|
8
|
+
if style == :single_quotes
|
9
|
+
"ζ*'ヮ')ζ<うっうー!特殊記号とか補間がないときはシングルクォーテーションで囲いましょうねー"
|
10
|
+
else
|
11
|
+
"ζ*'ヮ')ζ<うっうー!バックスラッシュでシングルクォーテーションが必要でない限りダブルクォーテーションで囲いましょうねー"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Formatter
|
5
|
+
class ProgressFormatter < ClangStyleFormatter
|
6
|
+
def started(target_files)
|
7
|
+
super
|
8
|
+
@offenses_for_files = {}
|
9
|
+
output.puts "ζ*'ヮ')ζ<#{target_files.size}ファイルチェックしますよー!"
|
10
|
+
end
|
11
|
+
|
12
|
+
def finished(inspected_files)
|
13
|
+
output.puts
|
14
|
+
|
15
|
+
unless @offenses_for_files.empty?
|
16
|
+
output.puts
|
17
|
+
output.puts "ζ*'ヮ')ζ<うっうー!!"
|
18
|
+
output.puts
|
19
|
+
|
20
|
+
@offenses_for_files.each do |file, offenses|
|
21
|
+
report_file(file, offenses)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Formatter
|
5
|
+
class SimpleTextFormatter < BaseFormatter
|
6
|
+
class Report
|
7
|
+
def summary
|
8
|
+
if @correction_count > 0
|
9
|
+
"ζ*'ヮ')ζ<うっうー!#{@file_count}ファイルチェックしましたよー!\r\n" \
|
10
|
+
"#{offences_text}\r\n" \
|
11
|
+
"ζ*'ヮ')ζ<うっうー#{corrections}直しましたよー!"
|
12
|
+
else
|
13
|
+
"ζ*'ヮ')ζ<うっうー!#{@file_count}ファイルチェックしましたよー!\r\n#{offences_text}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def offenses
|
20
|
+
text = "#{@offense_count}こ"
|
21
|
+
color = :red
|
22
|
+
|
23
|
+
colorize(text, color)
|
24
|
+
end
|
25
|
+
|
26
|
+
def offences_text
|
27
|
+
if @offense_count.zero?
|
28
|
+
"ζ*'ヮ')ζ<うっうー!怪しいところはありませんでしたー!"
|
29
|
+
else
|
30
|
+
"ζ*'ヮ')ζ<うっうー!#{offenses}怪しいですよー!"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def corrections
|
35
|
+
text = "#{@correction_count}こ"
|
36
|
+
color = @correction_count == @offense_count ? :green : :cyan
|
37
|
+
|
38
|
+
colorize(text, color)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubocop'
|
2
|
+
|
3
|
+
require_relative 'rubocop/formatter/progress_formatter'
|
4
|
+
require_relative 'rubocop/formatter/simple_text_formatter'
|
5
|
+
|
6
|
+
require_relative 'rubocop/cop/layout/def_end_alignment'
|
7
|
+
require_relative 'rubocop/cop/layout/empty_line_between_defs'
|
8
|
+
require_relative 'rubocop/cop/layout/empty_lines_around_method_body'
|
9
|
+
require_relative 'rubocop/cop/layout/empty_lines'
|
10
|
+
require_relative 'rubocop/cop/layout/indentation_consistency'
|
11
|
+
require_relative 'rubocop/cop/layout/indentation_width'
|
12
|
+
require_relative 'rubocop/cop/layout/initial_indentation'
|
13
|
+
require_relative 'rubocop/cop/layout/space_around_operators'
|
14
|
+
|
15
|
+
require_relative 'rubocop/cop/lint/ambiguous_block_association'
|
16
|
+
require_relative 'rubocop/cop/lint/unused_block_argument'
|
17
|
+
require_relative 'rubocop/cop/lint/unused_method_argument'
|
18
|
+
|
19
|
+
require_relative 'rubocop/cop/mixin/empty_lines_around_body'
|
20
|
+
require_relative 'rubocop/cop/mixin/end_keyword_alignment'
|
21
|
+
require_relative 'rubocop/cop/mixin/uncommunicative_name'
|
22
|
+
|
23
|
+
require_relative 'rubocop/cop/metrics/cyclomatic_complexity'
|
24
|
+
require_relative 'rubocop/cop/metrics/line_length'
|
25
|
+
require_relative 'rubocop/cop/metrics/perceived_complexity'
|
26
|
+
|
27
|
+
require_relative 'rubocop/cop/naming/class_and_module_camel_case'
|
28
|
+
require_relative 'rubocop/cop/naming/predicate_name'
|
29
|
+
require_relative 'rubocop/cop/naming/variable_name'
|
30
|
+
|
31
|
+
require_relative 'rubocop/cop/style/and_or'
|
32
|
+
require_relative 'rubocop/cop/style/ascii_comments'
|
33
|
+
require_relative 'rubocop/cop/style/colon_method_call'
|
34
|
+
require_relative 'rubocop/cop/style/documentation'
|
35
|
+
require_relative 'rubocop/cop/style/double_negation'
|
36
|
+
require_relative 'rubocop/cop/style/string_literals'
|
37
|
+
require_relative 'rubocop/cop/style/unneeded_condition'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'rubocop/yayoi/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rubocop-yayoi'
|
7
|
+
spec.version = Rubocop::Yayoi::VERSION
|
8
|
+
spec.authors = ['YutaGoto']
|
9
|
+
spec.email = ['you.goto.510@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = "ζ*'ヮ')ζ<うっうー!Rubocop with Yayoi Takatsuki"
|
12
|
+
spec.description = "ζ*'ヮ')ζ<うっうー!Rubocop with Yayoi Takatsuki"
|
13
|
+
spec.homepage = 'https://github.com/YutaGoto/rubocop-yayoi'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rubocop', '>= 0.67.2'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rubocop/yayoi'
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-yayoi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- YutaGoto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.67.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.67.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: ζ*'ヮ')ζ<うっうー!Rubocop with Yayoi Takatsuki
|
56
|
+
email:
|
57
|
+
- you.goto.510@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- CODE_OF_CONDUCT.md
|
67
|
+
- Gemfile
|
68
|
+
- Gemfile.lock
|
69
|
+
- LICENSE.txt
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- bin/console
|
73
|
+
- bin/setup
|
74
|
+
- lib/rubocop-yayoi.rb
|
75
|
+
- lib/rubocop/cop/.DS_Store
|
76
|
+
- lib/rubocop/cop/layout/def_end_alignment.rb
|
77
|
+
- lib/rubocop/cop/layout/empty_line_between_defs.rb
|
78
|
+
- lib/rubocop/cop/layout/empty_lines.rb
|
79
|
+
- lib/rubocop/cop/layout/empty_lines_around_method_body.rb
|
80
|
+
- lib/rubocop/cop/layout/indentation_consistency.rb
|
81
|
+
- lib/rubocop/cop/layout/indentation_width.rb
|
82
|
+
- lib/rubocop/cop/layout/initial_indentation.rb
|
83
|
+
- lib/rubocop/cop/layout/space_around_operators.rb
|
84
|
+
- lib/rubocop/cop/lint/ambiguous_block_association.rb
|
85
|
+
- lib/rubocop/cop/lint/unused_block_argument.rb
|
86
|
+
- lib/rubocop/cop/lint/unused_method_argument.rb
|
87
|
+
- lib/rubocop/cop/metrics/cyclomatic_complexity.rb
|
88
|
+
- lib/rubocop/cop/metrics/line_length.rb
|
89
|
+
- lib/rubocop/cop/metrics/perceived_complexity.rb
|
90
|
+
- lib/rubocop/cop/mixin/.DS_Store
|
91
|
+
- lib/rubocop/cop/mixin/empty_lines_around_body.rb
|
92
|
+
- lib/rubocop/cop/mixin/end_keyword_alignment.rb
|
93
|
+
- lib/rubocop/cop/mixin/uncommunicative_name.rb
|
94
|
+
- lib/rubocop/cop/naming/class_and_module_camel_case.rb
|
95
|
+
- lib/rubocop/cop/naming/predicate_name.rb
|
96
|
+
- lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
|
97
|
+
- lib/rubocop/cop/naming/variable_name.rb
|
98
|
+
- lib/rubocop/cop/style/and_or.rb
|
99
|
+
- lib/rubocop/cop/style/ascii_comments.rb
|
100
|
+
- lib/rubocop/cop/style/colon_method_call.rb
|
101
|
+
- lib/rubocop/cop/style/documentation.rb
|
102
|
+
- lib/rubocop/cop/style/double_negation.rb
|
103
|
+
- lib/rubocop/cop/style/string_literals.rb
|
104
|
+
- lib/rubocop/cop/style/unneeded_condition.rb
|
105
|
+
- lib/rubocop/formatter/progress_formatter.rb
|
106
|
+
- lib/rubocop/formatter/simple_text_formatter.rb
|
107
|
+
- lib/rubocop/yayoi.rb
|
108
|
+
- lib/rubocop/yayoi/version.rb
|
109
|
+
- rubocop-yayoi.gemspec
|
110
|
+
- spec/rubocop/yayoi_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
homepage: https://github.com/YutaGoto/rubocop-yayoi
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubygems_version: 3.0.3
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: ζ*'ヮ')ζ<うっうー!Rubocop with Yayoi Takatsuki
|
135
|
+
test_files: []
|