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 no-exit-message Setting and [exit-message] attribute #2568

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ArchieAtkinson
Copy link

This adds both the no-exit-message setting and the [exit-message] attribute. Current behaviour is [exit-message] overrides both set no-exit-message and [no-exit-message].

Idea from #2566.

I would like feedback on whether I need to add anything to the documents and whether any test cases are missing.

@ArchieAtkinson ArchieAtkinson marked this pull request as ready for review January 12, 2025 15:51
Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

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

Looks good!

  • I think there is an additional test case, just a plain recipe with the [no-exit-message] attribute with no setting.
    • [exit-message] and [no-exit-message] on the same recipe should produce an error, and this should also have a test

src/attribute.rs Outdated
@@ -17,6 +17,7 @@ pub(crate) enum Attribute<'src> {
Macos,
NoCd,
NoExitMessage,
ExitMessage,
Copy link
Owner

Choose a reason for hiding this comment

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

These should be sorted alphabetically.

Copy link
Author

Choose a reason for hiding this comment

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

Done

src/attribute.rs Outdated
@@ -36,6 +37,7 @@ impl AttributeDiscriminant {
| Self::Macos
| Self::NoCd
| Self::NoExitMessage
| Self::ExitMessage
Copy link
Owner

Choose a reason for hiding this comment

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

These should be sorted alphabetically.

Copy link
Author

Choose a reason for hiding this comment

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

Done

src/attribute.rs Outdated
@@ -84,6 +86,7 @@ impl<'src> Attribute<'src> {
AttributeDiscriminant::Macos => Self::Macos,
AttributeDiscriminant::NoCd => Self::NoCd,
AttributeDiscriminant::NoExitMessage => Self::NoExitMessage,
AttributeDiscriminant::ExitMessage => Self::ExitMessage,
Copy link
Owner

Choose a reason for hiding this comment

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

Sort

Copy link
Author

Choose a reason for hiding this comment

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

Done

src/attribute.rs Outdated
@@ -133,6 +136,7 @@ impl Display for Attribute<'_> {
| Self::Macos
| Self::NoCd
| Self::NoExitMessage
| Self::ExitMessage
Copy link
Owner

Choose a reason for hiding this comment

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

Sort

Copy link
Author

Choose a reason for hiding this comment

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

Done

src/justfile.rs Outdated
@@ -724,6 +724,54 @@ mod tests {
}
}

run_error! {
Copy link
Owner

Choose a reason for hiding this comment

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

I'm trying to move away from the test generation macros. New tests should be integration tests, and use Test::new(), see examples in the tests directory.

Copy link
Author

Choose a reason for hiding this comment

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

Done

src/settings.rs Outdated
@@ -67,6 +68,9 @@ impl<'src> Settings<'src> {
Setting::Quiet(quiet) => {
settings.quiet = quiet;
}
Setting::NoExitMessage(no_exit_message) => {
Copy link
Owner

Choose a reason for hiding this comment

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

Sort

Copy link
Author

Choose a reason for hiding this comment

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

Done

tests/json.rs Outdated
@@ -86,6 +86,7 @@ struct Settings<'a> {
ignore_comments: bool,
positional_arguments: bool,
quiet: bool,
no_exit_message: bool,
Copy link
Owner

Choose a reason for hiding this comment

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

Sort

Copy link
Author

Choose a reason for hiding this comment

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

done

@@ -129,3 +129,67 @@ hello:
stderr: "",
status: 100,
}

test! {
Copy link
Owner

Choose a reason for hiding this comment

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

These should use the Test::new() builder.

Copy link
Author

Choose a reason for hiding this comment

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

Done

}


test! {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this test can be removed, since whether or not a recipe is silent doesn't interact with exit messages.

Copy link
Author

Choose a reason for hiding this comment

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

Done

status: 100,
}

test! {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this test can be removed. It would be a quite weird interaction in this code if this failed.

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Author

@ArchieAtkinson ArchieAtkinson left a comment

Choose a reason for hiding this comment

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

All comments done.

Added additional suggested tests and moved all tests to no_exit_messsage.rs.

Also added a commit to refactor the other tests in no_exit_messsage.rs to Test::new() if that is suitable for this PR.

Let me know if there is anything else that needs changing.

@@ -129,3 +129,67 @@ hello:
stderr: "",
status: 100,
}

test! {
Copy link
Author

Choose a reason for hiding this comment

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

Done

tests/json.rs Outdated
@@ -86,6 +86,7 @@ struct Settings<'a> {
ignore_comments: bool,
positional_arguments: bool,
quiet: bool,
no_exit_message: bool,
Copy link
Author

Choose a reason for hiding this comment

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

done

src/attribute.rs Outdated
@@ -17,6 +17,7 @@ pub(crate) enum Attribute<'src> {
Macos,
NoCd,
NoExitMessage,
ExitMessage,
Copy link
Author

Choose a reason for hiding this comment

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

Done

src/attribute.rs Outdated
@@ -36,6 +37,7 @@ impl AttributeDiscriminant {
| Self::Macos
| Self::NoCd
| Self::NoExitMessage
| Self::ExitMessage
Copy link
Author

Choose a reason for hiding this comment

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

Done

src/attribute.rs Outdated
@@ -84,6 +86,7 @@ impl<'src> Attribute<'src> {
AttributeDiscriminant::Macos => Self::Macos,
AttributeDiscriminant::NoCd => Self::NoCd,
AttributeDiscriminant::NoExitMessage => Self::NoExitMessage,
AttributeDiscriminant::ExitMessage => Self::ExitMessage,
Copy link
Author

Choose a reason for hiding this comment

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

Done

src/setting.rs Outdated
@@ -34,6 +35,7 @@ impl Display for Setting<'_> {
| Self::IgnoreComments(value)
| Self::PositionalArguments(value)
| Self::Quiet(value)
| Self::NoExitMessage(value)
Copy link
Author

Choose a reason for hiding this comment

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

Done

src/settings.rs Outdated
@@ -18,6 +18,7 @@ pub(crate) struct Settings<'src> {
pub(crate) ignore_comments: bool,
pub(crate) positional_arguments: bool,
pub(crate) quiet: bool,
pub(crate) no_exit_message: bool,
Copy link
Author

Choose a reason for hiding this comment

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

Done

src/settings.rs Outdated
@@ -67,6 +68,9 @@ impl<'src> Settings<'src> {
Setting::Quiet(quiet) => {
settings.quiet = quiet;
}
Setting::NoExitMessage(no_exit_message) => {
Copy link
Author

Choose a reason for hiding this comment

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

Done

status: 100,
}

test! {
Copy link
Author

Choose a reason for hiding this comment

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

Done

}


test! {
Copy link
Author

Choose a reason for hiding this comment

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

Done

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