Skip to content

Commit

Permalink
Merge pull request #950 from stripe-internal/pt-rubocop
Browse files Browse the repository at this point in the history
introduce a bare-bones rubocop.yml

(Squashed by Merge Bot)
  • Loading branch information
ptarjan authored and stripe-ci committed May 2, 2018
1 parent 542cb06 commit 74c9315
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 11 deletions.
13 changes: 13 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,13 @@
inherit_gem:
stripe-rubocop: .rubocop.yml

AllCops:
Exclude:
# Someday we should enable some formatting cops for these
- test/testdata/**/*
- test/cli/**/*

# Things we didn't write
- bazel-*/**/*
- third_party/**/*
- parser/tools/generate_diagnostics.rb
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
2.4
2 changes: 2 additions & 0 deletions Dockerfile
Expand Up @@ -16,6 +16,8 @@ RUN apt-get update && apt-get install -y ragel bison ruby autoconf
# Dependencies for pay-server gems
RUN apt-get update && apt-get install -y libpq-dev libicu-dev libsqlite3-dev

RUN rbenv exec gem install bundler --no-rdoc --no-ri

RUN /usr/stripe/bin/docker/stripe-install-go 1.9 d70eadefce8e160638a9a6db97f7192d8463069ab33138893ad3bf31b0650a79
ENV GOPATH /gopath
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
Expand Down
17 changes: 17 additions & 0 deletions Gemfile
@@ -0,0 +1,17 @@
# rubocop:disable PrisonGuard/NoRequireSideEffects

found = ['~/.', '/etc/'].any? do |file|
begin
path = File.expand_path(file + 'bundle-gemfile-hook')
File.lstat(path)
rescue
next
end
instance_eval(File.read(path), path)
break true
end
source('https://rubygems.org/') if !found

gem 'stripe-rubocop', '0.7.4'

# rubocop:enable PrisonGuard/NoRequireSideEffects
29 changes: 29 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,29 @@
GEM
remote: https://intgems.local.corp.stripe.com:446/
specs:
ast (2.4.0)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
powerpack (0.1.1)
rainbow (3.0.0)
rubocop (0.52.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
stripe-rubocop (0.7.4)
rubocop (= 0.52.1)
unicode-display_width (1.3.0)

PLATFORMS
ruby

DEPENDENCIES
stripe-rubocop (= 0.7.4)

BUNDLED WITH
1.16.1
2 changes: 2 additions & 0 deletions ci/stripe-internal-ruby-typer.sh
Expand Up @@ -6,6 +6,8 @@ set -eux
./tools/scripts/lint_sh.sh -t
./tools/scripts/generate_compdb_targets.sh -t
./tools/scripts/build_compilation_db.sh
rbenv exec bundle install
rbenv exec bundle exec rubocop

err=0

Expand Down
5 changes: 4 additions & 1 deletion test/import_whitequark.rb
Expand Up @@ -24,4 +24,7 @@ def main
cur_file = nil
end
end
main

if $0 == __FILE__
main
end
20 changes: 10 additions & 10 deletions test/t.rb
@@ -1,21 +1,21 @@
# rubocop:disable PrisonGuard/NoTopLevelDeclarations
class T
def self.type(fixed: nil)
end
def self.assert_type!(*args)
end
def self.untyped
end
def self.type(fixed: nil); end
def self.assert_type!(*args); end
def self.untyped; end
end

class T::Sig
def returns(*args)
end
def returns(*args); end
end
def sig(*args)

def sig(*_args)
T::Sig.new
end

class Module
def [](*args)
def [](*_args)
self
end
end
# rubocop:enable PrisonGuard/NoTopLevelDeclarations

0 comments on commit 74c9315

Please sign in to comment.