typeprof-task 0.1.1 → 0.2.0

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: d5039791f8cec10859cfc53e82bc43bf33a00e0de1306a92f899cf673ae26912
4
- data.tar.gz: 59a04a5dadfd979fc2a1cf012107212deacbe2b7c44b49aba5dafc353a7c696f
3
+ metadata.gz: 5725e727bdc9bd5a7f8c8483fee02f98ff9ced1aa340ab0db5a12fb3eefe9d76
4
+ data.tar.gz: 0dc327967b858392d7aa75398b927e9cb1a6113f23877747c93c994f92ca3cd3
5
5
  SHA512:
6
- metadata.gz: f5c073c0d011c5a472eceffe6a728bf904e1ceb649a5ef06f55816648e3a5f9e9521f09bd52b163736ff1310d88c6849508670e1ed8fd363c018a4234a24b1cd
7
- data.tar.gz: 117ef770b2acf4949accc3bba61a8dbbe6c1f677d47a8ef3176fafe7fdc36690260d962538cdaca269707b52f9c4947715791ebdee441af5ca8a44068da0da63
6
+ metadata.gz: 0fc07652e86ef1bf785b1dce7efd47e166ec3b31f60171e7008ab9147fc2b8301d2aceb66c4a6daf9e47fb4341993ffa4630eeaeaa6720b8e2ea601c8566a7ae
7
+ data.tar.gz: 91cfe8e9bc75287c872c7f18c3e2590b2e1876f0350beaf4c0b30653cc88b73d2ccb4f3be00a096e36be1f574c4ed9dff6d0c07740e12dd28dff472ea24ccf0b
data/.rubocop.yml CHANGED
@@ -1,8 +1,5 @@
1
- AllCops:
2
- TargetRubyVersion: 3.0
3
-
4
- Style/StringLiterals:
5
- EnforcedStyle: double_quotes
1
+ inherit_from: .rubocop_todo.yml
6
2
 
7
- Style/StringLiteralsInInterpolation:
8
- EnforcedStyle: double_quotes
3
+ AllCops:
4
+ TargetRubyVersion: 3.1.4
5
+ NewCops: enable
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,100 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-01 05:17:16 UTC using RuboCop version 1.48.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: EnforcedStyle, AllowedGems, Include.
11
+ # SupportedStyles: Gemfile, gems.rb, gemspec
12
+ # Include: **/*.gemspec, **/Gemfile, **/gems.rb
13
+ Gemspec/DevelopmentDependencies:
14
+ Exclude:
15
+ - 'typeprof-task.gemspec'
16
+
17
+ # Offense count: 2
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
20
+ # Include: **/*.gemspec
21
+ Gemspec/OrderedDependencies:
22
+ Exclude:
23
+ - 'typeprof-task.gemspec'
24
+
25
+ # Offense count: 6
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
28
+ # SupportedHashRocketStyles: key, separator, table
29
+ # SupportedColonStyles: key, separator, table
30
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
31
+ Layout/HashAlignment:
32
+ Exclude:
33
+ - 'typeprof-task.gemspec'
34
+
35
+ # Offense count: 1
36
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
37
+ Metrics/AbcSize:
38
+ Max: 18
39
+
40
+ # Offense count: 1
41
+ # Configuration parameters: CountComments, CountAsOne.
42
+ Metrics/ClassLength:
43
+ Max: 127
44
+
45
+ # Offense count: 2
46
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
47
+ Metrics/MethodLength:
48
+ Max: 18
49
+
50
+ # Offense count: 1
51
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
52
+ # SupportedStyles: snake_case, normalcase, non_integer
53
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
54
+ Naming/VariableNumber:
55
+ Exclude:
56
+ - 'lib/typeprof/task.rb'
57
+
58
+ # Offense count: 1
59
+ # This cop supports unsafe autocorrection (--autocorrect-all).
60
+ # Configuration parameters: EnforcedStyle.
61
+ # SupportedStyles: nested, compact
62
+ Style/ClassAndModuleChildren:
63
+ Exclude:
64
+ - 'test/typeprof/task_test.rb'
65
+
66
+ # Offense count: 1
67
+ # This cop supports unsafe autocorrection (--autocorrect-all).
68
+ Style/CommentedKeyword:
69
+ Exclude:
70
+ - 'lib/typeprof/task.rb'
71
+
72
+ # Offense count: 1
73
+ # Configuration parameters: AllowedConstants.
74
+ Style/Documentation:
75
+ Exclude:
76
+ - 'spec/**/*'
77
+ - 'test/**/*'
78
+ - 'lib/typeprof/task.rb'
79
+
80
+ # Offense count: 79
81
+ # This cop supports safe autocorrection (--autocorrect).
82
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
83
+ # SupportedStyles: single_quotes, double_quotes
84
+ Style/StringLiterals:
85
+ Exclude:
86
+ - 'Gemfile'
87
+ - 'Rakefile'
88
+ - 'bin/console'
89
+ - 'lib/typeprof/task.rb'
90
+ - 'test/test_helper.rb'
91
+ - 'test/typeprof/task_test.rb'
92
+ - 'typeprof-task.gemspec'
93
+
94
+ # Offense count: 1
95
+ # This cop supports safe autocorrection (--autocorrect).
96
+ # Configuration parameters: EnforcedStyle, MinSize, WordRegex.
97
+ # SupportedStyles: percent, brackets
98
+ Style/WordArray:
99
+ Exclude:
100
+ - 'Rakefile'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.0 - 2025-11-29
6
+
7
+ * Update required TypeProf.
8
+
5
9
  ## 0.1.1 - 2025-01-01
