Create a Baseline
It would be nice to create a baseline feature when legacy warnings are too numbered.
I was just about to request something like this also, we are integrating periphery into a codebase with thousands of LOC and it's not feasible to fix the warnings without having a baseline ignore. You might be able to make use of a short ruby script to perform an automated insert of baseline ignores.
Does not handle parameters, and doesn't do indentation correctly
# takes as input lines of warnings from periphery formatted for Xcode
# exclude parameter based warnings (cannot be handled)
File.open('warnings.txt').grep_v(/Parameter/).sort.reverse.each do |line|
# extract location
file=line[/(.*?):(.*?):(.*?)/, 1]
line_num=line[/(.*?):(.*?):(.*?)/, 2]
# insert a baseline ignore on the line above
`sed -i '' '#{line_num}s/^/ \\/\\/ periphery:ignore - baseline ignores\\n/' "#{file}"`
end
I have been working on a very similar feature for SwiftLint, which is not in a shipping version yet, but has been merged to main - you can see more details here: https://github.com/realm/SwiftLint/pull/5475
I have an implementation of this feature for Periphery as well, that I'm just working out a few kinks on.
Implemented in https://github.com/peripheryapp/periphery/commit/e676e1abbfadbfea4b2206a5f8e3a3f7007543e3