@@ -26,15 +26,17 @@ def create_prism(ref)
2626 when "dump"
2727 begin
2828 child_socket . puts ( Prism . dump_file ( path ) . hash )
29- rescue Errno ::EISDIR
29+ rescue Errno ::EISDIR , Errno :: EACCES
3030 # Folder might end with `.rb` and get caught by the glob
31+ # Some gems may contain files that are not readable by the current user
3132 child_socket . puts ( "" )
3233 end
3334 when "details"
3435 parse_result = Prism . parse_file ( path )
3536 child_socket . puts ( {
3637 valid : parse_result . success? ,
37- errors : parse_result . errors_format . hash ,
38+ errors : parse_result . errors . map ( &:inspect ) . hash ,
39+ warnings : parse_result . warnings . map ( &:inspect ) . hash ,
3840 ast : parse_result . value . inspect . hash ,
3941 } . to_json )
4042 else
@@ -64,14 +66,15 @@ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
6466
6567def what_changed ( baseline , compare , source_path )
6668 if baseline [ :valid ] != compare [ :valid ]
67- "#{ source_path } changed from valid(#{ baseline [ :valid ] } ) to valid(#{ compare [ :valid ] } )"
68- elsif baseline [ :valid ] && compare [ :valid ] && baseline [ :ast ] != compare [ :ast ]
69- "#{ source_path } is syntax valid with changed ast}"
70- elsif !baseline [ :valid ] && !compare [ :valid ] && baseline [ :errors ] != compare [ :errors ]
71- "#{ source_path } is syntax invalid with changed errors"
72- else
73- raise "Unknown condition for #{ source_path } "
69+ return "#{ source_path } changed from valid(#{ baseline [ :valid ] } ) to valid(#{ compare [ :valid ] } )"
7470 end
71+
72+ changed = [ ]
73+ %i[ ast errors warnings ] . each do |type |
74+ changed << type if baseline [ type ] != compare [ type ]
75+ end
76+ raise "Unknown changes for #{ source_path } " if changed . empty?
77+ "#{ source_path } is valid(#{ baseline [ :valid ] } ) with changed #{ changed . join ( ", " ) } "
7578end
7679
7780files . each_with_index do |source_path , i |
0 commit comments