6
10
 
7
11
  * Make some options accessible (read and write permissions): `files`,
data/lib/typeprof/task.rb CHANGED
@@ -7,8 +7,9 @@ require "logger"
7
7
 
8
8
  module TypeProf
9
9
  class Task < Rake::TaskLib
10
- VERSION = "0.1.1"
10
+ VERSION = "0.2.0"
11
11
  LOGGER = Logger.new($stderr)
12
+ TYPEPROF0_30_0 = Gem::Version.new(TypeProf::VERSION) >= "0.30.0"
12
13
 
13
14
  # Target files. By default, files under one of the require paths.
14
15
  attr_accessor :files
@@ -83,23 +84,32 @@ module TypeProf
83
84
  # TypeProf's <tt>--union-width-limit</tt> option.
84
85
  attr_writer :union_width_limit
85
86
 
86
- def initialize(name = :typeprof)
87
+ def initialize(name = :typeprof) # :yield: self
88
+ super()
89
+ @name = name
90
+ defaults
91
+ block_given? and yield self
92
+ read_options
93
+ define_tasks
94
+ end
95
+
96
+ private
97
+
98
+ def defaults
87
99
  # TODO: Support multiple gemspecs and custom path options
88
100
  Dir["*.gemspec"] => [gemspec]
89
101
  spec = Gem::Specification.load(gemspec)
90
102
 
91
- @typeprof0_30_0 = Gem::Version.new(TypeProf::VERSION) >= "0.30.0"
92
-
93
- @files = @typeprof0_30_0 ? spec.require_paths : spec.lib_files
103
+ @files = TYPEPROF0_30_0 ? spec.require_paths : spec.lib_files
94
104
  @outfile = File.join("sig", "#{spec.name}.gen.rbs")
95
105
  @include = Set.new
96
106
  @require = Set.new
97
107
  @collection = Set.new
98
108
  @include_dir = Set.new
99
109
  @exclude_dir = Set.new
110
+ end
100
111
 
101
- block_given? and yield self
102
-
112
+ def read_options
103
113
  @options = ["-o", @outfile]
104
114
  @quiet and @options << "--quiet"
105
115
  deprecated_set_option("include", flag: "-I")
@@ -118,13 +128,15 @@ module TypeProf
118
128
  deprecated_boolean_option("stub-execution")
119
129
  deprecated_flag_with_value_option("type-depth-limit")
120
130
  deprecated_flag_with_value_option("union-width-limit")
131
+ end
121
132
 
133
+ def define_tasks
122
134
  outdir = File.dirname(@outfile)
123
135
 
124
136
  desc "Analyze types for Ruby code"
