Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to specify files to be applied positionally, as well as … #5388

Merged

Conversation

mesembria
Copy link
Contributor

Summary

Adds ability to specify files to be applied positionally, as well as by flags for ruletypes, profiles and data sources.

Fixes #5383

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Ruletype
Usage updated:
minder ruletype apply [files...] [flags]

Error updated:
Details: no files specified: use positional arguments or the -f flag

Single Positional argument
Cmd: minder ruletype apply osps-ac-02.yaml
Works as expected - ADDED

Multiple positional arguments
Cmd: minder ruletype apply osps-ac-02.yaml osps-ac-03.yaml
Works as expected - ADDED

Multiple positional arguments
ruletype apply osps-{ac-02,ac-03}.yaml
Works as expected - ADDED

All of these scenarios were also tested with project flag (-j) before and after the positional arguments.

Single positional argument, invalid file
Message: Error expanding file args
Details: error getting file info: stat sdfd.yaml: no such file or directory

Multiple positional arguments, invalid file + valid file
Message: Error expanding file args
Details: error getting file info: stat sdfd.yaml: no such file or directory

Single flag (regression test)
Cmd: minder ruletype apply -f osps-ac-02.yaml
Works as expected - SAME AS PREVIOUSLY

Multiple flags (regression test)
Cmd: minder ruletype apply -f osps-ac-02.yaml -f osps-ac-03.yaml
Works as expected - SAME AS PREVIOUSLY

Multiple flag arguments
ruletype apply -f osps-{ac-02,ac-03}.yaml
Works as expected - FIXED

Profile

Usage updated:
minder profile apply [file] [flags]

Error updated:
Details: file is required - provide as argument or via --file flag

Single flag (regression test)
Cmd: minder profile apply -f test-profile.yaml
Works as expected - SAME AS PREVIOUSLY

Single positional argument
Cmd: minder profile apply test-profile.yaml
Works as expected - ADDED

Datasource
Usage updated:
minder datasource apply [files...] [flags]

Error updated:
Details: no files specified: use positional arguments or the -f flag

Single positional argument
Cmd: minder datasource apply -f data-sources/osv.yaml
Works as expected - ADDED

Multiple positional arguments
Cmd: minder datasource apply /data-sources/{openssf_bestpractices,osv}.yaml
Works as expected - ADDED

Single flag (regression test)
Works as expected - SAME AS PREVIOUSLY

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@mesembria mesembria requested a review from a team as a code owner January 31, 2025 11:46
@mesembria mesembria linked an issue Jan 31, 2025 that may be closed by this pull request
3 tasks
@coveralls
Copy link

Coverage Status

coverage: 57.401%. remained the same
when pulling 1cdd85d on 5383-allow-for-position-arguments-with-apply-commands
into fc18f0f on main.

@mesembria mesembria merged commit 3fd28e1 into main Jan 31, 2025
26 checks passed
@mesembria mesembria deleted the 5383-allow-for-position-arguments-with-apply-commands branch January 31, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for position arguments with apply commands
3 participants