spoom 1.1.1 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b209723354af5be10930893accb559ecbb62afc1469d2d8a12f7a7af44d67d6c
4
- data.tar.gz: 4bd2e43681783fceb004e5595218127b5838b5e09c47800c6d4d0905566e42f0
3
+ metadata.gz: b9b05f4a851903017a55999c9ba093a08e690af7294145dbe6e4401e1cb919f1
4
+ data.tar.gz: 24db18c1f5f061a275576c5a863ec1c190da06eb1f76c1b420266c5c85818641
5
5
  SHA512:
6
- metadata.gz: 99e8cccc29317edb58b84ba3a5713dfbfcf44c97bea40d2b4f30c256460983da7698847ea6fd9fc5a8c58c1aa6cb716e626a4540ac3e60302822b2d17efb194c
7
- data.tar.gz: 055571522e43f963a1ee79a1cbd138d10d8ca685a252e5bfc64fc696abbf1812ae796bef764ab2d95359d1236012fe6cc45cfc48074997273f30df02e018a8b1
6
+ metadata.gz: 85f76b4b4ece46d92484dee9063ca001114a5231f6371cdac09d403ce8e23120ccd4bbd8c9e51e6ed8de43b4a0f9db0f0453c21e2bf20ab71cc25108745201e1
7
+ data.tar.gz: fb41d83d4dee426c81fb2d2d0786ea0ebe21c42c3fda3ed907b522f6ee0f9745cc860ba86f01e97a224c334ae6d837e97af94f45bfd4cb4e1eba45c5640dfde2
@@ -133,7 +133,7 @@ module Spoom
133
133
  if dry && command
134
134
  say("\nRun `#{command}` to bump them")
135
135
  elsif dry
136
- say("\nRun `spoom bump --from #{from} --to #{to}` to bump them")
136
+ say("\nRun `spoom bump --from #{from} --to #{to}` locally then `commit the changes` and `push them`")
137
137
  end
138
138
  end
139
139
 
@@ -44,8 +44,9 @@ module Spoom
44
44
  path = exec_path
45
45
  sorbet = options[:sorbet]
46
46
 
47
- sha_before = Spoom::Git.last_commit(path: path)
48
- unless sha_before
47
+ ref_before = Spoom::Git.current_branch
48
+ ref_before = Spoom::Git.last_commit(path: path) unless ref_before
49
+ unless ref_before
49
50
  say_error("Not in a git repository")
50
51
  say_error("\nSpoom needs to checkout into your previous commits to build the timeline.", status: nil)
51
52
  exit(1)
@@ -90,7 +91,7 @@ module Spoom
90
91
 
91
92
  snapshot = T.let(nil, T.nilable(Spoom::Coverage::Snapshot))
92
93
  if options[:bundle_install]
93
- Bundler.with_clean_env do
94
+ Bundler.with_unbundled_env do
94
95
  next unless bundle_install(path, sha)
95
96
  snapshot = Spoom::Coverage.snapshot(path: path, sorbet_bin: sorbet)
96
97
  end
@@ -107,7 +108,7 @@ module Spoom
107
108
  File.write(file, snapshot.to_json)
108
109
  say(" Snapshot data saved under `#{file}`\n\n")
109
110
  end
110
- Spoom::Git.checkout(sha_before, path: path)
111
+ Spoom::Git.checkout(ref_before, path: path)
111
112
  end
112
113
 
113
114
  desc "report", "Produce a typing coverage report"
@@ -9,8 +9,11 @@ module Spoom
9
9
  module Cli
10
10
  module Helper
11
11
  extend T::Sig
12
+ extend T::Helpers
12
13
  include Thor::Shell
13
14
 
15
+ requires_ancestor Thor
16
+
14
17
  # Print `message` on `$stdout`
15
18
  sig { params(message: String).void }
16
19
  def say(message)
@@ -66,7 +69,7 @@ module Spoom
66
69
  # Return the path specified through `--path`
67
70
  sig { returns(String) }
68
71
  def exec_path
69
- T.unsafe(self).options[:path] # TODO: requires_ancestor
72
+ options[:path]
70
73
  end
71
74
 
72
75
  sig { returns(String) }
@@ -87,7 +90,7 @@ module Spoom
87
90
  # Is the `--color` option true?
88
91
  sig { returns(T::Boolean) }
89
92
  def color?
90
- T.unsafe(self).options[:color] # TODO: requires_ancestor
93
+ options[:color]
91
94
  end
92
95
 
93
96
  sig { params(string: String).returns(String) }
@@ -21,6 +21,9 @@ module Spoom
21
21
 
