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

Add syntax check to history #306

Open
hofaflo opened this issue Feb 18, 2022 · 2 comments
Open

Add syntax check to history #306

hofaflo opened this issue Feb 18, 2022 · 2 comments

Comments

@hofaflo
Copy link
Contributor

hofaflo commented Feb 18, 2022

During development, it would be convenient if the history was checked for syntax errors. This can be implemented with the built-in function compile. Here's a basic example for this function:

>>> compile("a = 1\n b=2", "history", "exec")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "history", line 2
    b=2
IndentationError: unexpected indent
@cbrnr
Copy link
Owner

cbrnr commented Feb 18, 2022

Could this be a test then?

@hofaflo
Copy link
Contributor Author

hofaflo commented Feb 18, 2022

Not really, since it requires to perform actions which create history entries. The use case I had in mind was more like this: You're in the process of implementing a new feature. In the line that adds the history entry, you miss a closing parenthesis. Since it's inside a string, the typo isn't obvious in the text editor. Trying out the new feature in the GUI, the history entry is created and directly checked for syntactic correctness.
Of course this will only help to catch a small group of errors, but it might be helpful nonetheless.

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

No branches or pull requests

2 participants