Skip to content

W391 reported but not fixed in Jupyter notebook #13763

@DimitriPapadopoulos

Description

@DimitriPapadopoulos

Ruff emits a W391 error, a spurious one as far as I can see, and --fix doesn't modify the file:

$ ruff check --isolated --no-cache --extend-select W --preview --fix file.ipynb
Found 1 error (1 fixed, 0 remaining).
$ 
$ ruff check --isolated --no-cache --extend-select W --preview --fix file.ipynb
Found 1 error (1 fixed, 0 remaining).
$ 

The issue is associated to this line in the Jupyter Notebook:

   "source": []
  • List of keywords you searched for before creating this issue: "W391"

  • A minimal code snippet that reproduces the bug.

    code snippet
    {
     "cells": [
      {
       "cell_type": "code",
       "execution_count": null,
       "metadata": {},
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": [
          "True\n"
         ]
        }
       ],
       "source": [
        "True"
       ]
      },
      {
       "cell_type": "code",
       "execution_count": null,
       "metadata": {},
       "outputs": [],
       "source": []
      }
     ],
     "metadata": {
      "kernelspec": {
       "display_name": "Python 3 (ipykernel)",
       "language": "python",
       "name": "python3"
      }
     },
     "nbformat": 4,
     "nbformat_minor": 2
    }
    
  • The command you invoked (e.g., ruff /path/to/file.py --fix), ideally including the --isolated flag.

     ruff check --isolated --no-cache --extend-select W --preview --fix file.ipynb
    
  • The current Ruff settings (any relevant sections from your pyproject.toml).

  • The current Ruff version (ruff --version).

    ruff 0.6.9
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnotebookRelated to (Jupyter) notebooks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions