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

Small tool for generating the scaffolding of a new error message. #408

Merged
merged 9 commits into from
May 25, 2023

Conversation

BinderDavid
Copy link
Collaborator

Small tool for creating new error messages more easily.

$> runghc helper-tool.hs 
This tool helps you create the scaffolding for a new error message on the error-message-index.
You can leave any of the text fields blank and fill them in by hand later.

For which system do you want to generate a message?
 1) GHC
 2) GHCup
 3) Stack
Input (Default = GHC): 1

What is the errorcode that you want to document.
Input: 123456

What is the title of the error message.
Input: Missing Binding

Give a short summary of the error message.
Input: A type signature was given, but the binding is missing

What is the severity of the diagnostic.
 1) Error
 2) Warning
 3) N/A
Input (Default = N/A): 1


For which version was this error message emitted for the first time?
Note: For GHC this is most likely 9.6.1.
Input: 9.6.1

How many examples should be generated?
Input: 2
Creating scaffolding for the following configuration:
MkTemplate {system = GHC, code = "123456", title = "Missing Binding", summary = "A type signature was given, but the binding is missing", severity = Error, warningflag = Nothing, introduced = "9.6.1", examples = 2}

@david-christiansen
Copy link
Contributor

This is a good idea! It'll simplify a lot of things. We have a shell script somewhere in the repo that does something similar, but this one seems much easier to use.

chreekat added a commit to chreekat/error-message-index that referenced this pull request Apr 24, 2023
Replace it with haskellfoundation#408 script when possible.
@BinderDavid BinderDavid changed the title (WIP) Small tool for generating the scaffolding of a new error message. Small tool for generating the scaffolding of a new error message. May 2, 2023
@BinderDavid BinderDavid marked this pull request as ready for review May 2, 2023 11:58
Copy link
Contributor

@david-christiansen david-christiansen left a comment

Choose a reason for hiding this comment

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

A few fairly small comments.

I think that this is also much more useful if it includes easy instructions for running it.

message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
let toplvl_index =
unlines
[ "---",
"title: " <> title tmpl,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have to worry about any of the complicated YAML coercion rules here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure about what YAML accepts or doesn't accept, and how to test this in the script without writing complex validation logic 🤷‍♂️ I hope that incorrect YAML will be caught by the CI when trying to build the site.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that incorrect YAML is more likely to create icky output HTML than it is to actually cause an error message, unfortunately. But we can always add quotes around things if we need to afterwards.

message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
message-index/helper-tool.hs Outdated Show resolved Hide resolved
@david-christiansen
Copy link
Contributor

Thanks for this, I think it really lowers the barriers to contribution!

@BinderDavid
Copy link
Collaborator Author

I applied all of the changes you suggested in the commit aaa4dec except for the YAML validation, which would probably be quite complex.

W.r.t documenting the usage of this tool, I hope that we can handle this in #409

@david-christiansen
Copy link
Contributor

Sorry for the slow response here - I'm totally sunk organizing the Rapperswil event right now. I'll get to this as soon as I can!

@ulysses4ever
Copy link
Collaborator

Maybe the name of the script can be something more descriptive than helper-tool. Otherwise looks great! -- simply bystander speaking

@david-christiansen
Copy link
Contributor

I would prefer a more descriptive name like @ulysses4ever, but I don't think it's a blocker. Better to get this in here prior to Zurihac!

@BinderDavid
Copy link
Collaborator Author

I would prefer a more descriptive name like @ulysses4ever, but I don't think it's a blocker. Better to get this in here prior to Zurihac!

Renamed it to create-message-template.hs :)

@BinderDavid BinderDavid merged commit 5b8ff84 into haskellfoundation:main May 25, 2023
@david-christiansen
Copy link
Contributor

🎆

chreekat added a commit to chreekat/error-message-index that referenced this pull request May 29, 2023
Replace it with haskellfoundation#408 script when possible.
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.

3 participants