Class: Steep::Services::TypeCheckService::SourceFile
- Defined in:
- lib/steep/services/type_check_service.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#ignores ⇒ Object
readonly
Returns the value of attribute ignores.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#typing ⇒ Object
readonly
Returns the value of attribute typing.
Class Method Summary collapse
- .no_data(path:, content:) ⇒ Object
- .with_syntax_error(path:, content:, error:) ⇒ Object
- .with_typing(path:, content:, typing:, node:, ignores:) ⇒ Object
Instance Method Summary collapse
- #diagnostics ⇒ Object
-
#initialize(path:, node:, content:, typing:, ignores:, errors:) ⇒ SourceFile
constructor
A new instance of SourceFile.
- #update_content(content) ⇒ Object
Constructor Details
#initialize(path:, node:, content:, typing:, ignores:, errors:) ⇒ SourceFile
Returns a new instance of SourceFile.
18 19 20 21 22 23 24 25 |
# File 'lib/steep/services/type_check_service.rb', line 18 def initialize(path:, node:, content:, typing:, ignores:, errors:) @path = path @node = node @content = content @typing = typing @ignores = ignores @errors = errors end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/steep/services/type_check_service.rb', line 12 def content @content end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
15 16 17 |
# File 'lib/steep/services/type_check_service.rb', line 15 def errors @errors end |
#ignores ⇒ Object (readonly)
Returns the value of attribute ignores.
16 17 18 |
# File 'lib/steep/services/type_check_service.rb', line 16 def ignores @ignores end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
13 14 15 |
# File 'lib/steep/services/type_check_service.rb', line 13 def node @node end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/steep/services/type_check_service.rb', line 10 def path @path end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
11 12 13 |
# File 'lib/steep/services/type_check_service.rb', line 11 def target @target end |
#typing ⇒ Object (readonly)
Returns the value of attribute typing.
14 15 16 |
# File 'lib/steep/services/type_check_service.rb', line 14 def typing @typing end |
Class Method Details
.no_data(path:, content:) ⇒ Object
35 36 37 |
# File 'lib/steep/services/type_check_service.rb', line 35 def self.no_data(path:, content:) new(path: path, content: content, node: false, errors: nil, typing: nil, ignores: nil) end |
.with_syntax_error(path:, content:, error:) ⇒ Object
27 28 29 |
# File 'lib/steep/services/type_check_service.rb', line 27 def self.with_syntax_error(path:, content:, error:) new(path: path, node: false, content: content, errors: [error], typing: nil, ignores: nil) end |
.with_typing(path:, content:, typing:, node:, ignores:) ⇒ Object
31 32 33 |
# File 'lib/steep/services/type_check_service.rb', line 31 def self.with_typing(path:, content:, typing:, node:, ignores:) new(path: path, node: node, content: content, errors: nil, typing: typing, ignores: ignores) end |
Instance Method Details
#diagnostics ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/steep/services/type_check_service.rb', line 50 def diagnostics case when errors errors when typing && ignores errors = [] #: Array[Diagnostic::Ruby::Base] errors.concat( typing.errors.delete_if do |diagnostic| case diagnostic.location when ::Parser::Source::Range ignores.ignore?(diagnostic.location.first_line, diagnostic.location.last_line, diagnostic.diagnostic_code) when RBS::Location ignores.ignore?(diagnostic.location.start_line, diagnostic.location.end_line, diagnostic.diagnostic_code) end end ) ignores.error_ignores.each do |ignore| errors << Diagnostic::Ruby::InvalidIgnoreComment.new(comment: ignore.comment) end errors else [] end end |
#update_content(content) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/steep/services/type_check_service.rb', line 39 def update_content(content) self.class.new( path: path, content: content, node: node, errors: errors, typing: typing, ignores: ignores ) end |