├── .circleci └── config.yml ├── .gitignore ├── .rubocop.yml ├── CODE_OF_CONDUCT.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── config └── rubocop.yml ├── deka_eiwakun.gemspec ├── lib ├── deka_eiwakun.rb └── deka_eiwakun │ └── version.rb └── sample └── sample.rb /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/esminc/deka_eiwakun 5 | parallelism: 1 6 | shell: /bin/bash --login 7 | environment: 8 | CIRCLE_ARTIFACTS: /tmp/circleci-artifacts 9 | CIRCLE_TEST_REPORTS: /tmp/circleci-test-results 10 | LANG: en_US.UTF-8 11 | docker: 12 | - image: circleci/ruby:2.5.1 13 | steps: 14 | - checkout 15 | - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS 16 | - run: gem update --system 17 | - run: gem update bundler 18 | - run: env | sort 19 | - run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle 20 | --jobs=4 --retry=3 ' 21 | - run: bundle exec ruby -e "puts RUBY_VERSION" 22 | - run: echo $RUBY_VERSION > .ruby-version 23 | - run: bundle exec rake rubocop 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_gem: 2 | deka_eiwakun: "config/rubocop.yml" 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of 4 | fostering an open and welcoming community, we pledge to respect all people who 5 | contribute through reporting issues, posting feature requests, updating 6 | documentation, submitting pull requests or patches, and other activities. 7 | 8 | We are committed to making participation in this project a harassment-free 9 | experience for everyone, regardless of level of experience, gender, gender 10 | identity and expression, sexual orientation, disability, personal appearance, 11 | body size, race, ethnicity, age, religion, or nationality. 12 | 13 | Examples of unacceptable behavior by participants include: 14 | 15 | * The use of sexualized language or imagery 16 | * Personal attacks 17 | * Trolling or insulting/derogatory comments 18 | * Public or private harassment 19 | * Publishing other's private information, such as physical or electronic 20 | addresses, without explicit permission 21 | * Other unethical or unprofessional conduct 22 | 23 | Project maintainers have the right and responsibility to remove, edit, or 24 | reject comments, commits, code, wiki edits, issues, and other contributions 25 | that are not aligned to this Code of Conduct, or to ban temporarily or 26 | permanently any contributor for other behaviors that they deem inappropriate, 27 | threatening, offensive, or harmful. 28 | 29 | By adopting this Code of Conduct, project maintainers commit themselves to 30 | fairly and consistently applying these principles to every aspect of managing 31 | this project. Project maintainers who do not follow or enforce the Code of 32 | Conduct may be permanently removed from the project team. 33 | 34 | This code of conduct applies both within project spaces and in public spaces 35 | when an individual is representing the project or its community. 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 38 | reported by contacting a project maintainer at takkanm@gmail.com. All 39 | complaints will be reviewed and investigated and will result in a response that 40 | is deemed necessary and appropriate to the circumstances. Maintainers are 41 | obligated to maintain confidentiality with regard to the reporter of an 42 | incident. 43 | 44 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 45 | version 1.3.0, available at 46 | [http://contributor-covenant.org/version/1/3/0/][version] 47 | 48 | [homepage]: http://contributor-covenant.org 49 | [version]: http://contributor-covenant.org/version/1/3/0/ -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | # Specify your gem's dependencies in deka_eiwakun.gemspec 6 | gemspec 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 takkanm 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DekaEiwakun 2 | 3 | [![Circle CI](https://circleci.com/gh/esminc/deka_eiwakun.svg?style=svg)](https://circleci.com/gh/esminc/deka_eiwakun) 4 | 5 |
6 | eiwakun_deka 7 | eiwakun_deka 8 | eiwakun_deka 9 |
10 | 11 | 12 | DekaEiwakun is Ruby convention in esm. 13 | Inspired by [onkcop](https://github.com/onk/onkcop) 14 | 15 | ## Usage 16 | 17 | Add the following directive to your `.rubocop.yml`: 18 | 19 | ```yaml 20 | inherit_gem: 21 | deka_eiwakun: "config/rubocop.yml" 22 | 23 | AllCops: 24 | TargetRubyVersion: 2.3 25 | ``` 26 | 27 | ```sh 28 | bundle exec rubocop 29 | ``` 30 | 31 | ## Installation 32 | 33 | Add this line to your application's Gemfile: 34 | 35 | ```ruby 36 | gem 'deka_eiwakun' 37 | ``` 38 | 39 | ## Contributing 40 | 41 | Bug reports and pull requests are welcome on GitHub at https://github.com/esminc/deka_eiwakun. 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. 42 | 43 | 44 | ## License 45 | 46 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 47 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bundler/gem_tasks' 4 | require 'rubocop/rake_task' 5 | 6 | task default: :rubocop 7 | 8 | RuboCop::RakeTask.new 9 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'bundler/setup' 5 | require 'deka_eiwakun' 6 | 7 | # You can add fixtures and/or initialization code here to make experimenting 8 | # with your gem easier. You can also use a different console, if you like. 9 | 10 | # (If you use this, don't forget to add pry to your Gemfile!) 11 | # require "pry" 12 | # Pry.start 13 | 14 | require 'irb' 15 | IRB.start 16 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /config/rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - 'bin/bundle' 4 | - 'bin/rails' 5 | - 'bin/rake' 6 | - 'db/schema.rb' 7 | - 'vendor/bundle/**/*' 8 | 9 | Layout/ExtraSpacing: 10 | Enabled: false 11 | 12 | Layout/SpaceInsideBlockBraces: 13 | SpaceBeforeBlockParameters: false 14 | 15 | Layout/SpaceInsideHashLiteralBraces: 16 | EnforcedStyle: no_space 17 | 18 | Lint/UselessAccessModifier: 19 | Enabled: false 20 | 21 | Naming/UncommunicativeBlockParamName: 22 | Enabled: false 23 | 24 | Naming/UncommunicativeMethodParamName: 25 | Enabled: false 26 | 27 | Naming/VariableName: 28 | EnforcedStyle: snake_case 29 | Enabled: true 30 | 31 | Style/AccessModifierDeclarations: 32 | Enabled: false 33 | 34 | Style/AsciiComments: 35 | Enabled: false 36 | 37 | Style/AsciiComments: 38 | Enabled: false 39 | 40 | Style/BlockDelimiters: 41 | EnforcedStyle: semantic 42 | 43 | FunctionalMethods: 44 | - let 45 | - let! 46 | - map 47 | - subject 48 | 49 | Style/ClassAndModuleChildren: 50 | Exclude: 51 | - 'app/controllers/**/*' # `class Api::V1::UsersController...` のように書きたいことがあるし、他の理由でネストすることはあまりないのではないか。 52 | 53 | Style/Documentation: 54 | Enabled: false 55 | 56 | Style/EmptyCaseCondition: 57 | Enabled: false 58 | 59 | Style/FormatStringToken: 60 | Enabled: false 61 | 62 | Style/Lambda: 63 | Enabled: false 64 | 65 | Style/PercentLiteralDelimiters: 66 | PreferredDelimiters: 67 | default: '()' 68 | '%i': '()' 69 | '%I': '()' 70 | '%r': '||' 71 | '%w': '()' 72 | '%W': '()' 73 | 74 | Metrics/AbcSize: 75 | Exclude: 76 | - 'db/migrate/**/*' 77 | 78 | Metrics/ClassLength: 79 | Exclude: 80 | - 'db/migrate/**/*' 81 | 82 | Metrics/LineLength: 83 | Max: 125 84 | 85 | Metrics/MethodLength: 86 | Exclude: 87 | - 'db/migrate/**/*' 88 | -------------------------------------------------------------------------------- /deka_eiwakun.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | lib = File.expand_path('lib', __dir__) 4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 5 | require 'deka_eiwakun/version' 6 | 7 | Gem::Specification.new do |spec| 8 | spec.name = 'deka_eiwakun' 9 | spec.version = DekaEiwakun::VERSION 10 | spec.authors = ['eiwakun'] 11 | spec.email = ['eiwakun@esm.co.jp'] 12 | 13 | spec.summary = 'coding convention in esm' 14 | spec.description = 'coding convention in esm' 15 | spec.homepage = 'https://github.com/esminc/deka_eiwakun' 16 | spec.license = 'MIT' 17 | 18 | spec.files = `git ls-files -z`.split("\x0") 19 | spec.bindir = 'exe' 20 | spec.executables = spec.files.grep(%r|^exe/|) {|f| File.basename(f) } 21 | spec.require_paths = ['lib'] 22 | 23 | spec.add_dependency 'rubocop', '~> 0.58.2' 24 | spec.add_development_dependency 'bundler', '~> 1.11' 25 | spec.add_development_dependency 'rake', '~> 10.0' 26 | end 27 | -------------------------------------------------------------------------------- /lib/deka_eiwakun.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'deka_eiwakun/version' 4 | 5 | module DekaEiwakun 6 | end 7 | -------------------------------------------------------------------------------- /lib/deka_eiwakun/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module DekaEiwakun 4 | VERSION = '0.58.2' 5 | end 6 | -------------------------------------------------------------------------------- /sample/sample.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # ブロック 4 | ## 一行ブロック 5 | 6 | [1, 2, 3].map {|i| i } 7 | 8 | ## 複数行ブロック 9 | 10 | [1, 2, 3].each do |i| 11 | puts i 12 | end 13 | 14 | [1, 2, 3].map {|i| 15 | i 16 | }.join 17 | 18 | # RSpec で使うメソッド名 19 | subject { self } 20 | let(:a) { 1 } 21 | let!(:b) { 22 | 1 + 1 23 | } 24 | 25 | # ハッシュリテラル 26 | 27 | _ = {a: 1, b: 2} 28 | 29 | _ = { 30 | a: 1, 31 | b: 2 32 | } 33 | 34 | # 長い引数リスト 35 | def many_arg_method(a, b, c, d, e) 36 | [a, b, c, d, e] 37 | end 38 | 39 | many_arg_method( 40 | 1, 41 | 2, 42 | 3, 43 | 4, 44 | 5 45 | ) 46 | 47 | # 条件無し case 48 | a = 1 49 | b = 2 50 | case 51 | when a == 1 then true 52 | when b == 2 then false 53 | else 54 | raise 55 | end 56 | --------------------------------------------------------------------------------