Hi @InSyncWithFoo,
The command only works when no part of the file is selected.
If any fragment or even the whole file is selected, it doesn’t work.
At first, I thought this only affected import optimizations, but it actually applies to formatting in general, including imports.
This is the log in console log ruff, in idea.log nothing of ruff.
Ruff commands and their outputs will be logged here, when not text selected, with selected nothing show.
Ruff commands and their outputs will be logged here.
Running: (/opt/sources/odoo180) /usr/local/bin/ruff check --fix --fix-only --exit-zero --quiet - --select I,F401 --stdin-filename /opt/sources/odoo180/src/account-analytic/account_analytic_distribution_manual/models/account_analytic_distribution_manual.py --config /opt/sources/dev-tools/helpers/17_18.ruff.toml
Output: {"stdout":"from odoo import fields, models\n\n\nclass AccountAnalyticDistributionManual(models.Model):\n _name = "account.analytic.distribution.manual"\n _inherit = "analytic.mixin"\n _description = "Account analytic distribution manual"\n\n name = fields.Char(required=True)\n active = fields.Boolean(default=True)\n company_id = fields.Many2one(\n "res.company", required=True, default=lambda self: self.env.company\n )\n\n sql_constraints = [\n (\n "unique_name_by_company",\n "unique(name, company_id)",\n "The name must be unique per Company!",\n ),\n ]\n\n def copy_data(self, default=None):\n default = dict(default or {})\n vals_list = super().copy_data(default)\n if "name" not in default:\n for record, vals in zip(self, vals_list, strict=False):\n vals["name"] = self.env.("%s (Copy)", record.name)\n return vals_list\n","stderr":"","exitCode":0,"isTimeout":false,"isCancelled":false}
Running: (/opt/sources/odoo180) /usr/local/bin/ruff check --no-fix --exit-zero --quiet - --output-format json --stdin-filename /opt/sources/odoo180/src/account-analytic/account_analytic_distribution_manual/models/account_analytic_distribution_manual.py --config /opt/sources/dev-tools/helpers/17_18.ruff.toml
Output: {"stdout":"[\n {\n "cell": null,\n "code": "ANN201",\n "end_location": {\n "column": 18,\n "row": 23\n },\n "filename": "/opt/sources/odoo180/src/account-analytic/account_analytic_distribution_manual/models/account_analytic_distribution_manual.py",\n "fix": null,\n "location": {\n "column": 9,\n "row": 23\n },\n "message": "Missing return type annotation for public function copy_data",\n "noqa_row": 23,\n "url": "https://docs.astral.sh/ruff/rules/missing-return-type-undocumented-public-function"\n },\n {\n "cell": null,\n "code": "ANN001",\n "end_location": {\n "column": 32,\n "row": 23\n },\n "filename": "/opt/sources/odoo180/src/account-analytic/account_analytic_distribution_manual/models/account_analytic_distribution_manual.py",\n "fix": null,\n "location": {\n "column": 25,\n "row": 23\n },\n "message": "Missing type annotation for function argument default",\n "noqa_row": 23,\n "url": "https://docs.astral.sh/ruff/rules/missing-type-function-argument"\n }\n]","stderr":"","exitCode":0,"isTimeout":false,"isCancelled":false}
Originally posted by @igallart in #78: