Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rubocop requirement to ~> 0.53.0 #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
880 changes: 77 additions & 803 deletions .rubocop.yml

Large diffs are not rendered by default.

526 changes: 0 additions & 526 deletions .rubocop_todo.yml

This file was deleted.

10 changes: 6 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
appraise "rails-42" do
gem "activesupport", "~> 4.2.7"
# frozen_string_literal: true

appraise 'rails-42' do
gem 'activesupport', '~> 4.2.7'
end

appraise "rails-50" do
gem "activesupport", "~> 5.0.0"
appraise 'rails-50' do
gem 'activesupport', '~> 5.0.0'
end
15 changes: 9 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GEM
bundler
rake
thor (>= 0.14.0)
ast (2.3.0)
ast (2.4.0)
binding_of_caller (0.7.3)
debug_inspector (>= 0.0.1)
bundler-audit (0.6.0)
Expand Down Expand Up @@ -59,8 +59,8 @@ GEM
mime-types-data (3.2016.0521)
minitest (5.11.3)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
parser (2.5.0.3)
ast (~> 2.4.0)
powerpack (0.1.1)
pry (0.11.3)
coderay (~> 1.1.0)
Expand Down Expand Up @@ -89,13 +89,15 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rubocop (0.52.1)
rubocop (0.53.0)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
parser (>= 2.5)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.24.0)
rubocop (>= 0.53.0)
ruby-progressbar (1.9.0)
rugged (0.26.0)
simplecov (0.15.1)
Expand Down Expand Up @@ -128,7 +130,8 @@ DEPENDENCIES
pry-stack_explorer (~> 0.4.9.2)
rake (~> 12.0)
rspec (~> 3.7)
rubocop (~> 0.52.1)
rubocop (~> 0.53.0)
rubocop-rspec (~> 1.24.0)
simplecov (~> 0.15.1)

BUNDLED WITH
Expand Down
8 changes: 5 additions & 3 deletions Rakefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env rake
require "rubygems"
require "bundler/setup"
require "bundler/gem_tasks"
# frozen_string_literal: true

require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'
15 changes: 8 additions & 7 deletions bringit.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path('../lib', __FILE__)
$LOAD_PATH.push File.expand_path('lib', __dir__)

# Maintain your gem's version:
require 'bringit/version'

Gem::Specification.new do |s|
s.name = 'bringit'
s.version = Bringit::VERSION
s.date = Time.now.strftime("%Y-%m-%d")
s.summary = "Bringit library"
s.description = "Bringit wrapper around git objects"
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = 'Bringit library'
s.description = 'Bringit wrapper around git objects'
s.authors = ['Ontohub Core Developers', 'Dmitriy Zaporozhets']
s.email = ['[email protected]', '[email protected]']
s.license = 'MIT'
s.files = `git ls-files lib/`.split("\n")
s.homepage =
'https://github.com/ontohub/bringit'

s.add_dependency('github-linguist', '>= 5.1', '< 5.4')
s.add_dependency('activesupport', '>= 4.0')
s.add_dependency('rugged', '~> 0.26.0')
s.add_dependency('charlock_holmes', '~> 0.7.3')
s.add_dependency('github-linguist', '>= 5.1', '< 5.4')
s.add_dependency('rugged', '~> 0.26.0')

s.add_development_dependency 'appraisal'
s.add_development_dependency 'bundler', '~> 1.14'
Expand All @@ -36,6 +36,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9.2'
s.add_development_dependency 'rake', '~> 12.0'
s.add_development_dependency 'rspec', '~> 3.7'
s.add_development_dependency 'rubocop', '~> 0.52.1'
s.add_development_dependency 'rubocop', '~> 0.53.0'
s.add_development_dependency 'rubocop-rspec', '~> 1.24.0'
s.add_development_dependency 'simplecov', '~> 0.15.1'
end
24 changes: 13 additions & 11 deletions gemfiles/rails_42.gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"
source 'https://rubygems.org'

gem "activesupport", "~> 4.2.7"
gem 'activesupport', '~> 4.2.7'

group :development do
gem "rubocop", '~> 0.43.0'
gem "rubocop-rspec", '~> 1.8.0'
gem "rspec", "~> 3.5.0"
gem "pry"
gem "rake"
gem 'pry'
gem 'rake'
gem 'rspec', '~> 3.5.0'
gem 'rubocop', '~> 0.43.0'
gem 'rubocop-rspec', '~> 1.8.0'
end

group :test do
gem "simplecov", :require => false
gem 'simplecov', require: false
end

group :development, :test do
gem "bundler-audit", "~> 0.5.0", :require => false
gem "appraisal"
gem 'appraisal'
gem 'bundler-audit', '~> 0.5.0', require: false
end

gemspec :path => "../"
gemspec path: '../'
24 changes: 13 additions & 11 deletions gemfiles/rails_50.gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
# frozen_string_literal: true

# This file was generated by Appraisal

source "https://rubygems.org"
source 'https://rubygems.org'

gem "activesupport", "~> 5.0.0"
gem 'activesupport', '~> 5.0.0'

group :development do
gem "rubocop", '~> 0.43.0'
gem "rubocop-rspec", '~> 1.8.0'
gem "rspec", "~> 3.5.0"
gem "pry"
gem "rake"
gem 'pry'
gem 'rake'
gem 'rspec', '~> 3.5.0'
gem 'rubocop', '~> 0.43.0'
gem 'rubocop-rspec', '~> 1.8.0'
end

