datarockets-style 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/CHANGELOG.md +31 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +60 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +39 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/RELEASING.md +17 -0
- data/Rakefile +6 -0
- data/STYLE_GUIDE.md +202 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/datarockets-style.gemspec +36 -0
- data/default.yml +45 -0
- data/lib/datarockets/style.rb +7 -0
- data/lib/datarockets/style/version.rb +5 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 324883d55397473999caa61fc8ede9378a4fad7e
|
4
|
+
data.tar.gz: 7baac97267430faabd884999ade8340189e0e32f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3e7980949ee6b086ff587485378546b935b69b105874e1a043eb648fa5db66f212ef12d5ba5b6a9d0f3c7d13a7677d0abf77d0c983c0bcda261e25a1372a010
|
7
|
+
data.tar.gz: df7210852291e82002373257e0dce1c5baf1c87b4051003835bac2e0a7903193101625ee7d4b1a9f83cbef9c2189c7b4c96b6487346d626da47a03f7a055e621
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
The format is described in [Contributing notes](CONTRIBUTING.md#changelog-entry-format)
|
4
|
+
|
5
|
+
## master (unreleased)
|
6
|
+
|
7
|
+
## 0.1.0 (2019-06-27)
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
* Base config with community rules and some basic override rules. ([@r.dubrovsky][], [@aleks][])
|
12
|
+
* Config is based on rubocop version 0.72.0 ([@r.dubrovsky][])
|
13
|
+
* Enable `rubocop-spec` cops by default ([@r.dubrovsky][])
|
14
|
+
* Enable `Bundler/DuplicatedGem` cop by default ([@r.dubrovsky][])
|
15
|
+
* Enable `Bundler/OrderedGems` cop with allowing ordering by groups ([@r.dubrovsky][])
|
16
|
+
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
* Change the limit for size of line to 120 symbols ([@r.dubrovsky][])
|
21
|
+
* Disable `Metrics/BlockLength` cop for rspec files ([@r.dubrovsky][])
|
22
|
+
* Exclude rubocop checking for some config directories ([@r.dubrovsky][])
|
23
|
+
* Enable prafering double quotes for string literals ([@r.dubrovsky][])
|
24
|
+
* Do not add spaces beetwen hash literal braces (cop `Layout/SpaceInsideHashLiteralBraces`) ([@r.dubrovsky][])
|
25
|
+
* Prefer normal style for `Layout/IndentationConsistency` cop for Rails apps too ([@r.dubrovsky][])
|
26
|
+
* Change style to `variable` for `Layout/EndAlignment` cop ([@r.dubrovsky][])
|
27
|
+
* Change style to `with_fixed_indentation` with indentation width 2 for `Layout/AlignParameter` cop ([@r.dubrovsky][])
|
28
|
+
* Always ingone hash aligning for key word arguments (cop: `Layout/AlignHash`) ([@r.dubrovsky][])
|
29
|
+
|
30
|
+
[@r.dubrovsky]: https://github.com/roman-dubrovsky
|
31
|
+
[@aleks]: https://github.com/AleksSenkou
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 hello@datarockets.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,60 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
If you discover issues, want to add or change some code-style rules,
|
4
|
+
have ideas for improvements or new features,
|
5
|
+
please report them to the [issue tracker][1] of the repository or
|
6
|
+
submit a pull request. Please, try to follow these guidelines when you
|
7
|
+
do so.
|
8
|
+
|
9
|
+
## Issue reporting
|
10
|
+
|
11
|
+
* Check that the issue has not already been reported.
|
12
|
+
* Check that the issue has not already been fixed in the latest code
|
13
|
+
(a.k.a. `master`).
|
14
|
+
* Be clear, concise and precise in your description of the problem.
|
15
|
+
* Open an issue with a descriptive title and a summary in grammatically correct,
|
16
|
+
complete sentences.
|
17
|
+
* Include any relevant code to the issue summary
|
18
|
+
|
19
|
+
## Pull requests
|
20
|
+
|
21
|
+
* Read [how to properly contribute to open source projects on GitHub][2].
|
22
|
+
* Fork the project.
|
23
|
+
* Use a topic/feature branch to easily amend a pull request later, if necessary.
|
24
|
+
* Write [good commit messages][3].
|
25
|
+
* Use the same coding conventions as the rest of the project.
|
26
|
+
* Commit and push until you are happy with your contribution.
|
27
|
+
* If your change has a corresponding open GitHub issue, prefix the commit message with `[Fix #github-issue-number]`.
|
28
|
+
* Make sure to add tests for it. This is important so we don't break it
|
29
|
+
in a future version unintentionally.
|
30
|
+
* If you add new code-style rule or cop, add some words about it in the [Code Style Notes](STYLE_GUIDE.md).
|
31
|
+
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
|
32
|
+
* If you deliver new cop, try to suggest and deliver it to the community [rubocop][7] gem.
|
33
|
+
* [Squash related commits together][5].
|
34
|
+
* Open a [pull request][4] that relates to *only* one subject with a clear title
|
35
|
+
and description in grammatically correct, complete sentences.
|
36
|
+
|
37
|
+
### Changelog entry format
|
38
|
+
|
39
|
+
Here are a few examples:
|
40
|
+
|
41
|
+
```
|
42
|
+
* [#716](https://github.com/rubocop-hq/rubocop/issues/716): Fixed a regression in the auto-correction logic of `MethodDefParentheses`. ([@bbatsov][])
|
43
|
+
* New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
|
44
|
+
```
|
45
|
+
|
46
|
+
* There are four categories for each release: added, changed, bug fixed and removed
|
47
|
+
* Mark it up in [Markdown syntax][6].
|
48
|
+
* The entry line should start with `* ` (an asterisk and a space).
|
49
|
+
* 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/issues/123): `.
|
50
|
+
* Describe the brief of the change. The sentence should end with a punctuation.
|
51
|
+
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
52
|
+
* 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`.
|
53
|
+
|
54
|
+
[1]: https://github.com/datarockets/datarockets-style/issues
|
55
|
+
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
|
56
|
+
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
57
|
+
[4]: https://help.github.com/articles/about-pull-requests
|
58
|
+
[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
|
59
|
+
[6]: https://daringfireball.net/projects/markdown/syntax
|
60
|
+
[7]: https://github.com/rubocop-hq/rubocop
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
datarockets-style (0.1.0)
|
5
|
+
rubocop (~> 0.72.0)
|
6
|
+
rubocop-rspec
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
jaro_winkler (1.5.3)
|
13
|
+
parallel (1.17.0)
|
14
|
+
parser (2.6.3.0)
|
15
|
+
ast (~> 2.4.0)
|
16
|
+
rainbow (3.0.0)
|
17
|
+
rake (10.5.0)
|
18
|
+
rubocop (0.72.0)
|
19
|
+
jaro_winkler (~> 1.5.1)
|
20
|
+
parallel (~> 1.10)
|
21
|
+
parser (>= 2.6)
|
22
|
+
rainbow (>= 2.2.2, < 4.0)
|
23
|
+
ruby-progressbar (~> 1.7)
|
24
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
25
|
+
rubocop-rspec (1.33.0)
|
26
|
+
rubocop (>= 0.60.0)
|
27
|
+
ruby-progressbar (1.10.1)
|
28
|
+
unicode-display_width (1.6.0)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
bundler (~> 1.16)
|
35
|
+
datarockets-style!
|
36
|
+
rake (~> 10.0)
|
37
|
+
|
38
|
+
BUNDLED WITH
|
39
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 datarockets
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Datarockets::Style
|
2
|
+
|
3
|
+
Datarockets shared style configs and notes of code-style convensions. Based on the [Rubocop](https://github.com/rubocop-hq/rubocop) util.
|
4
|
+
|
5
|
+
This config enforces many of the guidelines outlined in the datarockets [Ruby Style Guide](STYLE_GUIDE.md).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
group :test, :development do
|
13
|
+
gem 'datarockets-style'
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
Or, for a Ruby library, add this to your gemspec:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
spec.add_development_dependency 'datarockets-style'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Create a `.rubocop.yml` with the following directives:
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
inherit_gem:
|
33
|
+
datarockets-style:
|
34
|
+
- default.yml
|
35
|
+
```
|
36
|
+
|
37
|
+
Now, run:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
$ bundle exec rubocop
|
41
|
+
```
|
42
|
+
|
43
|
+
You do not need to include rubocop directly in your application's dependencies. Datarockets-style will include a specific version of `rubocop` and `rubocop-rspec` that is shared across all projects.
|
44
|
+
|
45
|
+
## Changelog
|
46
|
+
|
47
|
+
Datarockets Style's changelog is available [here](CHANGELOG.md).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/datarockets/datarockets-style. If you'd like to contribute to our RuboCop config and code-style rules, please take the time to go through our short [contribution guidelines](CONTRIBUTING.md).
|
52
|
+
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
+
|
58
|
+
## Code of Conduct
|
59
|
+
|
60
|
+
Everyone interacting in the Datarockets::Style project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
|
data/RELEASING.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
* Update `version.rb` file accordingly.
|
4
|
+
* Update `CHANGELOG.md` file
|
5
|
+
* Tag the release: `git tag vVERSION`
|
6
|
+
* Push changes: `git push --tags`
|
7
|
+
* Update the release notes on GitHub.com
|
8
|
+
* Build and publish:
|
9
|
+
|
10
|
+
```bash
|
11
|
+
bundle exec rake build
|
12
|
+
gem push *todo*
|
13
|
+
```
|
14
|
+
|
15
|
+
* Announce the new release,
|
16
|
+
making sure to say "thank you" to the contributors
|
17
|
+
who helped shape this version!
|
data/Rakefile
ADDED
data/STYLE_GUIDE.md
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
# Style Guide
|
2
|
+
|
3
|
+
In datarockets we enforce a community [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide).
|
4
|
+
|
5
|
+
This is a small list of differences which we have when compared with community style guide:
|
6
|
+
|
7
|
+
## Bundler
|
8
|
+
|
9
|
+
* A Gem's requirements should be listed only once in a Gemfile
|
10
|
+
|
11
|
+
* Gems should be alphabetically sorted within groups. Also you can use a line comment as a group separator.
|
12
|
+
|
13
|
+
## Style
|
14
|
+
|
15
|
+
* Limit lines to 80 characters.
|
16
|
+
|
17
|
+
* Prefer double-quotes unless your string literal contains " or escape characters you want to suppress.
|
18
|
+
|
19
|
+
* If elements of a hash literal span more than one line we're aligning them by keys
|
20
|
+
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# bad
|
24
|
+
{
|
25
|
+
foo: bar,
|
26
|
+
ba: baz
|
27
|
+
}
|
28
|
+
{
|
29
|
+
foo: bar,
|
30
|
+
ba: baz
|
31
|
+
}
|
32
|
+
|
33
|
+
# good
|
34
|
+
{
|
35
|
+
foo: bar,
|
36
|
+
ba: baz
|
37
|
+
}
|
38
|
+
```
|
39
|
+
|
40
|
+
* There is one exception in the rule above when the hash literal is passed as method argument.
|
41
|
+
In this case we just use an indentation level.
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# bad
|
45
|
+
do_something(foo: 1,
|
46
|
+
bar: 2)
|
47
|
+
|
48
|
+
# good
|
49
|
+
do_something(foo: 1,
|
50
|
+
bar: 2)
|
51
|
+
```
|
52
|
+
|
53
|
+
* The parameters on a multi-line method call or definition are aligning by an indentation level.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# good
|
57
|
+
|
58
|
+
def foo(bar,
|
59
|
+
baz)
|
60
|
+
123
|
61
|
+
end
|
62
|
+
|
63
|
+
def foo(
|
64
|
+
bar,
|
65
|
+
baz
|
66
|
+
)
|
67
|
+
123
|
68
|
+
end
|
69
|
+
|
70
|
+
# bad
|
71
|
+
|
72
|
+
def foo(bar,
|
73
|
+
baz)
|
74
|
+
123
|
75
|
+
end
|
76
|
+
|
77
|
+
# bad
|
78
|
+
|
79
|
+
def foo(
|
80
|
+
bar,
|
81
|
+
baz)
|
82
|
+
123
|
83
|
+
end
|
84
|
+
```
|
85
|
+
|
86
|
+
* The `end` shall be aligned with the left-hand-side of the variable assignment. But we prefer not to use code blocks with `end` for variable assignment and prefer move it into the separate methods.
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# bad
|
90
|
+
|
91
|
+
variable = if true
|
92
|
+
end
|
93
|
+
|
94
|
+
variable = array.map do |value|
|
95
|
+
value
|
96
|
+
end
|
97
|
+
|
98
|
+
# good
|
99
|
+
|
100
|
+
variable = if true
|
101
|
+
end
|
102
|
+
|
103
|
+
variable =
|
104
|
+
if true
|
105
|
+
end
|
106
|
+
|
107
|
+
variable = array.map do |value|
|
108
|
+
value
|
109
|
+
end
|
110
|
+
|
111
|
+
# better
|
112
|
+
|
113
|
+
variable = condition_value
|
114
|
+
|
115
|
+
def condition_value(*args)
|
116
|
+
if true
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
variable = values_from_array(array)
|
121
|
+
|
122
|
+
def values_from_array(array)
|
123
|
+
array.map do |value|
|
124
|
+
value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
```
|
129
|
+
|
130
|
+
* We're prefering a ruby style for methods indentations, not rails. You can check it [here](https://github.com/rubocop-hq/ruby-style-guide#indent-public-private-protected)
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
# bad
|
134
|
+
class A
|
135
|
+
def test
|
136
|
+
puts 'hello'
|
137
|
+
puts 'world'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# bad
|
142
|
+
class A
|
143
|
+
def test
|
144
|
+
puts 'hello'
|
145
|
+
puts 'world'
|
146
|
+
end
|
147
|
+
|
148
|
+
protected
|
149
|
+
|
150
|
+
def foo
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def bar
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# good
|
160
|
+
class A
|
161
|
+
def test
|
162
|
+
puts 'hello'
|
163
|
+
puts 'world'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# good
|
168
|
+
class A
|
169
|
+
def test
|
170
|
+
puts 'hello'
|
171
|
+
puts 'world'
|
172
|
+
end
|
173
|
+
|
174
|
+
protected
|
175
|
+
|
176
|
+
def foo
|
177
|
+
end
|
178
|
+
|
179
|
+
private
|
180
|
+
|
181
|
+
def bar
|
182
|
+
end
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
* For hash literals not to add scapes after `{` or before `}`. We want to have the advantage of adding visual difference between block and hash literals.
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
# bad
|
190
|
+
h = { a: 1, b: 2 }
|
191
|
+
Array.new(3) {|i| i + 1}
|
192
|
+
|
193
|
+
# good
|
194
|
+
h = {a: 1, b: 2}
|
195
|
+
Array.new(3) { |i| i + 1 }
|
196
|
+
```
|
197
|
+
|
198
|
+
## Rspec
|
199
|
+
|
200
|
+
* We're happy to use [better spec rules](http://www.betterspecs.org/) for improving our tests.
|
201
|
+
|
202
|
+
* We're not limiting a length of rspec files
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "datarockets/style"
|
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,36 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "datarockets/style/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "datarockets-style"
|
7
|
+
spec.version = Datarockets::Style::VERSION
|
8
|
+
spec.authors = ["Roman Dubrovsky"]
|
9
|
+
spec.email = ["r.dubrovsky@datarockets.com"]
|
10
|
+
|
11
|
+
spec.summary = "Datarockets style guides and shared style configs"
|
12
|
+
spec.homepage = "https://github.com/datarockets/datarockets-style"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_dependency "rubocop", "~> 0.72.0"
|
32
|
+
spec.add_dependency "rubocop-rspec"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
end
|
data/default.yml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- "db/**/*"
|
4
|
+
- "bin/*"
|
5
|
+
- "lib/tasks/**/*"
|
6
|
+
- "config/**/*"
|
7
|
+
- "vendor/**/*"
|
8
|
+
- "app/views/**/*"
|
9
|
+
- "config.ru"
|
10
|
+
- "Rakefile"
|
11
|
+
|
12
|
+
require: rubocop-rspec
|
13
|
+
|
14
|
+
Bundler/DuplicatedGem:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Bundler/OrderedGems:
|
18
|
+
TreatCommentsAsGroupSeparators: true
|
19
|
+
|
20
|
+
Layout/AlignHash:
|
21
|
+
EnforcedLastArgumentHashStyle: always_ignore
|
22
|
+
|
23
|
+
Layout/AlignParameters:
|
24
|
+
EnforcedStyle: with_fixed_indentation
|
25
|
+
IndentationWidth: 2
|
26
|
+
|
27
|
+
Layout/EndAlignment:
|
28
|
+
EnforcedStyleAlignWith: variable
|
29
|
+
|
30
|
+
Layout/IndentationConsistency:
|
31
|
+
EnforcedStyle: normal
|
32
|
+
|
33
|
+
Layout/SpaceInsideHashLiteralBraces:
|
34
|
+
EnforcedStyle: no_space
|
35
|
+
EnforcedStyleForEmptyBraces: no_space
|
36
|
+
|
37
|
+
Metrics/BlockLength:
|
38
|
+
Exclude:
|
39
|
+
- "spec/**/*"
|
40
|
+
|
41
|
+
Metrics/LineLength:
|
42
|
+
Max: 120
|
43
|
+
|
44
|
+
Style/StringLiterals:
|
45
|
+
EnforcedStyle: double_quotes
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: datarockets-style
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman Dubrovsky
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-27 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.72.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.72.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
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
|
+
- r.dubrovsky@datarockets.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- CHANGELOG.md
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- CONTRIBUTING.md
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- RELEASING.md
|
85
|
+
- Rakefile
|
86
|
+
- STYLE_GUIDE.md
|
87
|
+
- bin/console
|
88
|
+
- bin/setup
|
89
|
+
- datarockets-style.gemspec
|
90
|
+
- default.yml
|
91
|
+
- lib/datarockets/style.rb
|
92
|
+
- lib/datarockets/style/version.rb
|
93
|
+
homepage: https://github.com/datarockets/datarockets-style
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata:
|
97
|
+
allowed_push_host: https://rubygems.org
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.6.14
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Datarockets style guides and shared style configs
|
118
|
+
test_files: []
|