Skip to content

Improve parsing of gem install flag patterns to reduce false positives#954

Merged
lorenzo merged 1 commit intohadolint:masterfrom
mkusaka:patch
Apr 24, 2024
Merged

Improve parsing of gem install flag patterns to reduce false positives#954
lorenzo merged 1 commit intohadolint:masterfrom
mkusaka:patch

Conversation

@mkusaka
Copy link
Copy Markdown
Contributor

@mkusaka mkusaka commented Apr 26, 2023

What I did

In Hadolint, there are several gem install flag patterns that result in false positives.

Warnings should not be displayed for the following patterns:

RUN gem install bundler:2.0.1 -- --use-system-libraries true
RUN gem install bundler:2.0.1 --use-system-libraries true
RUN gem install bundler:2.0.1 --use-system-libraries=true

In this PR, I have made adjustments so that these patterns can also be parsed correctly.

How I did it

I modified the processing to remove options and their subsequent arguments from the list of arguments.

How to verify it

I have added tests related to the additional patterns.

extra flags without equal sign and double dashes:
RUN gem install bundler:2.0.1 -- --use-system-libraries true

extra flags without double dashes:
RUN gem install bundler:2.0.1 --use-system-libraries true

extra flags without double dashes with equal sign:
RUN gem install bundler:2.0.1 --use-system-libraries=true
@lorenzo
Copy link
Copy Markdown
Member

lorenzo commented Apr 24, 2024

thanks

@lorenzo lorenzo merged commit 968a16e into hadolint:master Apr 24, 2024
@mkusaka mkusaka deleted the patch branch April 25, 2024 06:20
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.

2 participants