Skip to content

Commit

Permalink
Create gem
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed May 12, 2020
1 parent 03750a0 commit cd81d4f
Show file tree
Hide file tree
Showing 18 changed files with 701 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .gitignore
@@ -0,0 +1,61 @@
# rcov generated
coverage
coverage.data

# rdoc generated
rdoc

# yard generated
doc
.yardoc

# bundler
.bundle
./Gemfile.lock
./Gemfile.local

# rbenv
.ruby-version

# rspec
/spec/examples.txt
/.test_queue_stats

# jeweler generated
pkg

# etags
TAGS

# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
# * Include files you want ignored
# * Run: git config --global core.excludesfile ~/.gitignore
#
# After doing this, these files will be ignored in all your git projects,
# saving you from having to 'pollute' every project you touch with them
#
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
#
# For MacOS:
#
#.DS_Store

# For TextMate
#*.tmproj
#tmtags

# For emacs:
#*~
#\#*
#.\#*

# For vim:
*.swp

# For redcar:
#.redcar

# For rubinius:
#*.rbc
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--require spec_helper
110 changes: 110 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,110 @@
# This is the configuration used to check the rubocop source code.

inherit_from: .rubocop_todo.yml
require:
- rubocop/cop/internal_affairs
- rubocop-performance
- rubocop-rspec

AllCops:
NewCops: enable
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
- 'tmp/**/*'
- '.git/**/*'
TargetRubyVersion: 2.4

Naming/PredicateName:
# Method define macros for dynamically generated method.
MethodDefinitionMacros:
- define_method
- define_singleton_method
- def_node_matcher
- def_node_search

Style/FormatStringToken:
# Because we parse a lot of source codes from strings. Percent arrays
# look like unannotated format string tokens to this cop.
Exclude:
- spec/**/*

Style/IpAddresses:
# The test for this cop includes strings that would cause offenses
Exclude:
- spec/rubocop/cop/style/ip_addresses_spec.rb

Layout/EndOfLine:
EnforcedStyle: lf

Layout/ClassStructure:
Enabled: true
Categories:
module_inclusion:
- include
- prepend
- extend
ExpectedOrder:
- module_inclusion
- constants
- public_class_methods
- initializer
- instance_methods
- protected_methods
- private_methods

# Trailing white space is meaningful in code examples
Layout/TrailingWhitespace:
AllowInHeredoc: true

Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*.rb'

Layout/HashAlignment:
EnforcedHashRocketStyle:
- key
- table
EnforcedColonStyle:
- key
- table

Lint/InterpolationCheck:
Exclude:
- 'spec/**/*.rb'

Lint/UselessAccessModifier:
MethodCreatingMethods:
- 'def_matcher'
- 'def_node_matcher'

Lint/BooleanSymbol:
Enabled: false

Metrics/BlockLength:
Exclude:
- 'Rakefile'
- '**/*.rake'
- 'spec/**/*.rb'
- '**/*.gemspec'

Metrics/ClassLength:
Exclude:
- lib/rubocop/config_obsoletion.rb

Metrics/ModuleLength:
Exclude:
- 'spec/**/*.rb'

RSpec/FilePath:
Exclude:
- spec/rubocop/formatter/junit_formatter_spec.rb

RSpec/PredicateMatcher:
EnforcedStyle: explicit

RSpec/MessageSpies:
EnforcedStyle: receive

RSpec/NestedGroups:
Max: 7
85 changes: 85 additions & 0 deletions .rubocop_todo.yml
@@ -0,0 +1,85 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-05-11 03:29:20 -0400 using RuboCop version 0.82.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'rubocop-ast.gemspec'

# Offense count: 2
InternalAffairs/NodeDestructuring:
Exclude:
- 'spec/rubocop/ast/resbody_node_spec.rb'
- 'spec/rubocop/node_pattern_spec.rb'

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 148

# Offense count: 4
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 13

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 101

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/rubocop-ast.rb'

# Offense count: 1
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- 'spec/rubocop/ast/node_spec.rb'