group :test do
gem "simplecov", :require => false
gem 'simplecov', require: false
end

group :development, :test do
gem "bundler-audit", "~> 0.5.0", :require => false
gem "appraisal"
gem 'appraisal'
gem 'bundler-audit', '~> 0.5.0', require: false
end

gemspec :path => "../"
gemspec path: '../'
72 changes: 33 additions & 39 deletions lib/bringit.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Libraries
require 'ostruct'
require 'fileutils'
Expand All @@ -9,40 +11,40 @@
require 'active_support/core_ext/object/try'
require 'active_support/core_ext/module/delegation'
require 'rugged'
require "charlock_holmes"
require 'charlock_holmes'

# Bringit
require_relative "bringit/popen"
require_relative 'bringit/popen'
require_relative 'bringit/encoding_helper'
require_relative 'bringit/path_helper'
require_relative "bringit/blame"
require_relative "bringit/blob"
require_relative "bringit/commit"
require_relative "bringit/commit_stats"
require_relative "bringit/compare"
require_relative "bringit/diff"
require_relative "bringit/diff_collection"
require_relative "bringit/hook"
require_relative "bringit/index"
require_relative "bringit/rev_list"
require_relative "bringit/repository"
require_relative "bringit/tree"
require_relative "bringit/blob_snippet"
require_relative "bringit/ref"
require_relative "bringit/branch"
require_relative "bringit/tag"
require_relative "bringit/util"
require_relative "bringit/attributes"
require_relative "bringit/version_info"
require_relative "bringit/committing"
require_relative "bringit/cloning"
require_relative "bringit/pulling"
require_relative "bringit/wrapper"
require_relative 'bringit/blame'
require_relative 'bringit/blob'
require_relative 'bringit/commit'
require_relative 'bringit/commit_stats'
require_relative 'bringit/compare'
require_relative 'bringit/diff'
require_relative 'bringit/diff_collection'
require_relative 'bringit/hook'
require_relative 'bringit/index'
require_relative 'bringit/rev_list'
require_relative 'bringit/repository'
require_relative 'bringit/tree'
require_relative 'bringit/blob_snippet'
require_relative 'bringit/ref'
require_relative 'bringit/branch'
require_relative 'bringit/tag'
require_relative 'bringit/util'
require_relative 'bringit/attributes'
require_relative 'bringit/version_info'
require_relative 'bringit/committing'
require_relative 'bringit/cloning'
require_relative 'bringit/pulling'
require_relative 'bringit/wrapper'

module Bringit
BLANK_SHA = ('0' * 40).freeze
TAG_REF_PREFIX = "refs/tags/".freeze
BRANCH_REF_PREFIX = "refs/heads/".freeze
TAG_REF_PREFIX = 'refs/tags/'
BRANCH_REF_PREFIX = 'refs/heads/'

class << self
def ref_name(ref)
Expand All @@ -51,11 +53,7 @@ def ref_name(ref)

def branch_name(ref)
ref = ref.to_s
if self.branch_ref?(ref)
self.ref_name(ref)
else
nil
end
ref_name(ref) if branch_ref?(ref)
end

def committer_hash(email:, name:)
Expand All @@ -64,17 +62,13 @@ def committer_hash(email:, name:)
{
email: email,
name: name,
time: Time.now
time: Time.now,
}
end

def tag_name(ref)
ref = ref.to_s
if self.tag_ref?(ref)
self.ref_name(ref)
else
nil
end
ref_name(ref) if tag_ref?(ref)
end

def tag_ref?(ref)
Expand All @@ -90,7 +84,7 @@ def blank_ref?(ref)
end

def version
Bringit::VersionInfo.parse(Bringit::Popen.popen(%W(git --version)).first)
Bringit::VersionInfo.parse(Bringit::Popen.popen(%w(git --version)).first)
end
end
end
2 changes: 2 additions & 0 deletions lib/bringit/attributes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Bringit
# Class for parsing Git attribute files and extracting the attributes for
# file patterns.
Expand Down
14 changes: 10 additions & 4 deletions lib/bringit/blame.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Bringit
class Blame
include Bringit::EncodingHelper
Expand Down Expand Up @@ -26,21 +28,25 @@ def each
def load_blame
cmd = %W(git --git-dir=#{@repo.path} blame -p #{@sha} -- #{@path})
# Read in binary mode to ensure ASCII-8BIT
raw_output = IO.popen(cmd, 'rb') {|io| io.read }
raw_output = IO.popen(cmd, 'rb', &:read)
output = encode_utf8(raw_output)
process_raw_blame output
end

def process_raw_blame(output)
lines, final = [], []
info, commits = {}, {}
lines = []
final = []
info = {}
commits = {}

# process the output
output.split("\n").each do |line|
if line[0, 1] == "\t"
lines << line[1, line.size]
elsif m = /^(\w{40}) (\d+) (\d+)/.match(line)
commit_id, old_lineno, lineno = m[1], m[2].to_i, m[3].to_i
commit_id = m[1]
old_lineno = m[2].to_i
lineno = m[3].to_i
commits[commit_id] = nil unless commits.key?(commit_id)
info[lineno] = [commit_id, old_lineno]
end
Expand Down
Loading