shimmer 0.0.28 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.babelrc +14 -0
- data/.rspec +1 -0
- data/.rubocop.yml +7 -0
- data/.ruby-version +1 -1
- data/.vscode/settings.json +7 -4
- data/Gemfile +42 -0
- data/Gemfile.lock +346 -34
- data/Guardfile +12 -0
- data/README.md +144 -3
- data/Rakefile +1 -1
- data/bin/_guard-core +27 -0
- data/bin/dev +2 -0
- data/bin/guard +27 -0
- data/bin/rake +27 -0
- data/bin/rspec +27 -0
- data/bin/setup +3 -0
- data/config/rubocop_base.yml +32 -14
- data/config/rubocop_extensions/graphql.yml +68 -0
- data/config/rubocop_extensions/rails.yml +34 -0
- data/config/rubocop_extensions/rspec.yml +203 -0
- data/gemfiles/Gemfile-rails-7-0 +48 -0
- data/lib/shimmer/auth/apple_provider.rb +1 -1
- data/lib/shimmer/controllers/sitemaps_controller.rb +3 -1
- data/lib/shimmer/form/builder.rb +1 -1
- data/lib/shimmer/utils/config.rb +9 -3
- data/lib/shimmer/version.rb +1 -1
- data/package.json +24 -4
- data/rollup.component.config.js +37 -0
- data/src/components/stack.scss +252 -0
- data/src/components/stack.tsx +81 -0
- data/stack.png +0 -0
- data/tsconfig.json +3 -2
- data/yarn.lock +3091 -372
- metadata +20 -102
data/README.md
CHANGED
@@ -4,20 +4,137 @@ Shimmer is a collection of Rails extensions that bring advanced UI features into
|
|
4
4
|
|
5
5
|
## Features
|
6
6
|
|
7
|
+
### Components
|
8
|
+
|
9
|
+
Shimmer includes a suite of styled components that can be implemented in React and also in plain HTML or slim.
|
10
|
+
|
11
|
+
### Stack
|
12
|
+
|
13
|
+
Stack is a reusable typed component that allows you to easily manage the layout of your app. You can define whether it should be displayed horizontally, vertically, and how much spacing there should be in between the child components. This component implements a mobile-first design and allows you to customize the display and spacing even on defined breakpoints (tablet, desktop, widescreen) should you need to.
|
14
|
+
|
15
|
+
To use it in a React project, you can just import and use it as you would in a normal React component:
|
16
|
+
|
17
|
+
```js
|
18
|
+
import { Stack } from "@nerdgeschoss/shimmer/components/stack";
|
19
|
+
|
20
|
+
<Stack gapTablet={4} gapDesktop={12} line>
|
21
|
+
<div></div>
|
22
|
+
<div></div>
|
23
|
+
<div></div>
|
24
|
+
</Stack>;
|
25
|
+
```
|
26
|
+
|
27
|
+
To use it in an HTML file, you can just import the css file directly from `@nerdgeschoss/shimmer/components/stack.css` and just implement the classes as they are in the stylesheet:
|
28
|
+
|
29
|
+
```html
|
30
|
+
<div class="stack stack--line stack--tablet-4 stack--desktop-12">
|
31
|
+
<div></div>
|
32
|
+
<div></div>
|
33
|
+
<div></div>
|
34
|
+
</div>
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Helper types:
|
38
|
+
|
39
|
+
```ts
|
40
|
+
type Justify =
|
41
|
+
| "start"
|
42
|
+
| "center"
|
43
|
+
| "end"
|
44
|
+
| "space-between"
|
45
|
+
| "space-around"
|
46
|
+
| "stretch"
|
47
|
+
| "equal-size";
|
48
|
+
```
|
49
|
+
|
50
|
+
```ts
|
51
|
+
type Align = "start" | "center" | "end" | "stretch" | "baseline";
|
52
|
+
```
|
53
|
+
|
54
|
+
![Stack possible layouts](stack.png)
|
55
|
+
|
56
|
+
### Available props:
|
57
|
+
|
58
|
+
| Field | Type | Description |
|
59
|
+
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
60
|
+
| gap | `number` | Space between elements |
|
61
|
+
| gapTablet | `number` | Gap size for screen starting on Tablet breakpoint |
|
62
|
+
| gapDesktop | `number` | Gap size for screen starting on Desktop breakpoint |
|
63
|
+
| gapWidescreen | `number` | Gap size for screen starting on WideScreen breakpoint |
|
64
|
+
| line | `boolean` | Stacks elements horizontally |
|
65
|
+
| lineTablet | `boolean` | Stacks elements horizontally starting on Tablet breakpoint |
|
66
|
+
| lineDesktop | `boolean` | Stacks elements horizontally starting on Desktop breakpoint |
|
67
|
+
| lineWidescreen | `boolean` | Stacks elements horizontally starting on WideScreen breakpoint |
|
68
|
+
| align | `Align` | Aligns element according to the [main axis](https://developer.mozilla.org/en-US/docs/Glossary/Main_Axis) of the flex container |
|
69
|
+
| alignTablet | `Align` | Align on Tablet breakpoint |
|
70
|
+
| alignDesktop | `Align` | Align on Desktop breakpoint |
|
71
|
+
| alignWidescreen | `Align` | Align on Widescreen breakpoint |
|
72
|
+
| justify | `Justify` | Specifies how elements are distributed along [main axis](https://developer.mozilla.org/en-US/docs/Glossary/Main_Axis) of the flex container |
|
73
|
+
| justifyTablet | `Justify` | Justify on Tablet breakpoint |
|
74
|
+
| justifyDesktop | `Justify` | Justify on Desktop breakpoint |
|
75
|
+
| justifyWidescreen | `Justify` | Justify on Widescreen breakpoint |
|
76
|
+
|
77
|
+
When using the CSS classes instead of react component we can generate the class names looking at the available props by using the prop names and BEM convention.
|
78
|
+
|
79
|
+
For example:
|
80
|
+
|
81
|
+
```js
|
82
|
+
<Stack gapTablet={4} gapDesktop={12} line>
|
83
|
+
...
|
84
|
+
</Stack>
|
85
|
+
```
|
86
|
+
|
87
|
+
would translate to
|
88
|
+
|
89
|
+
```html
|
90
|
+
<div class="stack stack--tablet-4 stack--destop-12 stack--line">...</div>
|
91
|
+
```
|
92
|
+
|
93
|
+
Pleae, note that there is not word "gap" in the class names since we use it implicitly, i.e. `gapWidescreen={12}` is equivalent to `stack stack--widescreen-12`.
|
94
|
+
|
95
|
+
Another thing to keep in mind when using CSS version of the component that the sizes are fixed - in contrary to the React one where we can add any number we want.
|
96
|
+
|
97
|
+
Here is the list of available sizes for CSS version:
|
98
|
+
|
99
|
+
```scss
|
100
|
+
$sizes: (
|
101
|
+
0: 0px,
|
102
|
+
2: 2px,
|
103
|
+
4: 4px,
|
104
|
+
8: 8px,
|
105
|
+
12: 12px,
|
106
|
+
16: 16px,
|
107
|
+
20: 20px,
|
108
|
+
22: 22px,
|
109
|
+
24: 24px,
|
110
|
+
32: 32px,
|
111
|
+
40: 40px,
|
112
|
+
48: 48px,
|
113
|
+
56: 56px,
|
114
|
+
64: 64px,
|
115
|
+
);
|
116
|
+
```
|
117
|
+
|
118
|
+
### Supported breakpoints:
|
119
|
+
|
120
|
+
- **Tablet**: 640px
|
121
|
+
- **Desktop**: 890px
|
122
|
+
- **Widescreen**: 1280px
|
123
|
+
|
7
124
|
### Rubocop Base Configuration
|
8
125
|
|
9
|
-
|
126
|
+
_Shimmer_ offers an opiniated _Rubocop_ base configuration. This configuration inherits itself from _StandardRB_ and aim at remaining as close to it as possible. Why not only use _StandardRB_, since it is so fast and prevent bikeshedding? Well, sadly, it does not solve all problems and using _Rubocop_ still integrates a lot easier in most toolsets. However, the idea is to still prevent bikeshedding our _Rubocop_ configuration by making sure that every exception to what's configured in _StandardRB_ is justified (with a comment over its configuration block in `./config/rubocop_base.yml`), reviewed, debated, and agreed upon before being merged.
|
10
127
|
|
11
128
|
#### Use Shared Configuration In Projects
|
12
129
|
|
13
|
-
Typically, a `.rubocop.yml` file in projects using
|
130
|
+
Typically, a `.rubocop.yml` file in projects using _Shimmer_ looks like this.
|
14
131
|
|
15
132
|
```yml
|
16
133
|
inherit_gem:
|
17
134
|
shimmer: config/rubocop_base.yml
|
18
135
|
```
|
19
136
|
|
20
|
-
Then, if there are specific cops you want to use in the specific project you are working on, you still can easily add them. But at least, the base configuration is shared between projects and is itself as close to
|
137
|
+
Then, if there are specific cops you want to use in the specific project you are working on, you still can easily add them. But at least, the base configuration is shared between projects and is itself as close to _StandardRB_ as possible.
|
21
138
|
|
22
139
|
### Static File Serving
|
23
140
|
|
@@ -203,6 +320,30 @@ import { application } from "controllers/application";
|
|
203
320
|
start({ application });
|
204
321
|
```
|
205
322
|
|
323
|
+
## Testing & Demo
|
324
|
+
|
325
|
+
This library is tested using _RSpec_.
|
326
|
+
|
327
|
+
```bash
|
328
|
+
bin/rspec
|
329
|
+
```
|
330
|
+
|
331
|
+
A **system test** suite is included and is performed against a demo _Rails_ application in `spec/rails_app`. This
|
332
|
+
application can be started in development mode for "playing around" with _Shimmer_ during its development and add
|
333
|
+
more system tests. The `bin/dev` script starts that demo application.
|
334
|
+
|
335
|
+
The first time, you want to initialize the database and seed it some data.
|
336
|
+
|
337
|
+
```bash
|
338
|
+
bin/setup
|
339
|
+
```
|
340
|
+
|
341
|
+
Then you can start the development server.
|
342
|
+
|
343
|
+
```bash
|
344
|
+
bin/dev
|
345
|
+
```
|
346
|
+
|
206
347
|
## Contributing
|
207
348
|
|
208
349
|
Bug reports and pull requests are welcome on GitHub at https://github.com/nerdgeschoss/shimmer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nerdgeschoss/shimmer/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
data/bin/_guard-core
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application '_guard-core' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("guard", "_guard-core")
|
data/bin/dev
ADDED
data/bin/guard
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'guard' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("guard", "guard")
|
data/bin/rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
CHANGED
data/config/rubocop_base.yml
CHANGED
@@ -1,15 +1,11 @@
|
|
1
|
+
# Most of those cops are documented here:
|
2
|
+
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style
|
3
|
+
#
|
1
4
|
AllCops:
|
2
5
|
NewCops: disable
|
3
|
-
Exclude:
|
4
|
-
- '**/vendor/bundle/**/*'
|
5
|
-
- '**/bin/**/*'
|
6
|
-
- '**/db/schema.rb'
|
7
|
-
- '**/node_modules/**/*'
|
8
6
|
|
9
7
|
require:
|
10
|
-
- standard
|
11
|
-
- rubocop-rails
|
12
|
-
- rubocop-rake
|
8
|
+
- standard # https://github.com/standardrb/standard
|
13
9
|
|
14
10
|
inherit_gem:
|
15
11
|
standard: config/base.yml
|
@@ -23,10 +19,32 @@ Style/MutableConstant:
|
|
23
19
|
Enabled: true
|
24
20
|
EnforcedStyle: strict
|
25
21
|
|
26
|
-
#
|
27
|
-
|
28
|
-
Enabled:
|
22
|
+
# Pass &:method_name as an argument to index_by instead of a block.
|
23
|
+
Style/SymbolProc:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# Prefer `[:foo, :bar]` to `%i[foo bar]`.
|
27
|
+
Style/SymbolArray:
|
28
|
+
Enabled: true
|
29
|
+
EnforcedStyle: brackets
|
30
|
+
|
31
|
+
# Prefer `["foo", "bar"]` to `%w[foo bar]`.
|
32
|
+
Style/WordArray:
|
33
|
+
Enabled: true
|
34
|
+
EnforcedStyle: brackets
|
35
|
+
|
36
|
+
# <% if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1") %>
|
37
|
+
Style/HashSyntax:
|
38
|
+
Enabled: true
|
39
|
+
EnforcedShorthandSyntax: always
|
40
|
+
# <% end %>
|
29
41
|
|
30
|
-
#
|
31
|
-
|
32
|
-
|
42
|
+
# Keep at the end of the file (after the individual cops configuration),
|
43
|
+
# otherwise, those cops are not configured properly.
|
44
|
+
inherit_from:
|
45
|
+
# <% Dir["#{File.expand_path(__dir__)}/rubocop_extensions/*.yml"].each do |filename| %>
|
46
|
+
# <% gem_name = filename.delete_suffix(".yml").delete_prefix("#{File.expand_path(__dir__)}/rubocop_extensions/") %>
|
47
|
+
# <% if Gem.loaded_specs.key?(gem_name) %>
|
48
|
+
- rubocop_extensions/<%= gem_name %>.yml
|
49
|
+
# <% end # if Gem.loaded_specs.key? %>
|
50
|
+
# <% end # Dir.foreach %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Documentation on the rules can be found here:
|
2
|
+
# https://github.com/DmitryTsepelev/rubocop-graphql/tree/master/lib/rubocop/cop/graphql
|
3
|
+
#
|
4
|
+
require:
|
5
|
+
- rubocop-graphql
|
6
|
+
|
7
|
+
GraphQL:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
# Keep mutation file ordered.
|
11
|
+
GraphQL/OrderedFields:
|
12
|
+
Enabled: true
|
13
|
+
Exclude:
|
14
|
+
- "*"
|
15
|
+
Include:
|
16
|
+
- '**/mutation_type.rb'
|
17
|
+
|
18
|
+
# Ensures snake case of argument name.
|
19
|
+
GraphQL/ArgumentName:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# Detects duplicate argument definitions.
|
23
|
+
GraphQL/ArgumentUniqueness:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# Prevents defining unnecessary resolver methods in cases when `:hash_key` option can be used.
|
27
|
+
GraphQL/FieldHashKey:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
# Prevents defining unnecessary resolver methods in cases when `:method option` can be used.
|
31
|
+
GraphQL/FieldMethod:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# Ensures snake case of field name.
|
35
|
+
GraphQL/FieldName:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# Detects duplicate field definitions within the same type.
|
39
|
+
GraphQL/FieldUniqueness:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
# Ensures type definitions are class-based (no longer legacy).
|
43
|
+
GraphQL/LegacyDsl:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# Ensures fields with multiple definitions are grouped together
|
47
|
+
GraphQL/MultipleFieldDefinitions:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
# Forces `Relay::Node` implementations to expose an `authorized?` method.
|
51
|
+
GraphQL/NotAuthorizedNodeType:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
# Checks for has an unnecessary argument camelize.
|
55
|
+
GraphQL/UnnecessaryArgumentCamelize:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# Prevents defining an unnecessary `alias`, `method`, or `resolver_method` arguements to fields.
|
59
|
+
GraphQL/UnnecessaryFieldAlias:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
# Checks for has an unnecessary field camelize.
|
63
|
+
GraphQL/UnnecessaryFieldCamelize:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
# Arguments should either be listed explicitly or `**rest` should be in the resolve signature.
|
67
|
+
GraphQL/UnusedArgument:
|
68
|
+
Enabled: true
|
@@ -0,0 +1,34 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- '**/vendor/bundle/**/*'
|
4
|
+
- '**/db/schema.rb'
|
5
|
+
|
6
|
+
require:
|
7
|
+
- rubocop-rails
|
8
|
+
|
9
|
+
Rails:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Prefer :bad_request over 400 to define HTTP status code.
|
13
|
+
Rails/HttpStatus:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
# Prefer index_by over map { ... }.to_h.
|
17
|
+
Rails/IndexBy:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
# Prefer index_with over each_with_object.
|
21
|
+
Rails/IndexWith:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
# Specify a :dependent option. (https://rails.rubystyle.guide#has_many-has_one-dependent-option)
|
25
|
+
Rails/HasManyOrHasOneDependent:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# Specify an :inverse_of option.
|
29
|
+
Rails/InverseOf:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Specifying the default value for foreign_key is redundant.
|
33
|
+
Rails/RedundantForeignKey:
|
34
|
+
Enabled: true
|
@@ -0,0 +1,203 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
RSpec:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
# Checks that around blocks actually run the test.
|
8
|
+
# Would be a shame if the test would be green simply because it is not called.
|
9
|
+
RSpec/AroundBlock:
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
# Be what? Not nil? Present? Truthy?
|
13
|
+
RSpec/Be:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
# The be matcher compares by identity while the eq matcher compares using ==.
|
17
|
+
# Booleans and nil can be compared by identity and therefore the be matcher is
|
18
|
+
# preferable as it is a more strict test.
|
19
|
+
RSpec/BeEq:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# The be matcher compares by identity while the eq matcher compares using ==.
|
23
|
+
# Booleans and nil can be compared by identity and therefore the be matcher is
|
24
|
+
# preferable as it is a more strict test.
|
25
|
+
RSpec/BeEql:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# Prefer `.to be_nil` to `.to be(nil)`.
|
29
|
+
RSpec/BeNil:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Avoid `before(:all)`, prefer `before(:each)` within a group.
|
33
|
+
RSpec/BeforeAfterAll:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# Avoid `.to change(...).by(0)`, prefer `not_to change` and `.to not_change` (for composite).
|
37
|
+
RSpec/ChangeByZero:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# Expect expectations in all tests.
|
41
|
+
# If it's just expecting it to not raise, wrap it in `expect do ... end.not_to raise`.
|
42
|
+
RSpec/EmptyExampleGroup:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
# Don't allow empty hooks.
|
46
|
+
RSpec/EmptyHook:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# Separate groups.
|
50
|
+
RSpec/EmptyLineAfterExampleGroup:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# Separate `let`s from tests.
|
54
|
+
RSpec/EmptyLineAfterFinalLet:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# Separate hooks from tests.
|
58
|
+
RSpec/EmptyLineAfterHook:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
# Don't allow specs without description.
|
62
|
+
RSpec/ExampleWithoutDescription:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
# Checks for common mistakes in example descriptions.
|
66
|
+
RSpec/ExampleWording:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
# Trim descriptions.
|
70
|
+
RSpec/ExcessiveDocstringSpacing:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
# Do stdout expectations right.
|
74
|
+
RSpec/ExpectOutput:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
# Enforces spec file naming convention.
|
78
|
+
RSpec/FilePath:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# Don't forget focussed tests (expecially useful for the CI to fail).
|
82
|
+
RSpec/Focus:
|
83
|
+
Enabled: true
|
84
|
+
AutoCorrect: false
|
85
|
+
|
86
|
+
# Checks for before/around/after hooks that come after an example.
|
87
|
+
RSpec/HooksBeforeExamples:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
# Don't expect something to be itself.
|
91
|
+
RSpec/IdenticalEqualityAssertion:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
# Explicitly declare `it` blocks.
|
95
|
+
RSpec/ImplicitBlockExpectation:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
# Prevent instance variable usage in specs.
|
99
|
+
RSpec/InstanceVariable:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
# Check that all matcher is used instead of iterating over an array.
|
103
|
+
RSpec/IteratedExpectation:
|
104
|
+
Enabled: true
|
105
|
+
|
106
|
+
# Checks that no class, module, or constant is declared.
|
107
|
+
# Constants, including classes and modules, when declared in a block scope,
|
108
|
+
# are defined in global namespace, and leak between examples.
|
109
|
+
# Prevents class re-opening, leading to unpredictable side effects.
|
110
|
+
RSpec/LeakyConstantDeclaration:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
# Force `let`s to be before tests.
|
114
|
+
RSpec/LetBeforeExamples:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
# Force groups to have descriptions or symbol.
|
118
|
+
RSpec/MissingExampleGroupArgument:
|
119
|
+
Enabled: true
|
120
|
+
|
121
|
+
# Files should have only one root `describe` block.
|
122
|
+
RSpec/MultipleDescribes:
|
123
|
+
Enabled: true
|
124
|
+
|
125
|
+
# Checks if an example group defines subject multiple times.
|
126
|
+
RSpec/MultipleSubjects:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
# Checks if an example contains any expectation.
|
130
|
+
RSpec/NoExpectationExample:
|
131
|
+
Enabled: false # considered, but gives false positives when expectations are inside of a re-used function
|
132
|
+
|
133
|
+
# Prefer `expect(...).not_to` to `expect(...).to_not`.
|
134
|
+
RSpec/NotToNot:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
# Prevent setting the same `let` block more than once.
|
138
|
+
RSpec/OverwritingSetup:
|
139
|
+
Enabled: true
|
140
|
+
|
141
|
+
# Prevent useless `around` hooks.
|
142
|
+
RSpec/RedundantAround:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
# Prevent duplicate description.
|
146
|
+
RSpec/RepeatedDescription:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
# Prevent duplicate example (test).
|
150
|
+
RSpec/RepeatedExample:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
# Detects duplicate in example group body.
|
154
|
+
RSpec/RepeatedExampleGroupBody:
|
155
|
+
Enabled: true
|
156
|
+
|
157
|
+
# Detects duplicate in example group description.
|
158
|
+
RSpec/RepeatedExampleGroupDescription:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
# Check for repeated include of shared examples.
|
162
|
+
RSpec/RepeatedIncludeExample:
|
163
|
+
Enabled: true
|
164
|
+
|
165
|
+
# Keep `let` blocks together.
|
166
|
+
RSpec/ScatteredLet:
|
167
|
+
Enabled: true
|
168
|
+
|
169
|
+
# Keep `setup` blocks (ex: group `before`) together.
|
170
|
+
RSpec/ScatteredSetup:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
# Checks for proper shared_context and shared_examples usage.
|
174
|
+
RSpec/SharedContext:
|
175
|
+
Enabled: true
|
176
|
+
|
177
|
+
# Enforces use of string to titleize shared examples.
|
178
|
+
RSpec/SharedExamples:
|
179
|
+
Enabled: true
|
180
|
+
|
181
|
+
# Checks that chains of messages contain more than one element.
|
182
|
+
RSpec/SingleArgumentMessageChain:
|
183
|
+
Enabled: true
|
184
|
+
|
185
|
+
# Skip either the whole example of not at all.
|
186
|
+
RSpec/SkipBlockInsideExample:
|
187
|
+
Enabled: true
|
188
|
+
|
189
|
+
# Be specific about what exception/error is expected.
|
190
|
+
RSpec/UnspecifiedException:
|
191
|
+
Enabled: true
|
192
|
+
|
193
|
+
# Use symbols for `let` and `subject` names.
|
194
|
+
RSpec/VariableDefinition:
|
195
|
+
Enabled: true
|
196
|
+
|
197
|
+
# Avoid empty expectation.
|
198
|
+
RSpec/VoidExpect:
|
199
|
+
Enabled: true
|
200
|
+
|
201
|
+
# Use proper `yield` stub syntax.
|
202
|
+
RSpec/Yield:
|
203
|
+
Enabled: true
|