koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
196 stars 9 forks source link

Fix random illegalargumentexception #274

Closed koxudaxi closed 11 months ago

koxudaxi commented 11 months ago

Summary

Ensured code consistency before and just before the execution of Ruff due to the possibility of alterations by other processes.

Details:

In this PR, modifications have been made to ensure the consistency of the code before and just before the execution of Ruff. Due to the time consumption caused by the launching of new processes during Ruff’s execution, there exists a possibility that other methods may have altered the structure of the virtual file object tree.

To prevent alterations to the code during processing, the code is now stored in memory as text. A check is also performed before code modifications to ensure no unexpected alterations by other processes.

Notes

Unable to reproduce the issue in the test. Believed to have resolved the fundamental problem.

Related Issues: https://github.com/koxudaxi/ruff-pycharm-plugin/issues/183

github-actions[bot] commented 11 months ago

Qodana Community for JVM

27 new problems were found

Inspection name Severity Problems
Unstable API Usage 🔶 Warning 16
Incorrect string capitalization 🔶 Warning 2
Constant conditions 🔶 Warning 1
Unused symbol 🔶 Warning 1
Class member can have 'private' visibility ◽️ Notice 3
Array property in data class ◽️ Notice 1
Const property naming convention ◽️ Notice 1
Package name does not match containing directory ◽️ Notice 1
Regular expression can be simplified ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report To be able to view the detailed Qodana report, you can either: 1. Register at [Qodana Cloud](https://qodana.cloud/) and [configure the action](https://github.com/jetbrains/qodana-action#qodana-cloud) 2. Use [GitHub Code Scanning with Qodana](https://github.com/jetbrains/qodana-action#github-code-scanning) 3. Host [Qodana report at GitHub Pages](https://github.com/JetBrains/qodana-action/blob/3a8e25f5caad8d8b01c1435f1ef7b19fe8b039a0/README.md#github-pages) 4. Inspect and use `qodana.sarif.json` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) To get `*.log` files or any other Qodana artifacts, run the action with `upload-result` option set to `true`, so that the action will upload the files as the job artifacts: ```yaml - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2023.2.6 with: upload-result: true ```
Contact Qodana team Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - Or via our issue tracker: https://jb.gg/qodana-issue - Or share your feedback: https://jb.gg/qodana-discussions