# Offense count: 180
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/rubocop/ast/array_node_spec.rb'
- 'spec/rubocop/ast/block_node_spec.rb'
- 'spec/rubocop/ast/float_node_spec.rb'
- 'spec/rubocop/ast/hash_node_spec.rb'
- 'spec/rubocop/ast/int_node_spec.rb'
- 'spec/rubocop/ast/node_spec.rb'
- 'spec/rubocop/ast/resbody_node_spec.rb'
- 'spec/rubocop/node_pattern_spec.rb'
- 'spec/rubocop/processed_source_spec.rb'
- 'spec/rubocop/token_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 5
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
- 'spec/rubocop/node_pattern_spec.rb'
- 'spec/rubocop/processed_source_spec.rb'

# Offense count: 50
# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 5

# Offense count: 1
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,7 @@
# Change log

## master (unreleased)

* Gem extracted from RuboCop. ([@marcandre][])

[@marcandre]: https://github.com/marcandre
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,70 @@
# Contributing

If you discover issues, have ideas for improvements or new features,
please report them to the [issue tracker][1] of the repository or
submit a pull request. Please, try to follow these guidelines when you
do so.

## Issue reporting

* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `master`).
* Be clear, concise and precise in your description of the problem.
* Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
* Include the output of `rubocop -V`:

```
$ rubocop -V
0.50.0 (using Parser 2.4.0.0, running on ruby 2.4.2 x86_64-linux)
```

* Include any relevant code to the issue summary.

## Pull requests

* Read [how to properly contribute to open source projects on GitHub][2].
* Fork the project.
* Use a topic/feature branch to easily amend a pull request later, if necessary.
* Write [good commit messages][3].
* Use the same coding conventions as the rest of the project.
* Commit and push until you are happy with your contribution.
* If your change has a corresponding open GitHub issue, prefix the commit message with `[Fix #github-issue-number]`.
* Make sure to add tests for it. This is important so I don't break it
in a future version unintentionally.
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
* Please try not to mess with the Rakefile, version, or history. If
you want to have your own version, or is otherwise necessary, that
is fine, but please isolate to its own commit so I can cherry-pick
around it.
* Make sure the test suite is passing and the code you wrote doesn't produce
RuboCop offenses (usually this is as simple as running `bundle exec rake`).
* [Squash related commits together][5].
* Open a [pull request][4] that relates to *only* one subject with a clear title
and description in grammatically correct, complete sentences.

### Changelog entry format

Here are a few examples:

```
* [#716](https://github.com/rubocop-hq/rubocop-ast/issues/716): Fixed a regression in the auto-correction logic of `MethodDefParentheses`. ([@bbatsov][])
* New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
* [#7542](https://github.com/rubocop-hq/rubocop-ast/pull/7542): **(Breaking)** Move `LineLength` cop from `Metrics` department to `Layout` department. ([@koic][])
```

* Mark it up in [Markdown syntax][6].
* The entry line should start with `* ` (an asterisk and a space).
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/rubocop-hq/rubocop-ast/issues/123): `.
* Describe the brief of the change. The sentence should end with a punctuation.
* If this is a breaking change, mark it with `**(Breaking)**`.
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
* If this is your first contribution to RuboCop project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.

[1]: https://github.com/rubocop-hq/rubocop-ast/issues
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[4]: https://help.github.com/articles/about-pull-requests
[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
[6]: https://daringfireball.net/projects/markdown/syntax
18 changes: 18 additions & 0 deletions Gemfile
@@ -0,0 +1,18 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'pry'
gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.7'
# Workaround for cc-test-reporter with SimpleCov 0.18.
# Stop upgrading SimpleCov until the following issue will be resolved.
# https://github.com/codeclimate/test-reporter/issues/418
gem 'simplecov', '~> 0.10', '< 0.18'
gem 'test-queue'
gem 'yard', '~> 0.9'

local_gemfile = File.expand_path('Gemfile.local', __dir__)
eval_gemfile local_gemfile if File.exist?(local_gemfile)

0 comments on commit cd81d4f

Please sign in to comment.