Parsing and processing Ruby files
Hello! Some time ago we found out that Ruby 3.0/3.1 handles the keyword method arguments a bit differently than Ruby 2.5. See more details in https://bugzilla.suse.com/show_bug.cgi?id=1195226#c4. We fixed one place but the question was whether some other code was also affected. I wrote a simple script which parses Ruby files and tries to find the non-matching method calls. The script [1] is simple and can only find mismatching static methods (it does not track the variable content) and still might report some false positives. But it did not found any other problematic place (just some false positives). I'm announcing this just for your future reference. In most cases using plain "grep" or "ack" is enough for searching in the YaST Ruby sources. But if you ever need to do something non-trivial where simple "grep" is not enough (or the regexp would be too complicated) then an example script might be handy. Technical details: It uses the "rubocop-ast" library which was extracted from Rubocop and provides nice functions for parsing and processing Ruby files. Enjoy! :) Ladislav [1] https://github.com/yast/helper_scripts/blob/master/ruby/scan_kwoptargs/scan_... -- Ladislav Slezák YaST Developer SUSE LINUX, s.r.o. Corso IIa Křižíkova 148/34 18600 Praha 8
participants (1)
-
Ladislav Slezák