125
- task name => outdir do
137
+ task @name => outdir do
126
138
  argv = [*@options, *@files]
127
- if @typeprof0_30_0
139
+ if TYPEPROF0_30_0
128
140
  TypeProf::CLI::CLI.new(argv).run
129
141
  else
130
142
  config = TypeProf::CLI.parse(argv)
@@ -135,8 +147,6 @@ module TypeProf
135
147
  directory outdir
136
148
  end
137
149
 
138
- private
139
-
140
150
  def read_boolean_option(name, attribute: nil)
141
151
  var = attribute || instance_variable_name(name)
142
152
  instance_variable_defined?(var) or return
@@ -145,7 +155,7 @@ module TypeProf
145
155
 
146
156
  def deprecated_boolean_option(name, attribute: nil)
147
157
  var = attribute || instance_variable_name(name)
148
- if @typeprof0_30_0 && instance_variable_defined?(var)
158
+ if TYPEPROF0_30_0 && instance_variable_defined?(var)
149
159
  warn_ignored_option(name)
150
160
  return
151
161
  end
@@ -156,7 +166,7 @@ module TypeProf
156
166
  def deprecated_set_option(name, flag: nil)
157
167
  value = instance_variable_get(:"@#{name}")
158
168
 
159
- if @typeprof0_30_0 && !value.empty?
169
+ if TYPEPROF0_30_0 && !value.empty?
160
170
  warn_ignored_option(name)
161
171
  return
162
172
  end
@@ -172,7 +182,7 @@ module TypeProf
172
182
  def deprecated_flag_option(name)
173
183
  var = :"@#{name}"
174
184
 
175
- if @typeprof0_30_0 && instance_variable_defined?(var)
185
+ if TYPEPROF0_30_0 && instance_variable_defined?(var)
176
186
  warn_ignored_option(name)
177
187
  return
178
188
  end
@@ -185,7 +195,7 @@ module TypeProf
185
195
  def deprecated_flag_with_value_option(name)
186
196
  var = instance_variable_name(name)
187
197
 
188
- if @typeprof0_30_0 && instance_variable_defined?(var)
198
+ if TYPEPROF0_30_0 && instance_variable_defined?(var)
189
199
  warn_ignored_option(name)
190
200
  return
191
201
  end
data/manifest.scm CHANGED
@@ -1 +1 @@
1
- (specifications->manifest (list "ruby@3.1" "ruby-rubocop"))
1
+ (specifications->manifest (list "ruby@3.3" "ruby-rubocop"))
@@ -13,6 +13,7 @@ module TypeProf
13
13
  class Task < Rake::TaskLib
14
14
  VERSION: String
15
15
  LOGGER: Logger
16
+ @name: :typeprof
16
17
  @typeprof0_30_0: bool
17
18
  @options: Array[String]
18
19
 
@@ -38,6 +39,9 @@ module TypeProf
38
39
  def initialize: (?:typeprof name) -> void
39
40
 
40
41
  private
42
+ def defaults: -> Set[bot]
43
+ def read_options: -> Array[String]?
44
+ def define_tasks: -> untyped
41
45
  def read_boolean_option: (String name, ?attribute: (:@show_version | Symbol)?) -> String?
42
46
  def deprecated_boolean_option: (String name, ?attribute: nil) -> String?
43
47
  def deprecated_set_option: (String name, ?flag: String?) -> Array[String]?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeprof-task
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-01 00:00:00.000000000 Z
11
+ date: 2025-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typeprof
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.3
19
+ version: 0.31.0
20
20
  type: :runtime
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: 0.21.3
26
+ version: 0.31.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ files:
77
77
  - ".envrc"
78
78
  - ".rdoc_options"
79
79
  - ".rubocop.yml"
80
+ - ".rubocop_todo.yml"
80
81
  - CHANGELOG.md
81
82
  - LICENSE
82
83
  - README.md
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
115
  - !ruby/object:Gem::Version
115
116
  version: '0'
116
117
  requirements: []
117
- rubygems_version: 3.3.26
118
+ rubygems_version: 3.5.22
118
119
  signing_key:
119
120
  specification_version: 4
120
121
  summary: TypeProf for Rake task