standard 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of standard might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.circleci/config.yml +31 -0
- data/.gitignore +8 -0
- data/.standard.yml +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +24 -0
- data/README.md +325 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/base.yml +205 -0
- data/exe/standard +7 -0
- data/exe/standardrb +7 -0
- data/lib/standard/cli.rb +36 -0
- data/lib/standard/config.rb +112 -0
- data/lib/standard/cop/semantic_blocks.rb +161 -0
- data/lib/standard/file_finder.rb +13 -0
- data/lib/standard/formatter.rb +34 -0
- data/lib/standard/railtie.rb +11 -0
- data/lib/standard/rake.rb +26 -0
- data/lib/standard/rubocop/ext.rb +7 -0
- data/lib/standard/version.rb +3 -0
- data/lib/standard.rb +12 -0
- data/standard.gemspec +26 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf5ed86950c990b0936715209dd69fd5d01d3c8e4167d04a9c3b95812923df5e
|
4
|
+
data.tar.gz: da51183d3e39d8f1b7eabbf3ffa3936296dd90fcc3925710e31de3b6a612f606
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec4637a8c9409327c4666577b94ece9227d2e29c90e107d8dbb2228ccb05b3bcec25df1e6af12c87ec9e22a67b4c880b627c14568cb40a9bbaa91e6c8de1a13f
|
7
|
+
data.tar.gz: 3b621b77d44fd78f6cc6c09890a62698ced870f13776dbb8035fb678d3f07733585937fbe26b055c946149b7caf2c51ce74119a24c7482214e376eb05acfcf2a
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
10
|
+
working_directory: ~/repo
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
- restore_cache:
|
15
|
+
keys:
|
16
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
17
|
+
- v1-dependencies-
|
18
|
+
|
19
|
+
- run:
|
20
|
+
name: install dependencies
|
21
|
+
command: |
|
22
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
23
|
+
|
24
|
+
- save_cache:
|
25
|
+
paths:
|
26
|
+
- ./vendor/bundle
|
27
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: lint
|
31
|
+
command: bundle exec ./exe/standard --fix
|
data/.gitignore
ADDED
data/.standard.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
standard (0.0.7)
|
5
|
+
rubocop (>= 0.60)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
jaro_winkler (1.5.1)
|
12
|
+
minitest (5.11.3)
|
13
|
+
parallel (1.12.1)
|
14
|
+
parser (2.5.3.0)
|
15
|
+
ast (~> 2.4.0)
|
16
|
+
powerpack (0.1.2)
|
17
|
+
rainbow (3.0.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
rubocop (0.60.0)
|
20
|
+
jaro_winkler (~> 1.5.1)
|
21
|
+
parallel (~> 1.10)
|
22
|
+
parser (>= 2.5, != 2.5.1.1)
|
23
|
+
powerpack (~> 0.1)
|
24
|
+
rainbow (>= 2.2.2, < 4.0)
|
25
|
+
ruby-progressbar (~> 1.7)
|
26
|
+
unicode-display_width (~> 1.4.0)
|
27
|
+
ruby-progressbar (1.10.0)
|
28
|
+
unicode-display_width (1.4.0)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
bundler (~> 1.17)
|
35
|
+
minitest (~> 5.0)
|
36
|
+
rake (~> 10.0)
|
37
|
+
standard!
|
38
|
+
|
39
|
+
BUNDLED WITH
|
40
|
+
1.17.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2018 Test Double, LLC
|
2
|
+
|
3
|
+
Portions of these files Copyright (c) 2012-18 Bozhidar Batsov:
|
4
|
+
- config/base.yml
|
5
|
+
- lib/standard/cop/semantic_blocks.rb
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
a copy of this software and associated documentation files (the
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be
|
16
|
+
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 OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,325 @@
|
|
1
|
+
## Standard - Ruby style guide, linter, and formatter
|
2
|
+
|
3
|
+
This gem is a spiritual port of [StandardJS](https://standardjs.com) and aims
|
4
|
+
to save you (and others!) time in the same three ways:
|
5
|
+
|
6
|
+
* **No configuration.** The easiest way to enforce consistent style in your
|
7
|
+
project. Just drop it in.
|
8
|
+
* **Automatically format code.** Just run `standard --fix` and say goodbye to
|
9
|
+
messy or inconsistent code.
|
10
|
+
* **Catch style issues & programmer errors early.** Save precious code review
|
11
|
+
time by eliminating back-and-forth between reviewer & contributor.
|
12
|
+
|
13
|
+
No decisions to make. It just works.
|
14
|
+
|
15
|
+
Install by adding it to your Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem "standard", :group => [:development, :test]
|
19
|
+
```
|
20
|
+
|
21
|
+
And running `bundle install`.
|
22
|
+
|
23
|
+
Run Standard from the command line with:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
$ bundle exec standard
|
27
|
+
```
|
28
|
+
|
29
|
+
And if you'd like, Standard can autocorrect your code by tacking on a `--fix`
|
30
|
+
flag.
|
31
|
+
|
32
|
+
## StandardRB — The Rules
|
33
|
+
|
34
|
+
- **2 spaces** – for indentation
|
35
|
+
- **Double quotes for string literals** - because pre-committing to whether
|
36
|
+
you'll need interpolation in a string slows people down
|
37
|
+
- **Hashrockets** - Ruby 1.9's `:` syntax is newer and terser (and presently,
|
38
|
+
more popular), but they can't be used consistently safely, and Standard is
|
39
|
+
all about consistency and safety. Hashrockets [are
|
40
|
+
good](https://samphippen.com/hash-rockets-are-good-actually/)
|
41
|
+
- **Semantic blocks** - `{`/`}` for functional blocks that return a value, and
|
42
|
+
`do`/`end` for procedural blocks that have side effects. More
|
43
|
+
[here](http://www.virtuouscode.com/2011/07/26/the-procedurefunction-block-convention-in-ruby/)
|
44
|
+
and [here](https://github.com/rubocop-hq/ruby-style-guide/issues/162)
|
45
|
+
- **Trailing dots on multi-line method chains** - chosen because it makes
|
46
|
+
copying lines into a REPL easier
|
47
|
+
- **And a good deal more**
|
48
|
+
|
49
|
+
If you're familiar with [RuboCop](https://github.com/rubocop-hq/rubocop), you
|
50
|
+
can look at Standard's current base configuration in
|
51
|
+
[config/base.yml](/config/base.yml).
|
52
|
+
|
53
|
+
**[NOTE: until StandardRB hits 1.0.0, we consider this configuration to be a
|
54
|
+
non-final work in progress and we encourage you to submit your opinions (and
|
55
|
+
reasoned arguments) for the addition, removal, or change to a rule by [opening
|
56
|
+
an issue](https://github.com/testdouble/standard/issues/new). If you start using
|
57
|
+
Standard, don't be shocked if things change a bit!]**
|
58
|
+
|
59
|
+
## Usage
|
60
|
+
|
61
|
+
Once you've installed `standard`, you should be able to use the `standard`
|
62
|
+
program. The simplest use case would be checking the style of all Ruby
|
63
|
+
files in the current working directory:
|
64
|
+
|
65
|
+
```bash
|
66
|
+
$ bundle exec standard
|
67
|
+
standard: Use Ruby Standard Style (https://github.com/testdouble/standard)
|
68
|
+
standard: Run `standard --fix` to automatically fix some problems.
|
69
|
+
/Users/code/cli.rb:31:23: Style/Semicolon: Do not use semicolons to terminate expressions.
|
70
|
+
```
|
71
|
+
|
72
|
+
You can optionally pass in a directory (or directories) using the glob pattern. Be
|
73
|
+
sure to quote paths containing glob patterns so that they are expanded by
|
74
|
+
`standard` instead of your shell:
|
75
|
+
|
76
|
+
```bash
|
77
|
+
$ bundle exec standard "lib/**/*.rb" test
|
78
|
+
```
|
79
|
+
|
80
|
+
**Note:** by default `standard` will look for all `*.rb` files (and some other
|
81
|
+
files typically associated with Ruby like `*.gemspec` and `Gemfile`)
|
82
|
+
|
83
|
+
### Using with Rake
|
84
|
+
|
85
|
+
Standard also ships with Rake tasks. If you're using Rails, these should
|
86
|
+
autoload and be available after installing Standard. Otherwise, just require the
|
87
|
+
tasks in your `Rakefile`:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
require "standard/rake"
|
91
|
+
```
|
92
|
+
|
93
|
+
Here are the tasks bundled with Standard:
|
94
|
+
|
95
|
+
```
|
96
|
+
$ rake standard # equivalent to running `standard`
|
97
|
+
$ rake standard:fix # equivalent to running `standard --fix`
|
98
|
+
```
|
99
|
+
|
100
|
+
You may also pass command line options to Standard's Rake tasks by embedding
|
101
|
+
them in a `STANDARDOPTS` environment variable (similar to how the Minitest Rake
|
102
|
+
task accepts CLI options in `TESTOPTS`).
|
103
|
+
|
104
|
+
```
|
105
|
+
# equivalent to `standard --format progress`:
|
106
|
+
$ rake standard STANDARDOPTS="--format progress"
|
107
|
+
|
108
|
+
# equivalent to `standard lib "app/**/*"`, to lint just certain paths:
|
109
|
+
$ rake standard STANDARDOPTS="lib \"app/**/*\""
|
110
|
+
```
|
111
|
+
|
112
|
+
## What you might do if you're clever
|
113
|
+
|
114
|
+
If you want or need to configure Standard, there are a _handful_ of options
|
115
|
+
are available creating a `.standard.yml` file in the root of your project.
|
116
|
+
|
117
|
+
Here's an example yaml file with every option set:
|
118
|
+
|
119
|
+
```yaml
|
120
|
+
fix: true
|
121
|
+
parallel: true
|
122
|
+
format: progress
|
123
|
+
ruby_version: 2.3.3
|
124
|
+
|
125
|
+
ignore:
|
126
|
+
- 'db/schema.rb'
|
127
|
+
- 'vendor/bundle/**/*'
|
128
|
+
- 'test/**/*':
|
129
|
+
- Layout/AlignHash
|
130
|
+
```
|
131
|
+
|
132
|
+
## What you might do if you're REALLY clever
|
133
|
+
|
134
|
+
Because StandardRB is essentially a wrapper on top of
|
135
|
+
[RuboCop](https://github.com/rubocop-hq/rubocop), it will actually forward the
|
136
|
+
vast majority of CLI and ENV arguments forward to RuboCop.
|
137
|
+
|
138
|
+
You can see a list of
|
139
|
+
[RuboCop](https://docs.rubocop.org/en/latest/basic_usage/#other-useful-command-line-flags)'s
|
140
|
+
CLI flags here.
|
141
|
+
|
142
|
+
## Why should I use Ruby Standard Style?
|
143
|
+
|
144
|
+
(This section will [look
|
145
|
+
familiar](https://github.com/standard/standard#why-should-i-use-javascript-standard-style)
|
146
|
+
if you've used StandardJS.)
|
147
|
+
|
148
|
+
The beauty of Ruby Standard Style is that it's simple. No one wants to
|
149
|
+
maintain multiple hundred-line style configuration files for every module/project
|
150
|
+
they work on. Enough of this madness!
|
151
|
+
|
152
|
+
This gem saves you (and others!) time in three ways:
|
153
|
+
|
154
|
+
- **No configuration.** The easiest way to enforce consistent style in your
|
155
|
+
project. Just drop it in.
|
156
|
+
- **Automatically format code.** Just run `standard --fix` and say goodbye to
|
157
|
+
messy or inconsistent code.
|
158
|
+
- **Catch style issues & programmer errors early.** Save precious code review
|
159
|
+
time by eliminating back-and-forth between reviewer & contributor.
|
160
|
+
|
161
|
+
Adopting `standard` style means ranking the importance of code clarity and
|
162
|
+
community conventions higher than personal style. This might not make sense for
|
163
|
+
100% of projects and development cultures, however open source can be a hostile
|
164
|
+
place for newbies. Setting up clear, automated contributor expectations makes a
|
165
|
+
project healthier.
|
166
|
+
|
167
|
+
## Who uses Ruby Standard Style?
|
168
|
+
|
169
|
+
(This section will not [look very
|
170
|
+
familiar](https://github.com/standard/standard#who-uses-javascript-standard-style)
|
171
|
+
if you've used StandardJS.)
|
172
|
+
|
173
|
+
* [Test Double](https://testdouble.com/agency)
|
174
|
+
* And that's about it so far!
|
175
|
+
|
176
|
+
## What if I also have StandardJS installed?
|
177
|
+
|
178
|
+
**[Note: While StandardRB is pre-1.0.0, we are waiting for user feedback before
|
179
|
+
deciding whether to mitigate this issue through cleverness or eliminate it by
|
180
|
+
changing the bin name. Please comment on [this
|
181
|
+
issue](https://github.com/testdouble/standard/issues/3) if you run into a
|
182
|
+
real-world problem trying to run either type of Standard.]**
|
183
|
+
|
184
|
+
Because StandardRB and StandardJS (and perhaps future packages for other
|
185
|
+
languages) both ship with binaries named `standard`, having both installed
|
186
|
+
globally and then executing them from your PATH will—at the moment—run whichever
|
187
|
+
one is found earlier in the PATH.
|
188
|
+
|
189
|
+
Ambiguity is bad, but we're banking on the majority of JS users to run standard
|
190
|
+
from a [package script](https://docs.npmjs.com/misc/scripts) and the majority of
|
191
|
+
Ruby developers to run standard from a [Bundler
|
192
|
+
binstub](https://bundler.io/v1.10/bundle_binstubs.html) or [Rake
|
193
|
+
task](#using-with-rake).
|
194
|
+
|
195
|
+
For every other case, if you're using both standard programs, note that
|
196
|
+
StandardRB ships with a `standardrb` bin, and we have a [pull request
|
197
|
+
open](https://github.com/standard/standard/pull/1224) to StandardJS to add a
|
198
|
+
`standardjs` alias so that either program can be run without any ambiguity.
|
199
|
+
|
200
|
+
## Is there a readme badge?
|
201
|
+
|
202
|
+
Yes! If you use `standard` in your project, you can include one of these badges
|
203
|
+
in your readme to let people know that your code is using the standard style.
|
204
|
+
|
205
|
+
|
206
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
207
|
+
|
208
|
+
```md
|
209
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
210
|
+
```
|
211
|
+
|
212
|
+
## I disagree with rule X, can you change it?
|
213
|
+
|
214
|
+
**[NOTE: until StandardRB hits 1.0.0, the answer is yes! It just requires
|
215
|
+
[opening an issue](https://github.com/testdouble/standard/issues/new) and
|
216
|
+
convincing [@searls](https://twitter.com/searls) (the BDFNow) to make the
|
217
|
+
change.]**
|
218
|
+
|
219
|
+
No. The whole point of `standard` is to save you time by avoiding
|
220
|
+
[bikeshedding](https://www.freebsd.org/doc/en/books/faq/misc.html#bikeshed-painting)
|
221
|
+
about code style. There are lots of debates online about tabs vs. spaces, etc.
|
222
|
+
that will never be resolved. These debates just distract from getting stuff
|
223
|
+
done. At the end of the day you have to 'just pick something', and that's the
|
224
|
+
whole philosophy of `standard` -- its a bunch of sensible 'just pick something'
|
225
|
+
opinions. Hopefully, users see the value in that over defending their own
|
226
|
+
opinions.
|
227
|
+
|
228
|
+
Pro tip: Just use `standard` and move on. There are actual real problems that
|
229
|
+
you could spend your time solving! :P
|
230
|
+
|
231
|
+
## Is there an automatic formatter?
|
232
|
+
|
233
|
+
Yes! You can use `standard --fix` to fix most issues automatically.
|
234
|
+
|
235
|
+
`standard --fix` is built into `standard` for maximum convenience. Most problems
|
236
|
+
are fixable, but some errors (like forgetting to handle errors) must be fixed
|
237
|
+
manually.
|
238
|
+
|
239
|
+
To save you time, `standard` outputs the message "`Run standard --fix to
|
240
|
+
automatically fix some problems`" when it detects problems that can be fixed
|
241
|
+
automatically.
|
242
|
+
|
243
|
+
## How do I ignore files?
|
244
|
+
|
245
|
+
Sometimes you need to ignore additional folders or specific minified files. To
|
246
|
+
do that, add a `.standard.yml` file to the root of your project and specify a
|
247
|
+
list of files and globs that should be excluded:
|
248
|
+
|
249
|
+
```yaml
|
250
|
+
ignore:
|
251
|
+
- 'db/schema.rb'
|
252
|
+
- 'vendor/bundle/**/*'
|
253
|
+
```
|
254
|
+
|
255
|
+
## How do I hide a certain warning?
|
256
|
+
|
257
|
+
In rare cases, you'll need to break a rule and hide the warning generated by
|
258
|
+
`standard`.
|
259
|
+
|
260
|
+
Ruby Standard Style uses [RuboCop](https://github.com/rubocop-hq/rubocop)
|
261
|
+
under-the-hood and you can hide warnings as you normally would if you used
|
262
|
+
RuboCop directly.
|
263
|
+
|
264
|
+
To ignore only certain rules from certain globs (not recommended, but maybe your
|
265
|
+
test suite uses a non-standardable DSL, you can specify an array of RuboCop
|
266
|
+
rules to ignore for a particular glob:
|
267
|
+
|
268
|
+
```yaml
|
269
|
+
ignore:
|
270
|
+
- 'test/**/*':
|
271
|
+
- Style/BlockDelimiters
|
272
|
+
```
|
273
|
+
|
274
|
+
You can also use special comments to disable all or certain rules within your
|
275
|
+
source code. See [RuboCop's
|
276
|
+
docs](https://docs.rubocop.org/en/latest/configuration/#disabling-cops-within-source-code)
|
277
|
+
for details.
|
278
|
+
|
279
|
+
## How do I specify a Ruby version? What is supported?
|
280
|
+
|
281
|
+
Because Standard wraps RuboCop, they share the same [runtime
|
282
|
+
requirements](https://github.com/rubocop-hq/rubocop#compatibility)—currently,
|
283
|
+
that's MRI 2.2 and newer.
|
284
|
+
|
285
|
+
Standard will default to telling RuboCop to target the currently runing version
|
286
|
+
of Ruby (by inspecting `RUBY_VERSION` at runtime. But if you want to lock it
|
287
|
+
down, you can specify `ruby_version` in `.standard.yml`.
|
288
|
+
|
289
|
+
```
|
290
|
+
ruby_version: 2.3.3
|
291
|
+
```
|
292
|
+
|
293
|
+
It's a little confusing to consider, but the targeted Ruby version for linting
|
294
|
+
may or may not match the version of the runtime (suppose you're on Ruby 2.5.1,
|
295
|
+
but your library supports Ruby 2.2.0). In this case, specify `ruby_version` and
|
296
|
+
you should be okay. However, note that if you target a _newer_ Ruby version than
|
297
|
+
the runtime, RuboCop may behave in surprising or inconsistent ways.
|
298
|
+
|
299
|
+
## How do I change the output?
|
300
|
+
|
301
|
+
Standard's built-in formatter is intentionally minimal, printing only unfixed
|
302
|
+
failures or (when successful) printing nothing at all. If you'd like to use a
|
303
|
+
different formatter, you can specify any of RuboCop's built-in formatters or
|
304
|
+
write your own.
|
305
|
+
|
306
|
+
For example, if you'd like to see colorful progress dots, you can either run
|
307
|
+
standard with:
|
308
|
+
|
309
|
+
```
|
310
|
+
$ bundle exec standard --format progress
|
311
|
+
Inspecting 15 files
|
312
|
+
...............
|
313
|
+
|
314
|
+
15 files inspected, no offenses detected
|
315
|
+
```
|
316
|
+
|
317
|
+
Or, in your project's `.standard.yml` file, specify:
|
318
|
+
|
319
|
+
```yaml
|
320
|
+
format: progress
|
321
|
+
```
|
322
|
+
|
323
|
+
Refer to RuboCop's [documentation on
|
324
|
+
formatters](https://rubocop.readthedocs.io/en/latest/formatters/) for more
|
325
|
+
information.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "standard"
|
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
data/config/base.yml
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
Bundler/OrderedGems:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Layout/AlignParameters:
|
5
|
+
EnforcedStyle: with_fixed_indentation
|
6
|
+
|
7
|
+
Layout/AlignHash:
|
8
|
+
EnforcedLastArgumentHashStyle: always_ignore
|
9
|
+
|
10
|
+
# Disabled because IndentOneStep can't be configured for one-liner cases. See:
|
11
|
+
# https://github.com/rubocop-hq/rubocop/issues/6447
|
12
|
+
Layout/CaseIndentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/DotPosition:
|
16
|
+
EnforcedStyle: trailing
|
17
|
+
|
18
|
+
Layout/EmptyLineAfterGuardClause:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Layout/EndAlignment:
|
22
|
+
EnforcedStyleAlignWith: variable
|
23
|
+
|
24
|
+
Layout/FirstParameterIndentation:
|
25
|
+
EnforcedStyle: consistent
|
26
|
+
|
27
|
+
Layout/IndentHash:
|
28
|
+
EnforcedStyle: consistent
|
29
|
+
|
30
|
+
Layout/IndentArray:
|
31
|
+
EnforcedStyle: consistent
|
32
|
+
|
33
|
+
Layout/MultilineMethodCallIndentation:
|
34
|
+
EnforcedStyle: indented
|
35
|
+
|
36
|
+
# Disabled without this:
|
37
|
+
# http://github.com/rubocop-hq/rubocop/issues/6446
|
38
|
+
Layout/SpaceInsideBlockBraces:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Layout/SpaceInsideHashLiteralBraces:
|
42
|
+
EnforcedStyle: no_space
|
43
|
+
|
44
|
+
Lint/AssignmentInCondition:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Metrics/AbcSize:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/BlockLength:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Metrics/BlockNesting:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Metrics/ClassLength:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Metrics/CyclomaticComplexity:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Metrics/LineLength:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Metrics/MethodLength:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Metrics/ModuleLength:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Metrics/ParameterLists:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Metrics/PerceivedComplexity:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Naming/PredicateName:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Naming/UncommunicativeMethodParamName:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Naming/VariableNumber:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Standard/SemanticBlocks:
|
87
|
+
ProceduralMethods:
|
88
|
+
- benchmark
|
89
|
+
- bm
|
90
|
+
- bmbm
|
91
|
+
- create
|
92
|
+
- each_with_object
|
93
|
+
- measure
|
94
|
+
- new
|
95
|
+
- realtime
|
96
|
+
- tap
|
97
|
+
- with_object
|
98
|
+
FunctionalMethods:
|
99
|
+
- let
|
100
|
+
- let!
|
101
|
+
- subject
|
102
|
+
- watch
|
103
|
+
- Given
|
104
|
+
- Given!
|
105
|
+
- Invariant
|
106
|
+
- Then
|
107
|
+
- And
|
108
|
+
IgnoredMethods:
|
109
|
+
- lambda
|
110
|
+
- proc
|
111
|
+
- it
|
112
|
+
- When
|
113
|
+
|
114
|
+
Style/AsciiComments:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Style/BlockDelimiters:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Style/BracesAroundHashParameters:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Style/ClassAndModuleChildren:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Style/Documentation:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/DoubleNegation:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/EmptyMethod:
|
133
|
+
EnforcedStyle: expanded
|
134
|
+
|
135
|
+
Style/ExpandPathArguments:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Style/FormatStringToken:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Style/FrozenStringLiteralComment:
|
142
|
+
EnforcedStyle: never
|
143
|
+
|
144
|
+
Style/GuardClause:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Style/HashSyntax:
|
148
|
+
EnforcedStyle: hash_rockets
|
149
|
+
|
150
|
+
Style/IfUnlessModifier:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
Style/MethodDefParentheses:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
Style/MultilineBlockChain:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
Style/MultilineTernaryOperator:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
Style/MultipleComparison:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
Style/MutableConstant:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
Style/NumericLiterals:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Style/NumericPredicate:
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
Style/RescueStandardError:
|
175
|
+
EnforcedStyle: implicit
|
176
|
+
|
177
|
+
Style/SignalException:
|
178
|
+
Enabled: false
|
179
|
+
|
180
|
+
Style/StringLiterals:
|
181
|
+
EnforcedStyle: double_quotes
|
182
|
+
|
183
|
+
Style/StringLiteralsInInterpolation:
|
184
|
+
EnforcedStyle: double_quotes
|
185
|
+
|
186
|
+
Style/StructInheritance:
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
Style/SymbolArray:
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
Style/TrailingCommaInArguments:
|
193
|
+
Enabled: false
|
194
|
+
|
195
|
+
Style/TrailingCommaInArrayLiteral:
|
196
|
+
EnforcedStyleForMultiline: consistent_comma
|
197
|
+
|
198
|
+
Style/TrailingCommaInHashLiteral:
|
199
|
+
EnforcedStyleForMultiline: consistent_comma
|
200
|
+
|
201
|
+
Style/WordArray:
|
202
|
+
Enabled: false
|
203
|
+
|
204
|
+
Style/ZeroLengthPredicate:
|
205
|
+
Enabled: false
|
data/exe/standard
ADDED
data/exe/standardrb
ADDED
data/lib/standard/cli.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative "config"
|
2
|
+
|
3
|
+
module Standard
|
4
|
+
class Cli
|
5
|
+
SUCCESS_STATUS_CODE = 0
|
6
|
+
FAILURE_STATUS_CODE = 1
|
7
|
+
|
8
|
+
def initialize(argv)
|
9
|
+
@config = Config.new(argv)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
rubocop_config = @config.to_rubocop
|
14
|
+
runner = RuboCop::Runner.new(
|
15
|
+
rubocop_config.options,
|
16
|
+
rubocop_config.config_store
|
17
|
+
)
|
18
|
+
|
19
|
+
run_succeeded = runner.run(rubocop_config.paths)
|
20
|
+
|
21
|
+
if run_succeeded
|
22
|
+
SUCCESS_STATUS_CODE
|
23
|
+
else
|
24
|
+
(runner.warnings + runner.errors).each do |message|
|
25
|
+
warn message
|
26
|
+
end
|
27
|
+
puts <<-CALL_TO_ACTION.gsub(/^ {10}/, "")
|
28
|
+
|
29
|
+
Notice: Disagree with these rules? While StandardRB is pre-1.0.0, feel free to submit suggestions to:
|
30
|
+
https://github.com/testdouble/standard/issues/new
|
31
|
+
CALL_TO_ACTION
|
32
|
+
FAILURE_STATUS_CODE
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require "rubocop"
|
2
|
+
require "pathname"
|
3
|
+
require "yaml"
|
4
|
+
require_relative "file_finder"
|
5
|
+
require_relative "formatter"
|
6
|
+
|
7
|
+
module Standard
|
8
|
+
class Config
|
9
|
+
RuboCopConfig = Struct.new(:paths, :options, :config_store)
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
filtered_argv, fix_flag = parse_argv(argv)
|
13
|
+
@rubocop_options, @paths = RuboCop::Options.new.parse(filtered_argv)
|
14
|
+
@standard_yml_path = FileFinder.new.call(".standard.yml", Dir.pwd)
|
15
|
+
@standard_config = init_standard_config(@standard_yml_path, fix_flag)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_rubocop
|
19
|
+
RuboCopConfig.new(
|
20
|
+
@paths,
|
21
|
+
wrap_rubocop_options(@rubocop_options),
|
22
|
+
RuboCop::ConfigStore.new.tap(&method(:mutate_config_store!))
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Filtered b/c RuboCop will switch to --only Layout when --fix is set (undocumented behavior)
|
29
|
+
def parse_argv(argv)
|
30
|
+
filtered_argv = argv.dup
|
31
|
+
fix_flag = !!filtered_argv.delete("--fix")
|
32
|
+
[filtered_argv, fix_flag]
|
33
|
+
end
|
34
|
+
|
35
|
+
def init_standard_config(yml_path, fix_flag)
|
36
|
+
user_config = YAML.load_file(Pathname.new(Dir.pwd).join(yml_path)) if yml_path
|
37
|
+
user_config ||= {}
|
38
|
+
|
39
|
+
{
|
40
|
+
:fix => fix_flag || !!user_config["fix"],
|
41
|
+
:format => user_config["format"],
|
42
|
+
:ignore => expand_ignore_config(user_config["ignore"]),
|
43
|
+
:parallel => !!user_config["parallel"],
|
44
|
+
:ruby_version => ruby_version(user_config["ruby_version"] || RUBY_VERSION),
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def wrap_rubocop_options(rubocop_options)
|
49
|
+
{
|
50
|
+
:auto_correct => @standard_config[:fix],
|
51
|
+
:safe_auto_correct => @standard_config[:fix],
|
52
|
+
:formatters => [[@standard_config[:format] || "Standard::Formatter", nil]],
|
53
|
+
:parallel => @standard_config[:parallel],
|
54
|
+
}.merge(rubocop_options)
|
55
|
+
end
|
56
|
+
|
57
|
+
def mutate_config_store!(config_store)
|
58
|
+
config_store.options_config = Pathname.new(__dir__).join("../../config/base.yml")
|
59
|
+
options_config = config_store.instance_variable_get("@options_config")
|
60
|
+
|
61
|
+
options_config["AllCops"]["TargetRubyVersion"] = floatify_version(
|
62
|
+
minimum_rubocop_supported_version(@standard_config[:ruby_version])
|
63
|
+
)
|
64
|
+
|
65
|
+
@standard_config[:ignore].each do |(path, cops)|
|
66
|
+
cops.each do |cop|
|
67
|
+
options_config[cop] ||= {}
|
68
|
+
options_config[cop]["Exclude"] ||= []
|
69
|
+
options_config[cop]["Exclude"] |= [Pathname.new(@standard_yml_path).dirname.join(path).to_s]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def expand_ignore_config(ignore_config)
|
75
|
+
arrayify(ignore_config).map { |rule|
|
76
|
+
if rule.is_a?(String)
|
77
|
+
[rule, ["AllCops"]]
|
78
|
+
elsif rule.is_a?(Hash)
|
79
|
+
rule.entries.first
|
80
|
+
end
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def ruby_version(version)
|
85
|
+
Gem::Version.new(version)
|
86
|
+
end
|
87
|
+
|
88
|
+
def floatify_version(version)
|
89
|
+
major, minor = version.segments
|
90
|
+
"#{major}.#{minor}".to_f # lol
|
91
|
+
end
|
92
|
+
|
93
|
+
def minimum_rubocop_supported_version(desired_version)
|
94
|
+
rubocop_supported_version = Gem::Version.new("2.2")
|
95
|
+
if desired_version < rubocop_supported_version
|
96
|
+
rubocop_supported_version
|
97
|
+
else
|
98
|
+
desired_version
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def arrayify(object)
|
103
|
+
if object.nil?
|
104
|
+
[]
|
105
|
+
elsif object.respond_to?(:to_ary)
|
106
|
+
object.to_ary || [object]
|
107
|
+
else
|
108
|
+
[object]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
module RuboCop::Cop
|
2
|
+
module Standard
|
3
|
+
class SemanticBlocks < RuboCop::Cop::Cop
|
4
|
+
include RuboCop::Cop::IgnoredMethods
|
5
|
+
|
6
|
+
def on_send(node)
|
7
|
+
return unless node.arguments?
|
8
|
+
return if node.parenthesized? || node.operator_method?
|
9
|
+
|
10
|
+
node.arguments.each do |arg|
|
11
|
+
get_blocks(arg) do |block|
|
12
|
+
# If there are no parentheses around the arguments, then braces
|
13
|
+
# and do-end have different meaning due to how they bind, so we
|
14
|
+
# allow either.
|
15
|
+
ignore_node(block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def on_block(node)
|
21
|
+
return if ignored_node?(node) || proper_block_style?(node)
|
22
|
+
|
23
|
+
add_offense(node, :location => :begin)
|
24
|
+
end
|
25
|
+
|
26
|
+
def autocorrect(node)
|
27
|
+
return if correction_would_break_code?(node)
|
28
|
+
|
29
|
+
if node.single_line?
|
30
|
+
replace_do_end_with_braces(node.loc)
|
31
|
+
elsif node.braces?
|
32
|
+
replace_braces_with_do_end(node.loc)
|
33
|
+
else
|
34
|
+
replace_do_end_with_braces(node.loc)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def message(node)
|
41
|
+
if node.single_line?
|
42
|
+
"Prefer `{...}` over `do...end` for single-line blocks."
|
43
|
+
elsif node.loc.begin.source == "{"
|
44
|
+
"Prefer `do...end` over `{...}` for procedural blocks."
|
45
|
+
else
|
46
|
+
"Prefer `{...}` over `do...end` for functional blocks."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def replace_braces_with_do_end(loc)
|
51
|
+
b = loc.begin
|
52
|
+
e = loc.end
|
53
|
+
|
54
|
+
lambda do |corrector|
|
55
|
+
corrector.insert_before(b, " ") unless whitespace_before?(b)
|
56
|
+
corrector.insert_before(e, " ") unless whitespace_before?(e)
|
57
|
+
corrector.insert_after(b, " ") unless whitespace_after?(b)
|
58
|
+
corrector.replace(b, "do")
|
59
|
+
corrector.replace(e, "end")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def replace_do_end_with_braces(loc)
|
64
|
+
b = loc.begin
|
65
|
+
e = loc.end
|
66
|
+
|
67
|
+
lambda do |corrector|
|
68
|
+
corrector.insert_after(b, " ") unless whitespace_after?(b, 2)
|
69
|
+
|
70
|
+
corrector.replace(b, "{")
|
71
|
+
corrector.replace(e, "}")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def whitespace_before?(range)
|
76
|
+
range.source_buffer.source[range.begin_pos - 1, 1] =~ /\s/
|
77
|
+
end
|
78
|
+
|
79
|
+
def whitespace_after?(range, length = 1)
|
80
|
+
range.source_buffer.source[range.begin_pos + length, 1] =~ /\s/
|
81
|
+
end
|
82
|
+
|
83
|
+
def get_blocks(node, &block)
|
84
|
+
case node.type
|
85
|
+
when :block
|
86
|
+
yield node
|
87
|
+
when :send
|
88
|
+
get_blocks(node.receiver, &block) if node.receiver
|
89
|
+
when :hash
|
90
|
+
# A hash which is passed as method argument may have no braces
|
91
|
+
# In that case, one of the K/V pairs could contain a block node
|
92
|
+
# which could change in meaning if do...end replaced {...}
|
93
|
+
return if node.braces?
|
94
|
+
|
95
|
+
node.each_child_node { |child| get_blocks(child, &block) }
|
96
|
+
when :pair
|
97
|
+
node.each_child_node { |child| get_blocks(child, &block) }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def proper_block_style?(node)
|
102
|
+
method_name = node.method_name
|
103
|
+
|
104
|
+
if ignored_method?(method_name)
|
105
|
+
true
|
106
|
+
elsif node.single_line?
|
107
|
+
node.braces?
|
108
|
+
elsif node.braces?
|
109
|
+
functional_method?(method_name) || functional_block?(node)
|
110
|
+
else
|
111
|
+
procedural_method?(method_name) || !return_value_used?(node)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def correction_would_break_code?(node)
|
116
|
+
return unless node.keywords?
|
117
|
+
|
118
|
+
node.send_node.arguments? && !node.send_node.parenthesized?
|
119
|
+
end
|
120
|
+
|
121
|
+
def functional_method?(method_name)
|
122
|
+
cop_config["FunctionalMethods"].map(&:to_sym).include?(method_name)
|
123
|
+
end
|
124
|
+
|
125
|
+
def functional_block?(node)
|
126
|
+
return_value_used?(node) || return_value_of_scope?(node)
|
127
|
+
end
|
128
|
+
|
129
|
+
def procedural_method?(method_name)
|
130
|
+
cop_config["ProceduralMethods"].map(&:to_sym).include?(method_name)
|
131
|
+
end
|
132
|
+
|
133
|
+
def return_value_used?(node)
|
134
|
+
return unless node.parent
|
135
|
+
|
136
|
+
# If there are parentheses around the block, check if that
|
137
|
+
# is being used.
|
138
|
+
if node.parent.begin_type?
|
139
|
+
return_value_used?(node.parent)
|
140
|
+
else
|
141
|
+
node.parent.assignment? || node.parent.send_type?
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def return_value_of_scope?(node)
|
146
|
+
return unless node.parent
|
147
|
+
|
148
|
+
conditional?(node.parent) || array_or_range?(node.parent) ||
|
149
|
+
node.parent.children.last == node
|
150
|
+
end
|
151
|
+
|
152
|
+
def conditional?(node)
|
153
|
+
node.if_type? || node.or_type? || node.and_type?
|
154
|
+
end
|
155
|
+
|
156
|
+
def array_or_range?(node)
|
157
|
+
node.array_type? || node.irange_type? || node.erange_type?
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "rubocop"
|
2
|
+
|
3
|
+
module Standard
|
4
|
+
class Formatter < RuboCop::Formatter::BaseFormatter
|
5
|
+
def file_finished(file, offenses)
|
6
|
+
uncorrected_offenses = offenses.reject(&:corrected?)
|
7
|
+
print_header_once unless uncorrected_offenses.empty?
|
8
|
+
working_directory = Pathname.new(Dir.pwd)
|
9
|
+
|
10
|
+
uncorrected_offenses.each do |o|
|
11
|
+
absolute_path = Pathname.new(file)
|
12
|
+
relative_path = absolute_path.relative_path_from(working_directory)
|
13
|
+
output.printf(" %s:%d:%d: %s\n", relative_path, o.line, o.real_column, o.message.tr("\n", " "))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def print_header_once
|
20
|
+
return if @header_printed_already
|
21
|
+
command = if File.split($PROGRAM_NAME).last == "rake"
|
22
|
+
"rake standard:fix"
|
23
|
+
else
|
24
|
+
"standard --fix"
|
25
|
+
end
|
26
|
+
|
27
|
+
output.print <<-HEADER.gsub(/^ {8}/, "")
|
28
|
+
standard: Use Ruby Standard Style (https://github.com/testdouble/standard)
|
29
|
+
standard: Run `#{command}` to automatically fix some problems.
|
30
|
+
HEADER
|
31
|
+
@header_printed_already = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Standard
|
2
|
+
module RakeSupport
|
3
|
+
# Allow command line flags set in STANDARDOPTS (like MiniTest's TESTOPTS)
|
4
|
+
def self.argvify
|
5
|
+
if ENV["STANDARDOPTS"]
|
6
|
+
ENV["STANDARDOPTS"].split(/\s+/)
|
7
|
+
else
|
8
|
+
[]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Lint with the Standard Ruby style guide"
|
15
|
+
task :standard do
|
16
|
+
require "standard"
|
17
|
+
exit_code = Standard::Cli.new(Standard::RakeSupport.argvify).run
|
18
|
+
fail unless exit_code == 0
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Lint and automatically fix with the Standard Ruby style guide"
|
22
|
+
task :"standard:fix" do
|
23
|
+
require "standard"
|
24
|
+
exit_code = Standard::Cli.new(Standard::RakeSupport.argvify + ["--fix"]).run
|
25
|
+
fail unless exit_code == 0
|
26
|
+
end
|
data/lib/standard.rb
ADDED
data/standard.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "standard/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "standard"
|
7
|
+
spec.version = Standard::VERSION
|
8
|
+
spec.authors = ["Justin Searls"]
|
9
|
+
spec.email = ["searls@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Ruby Style Guide, with linter & automatic code fixer"
|
12
|
+
spec.homepage = "https://github.com/testdouble/standard"
|
13
|
+
|
14
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
15
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
end
|
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_dependency "rubocop", ">= 0.60"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
24
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: standard
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Searls
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-11 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.60'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.60'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.17'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- searls@gmail.com
|
72
|
+
executables:
|
73
|
+
- standard
|
74
|
+
- standardrb
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".circleci/config.yml"
|
79
|
+
- ".gitignore"
|
80
|
+
- ".standard.yml"
|
81
|
+
- Gemfile
|
82
|
+
- Gemfile.lock
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/console
|
87
|
+
- bin/setup
|
88
|
+
- config/base.yml
|
89
|
+
- exe/standard
|
90
|
+
- exe/standardrb
|
91
|
+
- lib/standard.rb
|
92
|
+
- lib/standard/cli.rb
|
93
|
+
- lib/standard/config.rb
|
94
|
+
- lib/standard/cop/semantic_blocks.rb
|
95
|
+
- lib/standard/file_finder.rb
|
96
|
+
- lib/standard/formatter.rb
|
97
|
+
- lib/standard/railtie.rb
|
98
|
+
- lib/standard/rake.rb
|
99
|
+
- lib/standard/rubocop/ext.rb
|
100
|
+
- lib/standard/version.rb
|
101
|
+
- standard.gemspec
|
102
|
+
homepage: https://github.com/testdouble/standard
|
103
|
+
licenses: []
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.7.6
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Ruby Style Guide, with linter & automatic code fixer
|
125
|
+
test_files: []
|