22
22
  metrics = Spoom::Sorbet.srb_metrics(
23
23
  "--no-config",
24
+ "--no-error-sections",
25
+ "--no-error-count",
26
+ "--isolate-error-code=0",
24
27
  new_config.options_string,
25
28
  path: path,
26
29
  capture_err: true,
data/lib/spoom/git.rb CHANGED
@@ -50,6 +50,13 @@ module Spoom
50
50
  exec("git show #{arg.join(' ')}", path: path)
51
51
  end
52
52
 
53
+ sig { params(path: String).returns(T.nilable(String)) }
54
+ def self.current_branch(path: ".")
55
+ out, _, status = exec("git branch --show-current", path: path)
56
+ return nil unless status
57
+ out.strip
58
+ end
59
+
53
60
  # Utils
54
61
 
55
62
  # Get the commit epoch timestamp for a `sha`
@@ -93,7 +100,19 @@ module Spoom
93
100
  def self.sorbet_intro_commit(path: ".")
94
101
  res, _, status = Spoom::Git.log("--diff-filter=A --format='%h' -1 -- sorbet/config", path: path)
95
102
  return nil unless status
96
- res.strip
103
+ res.strip!
104
+ return nil if res.empty?
105
+ res
106
+ end
107
+
108
+ # Get the hash of the commit removing the `sorbet/config` file
109
+ sig { params(path: String).returns(T.nilable(String)) }
110
+ def self.sorbet_removal_commit(path: ".")
111
+ res, _, status = Spoom::Git.log("--diff-filter=D --format='%h' -1 -- sorbet/config", path: path)
112
+ return nil unless status
113
+ res.strip!
114
+ return nil if res.empty?
115
+ res
97
116
  end
98
117
  end
99
118
  end
@@ -29,11 +29,15 @@ module Spoom
29
29
  sig { returns(T::Array[String]) }
30
30
  attr_reader :paths, :ignore, :allowed_extensions
31
31
 
32
+ sig { returns(T::Boolean) }
33
+ attr_accessor :no_stdlib
34
+
32
35
  sig { void }
33
36
  def initialize
34
37
  @paths = T.let([], T::Array[String])
35
38
  @ignore = T.let([], T::Array[String])
36
39
  @allowed_extensions = T.let([], T::Array[String])
40
+ @no_stdlib = T.let(false, T::Boolean)
37
41
  end
38
42
 
39
43
  sig { returns(Config) }
@@ -42,6 +46,7 @@ module Spoom
42
46
  new_config.paths.concat(@paths)
43
47
  new_config.ignore.concat(@ignore)
44
48
  new_config.allowed_extensions.concat(@allowed_extensions)
49
+ new_config.no_stdlib = @no_stdlib
45
50
  new_config
46
51
  end
47
52
 
@@ -63,6 +68,7 @@ module Spoom
63
68
  opts.concat(paths)
64
69
  opts.concat(ignore.map { |p| "--ignore #{p}" })
65
70
  opts.concat(allowed_extensions.map { |ext| "--allowed-extension #{ext}" })
71
+ opts << "--no-stdlib" if @no_stdlib
66
72
  opts.join(" ")
67
73
  end
68
74
 
@@ -106,12 +112,19 @@ module Spoom
106
112
  when /^--dir=/
107
113
  config.paths << parse_option(line)
108
114
  next
115
+ when /^--no-stdlib$/
116
+ config.no_stdlib = true
117
+ next
109
118
  when /^--.*=/
110
119
  next
111
120
  when /^--/
112
121
  state = :skip
113
122
  when /^-.*=?/
114
123
  next
124
+ when /^#/
125
+ next
126
+ when /^$/
127
+ next
115
128
  else
116
129
  case state
117
130
  when :ignore
@@ -55,7 +55,7 @@ module Spoom
55
55
  # * returns nil if no sigil
56
56
  sig { params(path: T.any(String, Pathname)).returns(T.nilable(String)) }
57
57
  def self.file_strictness(path)
58
- return nil unless File.exist?(path)
58
+ return nil unless File.file?(path)
59
59
  content = File.read(path, encoding: Encoding::ASCII_8BIT)
60
60
  strictness_in_content(content)
61
61
  end
@@ -100,6 +100,16 @@ module Spoom
100
100
  FileUtils.rm_rf(path)
101
101
  end
102
102
 
103
+ sig { params(name: String).void }
104
+ def create_and_checkout_branch(name)
105
+ Spoom::Git.exec("git checkout -b #{name}", path: path)
106
+ end
107
+
108
+ sig { returns(T.nilable(String)) }
109
+ def current_branch
110
+ Spoom::Git.current_branch(path: path)
111
+ end
112
+
103
113
  private
104
114
 
105
115
  # Create an absolute path from `self.path` and `rel_path`
data/lib/spoom/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Spoom
5
- VERSION = "1.1.1"
5
+ VERSION = "1.1.2"
6
6
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Terrasa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-04 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: 2.2.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: 2.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
176
  requirements: []
177
- rubygems_version: 3.0.3
177
+ rubygems_version: 3.2.20
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Useful tools for Sorbet enthusiasts.