Address minor issues flagged in a SAST scan #964
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
We recently ran ClassifAI through a handful of security audits. One of those was a SAST scan and while no major issues were flagged, quite a few smaller issues were highlighted. This PR fixes quite a few of those, though there are still some we may want to look at fixing in follow-up PRs.
I know there's a lot of file changes here but most of these changes fall in the following buckets:
if
statements (error messageMerge this if statement with the enclosing one
)Immediately return this expression instead of assigning it to the temporary variable
)Remove this unused "$example" local variable
)How to test the Change
Ensure all tests pass
If desired, could use some smoke testing across the entire plugin to ensure all functionality works as expected
Changelog Entry
Credits
Props @dkotter
Checklist: