gnar-style 0.2.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e13cb25e1fc2909b27e6ab09a9febe2f3f107ce
4
+ data.tar.gz: 7c73588f837d50b0a31fa6d9ea61774cb87a0cc0
5
+ SHA512:
6
+ metadata.gz: 9c82eb9ac650259796c068e43b2b524cf7250643e94e504bd52a90fd341033b5976352af4dc98441680dc3dd154e6f91112f8fc889778768e656286ca700e5b8
7
+ data.tar.gz: c48fe0f66ebe642d27127dadb9c65dee037b0dc7baaa745313f50f81ba4853335c498f3c8cb81e70981170d8514dc77e5e86cb4250d6812659b45ca58a3a3d61
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --order rand
2
+ --color
@@ -0,0 +1 @@
1
+ inherit_from: rubocop/rubocop_gem.yml
@@ -0,0 +1,6 @@
1
+ ## Current release (in development)
2
+
3
+ ## 0.2.0
4
+
5
+ * Move rubocop template files into `rubocop/` directory rather than the ambiguous `gnar_style/` directory. [#4](https://github.com/TheGnarCo/gnar-style/pull/4)
6
+ *Kevin Murphy*
@@ -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 TODO: Write your email address. 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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gnar-style.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Kevin Murphy
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.
@@ -0,0 +1,129 @@
1
+ # gnar-style
2
+
3
+ Gnar shared style configurations.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ group :development, :test
11
+ gem 'gnar-style'
12
+ end
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gnar-style
22
+
23
+ ## Usage
24
+
25
+ This gem includes rubocop, and it's not necessary to separately include rubocop directly in your application's dependencies.
26
+
27
+ ### Inheriting from the gem
28
+
29
+ Create a `.rubocop.yml` with the following configuration:
30
+
31
+ ```yaml
32
+ inherit_gem:
33
+ gnar-style:
34
+ # Choose from one of these three
35
+ - "rubocop/rubocop.yml" # if the pure ruby style is all that's needed
36
+ - "rubocop/rubocop_gem.yml" # if the application is a gem, already inherits from the default ruby style
37
+ - "rubocop/rubocop_rails.yml" # if the application is a rails project, already inherits from the default ruby style
38
+ ```
39
+
40
+ To check your application against these style configurations:
41
+
42
+ ```bash
43
+ $ bundle exec rubocop
44
+ ```
45
+
46
+ You [must](https://github.com/bbatsov/rubocop/blob/master/manual/configuration.md#inheriting-configuration-from-a-dependency-gem) use `bundle exec` when using the `inherit_gem` directive.
47
+
48
+ ### Inheriting from local copies of gem files
49
+
50
+ Use this approach should you not be able to, or not want to, use the `inherit_gem` directive. This may be because the requirement to use `bundle exec rubocop` to find the dependency's runtime installation path is not an option for you.
51
+
52
+ There is a command to copy the templates locally:
53
+
54
+ ```bash
55
+ $ bundle exec gnar-style copy_local
56
+ ```
57
+
58
+ The `copy_local` command accepts a `--format` option to specify what kind of project you have, and therefore, what files you need.
59
+
60
+ Acceptable options for the format are:
61
+ * `ruby` (the default)
62
+ * `gem`
63
+ * `rails`
64
+
65
+ You can use this option as follows:
66
+ ```bash
67
+ $ bundle exec gnar-style copy_local --format=gem
68
+ ```
69
+
70
+ Create a `.rubocop.yml` with the following configuration:
71
+
72
+ ```yaml
73
+ inherit_from:
74
+ # Choose from one of these three
75
+ - "gnar_style/rubocop.yml" # if the pure ruby style is all that's needed
76
+ - "gnar_style/rubocop_gem.yml" # if the application is a gem, already inherits from the default ruby style
77
+ - "gnar_style/rubocop_rails.yml" # if the application is a rails project, already inherits from the default ruby style
78
+ ```
79
+
80
+ To check your application against these style configurations:
81
+
82
+ ```bash
83
+ $ rubocop
84
+ ```
85
+
86
+ Upon updating this gem for any future updates, you'll need to re-run the `copy_local` command to store the updates locally.
87
+
88
+ ## Overriding Styles
89
+
90
+ Note that if you add in a local style exception in your own application after inheriting from gnar-style, that will completely override gnar-style's defaults. This is particularly important if you're not looking to modify the style at all, but instead are hoping to add to, for example, the list of files excluded.
91
+
92
+ Consider the following:
93
+ ```yaml
94
+ # In gnar-style/default.yml
95
+ Metrics/BlockLength:
96
+ Exclude:
97
+ - 'spec/**/*'
98
+ ```
99
+
100
+ ```yaml
101
+ # In your app's .rubocop.yml
102
+ inherit_gem:
103
+ gnar-style:
104
+ - "rubocop/rubocop.yml"
105
+
106
+ Metrics/BlockLength:
107
+ Exclude:
108
+ - specific_file.rb
109
+ ```
110
+
111
+ In this example, all files in the spec directory will no longer be excluded from the `Metrics/BlockLength` cop. The excluded array is overridden, and not inherited. This is discussed in [this rubocop issue](https://github.com/bbatsov/rubocop/issues/3208), though the suggestion to have a `super` keyword does not seem to have been implemented.
112
+
113
+ If you want to add to the list, you'll instead need to add in the prior array elements into your application's `.rubocop.yml` by referencing the initial list from gnar-style.
114
+
115
+ ## Different Styles
116
+
117
+ gnar-style provides defaults for three different scenarios. You can specify which configuration to use in your `rubocop.yml`. See the [Usage](#usage) section for details.
118
+
119
+ * `rubocop.yml` - Base styling configurations.
120
+ * `rubocop_rails.yml` - Styling for use in a rails project.
121
+ * `rubocop_gem.yml` - Styling for use in a gem.
122
+
123
+ ## Contributing
124
+
125
+ Bug reports and pull requests are welcome on GitHub at https://github.com/TheGnarCo/gnar-style. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
126
+
127
+ ## License
128
+
129
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gnar/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__)
@@ -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
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gnar/style"
4
+ Gnar::Style::Cli::Application.start(ARGV)
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "gnar/style/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "gnar-style"
9
+ spec.version = Gnar::Style::VERSION
10
+ spec.authors = ["The Gnar Company"]
11
+ spec.email = ["hi@thegnar.co"]
12
+
13
+ spec.summary = "Style guide default configuration for The Gnar Company"
14
+ spec.homepage = "https://github.com/TheGnarCo/gnar-style"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "rubocop", "~> 0.49"
25
+ spec.add_dependency "thor"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.14"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
@@ -0,0 +1,7 @@
1
+ require "gnar/style/cli/application"
2
+ require "gnar/style/version"
3
+
4
+ module Gnar
5
+ module Style
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ require "thor"
2
+
3
+ module Gnar
4
+ module Style
5
+ module Cli
6
+ class Application < Thor
7
+ include Thor::Actions
8
+
9
+ desc "copy_local", "Copy configuration files from the gem into your local directory"
10
+ option :format, type: :string, default: "ruby", enum: %w[gem rails ruby]
11
+ def copy_local
12
+ copy_file "rubocop.yml", "gnar_style/rubocop.yml"
13
+
14
+ case options[:format]
15
+ when "rails"
16
+ copy_file "rubocop_rails.yml", "gnar_style/rubocop_rails.yml"
17
+ when "gem"
18
+ copy_file "rubocop_gem.yml", "gnar_style/rubocop_gem.yml"
19
+ end
20
+ end
21
+
22
+ def self.source_root
23
+ "#{File.dirname(__FILE__)}/../../../../rubocop"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module Gnar
2
+ module Style
3
+ VERSION = "0.2.0".freeze
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ Style/StringLiterals:
2
+ EnforcedStyle: double_quotes
3
+ Exclude:
4
+ - 'Gemfile'
5
+
6
+ Metrics/LineLength:
7
+ Max: 100
8
+ Severity: refactor
9
+
10
+ Style/FrozenStringLiteralComment:
11
+ Enabled: false
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Style/SymbolArray:
17
+ EnforcedStyle: brackets
18
+
19
+ Style/ParenthesesAroundCondition:
20
+ Enabled: false
21
+
22
+ Layout/MultilineMethodCallIndentation:
23
+ EnforcedStyle: indented
24
+
25
+ Layout/AlignParameters:
26
+ EnforcedStyle: with_fixed_indentation
27
+
28
+ Metrics/BlockLength:
29
+ Exclude:
30
+ - 'spec/**/*'
31
+
32
+ Metrics/ModuleLength:
33
+ Exclude:
34
+ - 'spec/**/*'
@@ -0,0 +1,14 @@
1
+ inherit_from: rubocop.yml
2
+
3
+ Layout/ExtraSpacing:
4
+ Exclude:
5
+ - '*.gemspec'
6
+
7
+ Layout/SpaceAroundOperators:
8
+ Exclude:
9
+ - '*.gemspec'
10
+
11
+ Metrics/BlockLength:
12
+ Exclude:
13
+ - '*.gemspec'
14
+ - 'spec/**/*'
@@ -0,0 +1,13 @@
1
+ inherit_from: rubocop.yml
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - db/schema.rb
6
+ - 'vendor/**/*'
7
+
8
+ Rails:
9
+ Enabled: true
10
+
11
+ Metrics/MethodLength:
12
+ Exclude:
13
+ - 'db/migrate/**/*'
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gnar-style
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - The Gnar Company
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-08-02 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.49'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.49'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
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.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.14'
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
+ description:
84
+ email:
85
+ - hi@thegnar.co
86
+ executables:
87
+ - gnar-style
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".rubocop.yml"
94
+ - CHANGELOG.md
95
+ - CODE_OF_CONDUCT.md
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
102
+ - exe/gnar-style
103
+ - gnar-style.gemspec
104
+ - lib/gnar/style.rb
105
+ - lib/gnar/style/cli/application.rb
106
+ - lib/gnar/style/version.rb
107
+ - rubocop/rubocop.yml
108
+ - rubocop/rubocop_gem.yml
109
+ - rubocop/rubocop_rails.yml
110
+ homepage: https://github.com/TheGnarCo/gnar-style
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.6.11
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Style guide default configuration for The Gnar Company
134
+ test_files: []