house_style 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/CONTRIBUTING.md +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/house_style.gemspec +25 -0
- data/rails/rubocop.yml +4 -0
- data/ruby/configuration.yml +27 -0
- data/ruby/metrics.yml +11 -0
- data/ruby/rubocop.yml +4 -0
- data/ruby/style.yml +58 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1573476a3f4d373bcc6132043847a04a7e5b2c20
|
4
|
+
data.tar.gz: 62cd11dd3cc0929061beab267eeb091d04f3e731
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 15354968b0a58855978283350283014b5d81ddec69d21924cf18a0db114a50249ea691f9afff8dd8184966f6f083d2439b14272188a9e8840417682b57052e2d
|
7
|
+
data.tar.gz: 157d8dfe82af737d320012674cbd822d7daec817f460a4cb43bed8c582509ee18aed2020ff580834cf3193ebab1282d66b8e414ee93c44fb36252717529f8b70
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
# This is the rubocop configuration file for this gem.
|
2
|
+
# You probably shouldn't inherit from this in your own projects.
|
3
|
+
# See the [README](README.md) for instructions on using `house_style`
|
4
|
+
# style settings from within your own projects
|
5
|
+
inherit_from: ruby/rubocop.yml
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/altmetric/house_style. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
4
|
+
|
5
|
+
Pull requests are welcome for general changes such as:
|
6
|
+
|
7
|
+
* Spelling and grammatical errors
|
8
|
+
* Creation or amendment of extra descriptions of Rubocop rules
|
9
|
+
* Support for new languages (e.g., JS, CoffeeScript, Sass, PHP)
|
10
|
+
* Anything that helps the implementation of `house_style` in other projects
|
11
|
+
|
12
|
+
However, for changes in the _house style_ itself (i.e., the various YAML files that amend, enable and disable rules) will generally only be accepted if they come from people within the Altmetric organisation.
|
13
|
+
|
14
|
+
If the rules in `house_style` are not to your taste, you could override them in individual projects - but that kind of runs counter to the `house_style` ethos. Instead, fork this gem and run your own copy, changing your `Gemfile` accordingly:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'house_style', github: 'myorganisation/house_style'
|
18
|
+
```
|
19
|
+
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Scott Matthewman
|
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,55 @@
|
|
1
|
+
# HouseStyle
|
2
|
+
|
3
|
+
Be nice and consistent from project to project.
|
4
|
+
|
5
|
+
This gem acts as a local repository for house style checkers for Ruby and Rails projects.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'house_style'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
For non-Rails projects, add the following to the top of your `.rubocop.yml` file:
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
inherit_gem:
|
25
|
+
house_style: ruby/rubocop.yml
|
26
|
+
```
|
27
|
+
|
28
|
+
If your project is a Rails project, you should use the instruction below, which includes all the standard Ruby house styles, with Rails-specific cops:
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
inherit_gem:
|
32
|
+
house_style: rails/rubocop.yml
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
## Development
|
37
|
+
|
38
|
+
The gem has no executable code of its own, so there is no test suite to speak of.
|
39
|
+
|
40
|
+
Before committing any changes, ensure that it conforms to its own rubocop settings.
|
41
|
+
|
42
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
43
|
+
|
44
|
+
### Releasing a new version
|
45
|
+
|
46
|
+
Update the version number in `house_style.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/altmetric/house_style. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'house_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
|
data/bin/setup
ADDED
data/house_style.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'house_style'
|
7
|
+
spec.version = '0.1.0'
|
8
|
+
spec.authors = ['Scott Matthewman']
|
9
|
+
spec.email = ['scott@altmetric.com']
|
10
|
+
|
11
|
+
spec.summary = 'A centralised store of house style rules'
|
12
|
+
spec.description = 'Configuration files and other snippets to help you apply standards across multiple projects'
|
13
|
+
spec.homepage = 'https://github.com/altmetric/house_style'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
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.35.1'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
end
|
data/rails/rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
ExtraDetails: true
|
5
|
+
RunRailsCops: false
|
6
|
+
UseCache: true
|
7
|
+
|
8
|
+
Include:
|
9
|
+
- '**/*.gemspec'
|
10
|
+
- '**/*.podspec'
|
11
|
+
- '**/*.jbuilder'
|
12
|
+
- '**/*.rake'
|
13
|
+
- '**/*.opal'
|
14
|
+
- '**/config.ru'
|
15
|
+
- '**/Gemfile'
|
16
|
+
- '**/Rakefile'
|
17
|
+
- '**/Capfile'
|
18
|
+
- '**/Guardfile'
|
19
|
+
- '**/Podfile'
|
20
|
+
- '**/Thorfile'
|
21
|
+
- '**/Vagrantfile'
|
22
|
+
- '**/Berksfile'
|
23
|
+
- '**/Cheffile'
|
24
|
+
- '**/Vagabondfile'
|
25
|
+
Exclude:
|
26
|
+
- 'vendor/**/*'
|
27
|
+
- 'bin/**/*'
|
data/ruby/metrics.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Metrics/LineLength:
|
2
|
+
Max: 120
|
3
|
+
Details: >-
|
4
|
+
If lines are too short, methods become hard to read because you must
|
5
|
+
constantly jump from line to line. If lines are too long, following
|
6
|
+
the flow can be hard because it becomes harder to scan back and
|
7
|
+
locate the start of the next line. 80 characters is generally a bit
|
8
|
+
too short; 120 characters is a good compromise.
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Max: 10
|
11
|
+
|
data/ruby/rubocop.yml
ADDED
data/ruby/style.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
Style/BlockDelimiters:
|
3
|
+
EnforcedStyle: semantic
|
4
|
+
FunctionalMethods:
|
5
|
+
- before
|
6
|
+
- given
|
7
|
+
- given!
|
8
|
+
- watch
|
9
|
+
- times
|
10
|
+
- try
|
11
|
+
# logger methods that can take blocks
|
12
|
+
- debug
|
13
|
+
- error
|
14
|
+
- info
|
15
|
+
- warning
|
16
|
+
# Rubocop defaults which may otherwise be overwritten
|
17
|
+
- let
|
18
|
+
- let!
|
19
|
+
- subject
|
20
|
+
- watch
|
21
|
+
Style/BracesAroundHashParameters:
|
22
|
+
EnforcedStyle: context_dependent
|
23
|
+
Details: >-
|
24
|
+
When the last (or only) argument to a method is a Hash,
|
25
|
+
omit the { } braces. The exception is if the preceding
|
26
|
+
argument is also a Hash.
|
27
|
+
Style/CollectionMethods:
|
28
|
+
Enabled: true
|
29
|
+
Style/CommandLiteral:
|
30
|
+
EnforcedStyle: mixed
|
31
|
+
Style/Copyright:
|
32
|
+
Enabled: false
|
33
|
+
Style/Documentation:
|
34
|
+
Enabled: false
|
35
|
+
Style/EmptyLineBetweenDefs:
|
36
|
+
AllowAdjacentOneLineDefs: true
|
37
|
+
Style/Encoding:
|
38
|
+
EnforcedStyle: when_needed
|
39
|
+
Style/GuardClause:
|
40
|
+
MinBodyLength: 3
|
41
|
+
Style/HashSyntax:
|
42
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
43
|
+
Style/IfUnlessModifier:
|
44
|
+
MaxLineLength: 100
|
45
|
+
Style/IndentHash:
|
46
|
+
EnforcedStyle: consistent
|
47
|
+
Style/MethodCalledOnDoEndBlock:
|
48
|
+
Enabled: true
|
49
|
+
Style/MultilineOperationIndentation:
|
50
|
+
Enabled: false
|
51
|
+
Style/NonNilCheck:
|
52
|
+
IncludeSemanticChanges: true
|
53
|
+
Style/NumericLiterals:
|
54
|
+
MinDigits: 6
|
55
|
+
Style/StringLiterals:
|
56
|
+
Enabled: false
|
57
|
+
Style/StringMethods:
|
58
|
+
Enabled: true
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: house_style
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Matthewman
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-13 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.35.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.35.1
|
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.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Configuration files and other snippets to help you apply standards across
|
56
|
+
multiple projects
|
57
|
+
email:
|
58
|
+
- scott@altmetric.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".travis.yml"
|
66
|
+
- CODE_OF_CONDUCT.md
|
67
|
+
- CONTRIBUTING.md
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE.txt
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- bin/console
|
73
|
+
- bin/setup
|
74
|
+
- house_style.gemspec
|
75
|
+
- rails/rubocop.yml
|
76
|
+
- ruby/configuration.yml
|
77
|
+
- ruby/metrics.yml
|
78
|
+
- ruby/rubocop.yml
|
79
|
+
- ruby/style.yml
|
80
|
+
homepage: https://github.com/altmetric/house_style
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.4.5
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: A centralised store of house style rules
|
104
|
+
test_files: []
|