Skip to content

Evaluate the use of Ruff for code formatting #1682

@Torxed

Description

@Torxed

In light of astral-sh/ruff#1904 (comment)
I'm intrigued to evaluate Ruff as a code formatter.

It looks like it could combat some of my quarrels with #997 (Linked with issue #872).

Specifically the sentences:

I wanted a tool that formats things consistently with a set of rules that I can explain in prose, and recognize in the output.

YAPF caused its results to be sometimes hard to understand. No configuration file we tried saved us from very suboptimal edge cases

I just wanted a tool that does one thing and does it well.

I ran a super default test and it doesn't appear to be very intrusive.
It can also be found in the WIP PR I opened: #1681

~/archinstall (eval-ruff)$ ruff check archinstall/*.py --fix
diff --git a/archinstall/__init__.py b/archinstall/__init__.py
index b22b466..b57b468 100644
--- a/archinstall/__init__.py
+++ b/archinstall/__init__.py
@@ -6,7 +6,6 @@ from .lib.disk import *
 from .lib.exceptions import *
 from .lib.general import *
 from .lib.hardware import *
-from .lib.installer import __packages__, Installer, accessibility_tools_in_use
 from .lib.locale_helpers import *
 from .lib.luks import *
 from .lib.mirrors import *
@@ -14,37 +13,14 @@ from .lib.models.network_configuration import NetworkConfigurationHandler
 from .lib.models.users import User
 from .lib.networking import *
 from .lib.output import *
-from .lib.models.dataclasses import (
-       VersionDef,
-       PackageSearchResult,
-       PackageSearch,
-       LocalPackage
-)
-from .lib.packages.packages import (
-       group_search,
-       package_search,
-       find_package,
-       find_packages,
-       installed_package,
-       validate_package_list,
-)
 from .lib.profiles import *
 from .lib.services import *
 from .lib.storage import *
 from .lib.systemd import *
 from .lib.user_interaction import *
-from .lib.menu import Menu
-from .lib.menu.list_manager import ListManager
-from .lib.menu.text_input import TextInput
-from .lib.menu.global_menu import GlobalMenu
-from .lib.menu.abstract_menu import (
-       Selector,
-       AbstractMenu
-)
 from .lib.translationhandler import TranslationHandler, DeferredTranslation
 from .lib.plugins import plugins, load_plugin # This initiates the plugin loading ceremony
 from .lib.configuration import *
-from .lib.udev import udevadm_info
 parser = ArgumentParser()

 __version__ = "2.5.3"
@@ -194,7 +170,6 @@ def load_config():
        """
        refine and set some arguments. Formerly at the scripts
        """
-       from .lib.models import NetworkConfiguration

        if (archinstall_lang := arguments.get('archinstall-language', None)) is not None:
                arguments['archinstall-language'] = TranslationHandler().get_language_by_name(archinstall_lang)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions