inspire-ruby-style 4.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 34706559b4e82faeed6bf7e86536556eec845bb5c30d29120eede77a93da468b
4
+ data.tar.gz: c1fc08ee9b3abdd08bfe7bffdf4b231b21e3b651c4a2dd66adcb3f6549dd3c3e
5
+ SHA512:
6
+ metadata.gz: b7e0239c972c8d9487465861bb665a290359e349f4e4f934ab524bb99dfe678dd4a4930a811cf7a574a3bb79ee403124591f88a8ad689eb5976825fd8526e949
7
+ data.tar.gz: 1ecc9495c5aedc513870ebe9be8c687954c6b1632a8a20a8e1cb74550d3c9ae0044b681291120fc8f03413dfdc94daa52cba75828ac8a972d20e6167231fb16a
@@ -0,0 +1,47 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: ~/ruby-style
5
+ docker:
6
+ - image: circleci/ruby:2.5.1
7
+ environment:
8
+ BUNDLE_JOBS: 3
9
+ BUNDLE_RETRY: 3
10
+ BUNDLE_PATH: vendor/bundle
11
+
12
+ steps:
13
+ - checkout
14
+
15
+ # Which version of bundler?
16
+ - run:
17
+ name: Which bundler?
18
+ command: bundle -v
19
+
20
+ # Restore bundle cache
21
+ - restore_cache:
22
+ keys:
23
+ - ruby-style-bundle-v2-{{ checksum "Gemfile.lock" }}
24
+ - ruby-style-bundle-v2-
25
+
26
+ - run:
27
+ name: Bundle Install
28
+ command: bundle check || bundle install
29
+
30
+ # Store bundle cache
31
+ - save_cache:
32
+ key: ruby-style-bundle-v2-{{ checksum "Gemfile.lock" }}
33
+ paths:
34
+ - vendor/bundle
35
+
36
+ # Run rspec in parallel
37
+ - type: shell
38
+ command: |
39
+ bundle exec rspec --profile 10 \
40
+ --format RspecJunitFormatter \
41
+ --out test_results/rspec.xml \
42
+ --format progress \
43
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
44
+
45
+ # Save test results for timing analysis
46
+ - store_test_results:
47
+ path: test_results
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /.yardoc/
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /rdoc/
9
+ /InstalledFiles
10
+ /pkg/
11
+ /spec/reports
12
+ /tmp/
13
+
14
+ # RSpec failure tracking
15
+ .rspec_status
16
+
17
+ ## Environment normalization:
18
+ .ruby-gemset
19
+ .ruby-version
20
+ /.bundle/
21
+ /lib/bundler/man/
22
+ /vendor/bundle
23
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ inherit_from: default.yml
2
+
3
+ # This gem does not have any classes or modules that could be tested. Instead,
4
+ # the specs describe general concepts.
5
+ RSpec/DescribeClass:
6
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to the style guide will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/),
6
+ but please note that the style guide does **not** follow [SemVer](https://semver.org).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ -
13
+
14
+ ### Changed
15
+
16
+ -
17
+
18
+ ### Removed
19
+
20
+ -
21
+
22
+ ### Security
23
+
24
+ -
25
+
26
+ ## [v4]
27
+
28
+ - Disable `Lint/AmbiguousBlockAssociation` for specs
29
+
30
+ ## [v3]
31
+
32
+ ### Changed
33
+
34
+ - Prefix paths with a wildcard to match nested directories
35
+
36
+ ## [v2]
37
+
38
+ ### Added
39
+
40
+ - Enable [rubocop-rspec](https://github.com/rubocop-hq/rubocop-rspec) by default.
41
+
42
+ ## [v1]
43
+
44
+ ### Added
45
+
46
+ - Migrate style guides from developers manual to gem
47
+
48
+ ### Removed
49
+
50
+ - `Naming/MemoizedInstanceVariableName` (project-specific)
51
+
52
+ [Unreleased]: https://github.com/InspireNL/inspire-ruby-style/compare/v4...HEAD
53
+ [v4]: https://github.com/InspireNL/inspire-ruby-style/tree/v4
54
+ [v3]: https://github.com/InspireNL/inspire-ruby-style/tree/v3
55
+ [v2]: https://github.com/InspireNL/inspire-ruby-style/tree/v2
56
+ [v1]: https://github.com/InspireNL/inspire-ruby-style/tree/v1
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in inspire-ruby-style.gemspec
8
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Inspire Innovation BV
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,67 @@
1
+ # Inspire's Ruby Style
2
+
3
+ [![CircleCI branch](https://img.shields.io/circleci/project/github/InspireNL/inspire-ruby-style/master.svg)](https://circleci.com/gh/InspireNL/inspire-ruby-style)
4
+
5
+ This gem packages [Inspire]'s [Rubocop] configuration so that it can easily be
6
+ used in multiple projects. Projects can inherit the global configuration, and
7
+ easily add or overwrite rules as necessary.
8
+
9
+ The gem additionally declares Rubocop as a dependency. Since different versions
10
+ of Rubocop have different default rules, it is important to run the same version
11
+ in all projects to achieve the same Ruby style. Nonetheless, projects can opt-in
12
+ to newer Rubocop versions by adding Rubocop as a dependency in their `Gemfile`
13
+ with the newer version.
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem "inspire-ruby-style", github: "inspirenl/inspire-ruby-style", tag: "v4"
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install inspire-ruby-style
30
+
31
+ ## Usage
32
+
33
+ After installing the gem, create a `.rubocop.yml` file in the project root with
34
+ the following contents:
35
+
36
+ ```yaml
37
+ inherit_gem:
38
+ inspire-ruby-style:
39
+ - default.yml
40
+ ```
41
+
42
+ Individual rules can be overwritten for each project as needed. For example, it
43
+ might make sense to disable the Rails rules for gems:
44
+
45
+ ```yaml
46
+ Rails:
47
+ Enabled: false
48
+ ```
49
+
50
+ ## Releases
51
+
52
+ This gem does **not** follow [SemVer](https://semver.org), since any change to
53
+ the style guide must be considered a breaking change. When making any changes to
54
+ the style guide, increase the version number in the `gemspec`.
55
+
56
+ Document all changes in the `CHANGELOG`, so that it is easy to check if specific
57
+ rules need to be overwritten in a projec.t When changes to the guide are merged
58
+ into `master`, create a new release on GitHub and tag it with the new version
59
+ number.
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the
64
+ [MIT License](https://opensource.org/licenses/MIT).
65
+
66
+ [inspire]: https://inspire.nl
67
+ [rubocop]: https://github.com/rubocop-hq/rubocop
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "inspire/ruby/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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/default.yml ADDED
@@ -0,0 +1,146 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - "**/bin/**/*"
6
+ - "**/db/**/*"
7
+ - "**/lib/generators/**/*"
8
+ - "**/node_modules/**/*"
9
+ - "**/vendor/ruby/**/*"
10
+ TargetRubyVersion: 2.5
11
+
12
+ Layout/AlignHash:
13
+ EnforcedLastArgumentHashStyle: ignore_implicit
14
+
15
+ Layout/AlignParameters:
16
+ EnforcedStyle: with_fixed_indentation
17
+
18
+ Layout/ClassStructure:
19
+ Enabled: true
20
+ Categories:
21
+ module_inclusion:
22
+ - include
23
+ - prepend
24
+ - extend
25
+ scopes:
26
+ - default_scope
27
+ - scope
28
+ attributes:
29
+ - attr_accessor
30
+ - attr_reader
31
+ - attr_writer
32
+ - attribute
33
+ associations:
34
+ - belongs_to
35
+ - has_many
36
+ - has_one
37
+ validations:
38
+ - validates
39
+ - validate
40
+ hooks:
41
+ - after_commit
42
+ - after_create
43
+ - after_destroy
44
+ - after_rollback
45
+ - after_save
46
+ - after_update
47
+ - after_validation
48
+ - around_create
49
+ - around_destroy
50
+ - around_save
51
+ - around_update
52
+ - before_create
53
+ - before_destroy
54
+ - before_save
55
+ - before_update
56
+ - before_validation
57
+ ExpectedOrder:
58
+ - module_inclusion
59
+ - scopes
60
+ - constants
61
+ - attributes
62
+ - associations
63
+ - validations
64
+ - hooks
65
+ - public_class_methods
66
+ - initializer
67
+ - public_methods
68
+ - protected_methods
69
+ - private_methods
70
+
71
+ Layout/MultilineMethodCallIndentation:
72
+ EnforcedStyle: indented
73
+
74
+ Layout/MultilineOperationIndentation:
75
+ EnforcedStyle: indented
76
+
77
+ Layout/SpaceBeforeFirstArg:
78
+ Enabled: false
79
+
80
+ # This cop is incompatible with RSpec's idiom to use blocks as arguments for
81
+ # many methods. Read more: https://github.com/rubocop-hq/rubocop/issues/4222
82
+ Lint/AmbiguousBlockAssociation:
83
+ Exclude:
84
+ - "**/spec/**/*"
85
+
86
+ Metrics/AbcSize:
87
+ Max: 25
88
+ Exclude:
89
+ - "**/spec/**/*"
90
+
91
+ Metrics/BlockLength:
92
+ Exclude:
93
+ - "**/config/environments/*"
94
+ - "**/config/routes.rb"
95
+ - "**/lib/tasks/**/*"
96
+ - "**/spec/**/*"
97
+
98
+ Metrics/CyclomaticComplexity:
99
+ Max: 10
100
+
101
+ Metrics/LineLength:
102
+ Enabled: true
103
+ Exclude:
104
+ - "**/config/**/*"
105
+ Max: 125
106
+
107
+ Metrics/MethodLength:
108
+ Max: 25
109
+ Exclude:
110
+ - "**/spec/**/*"
111
+
112
+ Naming/FileName:
113
+ Enabled: false
114
+
115
+ Rails:
116
+ Enabled: true
117
+
118
+ Rails/Validation:
119
+ Include:
120
+ - "**/app/forms/**/*.rb"
121
+ - "**/app/models/**/*.rb"
122
+
123
+ Style/ClassAndModuleChildren:
124
+ EnforcedStyle: nested
125
+
126
+ Style/Documentation:
127
+ Enabled: false
128
+
129
+ Style/EmptyMethod:
130
+ EnforcedStyle: expanded
131
+
132
+ Style/FormatString:
133
+ EnforcedStyle: sprintf
134
+
135
+ Style/RegexpLiteral:
136
+ EnforcedStyle: mixed
137
+
138
+ Style/StringLiterals:
139
+ EnforcedStyle: double_quotes
140
+
141
+ Style/StringLiteralsInInterpolation:
142
+ EnforcedStyle: single_quotes
143
+
144
+ Style/TrivialAccessors:
145
+ AllowPredicates: true
146
+ AllowDSLWriters: true
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "inspire-ruby-style"
5
+ spec.version = "4.0.0"
6
+ spec.authors = ["Inspire Innovation BV"]
7
+ spec.email = ["info@inspire.nl"]
8
+
9
+ spec.summary = "Inspire's shared style guides for Ruby."
10
+ spec.homepage = "https://github.com/InspireNL/inspire-ruby-style"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
+ f.match(%r{^(test|spec|features)/})
15
+ end
16
+
17
+ spec.add_dependency "rubocop", "~> 0.58"
18
+ spec.add_dependency "rubocop-rspec", "~> 1.29"
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.16"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec", "~> 3.0"
23
+ spec.add_development_dependency "rspec_junit_formatter"
24
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inspire-ruby-style
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Inspire Innovation BV
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-18 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.58'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.58'
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: '1.29'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.29'
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
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec_junit_formatter
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - info@inspire.nl
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".circleci/config.yml"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - CHANGELOG.md
109
+ - Gemfile
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - bin/console
114
+ - bin/setup
115
+ - default.yml
116
+ - inspire-ruby-style.gemspec
117
+ homepage: https://github.com/InspireNL/inspire-ruby-style
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.7.6
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Inspire's shared style guides for Ruby.
141
+ test_files: []