angellist-style 1.0.2

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 @@
1
+ 2.4.5
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.1
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in angellist-style.gemspec
6
+ gemspec
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ angellist-style (1.0.2)
5
+ activesupport (= 5.1.7)
6
+ rubocop
7
+ rubocop-rails
8
+ rubocop-rspec
9
+ rubocop-thread_safety
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (5.1.7)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
19
+ ast (2.4.0)
20
+ concurrent-ruby (1.1.6)
21
+ diff-lcs (1.3)
22
+ i18n (1.8.2)
23
+ concurrent-ruby (~> 1.0)
24
+ jaro_winkler (1.5.4)
25
+ minitest (5.14.0)
26
+ parallel (1.19.1)
27
+ parser (2.7.1.2)
28
+ ast (~> 2.4.0)
29
+ rack (2.2.2)
30
+ rainbow (3.0.0)
31
+ rake (13.0.1)
32
+ rexml (3.2.4)
33
+ rspec (3.9.0)
34
+ rspec-core (~> 3.9.0)
35
+ rspec-expectations (~> 3.9.0)
36
+ rspec-mocks (~> 3.9.0)
37
+ rspec-core (3.9.2)
38
+ rspec-support (~> 3.9.3)
39
+ rspec-expectations (3.9.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-mocks (3.9.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.9.0)
45
+ rspec-support (3.9.3)
46
+ rubocop (0.82.0)
47
+ jaro_winkler (~> 1.5.1)
48
+ parallel (~> 1.10)
49
+ parser (>= 2.7.0.1)
50
+ rainbow (>= 2.2.2, < 4.0)
51
+ rexml
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 1.4.0, < 2.0)
54
+ rubocop-rails (2.5.2)
55
+ activesupport
56
+ rack (>= 1.1)
57
+ rubocop (>= 0.72.0)
58
+ rubocop-rspec (1.39.0)
59
+ rubocop (>= 0.68.1)
60
+ rubocop-thread_safety (0.3.4)
61
+ rubocop (>= 0.51.0)
62
+ ruby-progressbar (1.10.1)
63
+ thread_safe (0.3.6)
64
+ tzinfo (1.2.7)
65
+ thread_safe (~> 0.1)
66
+ unicode-display_width (1.7.0)
67
+
68
+ PLATFORMS
69
+ ruby
70
+
71
+ DEPENDENCIES
72
+ angellist-style!
73
+ bundler
74
+ rake
75
+ rspec
76
+
77
+ BUNDLED WITH
78
+ 2.1.4
@@ -0,0 +1,154 @@
1
+ :toc:
2
+
3
+ = `angellist-style`
4
+
5
+ image:https://github.com/venturehacks/angellist-style/workflows/Run%20RSpecs/badge.svg[link="https://github.com/venturehacks/angellist-style/actions?query=workflow%3A%22Run+RSpecs%22"]
6
+ image:https://badge.fury.io/rb/angellist-style.svg["Gem Version", link="https://badge.fury.io/rb/angellist-style"]
7
+
8
+ This gem encapsulates linter rules for https://docs.rubocop.org/en/stable/[rubocop] that can be applied to any Ruby application or service within AngelList stack. It comes with a multiple config files which deactivate some of RuboCop's features. It is meant as a less restrictive foundation that you can use directly or base your style discussions on.
9
+
10
+ IMPORTANT: The gems' ruleset also loads the https://relaxed.ruby.style/[relaxed ruby style] guide version 2.5, saved into a local file `.rubocop_relaxed.yml`.
11
+
12
+ == Public Service Announcement
13
+
14
+ === The Merits of Linting
15
+
16
+ image:https://thumbs.gfycat.com/CheerfulAbandonedAmethystsunbird-size_restricted.gif[width=335, title="Developers, Developers, Developers!", border="1"]
17
+
18
+ The debate is over: automatic formatters and linters have won, period. You can argue with a bus or a mountain, but you won't win that argument. Same here.
19
+
20
+ Please use rubocop to auto-correct your PRs.
21
+
22
+ * It's good for you,
23
+ * It's good for other developers who will be reading your code,
24
+ * It's good for the business, and
25
+ * It's good for the tests.
26
+
27
+ === Challenging the Status Quo
28
+
29
+ There are many scenarios where you may disagree with a given rule, either in general, or in a specific context.
30
+
31
+ Here are your choices:
32
+
33
+ . For in-place overrides that only happen once or twice, use in-line comments to disable and immediately re-enable the rule:
34
+ +
35
+ [source,ruby]
36
+ ----
37
+ # lib/path/to-my-file.rb
38
+ # rubocop: disable Metrics/MethodLength
39
+ def very_long_method
40
+ # very long body [snip]
41
+ end
42
+ # rubocop: enable Metrics/MethodLength
43
+ ----
44
+ +
45
+ . For per-file or folder rule overrides, add them to your local `.rubocop.yml`:
46
+ +
47
+ [source,yaml]
48
+ ----
49
+ # .rubocop.yml
50
+ Metrics/MethodLength:
51
+ Exclude:
52
+ - lib/path/to-my-file.rb
53
+ ----
54
+ +
55
+ . Add an entire rule overide into your local `.rubocop.yml` file:
56
+ +
57
+ [source,yaml]
58
+ ----
59
+ # .rubocop.yml
60
+ Metrics/MethodLength:
61
+ Exclude:
62
+ - lib/path/to-my-file.rb
63
+ ----
64
+ +
65
+ . Finally, if you want to propose a global change with one or more rules, dependencies, or exclusions, add your change to the appropriate file under `config/`, submit a pull request, and then announce your proposal and the PR in the appropriate Slack channel (you might want to create a poll). Once you are done receiving the feedback — move forward appropriately.
66
+
67
+ == Scope
68
+
69
+ This gem is released as a public ruby gem (available at https://rubygems.org/gems/angellist-style[rubygems]) for ease of deployment.
70
+
71
+ == Installation
72
+
73
+ Add this line to your application's Gemfile:
74
+
75
+ [source,ruby]
76
+ ----
77
+ gem 'angellist-style'
78
+ ----
79
+
80
+ And then execute:
81
+
82
+ $ bundle install
83
+
84
+ Alternatively, run:
85
+
86
+ $ gem install angellist-style -N
87
+
88
+ == Usage
89
+
90
+ To use the styles contained in this gem, add this to your `.rubocop.yml`:
91
+
92
+ [source,yaml]
93
+ ----
94
+ inherit_gem:
95
+ angellist-style:
96
+ - .rubocop.yml
97
+
98
+ # Local overrides.
99
+ Namespace/Rule1:
100
+ Enabled: false
101
+
102
+ Namespace/Rule2:
103
+ Enabled: false
104
+
105
+ # ... etc ....
106
+ ----
107
+
108
+ === Applying Partial Rulesets
109
+
110
+ While not recommended, you can load the rule overrides only for certain Rubocop top-level categories, which are all grouped in YAML files under the `config/` folder.
111
+
112
+ If you inspect the file `.rubocop_angellist.yml`, you'll see the full list of rule files that is being included.
113
+
114
+ Here we show a version you'd specify in your project's `.rubocop.yml`. If you prefer not to apply some of the categories, just delete the corresponding line that you do not want to include:
115
+
116
+ [source,yaml]
117
+ ----
118
+ inherit_gem:
119
+ angellist-style:
120
+ - .rubocop_relaxed.yml
121
+ - config/require.yml
122
+ - config/all_cops.yml
123
+ - config/layout.yml
124
+ - config/lint.yml
125
+ - config/metrics.yml
126
+ - config/naming.yml
127
+ - config/rails.yml
128
+ - config/rspec.yml
129
+ - config/security.yml
130
+ - config/style.yml
131
+ ----
132
+
133
+ === Generating a TODO File
134
+
135
+ Rubocop can generate a local "TODO" file, which you can check-in — *this alllows you to run rubocop on CI and have it pass all the legacy code, but fail any new code that does not satisfy the linter.*
136
+
137
+ [source, bash]
138
+ $ bundle exec rubocop --auto-gen-config
139
+
140
+ === Building the Gem
141
+
142
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
143
+
144
+ Gem management is provided by Rake tasks:
145
+
146
+ * To install this gem onto your local machine, run `bundle exec rake install`.
147
+
148
+ * If you have not yet authenticated with rubygems.org, make sure to create an account, and protect it with the MFA. Then
149
+
150
+ * To release a new version, update the version number in `version.rb`, 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 https://rubygems.org[rubygems.org].
151
+
152
+ == Contributing
153
+
154
+ Bug reports and pull requests are welcome on GitHub at https://github.com/venturehacks/angellist-style.
@@ -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
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/angellist/style/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "angellist-style"
7
+ spec.version = AngelList::Style::VERSION
8
+ spec.authors = ["Konstantin Gredeskoul", "AngelList Developers"]
9
+ spec.email = ["kigster@gmail.com", "dev@angel.co"]
10
+
11
+ spec.summary = 'Contains rubocop style decisions to be used across all Ruby projects.'
12
+ spec.description = 'Contains rubocop style decisions to be used across all Ruby projects.'
13
+ spec.homepage = "https://github.com/venturehacks/angellist-style"
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "https://github.com/venturehacks/angellist-style/tree/master/CHANGELOG.adoc"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency 'activesupport', '5.1.7'
30
+ spec.add_dependency 'rubocop'
31
+ spec.add_dependency 'rubocop-rails'
32
+ spec.add_dependency 'rubocop-rspec'
33
+ spec.add_dependency 'rubocop-thread_safety'
34
+
35
+ spec.add_development_dependency 'bundler'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'rspec'
38
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "angellist/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,11 @@
1
+ AllCops:
2
+ TargetRailsVersion: 5.1.71
3
+ Exclude:
4
+ - bin/**/*
5
+ - db/**/*
6
+ - app/views/**/*
7
+ - script/**/*
8
+ - vendor/**/*
9
+ - "**/node_modules/**/*"
10
+ - node-server/**/*
11
+ - tmp/**/*
@@ -0,0 +1,11 @@
1
+ Layout/LeadingCommentSpace:
2
+ Exclude:
3
+ - spec/
4
+
5
+ Layout/LineLength:
6
+ Max: 160
7
+
8
+ Layout/SpaceAroundMethodCallOperator:
9
+ Enabled: true
10
+
11
+
@@ -0,0 +1,24 @@
1
+ # when ...
2
+ # # noop
3
+ # when ...
4
+ # is ok to do
5
+ Lint/EmptyWhen:
6
+ Enabled: false
7
+
8
+ # Cop disables would require an re-enable - usually those are not needed b/c of scope or file end.
9
+ # Enforcing them creates a lot of noise in the codebase
10
+ Lint/MissingCopEnableDirective:
11
+ Enabled: false
12
+
13
+
14
+ # We should always inherit from StandardError, not from Exception.
15
+ # In those cases we can disable this rule locally
16
+ Lint/InheritException:
17
+ EnforcedStyle: standard_error
18
+
19
+ # This breaks for us with Psych
20
+ Lint/RaiseException:
21
+ Enabled: true
22
+
23
+ Lint/StructNewOverride:
24
+ Enabled: true
@@ -0,0 +1,32 @@
1
+ # Complexity Score Rating: from 15 to 50
2
+ Metrics/AbcSize:
3
+ Max: 50
4
+
5
+ # 'Block has too many lines'
6
+ Metrics/BlockLength:
7
+ Exclude:
8
+ - "**/*.gemspec"
9
+ - "**/Gemfile"
10
+ - spec
11
+ - test
12
+ - app/controllers
13
+
14
+ # 'Class definition is too long'
15
+ Metrics/ClassLength:
16
+ Enabled: false
17
+
18
+ # 'Method has too many lines' from 10 to 50
19
+ Metrics/MethodLength:
20
+ Max: 50
21
+
22
+ # 'Module has too many lines' from 100 to 500
23
+ Metrics/ModuleLength:
24
+ Max: 250
25
+
26
+ # Number of linearly independent paths through a method, 6 to 20
27
+ Metrics/CyclomaticComplexity:
28
+ Max: 20
29
+
30
+ # From 7 to 20
31
+ Metrics/PerceivedComplexity:
32
+ Max: 20
@@ -0,0 +1,28 @@
1
+ # @andreasklinger: is_foobar is fine in graphql types - `?` does not work
2
+ # Normally we'd use `Exclude:\n\t- app/graphql/` but unfortunately for some reason
3
+ # the `Exclude` is ignored. Hence disabled for now.
4
+ Naming/PredicateName:
5
+ Enabled: false
6
+
7
+ Naming/FileName:
8
+ Exclude:
9
+ - lib/angellist-style.rb
10
+
11
+ # some_var_1 is an ok name
12
+ Naming/VariableNumber:
13
+ Enabled: false
14
+
15
+ # Fundraising uses `fc` as very common variable name
16
+ Naming/MethodParameterName:
17
+ AllowedNames:
18
+ - io
19
+ - id
20
+ - to
21
+ - by
22
+ - 'on'
23
+ - in
24
+ - at
25
+ - ip
26
+ - db # --- until here defaults
27
+ - fc # needed by Fundraising
28
+ - jp # common name for job pairing
@@ -0,0 +1,42 @@
1
+ Rails:
2
+ Enabled: true
3
+
4
+ Rails/DynamicFindBy:
5
+ Whitelist:
6
+ - find_by_sql
7
+ - find_by_sql_with_read_from_replica
8
+ - find_by_sql_without_read_from_replica
9
+ - find_by_hash # See if we can get rid of these ones
10
+ - find_by_city
11
+ - find_by_slug
12
+ - find_by_username
13
+ - find_by_username!
14
+ - find_by_usernames
15
+ - find_by_usernames!
16
+ - find by_any_company_name
17
+ - find_by_domain
18
+ - find_by_token
19
+ - find_by_company_name
20
+ - find_by_name
21
+ - find_by_name_prefix_search
22
+ - find_by_any_email
23
+ - find_by_id
24
+ - find_by_encoded_id
25
+ - find_by_url
26
+ - find_by_startup_id
27
+ - find_by_lead_id
28
+ - find_by_target_company_id
29
+ - find_by_email_or_user
30
+ - find_by_any_company_name
31
+
32
+ # @andreasklinger: html_safe is fine - we just have to be careful when using it.
33
+ Rails/OutputSafety:
34
+ Enabled: false
35
+
36
+ # Currently we have no timezone set in the application.
37
+ # We need to fix this before we can enforce this rule
38
+ Rails/TimeZone:
39
+ Enabled: false
40
+
41
+ Rails/ActiveRecordOverride:
42
+ Enabled: false