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

cmd/fix: Filter files loaded for fixing #762

Merged
merged 1 commit into from
May 28, 2024

Conversation

charlieegan3
Copy link
Member

This uses the same logic to filter files when loading them for fixing as used in linting.

Fixes: #761

This uses the same logic to filter files when loading them for fixing as
used in linting.

Signed-off-by: Charlie Egan <[email protected]>
@@ -28,6 +28,10 @@ func (*UseAssignmentOperator) Fix(fc *FixCandidate, opts *RuntimeOptions) ([]Fix

line := lines[loc.Row-1]

if loc.Col-1 < 0 || loc.Col-1 >= len(line) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into this running fix on a large rego codebase where another fix had shifted the contents for that run.

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Charlie!

@anderseknert anderseknert merged commit cf030b4 into StyraInc:main May 28, 2024
3 checks passed
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
This uses the same logic to filter files when loading them for fixing as
used in linting.

Signed-off-by: Charlie Egan <[email protected]>
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.

fix fails on non-rego files
2 participants