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 topCommandInputFile for Format command #2063

Merged
merged 5 commits into from
May 10, 2023

Conversation

vrom911
Copy link
Contributor

@vrom911 vrom911 commented May 9, 2023

Thanks to @paulcadman , we figured out that the behaviour of the format command described in issue #2058 was due to the way the uniplates library was handling the FormatOptions. As FormatOption doesn't have the AppPath FileOrDir, it was not set up to anything, therefore, the directory was not properly set.

This change, instead of changing the FormatOptions data type to have some AppPath *, it just adds the special case on how to handle this specific command to figure out its input directory.

For the future, we might think of either refactoring the whole uniplates logic, or handling each command the way that I am handling the format command at the moment, so it is more explicit and consistent.

Let me know what you think!

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works:
    • Negative tests
    • Positive tests
    • Shell tests

@vrom911 vrom911 added this to the 0.3.4 milestone May 9, 2023
@vrom911 vrom911 self-assigned this May 9, 2023
Copy link
Collaborator

@jonaprieto jonaprieto left a comment

Choose a reason for hiding this comment

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

  • Add a smoke test that reflects that the issue is fixed. At leat, I didn't find it. For example, checking something like this gives a 0 exit code.
juvix format --in-place examples/milestone/TicTacToe/CLI/TicTacToe.juvix

@jonaprieto jonaprieto mentioned this pull request May 9, 2023
9 tasks
@jonaprieto jonaprieto merged commit 4e1fee1 into main May 10, 2023
@jonaprieto jonaprieto deleted the vrom911/2058-format-inputfile-dir branch May 10, 2023 06:52
jonaprieto added a commit that referenced this pull request May 19, 2023
…#2057)

This PR resolves a few bugs in the Makefile targets for formatting and
type checking Juvix files, which were preventing the capture of type
checking errors for our examples and bad formatting for all the Juvix
files in the repository. With this PR, our code should now be clean, and
we can expect every file to be properly formatted and type checked.

Changes made:

- [x] Updated `make format-juvix-files`
- [x] Updated `make check-format-juvix-files`
- [x] Formatted all Juvix files
- [x] Comment a fragment in `examples/milestone/Bank/Bank.juvix`

In the future, we will drastically simplify the Makefile once we improve
the `format` and the `type check` command for example posted here:

- #2066 
- #2087 

Related:

- #2063 
- #2040 (due to some typechecking errors we're not capturing before)
- #2105
- #2059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format subcommand does not handle (relative) paths correctly
2 participants