OpCore-Simplify icon indicating copy to clipboard operation
OpCore-Simplify copied to clipboard

added a python linter `Ruff`

Open rubentalstra opened this issue 1 month ago • 0 comments

This pull request introduces a number of improvements to the project, including the addition of code quality tooling, development environment configuration files, and several code cleanups and minor refactorings in OpCore-Simplify.py. The main themes are: improved code formatting and consistency, enhanced error handling, and better development tooling support.

Key changes:

Development Tooling and Configuration

  • Added a GitHub Actions workflow (.github/workflows/ruff.yaml) to run Ruff for linting Python code on every push and pull request.
  • Added VSCode settings (.vscode/settings.json) to enable automatic formatting and import organization using Ruff for Python files.
  • Added and updated various IDE configuration files for PyCharm/IntelliJ, including .gitignore for .idea, module, VCS, and migration state files, to standardize the development environment. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Code Formatting and Cleanup in OpCore-Simplify.py

  • Consolidated and reordered imports for clarity and PEP8 compliance, and switched to absolute imports where appropriate.
  • Improved string consistency by using single or double quotes as appropriate, and reformatted long lines for better readability. [1] [2] [3] [4] [5]
  • Replaced generic Exception with more specific FileNotFoundError in error handling when required files or directories are missing. [1] [2]
  • Improved robustness in patch and kext handling by checking for None before accessing indices, and clarified logic for enabling/disabling kexts.

Minor Logic and Robustness Improvements

  • Refactored some loops and variable names for clarity and to avoid shadowing built-ins (e.g., avoiding use of type as a variable). [1] [2] [3]
  • Improved exception handling when removing files by catching only relevant exceptions (OSError, IOError).
  • Minor logic tweaks to ensure compatibility suggestions avoid beta macOS versions, and to improve user prompts and validation. [1] [2]

These changes collectively improve code maintainability, developer experience, and robustness of the application.

rubentalstra avatar Nov 10 '25 17:11 rubentalstra