Skip to content

Update ConfigFile::Base class with common Lib sanitizer

What does this MR do and why?

Context

In !162313 (merged), we introduced the ConfigFiles::Base class where the intention is for each dependency manager config file type to be represented by a child class. The child class contains the parsing logic to extract a list of libraries and their versions from the file content.

This MR

In this MR, we add a method to sanitize the Lib objects returned by extract_libs. It removes Libs that have a blank name value, and strips the white spaces from name and versions.

Since it's common to all ConfigFile child classes, we don't have to remember to put name.strip, version.strip, and if name.present? everywhere in the extract_libs logic.

Resolves part of #476177 (closed).

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #476177 (closed)

Edited by Leaminn Ma

Merge request reports

Loading