When updating adlists, to detect problems I review the logs and open a report with the list maintainer to remove invalid entries. This works well on domain only lists, however for new abp style lists the output mixes IP's and domains that are ignored eg:
While the output is correct as the ips are non domain entries, abp lists actually support IP addresses officially. It would be more helpful if pihole stated something like ignored 7 non domain entries and ignored 20 ip addresses then listed the non domain entries as this can help detect problems and then improve the lists which helps everyone. Unfortunately pihole only lists 5 entries so it is easy for invalid entries to fall off the list and only ips be displayed.
If another line cannot be displayed for IP's another alternative solution would be to allow more than 5 (ie unlimited sample) of invalid domains in output if required so the fill list can be reviewed and monitored for issues.
Please consider this if possible as it would help improve lists.
Pi-hole isn't designed or intended to be a list filtering application.
The capabilities it currently has is to determine if an entry conforms to the standards for domain names. If not then it's not used. There really isn't anything to see if a non-used entry looks like it could be a domain or could be an IP address or could be anything else.
The limit of 5 entries is one I'm comfortable standing ground on. I can see the situation, and have actually experienced the situation of someone feeding in 100k lines of garbage to Pi-hole and displaying 100k lines in the gravity function output kills terminals pretty solidly. Does neat things to docker as well...
The regex used for our filtering is available in the code you have now, /opt/pihole/gravity.sh or on the GitHub repository https://github.com/pi-hole/pi-hole and you are fully welcomed and encouraged to use that code in creating a tool that you can use to do testing and filtering checks as part of your own list maintaining functions.