Skip to content

Add option to turn an arbitrary log entry into an error #2298

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

Merged
merged 4 commits into from
Dec 4, 2020
Merged

Add option to turn an arbitrary log entry into an error #2298

merged 4 commits into from
Dec 4, 2020

Conversation

andreiburdusa
Copy link
Contributor

Fixes #2285


Review checklist

The author performs the actions on the checklist. The reviewer evaluates the work and checks the boxes as they are completed.

  • Summary. Write a summary of the changes. Explain what you did to fix the issue, and why you did it. Present the changes in a logical order. Instead of writing a summary in the pull request, you may push a clean Git history.
  • Documentation. Write documentation for new functions. Update documentation for functions that changed, or complete documentation where it is missing.
  • Tests. Write unit tests for every change. Write the unit tests that were missing before the changes. Include any examples from the reported issue as integration tests.
  • Clean up. The changes are already clean. Clean up anything near the changes that you noticed while working. This does not mean only spatially near the changes, but logically near: any code that interacts with the changes!

@andreiburdusa andreiburdusa marked this pull request as ready for review December 3, 2020 13:32
@ttuegel ttuegel requested a review from ana-pantilie December 3, 2020 15:07
-}
]

notError :: String -> Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really sure about this function, if the convention of how we name entry types ever changes we might forget to change this function as well. What do you think?

Copy link
Contributor

@ana-pantilie ana-pantilie Dec 4, 2020

Choose a reason for hiding this comment

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

Maybe we could split the registry from Registry into a collection of types which are errors and a collection with those which are not. This way, we can use the types directly here. Does this make sense and do you think this would be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't split registry but entryTypeReps and entryHelpDocs. What do you think?

let textToType = (Map.fromList . map register) entryTypeReps
let textToType =
(Map.fromList . map register)
$ entryTypeRepsNoErr <> entryTypeRepsErr
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not entryTypeReps?


entryTypeRepsErr, entryTypeRepsNoErr :: [SomeTypeRep]
entryHelpDocsErr, entryHelpDocsNoErr :: [Pretty.Doc ()]
((entryTypeRepsNoErr, entryHelpDocsNoErr), (entryTypeRepsErr, entryHelpDocsErr))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be formatted on multiple lines? I think it's kind of long and hard to read.

@@ -201,12 +205,15 @@ parseEntryTypes =
[ "Log entries: logs entries of supplied types"
, "Available entry types:"
, (OptPretty.indent 4 . OptPretty.vsep)
(OptPretty.text <$> getEntryTypesAsText)
( OptPretty.text
<$> getNoErrEntryTypesAsText <> getErrEntryTypesAsText
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 this could remain getEntryTypesAsText, and that function could be implemented in Registry.

Comment on lines +170 to +171
( (entryTypeRepsNoErr, entryHelpDocsNoErr)
, (entryTypeRepsErr, entryHelpDocsErr) )
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
( (entryTypeRepsNoErr, entryHelpDocsNoErr)
, (entryTypeRepsErr, entryHelpDocsErr) )
( (entryTypeRepsNoErr, entryHelpDocsNoErr)
, (entryTypeRepsErr, entryHelpDocsErr)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't compile

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I was just thinking this would look nicer, but it's fine either way imo. Everything else looks ok to me.

@andreiburdusa andreiburdusa merged commit c160ec5 into runtimeverification:master Dec 4, 2020
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.

Add option to turn an arbitrary log entry into an error
2 participants