Skip to content

Conversation

ramsrq
Copy link
Contributor

@ramsrq ramsrq commented Apr 6, 2023

Some issues are detected when:

There are white spaces before and/or after a token when send press multiple keys
There is a empty line at the end of the file (index out of bound)
When default delay is modified, single or multiple key remain pressed during default delay period.

144: Fix white spaces after line
189: Prevent from key still pressed when default delay is more than zero.
202: Prevent error index out of bound whet read last line
203: Fix an error when press multiples key that skip the next execution line.

ramsrq added 2 commits April 5, 2023 20:42
Some issues ares detected when 
- There are white spaces before and/or after when send press multiple keys 
- There is a empty line at the end of the file (index out of bound) 
- When default delay is modified, single or multiple key remain pressed during default delay period. 

144: Fix white spaces after line
189: Prevent from key still pressed when default delay is more than zero.
202: Prevent error index out of bound whet read last line
203: Fix
@ramsrq
Copy link
Contributor Author

ramsrq commented Apr 7, 2023

Any advice of how address the precheck error in TEST task?
Error: black....................................................................Failed
Error: reformatted adafruit_ducky.py
Error: Process completed with exit code 1.

image

https://github.com/adafruit/Adafruit_CircuitPython_Ducky/actions/runs/4624950791/jobs/8180264741?pr=10

@tekktrik
Copy link
Member

You can fix the CI errors by using pre-commit, which will help/handle linting and reformatting your code the same way the CI does. You can find information on downloading and using pre-commit here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

I don't understand the first of the issues you mentioned:

144: Fix white spaces after line

I tested a few different duckyscript examples with whitespace at the end of lines. Everything seems to behave as expected as far as I could tell.

Do you have some specific script code in mind and a description of what problem you encountered when it executed?

I noticed that the proposed change for this fix strips whitespace from the end of STRING commands so for instance the duckyscript code: STRING Hello will lose all of the whitespace at the end of it even though the user did put those spaces into the code.

For now I think it's best if we revert this specific fix and look at the others on their own merits.

We can always open up a new PR to add this fix if there is a specific case that it fixes that I'm missing (and ideally if we can get it not to ignore literal spaces added in the code if they're intentional.)

@FoamyGuy FoamyGuy mentioned this pull request Apr 24, 2023
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

I tested this successfully on a Feather S2 TFT.

I was able to replicate the issue and confirm the fixes for these:

189: Prevent from key still pressed when default delay is more than zero.
202: Prevent error index out of bound whet read last line
203: Fix an error when press multiples key that skip the next execution line.

For this one:

144: Fix white spaces after line

I could not replicate any issues that I was able to notice. And I found that the included fix can cause intentional whitespace at the end of STRING commands to be stripped.

This PR Branch would not allow me to commit to it so I've created #11 starting from this branch with fixes for code format so we can get this merged.

@FoamyGuy FoamyGuy merged commit df4e909 into adafruit:main Apr 24, 2023
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