ramsey_cop 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab0d2626071447d40a493e7676824a0ba22f6faa
4
+ data.tar.gz: fe339310d317bd218af04cc9a35cafa2c147f231
5
+ SHA512:
6
+ metadata.gz: bd7f6eaa494033e88301c8119432d0f18626708376a1820c0590eca69e42de3cd5fd5af342bf867b9b83df3a97f5bdb5a257be26d6b2bb6dec597bbf17b72cae
7
+ data.tar.gz: 99766eb0d5372b44e4ba6da3a8abc1ceb5b1f3117c1bae70647dd42cab6ecbee3ea19c159a74ebd154e020ab2f7882ee5899c9b5df3c8d16659650c458a11ce5
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
13
+ .idea
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: default.yml
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.14.6
data/CODEOWNERS ADDED
@@ -0,0 +1,3 @@
1
+ # https://help.github.com/articles/about-codeowners/
2
+
3
+ * @jwsloan @rickpeyton
@@ -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 peytorb@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/CONTRIBUTING.md ADDED
@@ -0,0 +1,31 @@
1
+ # Contributing to RamseyCop
2
+
3
+ ## Getting Started
4
+ * `git clone git@github.com:ramseyinhouse/ramsey-cop.git`
5
+ * `cd ramsey-cop`
6
+ * `bundle`
7
+
8
+ ## Recommended Workflow
9
+ * Ensure that any local `.rubocop.yml` overrides are removed
10
+ * Pull this gem down
11
+ * Set your gemfile to point your local `ramsey_cop` and run `bundle`
12
+ * Run `rubocop` in your app
13
+ * Use `rubocop -D` to display cop names in the offense message and help you
14
+ quickly find the [appropriate override](https://github.com/bbatsov/rubocop/blob/master/config/default.yml)
15
+ * Review the offenses listed
16
+ * If your code does not adhere to dev standards
17
+ * Update the style in your code only as you make changes. There is no need to make style-only updates.
18
+ * Elsif your code does adhere to dev standards || you want to suggest changes
19
+ * Update the default.yml using a single commit per style change.
20
+ * Submit a PR
21
+
22
+ ## Submitting a PR
23
+ * Only add/update one cop per commit.
24
+ * Keep the cops defined in `default.yml` in alphabetical order.
25
+ * Follow the precedent set by previous commit messages such as:
26
+ * Layout/AccessModifierIndentation: set EnforcedStyle: outdent
27
+ * Style/Alias: set EnforcedStyle: prefer_alias_method
28
+ * If it is not a simple setting, feel free to do something like:
29
+ * Style/PercentLiteralDelimiters: set PreferredDelimiters
30
+ * After creating a PR, the CODEOWNERS file will assign your PR to the
31
+ appropriate reviewer.
data/Dockerfile ADDED
@@ -0,0 +1,29 @@
1
+ # Build Image
2
+ # docker build -t ruby:ramsey_cop .
3
+
4
+ # Run Tests
5
+ # docker run ruby:ramsey_cop
6
+ # Run bash
7
+ # docker run -it ruby:ramsey_cop bash
8
+
9
+ FROM ruby:2.4.0
10
+
11
+ RUN apt-get update -qq && \
12
+ apt-get upgrade -y
13
+
14
+ RUN gem update --system && \
15
+ gem update bundler
16
+
17
+ RUN mkdir /app
18
+ WORKDIR /app
19
+
20
+
21
+ ADD Gemfile /app/Gemfile
22
+ ADD Gemfile.lock /app/Gemfile.lock
23
+ ADD ramsey_cop.gemspec /app/ramsey_cop.gemspec
24
+ ADD ./lib/ramsey_cop/version.rb /app/lib/ramsey_cop/version.rb
25
+ RUN bundle install
26
+ ENV PATH="./bin:${PATH}"s
27
+
28
+ ADD . /app
29
+ CMD ["bundle","exec","rake"]
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ramsey_cop.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ramsey_cop (0.7.3)
5
+ rubocop (~> 0.52.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ diff-lcs (1.3)
12
+ parallel (1.12.1)
13
+ parser (2.5.0.0)
14
+ ast (~> 2.4.0)
15
+ powerpack (0.1.1)
16
+ rainbow (3.0.0)
17
+ rake (10.5.0)
18
+ rspec (3.6.0)
19
+ rspec-core (~> 3.6.0)
20
+ rspec-expectations (~> 3.6.0)
21
+ rspec-mocks (~> 3.6.0)
22
+ rspec-core (3.6.0)
23
+ rspec-support (~> 3.6.0)
24
+ rspec-expectations (3.6.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.6.0)
27
+ rspec-mocks (3.6.0)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.6.0)
30
+ rspec-support (3.6.0)
31
+ rubocop (0.52.1)
32
+ parallel (~> 1.10)
33
+ parser (>= 2.4.0.2, < 3.0)
34
+ powerpack (~> 0.1)
35
+ rainbow (>= 2.2.2, < 4.0)
36
+ ruby-progressbar (~> 1.7)
37
+ unicode-display_width (~> 1.0, >= 1.0.1)
38
+ ruby-progressbar (1.9.0)
39
+ unicode-display_width (1.3.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 1.14)
46
+ rake (~> 10.0)
47
+ ramsey_cop!
48
+ rspec (~> 3.0)
49
+
50
+ BUNDLED WITH
51
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1 @@
1
+ https://www.gnu.org/licenses/gpl-3.0.html
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # RamseyCop
2
+
3
+ Inspired by https://blog.percy.io/share-rubocop-rules-across-all-of-your-repos-f3281fbd71f8
4
+
5
+ Ramsey shared style configs.
6
+
7
+ ## Why
8
+
9
+ https://www.sandimetz.com/blog/2017/6/1/why-we-argue-style
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ group :test, :development do
17
+ gem "ramsey_cop"
18
+ end
19
+ ```
20
+
21
+ And then run:
22
+
23
+ ```bash
24
+ $ bundle install
25
+ ```
26
+
27
+ If you're in a Rails app, you can now run:
28
+ ```bash
29
+ $ rails generate ramsey_cop
30
+ ```
31
+
32
+ If you're not in a Rails app, you will need to create a `.rubocop.yml` with the following directives:
33
+
34
+ ```yaml
35
+ inherit_gem:
36
+ ramsey_cop:
37
+ - default.yml
38
+ ```
39
+
40
+ Now, run:
41
+
42
+ ```bash
43
+ $ bundle exec rubocop
44
+ ```
45
+
46
+ You do not need to include rubocop directly in your application's dependencies. RamseyCop will include a specific version of `rubocop` that is shared across all projects.
47
+
48
+ ## Documentation
49
+
50
+ * [Introducing RamseyCop to an existing repository](/documentation/existing-repositories.md)
51
+ * [RamseyCop linting in Vim with ALE](/documentation/vim-tips.md)
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 "ramsey_cop"
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
@@ -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
data/default.yml ADDED
@@ -0,0 +1,71 @@
1
+ Documentation:
2
+ Enabled: false
3
+
4
+ Layout/AccessModifierIndentation:
5
+ EnforcedStyle: outdent
6
+
7
+ Metrics/AbcSize:
8
+ Exclude:
9
+ - spec/**/*
10
+ - test/**/*
11
+
12
+ Metrics/BlockLength:
13
+ Exclude:
14
+ - spec/**/*
15
+ - test/**/*
16
+
17
+ Metrics/BlockNesting:
18
+ Exclude:
19
+ - spec/**/*
20
+ - test/**/*
21
+
22
+ Metrics/CyclomaticComplexity:
23
+ Exclude:
24
+ - spec/**/*
25
+ - test/**/*
26
+
27
+ Metrics/LineLength:
28
+ Max: 120
29
+
30
+ Metrics/MethodLength:
31
+ Exclude:
32
+ - spec/**/*
33
+ - test/**/*
34
+
35
+ Style/Alias:
36
+ EnforcedStyle: prefer_alias_method
37
+
38
+ Style/AndOr:
39
+ EnforcedStyle: conditionals
40
+
41
+ Style/DateTime:
42
+ Enabled: false
43
+
44
+ Style/FrozenStringLiteralComment:
45
+ Enabled: false
46
+
47
+ Style/Lambda:
48
+ Enabled: false
49
+
50
+ Style/NumericLiterals:
51
+ Enabled: false
52
+
53
+ Style/PercentLiteralDelimiters:
54
+ PreferredDelimiters:
55
+ '%i': ()
56
+ '%I': ()
57
+ '%q': ()
58
+ '%Q': ()
59
+ '%r': '{}'
60
+ '%s': ()
61
+ '%w': ()
62
+ '%W': ()
63
+ '%x': ()
64
+
65
+ Style/RegexpLiteral:
66
+ EnforcedStyle: mixed
67
+ AllowInnerSlashes: true
68
+
69
+ Style/StringLiterals:
70
+ EnforcedStyle: double_quotes
71
+ Enabled: true
@@ -0,0 +1,13 @@
1
+ # Integrating RamseyCop with CodeClimate
2
+
3
+ See https://codeclimate.com/changelog/582495c32c33066f1b00191d/ for context.
4
+
5
+ In your `.codeclimate.yml` file, you will need to add:
6
+ ```yml
7
+ prepare:
8
+ fetch:
9
+ - url: "https://raw.githubusercontent.com/RamseyInHouse/ramsey-cop/master/default.yml"
10
+ path: ".rubocop.yml"
11
+ ```
12
+
13
+ This will stomp your `.rubocop.yml` file, but only for the purpose of running RamseyCop against your PR in GitHub. This is necessary because CodeClimate will not install any gems.
@@ -0,0 +1,29 @@
1
+ # Introducing Ramsey Cop to an existing repository
2
+
3
+ Here are a few tips for introducing RamseyCop to an existing project
4
+
5
+ * Delete any existing `.rubocop.yml` config files
6
+ * Run `rails generate ramsey_cop`
7
+ * Or manually create a new `.rubocop.yml` that contains only
8
+
9
+ ```yaml
10
+ inherit_gem:
11
+ ramsey_cop:
12
+ - default.yml
13
+ ```
14
+
15
+ ## Getting a feel for the current state of your code.
16
+ * Run `bundle exec rubocop -f o` to get a count of violations per cop.
17
+ * Run `bundle exec rubocop -f w` to see your worst offending files.
18
+ * Run `bundle exec rubocop -h` to see the other handy options.
19
+
20
+ ## Letting rubocop fix what it can
21
+ Some of the cops are auto-correctable. This will make all of those changes. Generally it is not advised to make style-only changes, as your time is probably better spent adding some new feature. However, this only requires a review and may be worth the effort. If you're happy with the auto-correct changes, you could go ahead and commit that. If there are changes you are not happy with, then you can put in a PR for this gem to change the cops.
22
+
23
+ * Run `bundle exec rubocop --auto-correct`
24
+
25
+ ## Your first PR after including RamseyCop
26
+ Hopefully you have CodeClimate running against your repo and blocking PRs when it sees offenses. This is good, and it means your first PR will be blocked for all of your offenses. You may want to get a repo admin to merge your PR anyway. This will allow you to then only focus on offenses as code is changed/added.
27
+
28
+ ## Further notes
29
+ * Be sure to either use `bundle exec rubocop` OR run `bundle binstubs rubocop` before executing `rubocop` to make sure you are getting the version of `rubocop` specified in `RamseyCop`
@@ -0,0 +1,10 @@
1
+ # Vim Tips
2
+
3
+ ## RamseyCop, VIM and ALE
4
+
5
+ [Thoughtbot](https://github.com/thoughtbot) replaced the linting library [Syntastic](https://github.com/vim-syntastic/syntastic) with [ALE](https://github.com/w0rp/ale) in their community dotfiles. ALE works great in Vim with `RamseyCop`
6
+
7
+ * [Thoughtbot commit](https://github.com/thoughtbot/dotfiles/commit/8ac75ba56b6ad6eb8134283ca3fb406067ed02b4)
8
+ * [ALE repo](https://github.com/w0rp/ale)
9
+
10
+ ![alt text](/documentation/images/vim-tips-01.png "ALE, RamseyCop and Vim Example")
@@ -0,0 +1,7 @@
1
+ class RamseyCopGenerator < Rails::Generators::Base
2
+ source_root(File.expand_path(__dir__))
3
+
4
+ def create_rubcop_yml
5
+ template "rscop.yml", ".rubocop.yml"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ inherit_gem:
2
+ ramsey_cop:
3
+ - default.yml
@@ -0,0 +1,3 @@
1
+ module RamseyCop
2
+ VERSION = "0.7.3".freeze
3
+ end
data/lib/ramsey_cop.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "ramsey_cop/version"
2
+
3
+ module RamseyCop
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "ramsey_cop/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ramsey_cop"
7
+ spec.version = RamseyCop::VERSION
8
+ spec.authors = ["Rick Peyton", "John Sloan"]
9
+ spec.email = ["rick.peyton@daveramsey.com", "john.sloan@daveramsey.com"]
10
+
11
+ spec.summary = "Ramsey style guides and shared style configs."
12
+ spec.homepage = "https://github.com/ramseyinhouse/ramsey-cop"
13
+ spec.license = "GPLv3"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(/^(test|spec|features)\//)
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "rubocop", "~> 0.52.1"
23
+ spec.add_development_dependency "bundler", "~> 1.14"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ramsey_cop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
+ platform: ruby
6
+ authors:
7
+ - Rick Peyton
8
+ - John Sloan
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2018-02-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubocop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.52.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.52.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.14'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.14'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ description:
71
+ email:
72
+ - rick.peyton@daveramsey.com
73
+ - john.sloan@daveramsey.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".rubocop.yml"
81
+ - ".travis.yml"
82
+ - CODEOWNERS
83
+ - CODE_OF_CONDUCT.md
84
+ - CONTRIBUTING.md
85
+ - Dockerfile
86
+ - Gemfile
87
+ - Gemfile.lock
88
+ - LICENSE.txt
89
+ - README.md
90
+ - Rakefile
91
+ - bin/console
92
+ - bin/setup
93
+ - default.yml
94
+ - documentation/codeclimate-setup.md
95
+ - documentation/existing-repositories.md
96
+ - documentation/images/vim-tips-01.png
97
+ - documentation/vim-tips.md
98
+ - lib/generators/ramsey_cop_generator.rb
99
+ - lib/generators/rscop.yml
100
+ - lib/ramsey_cop.rb
101
+ - lib/ramsey_cop/version.rb
102
+ - ramsey_cop.gemspec
103
+ homepage: https://github.com/ramseyinhouse/ramsey-cop
104
+ licenses:
105
+ - GPLv3
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.6.8
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Ramsey style guides and shared style configs.
127
+ test_files: []