steep 1.2.0.pre.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16805860000461131410384bf4faece6263672c4e3378ecfe464e0f710322f61
4
- data.tar.gz: 3c3bd23ed01ae1fc56f4ecb683e5ef1f6dfdba3ff131be88c93bd43f87b621b2
3
+ metadata.gz: 93e3e37cfc8107518827a5b5e7126618c6189fae7804456e706b8ee810941ad7
4
+ data.tar.gz: c80ef32b93abb3f0c1f6f77eba1a675c993a2eb94632825f9057f76a39edb0ce
5
5
  SHA512:
6
- metadata.gz: 73c14bad856adc3a5bfbd4f10604a6e42ce73fc338e8891a50de91d86e971a42195aff504fb9c1d9eee41ef39bed8ec05d0622a5208403a2e4d219f3f8a3e85d
7
- data.tar.gz: 2c94b001a204c73498532062c14db1c01fb67b0562f18c815be5ca3dd99ceeea44e65ea13f17909dc6d7f3a00a885810ab0ec3d9d58f9a734913c06566712a42
6
+ metadata.gz: 72d8aadb1ea9454f47f4ab98dbd353c8372aa676096923c05d13d87f3b226fc7102c573bf02d563a5adbb2a072747ff5e9ea282e33cf0654ad3d3f562ebe81a5
7
+ data.tar.gz: 15fe6ea35cb298337440074e188178c6fdf73a03b5104fbca92863f8863862bfbb9d8e942e0b2482394307a19061185335da442af29d878c7d98f904ee52d2ab
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.2.0 (2022-10-08)
6
+
7
+ ### Commandline tool
8
+
9
+ * Refactor `--jobs` and `--steep-command` option handling ([#654](https://github.com/soutaro/steep/pull/654))
10
+
11
+ ### Miscellaneous
12
+
13
+ * Delete debug prints ([#653](https://github.com/soutaro/steep/pull/653))
14
+ * Update RBS to 2.7.0 ([#655](https://github.com/soutaro/steep/pull/655))
15
+
5
16
  ## 1.2.0.pre.1 (2022-10-06)
6
17
 
7
18
  ### Type checker core
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- steep (1.2.0.pre.1)
4
+ steep (1.2.0)
5
5
  activesupport (>= 5.1)
6
6
  language_server-protocol (>= 3.15, < 4.0)
7
7
  listen (~> 3.0)
8
8
  parallel (>= 1.0.0)
9
9
  parser (>= 3.1)
10
10
  rainbow (>= 2.2.2, < 4.0)
11
- rbs (>= 2.7.0.pre)
11
+ rbs (>= 2.7.0)
12
12
  securerandom (>= 0.1)
13
13
  terminal-table (>= 2, < 4)
14
14
 
@@ -45,7 +45,7 @@ GEM
45
45
  rb-fsevent (0.11.2)
46
46
  rb-inotify (0.10.1)
47
47
  ffi (~> 1.0)
48
- rbs (2.7.0.pre.3)
48
+ rbs (2.7.0)
49
49
  ruby-debug-ide (0.7.3)
50
50
  rake (>= 0.8.1)
51
51
  securerandom (0.2.0)
data/Steepfile CHANGED
@@ -24,6 +24,7 @@ target :app do
24
24
  "strscan",
25
25
  "rubygems",
26
26
  "optparse",
27
- "securerandom"
27
+ "securerandom",
28
+ "csv"
28
29
  )
29
30
  end
data/lib/steep/cli.rb CHANGED
@@ -43,7 +43,9 @@ module Steep
43
43
  end
44
44
 
45
45
  def setup_command
46
- @command = argv.shift&.to_sym
46
+ return false unless command = argv.shift&.to_sym
47
+ @command = command
48
+
47
49
  if CLI.available_commands.include?(@command) || @command == :worker || @command == :vendor
48
50
  true
49
51
  else
@@ -74,16 +76,13 @@ module Steep
74
76
  end
75
77
  end
76
78
 
77
- def handle_jobs_option(command, opts, modifier = 0)
78
- default = physical_processor_count + modifier
79
- command.jobs_count = default
80
- opts.on("-j N", "--jobs=N", "Specify the number of type check workers (defaults: #{default})") do |count|
81
- command.jobs_count = Integer(count) if Integer(count) > 0
79
+ def handle_jobs_option(option, opts)
80
+ opts.on("-j N", "--jobs=N", "Specify the number of type check workers (defaults: #{option.default_jobs_count})") do |count|
81
+ option.jobs_count = Integer(count) if Integer(count) > 0
82
82
  end
83
83
 
84
- command.steep_command = "steep"
85
84
  opts.on("--steep-command=COMMAND", "Specify command to exec Steep CLI for worker (defaults: steep)") do |cmd|
86
- command.steep_command = cmd
85
+ option.steep_command = cmd
87
86
  end
88
87
  end
89
88
 
@@ -115,7 +114,7 @@ module Steep
115
114
  opts.on("--severity-level=LEVEL", /^error|warning|information|hint$/, "Specify the minimum diagnostic severity to be recognized as an error (defaults: warning): error, warning, information, or hint") do |level|
116
115
  check.severity_level = level.to_sym
117
116
  end
118
- handle_jobs_option check, opts
117
+ handle_jobs_option check.jobs_option, opts
119
118
  handle_logging_options opts
120
119
  end.parse!(argv)
121
120
 
@@ -138,7 +137,7 @@ module Steep
138
137
  check.stdin_input[Pathname(object[:path])] = object[:content]
139
138
  end
140
139
  end
141
- handle_jobs_option check, opts
140
+ handle_jobs_option check.jobs_option, opts
142
141
  handle_logging_options opts
143
142
  end.parse!(argv)
144
143
 
@@ -153,7 +152,7 @@ module Steep
153
152
 
154
153
  opts.on("--steepfile=PATH") {|path| check.steepfile = Pathname(path) }
155
154
  opts.on("--format=FORMAT", "Specify output format: csv, table") {|format| check.format = format }
156
- handle_jobs_option check, opts
155
+ handle_jobs_option check.jobs_option, opts
157
156
  handle_logging_options opts
158
157
  end.parse!(argv)
159
158
 
@@ -197,7 +196,7 @@ module Steep
197
196
  opts.on("--severity-level=LEVEL", /^error|warning|information|hint$/, "Specify the minimum diagnostic severity to be recognized as an error (defaults: warning): error, warning, information, or hint") do |level|
198
197
  command.severity_level = level.to_sym
199
198
  end
200
- handle_jobs_option command, opts
199
+ handle_jobs_option command.jobs_option, opts
201
200
  handle_logging_options opts
202
201
  end.parse!(argv)
203
202
 
@@ -210,7 +209,7 @@ module Steep
210
209
  Drivers::Langserver.new(stdout: stdout, stderr: stderr, stdin: stdin).tap do |command|
211
210
  OptionParser.new do |opts|
212
211
  opts.on("--steepfile=PATH") {|path| command.steepfile = Pathname(path) }
213
- handle_jobs_option command, opts, -1
212
+ handle_jobs_option command.jobs_option, opts
214
213
  handle_logging_options opts
215
214
  end.parse!(argv)
216
215
  end.run
@@ -9,15 +9,16 @@ module Steep
9
9
  attr_accessor :with_expectations_path
10
10
  attr_accessor :save_expectations_path
11
11
  attr_accessor :severity_level
12
+ attr_reader :jobs_option
12
13
 
13
14
  include Utils::DriverHelper
14
- include Utils::JobsCount
15
15
 
16
16
  def initialize(stdout:, stderr:)
17
17
  @stdout = stdout
18
18
  @stderr = stderr
19
19
  @command_line_patterns = []
20
20
  @severity_level = :warning
21
+ @jobs_option = Utils::JobsOption.new()
21
22
  end
22
23
 
23
24
  def run
@@ -39,8 +40,8 @@ module Steep
39
40
  steepfile: project.steepfile_path,
40
41
  args: command_line_patterns,
41
42
  delay_shutdown: true,
42
- steep_command: steep_command,
43
- count: jobs_count
43
+ steep_command: jobs_option.steep_command_value,
44
+ count: jobs_option.jobs_count_value
44
45
  )
45
46
 
46
47
  master = Server::Master.new(
@@ -8,9 +8,9 @@ module Steep
8
8
  attr_reader :command_line_args
9
9
  attr_accessor :all_ruby, :all_rbs
10
10
  attr_reader :stdin_input
11
+ attr_reader :jobs_option
11
12
 
12
13
  include Utils::DriverHelper
13
- include Utils::JobsCount
14
14
 
15
15
  def initialize(stdout:, stderr:)
16
16
  @stdout = stdout
@@ -20,6 +20,8 @@ module Steep
20
20
  @all_rbs = false
21
21
  @all_ruby = false
22
22
  @stdin_input = {}
23
+
24
+ @jobs_option = Utils::JobsOption.new()
23
25
  end
24
26
 
25
27
  def run
@@ -88,10 +90,13 @@ module Steep
88
90
  files = target_paths + signature_paths
89
91
 
90
92
  count =
91
- if files.size >= jobs_count
92
- jobs_count
93
+ if jobs_option.jobs_count
94
+ jobs_option.jobs_count
93
95
  else
94
- files.size + 2
96
+ [
97
+ files.size + 2,
98
+ jobs_option.default_jobs_count
99
+ ].min || raise
95
100
  end
96
101
 
97
102
  Steep.logger.info { "Starting #{count} workers for #{files.size} files..." }
@@ -100,7 +105,7 @@ module Steep
100
105
  steepfile: project.steepfile_path,
101
106
  args: [],
102
107
  delay_shutdown: true,
103
- steep_command: steep_command,
108
+ steep_command: jobs_option.steep_command_value,
104
109
  count: count
105
110
  )
106
111
 
@@ -4,15 +4,12 @@ module Steep
4
4
  attr_reader :stdout
5
5
  attr_reader :stderr
6
6
  attr_reader :stdin
7
- attr_reader :latest_update_version
8
7
  attr_reader :write_mutex
9
8
  attr_reader :type_check_queue
10
9
  attr_reader :type_check_thread
10
+ attr_reader :jobs_option
11
11
 
12
12
  include Utils::DriverHelper
13
- include Utils::JobsCount
14
-
15
- TypeCheckRequest = Struct.new(:version, keyword_init: true)
16
13
 
17
14
  def initialize(stdout:, stderr:, stdin:)
18
15
  @stdout = stdout
@@ -20,6 +17,7 @@ module Steep
20
17
  @stdin = stdin
21
18
  @write_mutex = Mutex.new
22
19
  @type_check_queue = Queue.new
20
+ @jobs_option = Utils::JobsOption.new(jobs_count_modifier: -1)
23
21
  end
24
22
 
25
23
  def writer
@@ -37,8 +35,8 @@ module Steep
37
35
  def run
38
36
  @project = load_config()
39
37
 
40
- interaction_worker = Server::WorkerProcess.spawn_worker(:interaction, name: "interaction", steepfile: project.steepfile_path, steep_command: steep_command)
41
- typecheck_workers = Server::WorkerProcess.spawn_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: steep_command, count: jobs_count)
38
+ interaction_worker = Server::WorkerProcess.spawn_worker(:interaction, name: "interaction", steepfile: project.steepfile_path, steep_command: jobs_option.steep_command_value)
39
+ typecheck_workers = Server::WorkerProcess.spawn_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: jobs_option.steep_command_value, count: jobs_option.jobs_count_value)
42
40
 
43
41
  master = Server::Master.new(
44
42
  project: project,
@@ -100,14 +100,15 @@ module Steep
100
100
  attr_reader :stderr
101
101
  attr_reader :command_line_patterns
102
102
  attr_accessor :format
103
+ attr_reader :jobs_option
103
104
 
104
105
  include Utils::DriverHelper
105
- include Utils::JobsCount
106
106
 
107
107
  def initialize(stdout:, stderr:)
108
108
  @stdout = stdout
109
109
  @stderr = stderr
110
110
  @command_line_patterns = []
111
+ @jobs_option = Utils::JobsOption.new()
111
112
  end
112
113
 
113
114
  def run
@@ -129,8 +130,8 @@ module Steep
129
130
  steepfile: project.steepfile_path,
130
131
  delay_shutdown: true,
131
132
  args: command_line_patterns,
132
- steep_command: steep_command,
133
- count: jobs_count
133
+ steep_command: jobs_option.steep_command_value,
134
+ count: jobs_option.jobs_count_value
134
135
  )
135
136
 
136
137
  master = Server::Master.new(
@@ -0,0 +1,27 @@
1
+ module Steep
2
+ module Drivers
3
+ module Utils
4
+ class JobsOption
5
+ attr_accessor :jobs_count, :steep_command, :jobs_count_modifier
6
+
7
+ include Parallel::ProcessorCount
8
+
9
+ def initialize(jobs_count_modifier: 0)
10
+ @jobs_count_modifier = jobs_count_modifier
11
+ end
12
+
13
+ def default_jobs_count
14
+ physical_processor_count + jobs_count_modifier
15
+ end
16
+
17
+ def jobs_count_value
18
+ jobs_count || default_jobs_count
19
+ end
20
+
21
+ def steep_command_value
22
+ steep_command || "steep"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -6,9 +6,9 @@ module Steep
6
6
  attr_reader :stderr
7
7
  attr_reader :queue
8
8
  attr_accessor :severity_level
9
+ attr_reader :jobs_option
9
10
 
10
11
  include Utils::DriverHelper
11
- include Utils::JobsCount
12
12
 
13
13
  LSP = LanguageServer::Protocol
14
14
 
@@ -18,6 +18,7 @@ module Steep
18
18
  @stderr = stderr
19
19
  @queue = Thread::Queue.new
20
20
  @severity_level = :warning
21
+ @jobs_option = Utils::JobsOption.new()
21
22
  end
22
23
 
23
24
  def watching?(changed_path, files:, dirs:)
@@ -41,7 +42,7 @@ module Steep
41
42
  server_reader = LanguageServer::Protocol::Transport::Io::Reader.new(server_read)
42
43
  server_writer = LanguageServer::Protocol::Transport::Io::Writer.new(server_write)
43
44
 
44
- typecheck_workers = Server::WorkerProcess.spawn_typecheck_workers(steepfile: project.steepfile_path, args: dirs.map(&:to_s), steep_command: steep_command, count: jobs_count)
45
+ typecheck_workers = Server::WorkerProcess.spawn_typecheck_workers(steepfile: project.steepfile_path, args: dirs.map(&:to_s), steep_command: jobs_option.steep_command_value, count: jobs_option.jobs_count_value)
45
46
 
46
47
  master = Server::Master.new(
47
48
  project: project,
@@ -51,7 +52,7 @@ module Steep
51
52
  typecheck_workers: typecheck_workers
52
53
  )
53
54
  master.typecheck_automatically = false
54
- master.commandline_args.push(*dirs)
55
+ master.commandline_args.push(*dirs.map(&:to_s))
55
56
 
56
57
  main_thread = Thread.start do
57
58
  master.start()
@@ -99,6 +100,7 @@ module Steep
99
100
  end
100
101
 
101
102
  removed.each do |path|
103
+ p = Pathname(path)
102
104
  if watching?(p, files: file_paths, dirs: dir_paths)
103
105
  client_writer.write(
104
106
  method: "textDocument/didChange",
@@ -112,7 +114,7 @@ module Steep
112
114
  end
113
115
 
114
116
  client_writer.write(method: "$/typecheck", params: { guid: nil })
115
-
117
+
116
118
  stdout.puts Rainbow("done!").bold
117
119
  end.tap(&:start)
118
120
 
@@ -124,8 +126,7 @@ module Steep
124
126
  client_reader.read do |response|
125
127
  case response[:method]
126
128
  when "textDocument/publishDiagnostics"
127
- uri = URI.parse(response[:params][:uri])
128
- path = project.relative_path(Pathname(uri.path))
129
+ path = PathHelper.to_pathname(response[:params][:uri]) or break
129
130
  buffer = RBS::Buffer.new(content: path.read, name: path)
130
131
  printer = DiagnosticPrinter.new(stdout: stdout, buffer: buffer)
131
132
 
data/lib/steep/source.rb CHANGED
@@ -73,8 +73,6 @@ module Steep
73
73
 
74
74
  if node
75
75
  construct_mapping(node: node, annotations: annotations, mapping: mapping)
76
- else
77
- Steep.logger.fatal { "#{path} is empty source code" }
78
76
  end
79
77
 
80
78
  annotations.each do |annot|
@@ -194,7 +194,6 @@ module Steep
194
194
  fvs = relation.sub_type.free_variables + relation.super_type.free_variables
195
195
  cached = cache[relation, @self_type, @instance_type, @class_type, bounds]
196
196
  if cached && fvs.none? {|var| constraints.unknown?(var) }
197
- Steep.logger.fatal { { cached: relation.to_s }.inspect }
198
197
  cached
199
198
  else
200
199
  if assumptions.member?(relation)
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.2.0.pre.1"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/steep.rb CHANGED
@@ -125,7 +125,7 @@ require "steep/project/dsl"
125
125
 
126
126
  require "steep/expectations"
127
127
  require "steep/drivers/utils/driver_helper"
128
- require "steep/drivers/utils/jobs_count"
128
+ require "steep/drivers/utils/jobs_option"
129
129
  require "steep/drivers/check"
130
130
  require "steep/drivers/checkfile"
131
131
  require "steep/drivers/stats"
@@ -0,0 +1,5 @@
1
+ module Parallel
2
+ module ProcessorCount
3
+ def physical_processor_count: () -> Integer
4
+ end
5
+ end
data/sig/steep/cli.rbs ADDED
@@ -0,0 +1,55 @@
1
+ module Steep
2
+ class CLI
3
+ attr_reader argv: Array[String]
4
+
5
+ attr_reader stdout: IO
6
+
7
+ attr_reader stdin: IO
8
+
9
+ attr_reader stderr: IO
10
+
11
+ attr_reader command: Symbol
12
+
13
+ include Parallel::ProcessorCount
14
+
15
+ def initialize: (stdout: IO, stdin: IO, stderr: IO, argv: Array[String]) -> void
16
+
17
+ def self.available_commands: () -> ::Array[Symbol]
18
+
19
+ def process_global_options: () -> bool
20
+
21
+ def setup_command: () -> bool
22
+
23
+ def run: () -> Integer
24
+
25
+ def handle_logging_options: (OptionParser opts) -> void
26
+
27
+ def handle_jobs_option: (Drivers::Utils::JobsOption jobs_option, OptionParser opts) -> void
28
+
29
+ def process_init: () -> Integer
30
+
31
+ def process_check: () -> Integer
32
+
33
+ def process_checkfile: () -> Integer
34
+
35
+ def process_stats: () -> Integer
36
+
37
+ def process_validate: () -> Integer
38
+
39
+ def process_annotations: () -> Integer
40
+
41
+ def process_project: () -> Integer
42
+
43
+ def process_watch: () -> Integer
44
+
45
+ def process_langserver: () -> Integer
46
+
47
+ def process_vendor: () -> Integer
48
+
49
+ def process_binstub: () -> Integer
50
+
51
+ def process_version: () -> Integer
52
+
53
+ def process_worker: () -> Integer
54
+ end
55
+ end
@@ -15,9 +15,9 @@ module Steep
15
15
 
16
16
  attr_accessor severity_level: untyped
17
17
 
18
- include Utils::DriverHelper
18
+ attr_reader jobs_option: Utils::JobsOption
19
19
 
20
- include Utils::JobsCount
20
+ include Utils::DriverHelper
21
21
 
22
22
  def initialize: (stdout: untyped, stderr: untyped) -> void
23
23
 
@@ -10,7 +10,6 @@ module Steep
10
10
  attr_reader command_line_args: Array[String]
11
11
 
12
12
  include Utils::DriverHelper
13
- include Utils::JobsCount
14
13
 
15
14
  attr_accessor all_rbs: bool
16
15
 
@@ -18,6 +17,8 @@ module Steep
18
17
 
19
18
  attr_reader stdin_input: Hash[Pathname, String]
20
19
 
20
+ attr_reader jobs_option: Utils::JobsOption
21
+
21
22
  def initialize: (stdout: IO, stderr: IO) -> void
22
23
 
23
24
  def run: () -> Integer
@@ -1,35 +1,36 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class Langserver
4
- attr_reader stdout: untyped
4
+ attr_reader stdout: IO
5
5
 
6
- attr_reader stderr: untyped
6
+ attr_reader stderr: IO
7
7
 
8
- attr_reader stdin: untyped
8
+ attr_reader stdin: IO
9
9
 
10
- attr_reader latest_update_version: untyped
10
+ attr_reader write_mutex: Thread::Mutex
11
11
 
12
- attr_reader write_mutex: untyped
12
+ attr_reader type_check_queue: Thread::Queue
13
13
 
14
- attr_reader type_check_queue: untyped
14
+ attr_reader type_check_thread: Thread
15
15
 
16
- attr_reader type_check_thread: untyped
16
+ attr_reader jobs_option: Utils::JobsOption
17
17
 
18
18
  include Utils::DriverHelper
19
19
 
20
- include Utils::JobsCount
20
+ def initialize: (stdout: untyped, stderr: untyped, stdin: untyped) -> void
21
21
 
22
- TypeCheckRequest: untyped
22
+ @writer: LanguageServer::Protocol::Transport::Io::Writer?
23
23
 
24
- def initialize: (stdout: untyped, stderr: untyped, stdin: untyped) -> void
24
+ def writer: () -> LanguageServer::Protocol::Transport::Io::Writer
25
25
 
26
- def writer: () -> untyped
26
+ @reader: LanguageServer::Protocol::Transport::Io::Reader?
27
27
 
28
- def reader: () -> untyped
28
+ def reader: () -> LanguageServer::Protocol::Transport::Io::Reader
29
29
 
30
- def project: () -> untyped
30
+ @project: Project
31
+ def project: () -> Project
31
32
 
32
- def run: () -> 0
33
+ def run: () -> Integer
33
34
  end
34
35
  end
35
36
  end
@@ -1,35 +1,45 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class Stats
4
+ type file_stats = {
5
+ type: String,
6
+ target: String,
7
+ path: String,
8
+ type: String,
9
+ typed_calls: Integer,
10
+ untyped_calls: Integer,
11
+ total_calls: Integer
12
+ }
13
+
4
14
  class CSVPrinter
5
- attr_reader io: untyped
15
+ attr_reader io: IO
6
16
 
7
- def initialize: (io: untyped) -> void
17
+ def initialize: (io: IO) -> void
8
18
 
9
- def print: (untyped stats_result) -> untyped
19
+ def print: (Array[file_stats] stats_result) -> void
10
20
  end
11
21
 
12
22
  class TablePrinter
13
- attr_reader io: untyped
23
+ attr_reader io: IO
14
24
 
15
- def initialize: (io: untyped) -> void
25
+ def initialize: (io: IO) -> void
16
26
 
17
- def print: (untyped stats_result) -> untyped
27
+ def print: (Array[file_stats] stats_result) -> void
18
28
  end
19
29
 
20
- attr_reader stdout: untyped
30
+ attr_reader stdout: IO
21
31
 
22
- attr_reader stderr: untyped
32
+ attr_reader stderr: IO
23
33
 
24
- attr_reader command_line_patterns: untyped
34
+ attr_reader command_line_patterns: Array[String]
25
35
 
26
- attr_accessor format: untyped
36
+ attr_accessor format: "csv" | "table" | nil
27
37
 
28
- include Utils::DriverHelper
38
+ attr_reader jobs_option: Utils::JobsOption
29
39
 
30
- include Utils::JobsCount
40
+ include Utils::DriverHelper
31
41
 
32
- def initialize: (stdout: untyped, stderr: untyped) -> void
42
+ def initialize: (stdout: IO, stderr: IO) -> void
33
43
 
34
44
  def run: () -> 0
35
45
  end
@@ -0,0 +1,23 @@
1
+ module Steep
2
+ module Drivers
3
+ module Utils
4
+ class JobsOption
5
+ attr_accessor jobs_count: Integer?
6
+
7
+ attr_accessor steep_command: String?
8
+
9
+ attr_reader jobs_count_modifier: Integer
10
+
11
+ include Parallel::ProcessorCount
12
+
13
+ def initialize: (?jobs_count_modifier: Integer) -> void
14
+
15
+ def default_jobs_count: () -> Integer
16
+
17
+ def jobs_count_value: () -> Integer
18
+
19
+ def steep_command_value: () -> String
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,27 +1,27 @@
1
1
  module Steep
2
2
  module Drivers
3
3
  class Watch
4
- attr_reader dirs: untyped
4
+ attr_reader dirs: Array[Pathname]
5
5
 
6
- attr_reader stdout: untyped
6
+ attr_reader stdout: IO
7
7
 
8
- attr_reader stderr: untyped
8
+ attr_reader stderr: IO
9
9
 
10
- attr_reader queue: untyped
10
+ attr_reader queue: Thread::Queue
11
11
 
12
- attr_accessor severity_level: untyped
12
+ attr_accessor severity_level: Symbol
13
13
 
14
- include Utils::DriverHelper
14
+ attr_reader jobs_option: Utils::JobsOption
15
15
 
16
- include Utils::JobsCount
16
+ include Utils::DriverHelper
17
17
 
18
- LSP: untyped
18
+ LSP: singleton(LanguageServer::Protocol)
19
19
 
20
- def initialize: (stdout: untyped, stderr: untyped) -> void
20
+ def initialize: (stdout: IO, stderr: IO) -> void
21
21
 
22
- def watching?: (untyped changed_path, files: untyped, dirs: untyped) -> untyped
22
+ def watching?: (Pathname changed_path, files: Set[Pathname], dirs: Set[Pathname]) -> bool
23
23
 
24
- def run: () -> (1 | 0)
24
+ def run: () -> Integer
25
25
  end
26
26
  end
27
27
  end
@@ -1,7 +1,13 @@
1
1
  module Steep
2
2
  module PathHelper
3
+ # Receives a String that represents a *file* URI and returns a Pathname
4
+ #
5
+ # Returns `nil` when the schema of given URI is not `file://`.
6
+ #
3
7
  def self?.to_pathname: (String uri, ?dosish: bool) -> Pathname?
4
8
 
9
+ # Receives a Pathname and returns a *file* URI
10
+ #
5
11
  def self?.to_uri: (Pathname path, ?dosish: bool) -> URI::File
6
12
  end
7
13
  end
data/steep.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
34
34
  spec.add_runtime_dependency "listen", "~> 3.0"
35
35
  spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
36
- spec.add_runtime_dependency "rbs", ">= 2.7.0.pre"
36
+ spec.add_runtime_dependency "rbs", ">= 2.7.0"
37
37
  spec.add_runtime_dependency "parallel", ">= 1.0.0"
38
38
  spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
39
39
  spec.add_runtime_dependency "securerandom", ">= 0.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: 2.7.0.pre
101
+ version: 2.7.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 2.7.0.pre
108
+ version: 2.7.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: parallel
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -225,7 +225,7 @@ files:
225
225
  - lib/steep/drivers/print_project.rb
226
226
  - lib/steep/drivers/stats.rb
227
227
  - lib/steep/drivers/utils/driver_helper.rb
228
- - lib/steep/drivers/utils/jobs_count.rb
228
+ - lib/steep/drivers/utils/jobs_option.rb
229
229
  - lib/steep/drivers/validate.rb
230
230
  - lib/steep/drivers/vendor.rb
231
231
  - lib/steep/drivers/watch.rb
@@ -303,6 +303,7 @@ files:
303
303
  - sample/sig/conference.rbs
304
304
  - sample/sig/length.rbs
305
305
  - sig/shims/language-server_protocol.rbs
306
+ - sig/shims/parallel.rbs
306
307
  - sig/shims/parser.rbs
307
308
  - sig/shims/parser/source/map.rbs
308
309
  - sig/shims/parser/source/range.rbs
@@ -333,6 +334,7 @@ files:
333
334
  - sig/steep/ast/types/union.rbs
334
335
  - sig/steep/ast/types/var.rbs
335
336
  - sig/steep/ast/types/void.rbs
337
+ - sig/steep/cli.rbs
336
338
  - sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs
337
339
  - sig/steep/diagnostic/helper.rbs
338
340
  - sig/steep/diagnostic/lsp_formatter.rbs
@@ -347,7 +349,7 @@ files:
347
349
  - sig/steep/drivers/print_project.rbs
348
350
  - sig/steep/drivers/stats.rbs
349
351
  - sig/steep/drivers/utils/driver_helper.rbs
350
- - sig/steep/drivers/utils/jobs_count.rbs
352
+ - sig/steep/drivers/utils/jobs_option.rbs
351
353
  - sig/steep/drivers/validate.rbs
352
354
  - sig/steep/drivers/vendor.rbs
353
355
  - sig/steep/drivers/watch.rbs
@@ -682,11 +684,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
682
684
  version: 2.6.0
683
685
  required_rubygems_version: !ruby/object:Gem::Requirement
684
686
  requirements:
685
- - - ">"
687
+ - - ">="
686
688
  - !ruby/object:Gem::Version
687
- version: 1.3.1
689
+ version: '0'
688
690
  requirements: []
689
- rubygems_version: 3.3.3
691
+ rubygems_version: 3.3.7
690
692
  signing_key:
691
693
  specification_version: 4
692
694
  summary: Gradual Typing for Ruby
@@ -1,9 +0,0 @@
1
- module Steep
2
- module Drivers
3
- module Utils
4
- module JobsCount
5
- attr_accessor :jobs_count, :steep_command
6
- end
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module Steep
2
- module Drivers
3
- module Utils
4
- module JobsCount
5
- attr_accessor jobs_count: Integer
6
-
7
- attr_accessor steep_command: String
8
- end
9
- end
10
- end
11
- end