rubocop_rules 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6118dc53f3cc87ec1fd8ea6da3cd4ccc487c857
4
+ data.tar.gz: 5b9a2bf8bf2510f0536d6fa12564ac1ff72626e2
5
+ SHA512:
6
+ metadata.gz: fdbc3c77c46f56ade2c25d836908e05977b5efece039e5f12c7d51573ddff9aebe6247a3d5dd7f686bac431a731254b1f194fc7aa1eacacfa08211d4c84d148b
7
+ data.tar.gz: 94844afd9174e62868916a6909f650d1f1fd425b5dba2b19a5652fef4f1ae49e17144d5dc311eaf17f2e17476eef01d5a7dde5cea5c6f50385ba88a7dea798ef
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,19 @@
1
+ ###########################
2
+ # Configuration for rubocop
3
+ # in .rubocop.yml
4
+
5
+ ##############
6
+ # Global rules
7
+ # see .rubocop_common.yml
8
+
9
+ ##############
10
+ # Inherit default rules first, and then override those rules with
11
+ # our violation whitelist.
12
+ inherit_from:
13
+ - .rubocop_common.yml
14
+
15
+ ##############
16
+ # Project specific overrides here, example:
17
+ # Metrics/BlockLength:
18
+ # Exclude:
19
+ # - 'tasks/the_huge_task.rake'
@@ -0,0 +1,19 @@
1
+ ##############
2
+ # Global rules
3
+ AllCops:
4
+ Exclude:
5
+ - db/**/*
6
+
7
+ Rails:
8
+ Enabled: false
9
+
10
+ Style/SymbolArray:
11
+ EnforcedStyle: brackets
12
+
13
+ Metrics/LineLength:
14
+ Max: 100
15
+
16
+ Metrics/BlockLength:
17
+ Exclude:
18
+ - '*.gemspec'
19
+ - 'spec/**/*.rb'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,7 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-11-09 14:30:10 +0100 using RuboCop version 0.51.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.1] - 2017-11-09
10
+ ### Added
11
+ - rubocop-rules init
12
+ - rubocop-rules update
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rubocop-rules.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017 Mathias Klippinge (mathias.klippinge@gmail.com)
4
+
5
+ Permission is hereby granted, free of charge,
6
+ to any person obtaining a copy of this software and
7
+ associated documentation files (the "Software"), to
8
+ deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify,
10
+ merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom
12
+ the Software is furnished to do so,
13
+ subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice
16
+ shall be included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22
+ ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Rubocop::Rules
2
+
3
+ A common place to house rubocop rule enforcement across projects.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rubocop_rules', require: false
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rubocop_rules
20
+
21
+ ## Usage
22
+
23
+ After installing the gem, you need to initialize your project using the provided CLI.
24
+
25
+ ### Initializing a project
26
+
27
+ Initialize your project with the cli: `rubocop-rules init`
28
+
29
+ This will create `.rubocop.yml` and `rubucop_common.yml`, it will then run `rubucop -a` to automatically fix what can be fixed for you.
30
+ In addition to this it will create `rubucop_todo.yml` to put what cannot be fixed in quarantine for you to fix later.
31
+
32
+ Finally, a linter spec to make sure your code is following the common conventions.
33
+
34
+ ### Updating a project
35
+
36
+ Whenever a new version of the gem is deployed, you may update your project configuration using the command: `rubocop-rules update`. This command
37
+ will get a fresh copy of `rubucop_common.yml`, it will run autofixes and regenerate a new `rubucop_todo.yml` for you.
38
+
39
+ ## Development
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/klarna/rubocop_rules.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'rubocop/rules'
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/rubocop-rules ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
4
+
5
+ require 'rubocop_rules'
6
+ require 'rubocop_rules/cli'
7
+
8
+ STDOUT.sync = true
9
+ RubocopRules::CLI::Commands.start(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,5 @@
1
+ require 'rubocop_rules/version'
2
+
3
+ # :nodoc:
4
+ module RubocopRules
5
+ end
@@ -0,0 +1,65 @@
1
+ require 'thor'
2
+ require 'open3'
3
+
4
+ module RubocopRules
5
+ module CLI
6
+ # CLI for initializing a project with RubocopRules, and keeping it up to date
7
+ class Commands < Thor
8
+ include Thor::Actions
9
+
10
+ def self.source_root
11
+ File.expand_path(File.join(File.dirname(__FILE__), '../..'))
12
+ end
13
+
14
+ map '-v' => :version
15
+ map '--version' => :version
16
+
17
+ desc 'version', 'Outputs the version number'
18
+ def version
19
+ puts RubocopRules::VERSION
20
+ end
21
+
22
+ desc 'init', 'Initialize RubocopRules in your project'
23
+ def init
24
+ copy_file '.rubocop_common.yml', '.rubocop_common.yml'
25
+ copy_file '.rubocop.yml', '.rubocop.yml'
26
+ copy_file 'spec/lint_spec.rb', 'spec/lint_spec.rb'
27
+
28
+ print 'Autocorrecting your code... '
29
+ run_process(command: 'rubocop -a')
30
+
31
+ print 'Generating rubocop_todo... '
32
+ run_process(command: 'rubocop --auto-gen-config')
33
+
34
+ print 'Adding rubocop_todo to configuration... '
35
+ insert_into_file '.rubocop.yml', ' - .rubocop_todo.yml', after: " - .rubocop_common.yml\n"
36
+ end
37
+
38
+ desc 'update', 'Regenerate RubocopRules configuration in your project'
39
+ def update
40
+ puts 'Recreating configuration...'
41
+ remove_file '.rubocop_common.yml'
42
+ copy_file '.rubocop_common.yml', '.rubocop_common.yml'
43
+
44
+ puts 'Regenerating rubocop_todo... '
45
+ remove_file '.rubocop_todo.yml'
46
+ comment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
47
+ run_process(command: 'rubocop -a', silent: true)
48
+ run_process(command: 'rubocop --auto-gen-config', silent: true)
49
+ uncomment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
50
+ end
51
+
52
+ private
53
+
54
+ def run_process(command:, silent: false)
55
+ output = ''
56
+ Open3.popen2(command) do |stdin, stdout_stderr, wait_thr|
57
+ stdin.close
58
+ output = stdout_stderr.read
59
+ wait_thr.value
60
+ end
61
+ puts output.split("\n").last unless silent
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,3 @@
1
+ module RubocopRules
2
+ VERSION = '1.0.1'.freeze
3
+ end
@@ -0,0 +1,40 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubocop_rules/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rubocop_rules'
8
+ spec.version = RubocopRules::VERSION
9
+ spec.authors = ['Mathias Klippinge']
10
+ spec.email = ['mathias.klippinge@gmail.com']
11
+
12
+ spec.summary = 'Common place to host rubocop enforcement across projects'
13
+ spec.description = <<-DESC
14
+ Rubocop config lives all over the place and can easily get out of sync.
15
+ This project tries to solve this problem by centralizing shared config and provide CLI for keeping it up to date.
16
+ DESC
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+ else
23
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
24
+ 'public gem pushes.'
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = 'bin'
31
+ spec.executables = spec.files.grep(%r{^bin/rubocop-rules}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+ spec.add_dependency 'rubocop', '~> 0.51.0'
34
+ spec.add_dependency 'thor'
35
+
36
+ spec.add_development_dependency 'bundler', '~> 1.15'
37
+ spec.add_development_dependency 'pry'
38
+ spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_development_dependency 'rspec', '~> 3.0'
40
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop_rules
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mathias Klippinge
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-09 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.51.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.51.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: |2
98
+ Rubocop config lives all over the place and can easily get out of sync.
99
+ This project tries to solve this problem by centralizing shared config and provide CLI for keeping it up to date.
100
+ email:
101
+ - mathias.klippinge@gmail.com
102
+ executables:
103
+ - rubocop-rules
104
+ extensions: []
105
+ extra_rdoc_files: []
106
+ files:
107
+ - ".gitignore"
108
+ - ".rspec"
109
+ - ".rubocop.yml"
110
+ - ".rubocop_common.yml"
111
+ - ".rubocop_todo.yml"
112
+ - ".travis.yml"
113
+ - CHANGELOG.md
114
+ - Gemfile
115
+ - LICENSE
116
+ - README.md
117
+ - Rakefile
118
+ - bin/console
119
+ - bin/rubocop-rules
120
+ - bin/setup
121
+ - lib/rubocop_rules.rb
122
+ - lib/rubocop_rules/cli.rb
123
+ - lib/rubocop_rules/version.rb
124
+ - rubocop-rules.gemspec
125
+ homepage:
126
+ licenses: []
127
+ metadata:
128
+ allowed_push_host: https://rubygems.org
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.6.13
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Common place to host rubocop enforcement across projects
149
+ test_files: []