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

fix: Output a better error when attempting to rename files to the same destination #1119

Closed
charlieegan3 opened this issue Sep 19, 2024 · 0 comments · Fixed by #1120
Closed
Labels
bug Something isn't working

Comments

@charlieegan3
Copy link
Member

When attempting to fix via rename files with the same name and package in different directories, regal fix will fail with an unhelpful error.

…/regalbundle main ➜ cat example/example_test.rego 
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: example/example_test.rego
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ package example_test
   2   │ 
   3   │ import rego.v1
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
…/regalbundle main ➜ cat example2/example_test.rego 
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: example2/example_test.rego
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ package example_test
   2   │ 
   3   │ import rego.v1
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
…/regalbundle main ➜ regal fix .
failed to fix: failed to rename file: rename conflict: file /Users/charlieegan3/Desktop/regalbundle/example_test/example_test.rego already exists
@charlieegan3 charlieegan3 added the bug Something isn't working label Sep 19, 2024
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Sep 19, 2024
Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Sep 19, 2024
Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Sep 19, 2024
Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>
anderseknert pushed a commit to charlieegan3/regal that referenced this issue Sep 19, 2024
Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>
charlieegan3 added a commit to charlieegan3/regal that referenced this issue Sep 23, 2024
Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>
charlieegan3 added a commit that referenced this issue Sep 23, 2024
* fixer: Address rename conflicts with explanation

Fixes #1119

Signed-off-by: Charlie Egan <charlie@styra.com>

* fixer: Output the source of conflicts in report

Now conflicts are reported by type. If they conflict with an existing
file, these are shown first. Then, conflicts created by more than one
file being moved to the same location are shown after that - if any.

Signed-off-by: Charlie Egan <charlie@styra.com>

* fix: Address PR comments

Signed-off-by: Charlie Egan <charlie@styra.com>

---------

Signed-off-by: Charlie Egan <charlie@styra.com>
srenatus pushed a commit to srenatus/regal that referenced this issue Oct 1, 2024
* fixer: Address rename conflicts with explanation

Fixes StyraInc#1119

Signed-off-by: Charlie Egan <charlie@styra.com>

* fixer: Output the source of conflicts in report

Now conflicts are reported by type. If they conflict with an existing
file, these are shown first. Then, conflicts created by more than one
file being moved to the same location are shown after that - if any.

Signed-off-by: Charlie Egan <charlie@styra.com>

* fix: Address PR comments

Signed-off-by: Charlie Egan <charlie@styra.com>

---------

Signed-off-by: Charlie Egan <charlie@styra.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant