Commit Graph

21 Commits

Author SHA1 Message Date
71cb9ccbdb Connection::Buffer: Ignore linter indicator wrapped in quotes
The PyLint output is marking the erroneous location visually by using ^ in the next line. This indicator is always prefixed by multiple spaces and the line does not contain any further text. Now, it might happen that the indicator is between two source lines that use the same quote type. Since we detect quotes through our regex, this occurrence would qualify, effectively enquoting the linter indicator ^. As a consequence of our quote handling, we normally prevented quoted text from being split. However, in the described scenario, this is not desired, since we are not dealing with a regular quote (but an accidental mismatch).

Therefore, with this commit, we disable our quote handling for those multi-line quotes where one line fully represents a typical PyLint indicator line. This should restore the desired line-matching behavior.

Fixes CODEOCEAN-12N
2024-04-18 08:43:13 +02:00
42b0507cd6 Connection::Buffer: Ignore comments for quote matching
Within a source code comment (beginning with # or \\), a user could write arbitrary text, including unmatched quotes " or '. This is not an error and should be supported. However, with the current implementation, we would also treat such a quote the same way as an original one. With this commit, we fix that erroneous behavior.

Fixes CODEOCEAN-XF
2023-09-30 18:56:19 +02:00
077af74671 Connection::Buffer: Restore buffering for lines ending with CR
With the turtle graphics, some very long lines might be returned by Poseidon just after the CR (\r). In this case, our new normalization will fix the mistake, but the next message received (just a LF `\n`) will be forwarded to the clients unchanged. This is not desired, so that we filter this case separately.
2023-09-24 16:29:08 +02:00
515a81537c Connection::Buffer: Prevent modification of line breaks in quotes
After splitting the messages received into lines, we could still have a line break within quotes. Since we just want to modify terminating line breaks, we change the recognition accordingly.
2023-09-24 15:42:26 +02:00
64c1a1cb6f Connection::Buffer: Handle Python doc string correctly
In Python, a so-called doc string consists of a string encoded in three quote (starting and ending with """ or '''). These strings were not yet recognized correctly, so that line breaks there would cause further trouble with recognizing individual lines (which is important for the linter translation).
2023-09-24 15:38:58 +02:00
968fd5b864 Connection::Buffer: Fix recognition of incoming CLRF line endings
Previously, a message received with CRLF line endings was (incorrectly) converted to CRCRLF line endings (i.e., from \r\n to \r\r\n). Then, the splitting in individual lines could generate an "empty" line, just containing the newly-added CR line ending \r.
2023-09-24 14:10:06 +02:00
03637b3185 Buffer: Buffer messages with incomplete quotes
If a non-JSON message received contains quotes and is cut off weirdly, the following message might "quote" the line breaks. Then, we have an issue and cause \r\n\n for the further processing within the CodeOcean backend.
2023-09-20 22:35:26 +02:00
b5cb5c16dd Buffer: Split only complete lines ending with \r\n
This change is required for Turtle output generated by the Python environment. Otherwise, drawing some images could add empty new lines (in the browser), since the original JSON message got split between the ending \r\n characters.
2023-09-20 22:33:59 +02:00
bcdc71021e Fix Rubocop offenses 2023-06-11 20:46:45 +02:00
8d8bf5ef29 Connection::Buffer: Fix bug for incomplete lines
* Introduce (temporary) conversion to CRLF-line endings before processing and splitting the output
* (Partially) revert previous changes
2022-04-25 17:53:08 +02:00
902d09b3fa Connection::Buffer: Allow additional, single new lines for AWS 2022-04-24 19:34:53 +02:00
591d520e26 Connection::Buffer: Improve performance for deleting \r suffix 2022-04-24 19:00:02 +02:00
c5f0189859 Connection::Buffer: Remove duplicated new line character
"a\r".gsub(/\r?$/, "\n") ==> "a\n\n"
2022-04-24 18:57:33 +02:00
35454836c8 Allow \r\n and \n line breaks for Connection::Buffer
* Nomad sends CRLF-separated lines
* AWS sends LF-separated lines
2022-04-24 18:26:05 +02:00
18daa1c998 Enable image preview in STDOUT 2022-03-02 11:44:48 +01:00
e34656eb0f Modify buffer line breaking behavior
* This is based on Sentry issue CODEOCEAN-5W (linter translation failing due to \r in output)
* We cannot keep all "\r" messages but we must not forward the "\r" if it is a single message received after a valid JSON
2021-11-15 00:30:32 +01:00
7d032e5c0d Buffer: Prevent replacement of "\r" message 2021-11-08 23:33:37 +01:00
9a541998e4 Optimize RegEx 2021-11-06 02:15:03 +01:00
6ff14d6fc7 Connection Buffer: Replace \r in run and score output with \n 2021-11-01 17:13:14 +01:00
1891cdd69c Add check whether buffer is empty 2021-11-01 17:13:00 +01:00
a074a5cb0d Add buffering to output received from runner 2021-11-01 17:12:58 +01:00