astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
1.09k stars 53 forks source link

Light bulb (code action) appears on most lines #80

Closed xshapira closed 1 year ago

xshapira commented 1 year ago

Ruff reports fixable errors with Ruff: Fix All.

I can't tell under what situations this occurs but I see this constantly:

https://user-images.githubusercontent.com/48856190/209337112-49cfe406-3035-43ad-b349-c39b8b08b004.mp4

charliermarsh commented 1 year ago

Will take a look at this today hopefully.

charliermarsh commented 1 year ago

Would you mind posting your settings.json and pyproject.toml (if any)?

xshapira commented 1 year ago

settings.json

{
  "editor.fontSize": 15,
  "editor.lineHeight": 26,
  "editor.fontFamily": "FiraCode-Retina, Fira Code Retina, Fira Code, Consolas Ligaturized, Menlo, Monaco, 'Courier New', monospace",
  "editor.colorDecorators": false,
  "editor.codeActionsOnSaveTimeout": 2000,
  "editor.formatOnSaveTimeout": 2000,
  "editor.dragAndDrop": false,
  "editor.wordWrap": "wordWrapColumn",
  "editor.wrappingIndent": "same",
  "editor.wordWrapColumn": 80,
  "editor.maxTokenizationLineLength": 20000,
  "editor.smoothScrolling": true,
  "editor.multiCursorModifier": "alt",
  "editor.tabSize": 2,
  "editor.suggest.snippetsPreventQuickSuggestions": false,
  "editor.tabCompletion": "onlySnippets",
  "editor.wordBasedSuggestions": false,
  "editor.quickSuggestions": {
    "strings": true
  },
  "editor.acceptSuggestionOnCommitCharacter": false,
  "editor.suggestOnTriggerCharacters": true,
  "files.insertFinalNewline": true,
  "files.trimTrailingWhitespace": true,
  "editor.snippetSuggestions": "inline",
  "editor.selectionHighlight": false,
  "search.exclude": {
    "**/vendor": true,
    "**/storage/app": true,
    "**/storage/framework": true,
    "**/node_modules": true,
    "**/.venv": true,
    "**/dist/**": true,
    "**/tmp/**": true,
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true
  },
  "files.exclude": {
    "**/__pycache__": true,
    "**/.mypy_cache": true,
    "**/.pytest_cache": true,
    "**/.ruff_cache": true,
    "**/.DS_Store": true,
    "**/.ignored": true,
    "**/.git/objects/**": true
  },
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/tmp/**": true,
    "**/dist/**": true
  },
  "emmet.includeLanguages": {
    "blade": "html",
    "javascript ": "javascriptreact ",
    "django-html": "html",
    "html": "html",
    "postcss": "css"
  },
  "emmet.triggerExpansionOnTab": true,
  "aceJump.finder.onlyInitialLetter": false,
  "editor.formatOnPaste": true,
  "editor.cursorStyle": "line",
  "window.openFilesInNewWindow": "on",
  "workbench.editor.enablePreviewFromQuickOpen": false,
  "explorer.openEditors.visible": 0,
  "editor.fontLigatures": true,
  "workbench.settings.editor": "json",
  "workbench.settings.useSplitJSON": true,
  // Cursor Setup.
  "editor.cursorBlinking": "solid",
  "editor.cursorWidth": 4,
  // Hide UI Junk.
  "workbench.startupEditor": "none",
  "explorer.confirmDragAndDrop": false,
  "editor.quickSuggestionsDelay": 0,
  "terminal.integrated.macOptionIsMeta": true,
  // White space Commando Setup
  "editor.renderWhitespace": "none",
  "files.trimFinalNewlines": true,
  "diffEditor.ignoreTrimWhitespace": false,
  // Macros
  "macros": {
    "collapseAndClose": [
      "workbench.files.action.collapseExplorerFolders",
      "workbench.action.closeAllEditors"
    ]
  },
  // GIT ——————————————————
  "git.autofetch": true,
  "git.enableSmartCommit": true,
  "gitlens.currentLine.enabled": false,
  "gitlens.hovers.enabled": false,
  "gitlens.keymap": "alternate",
  "gitlens.advanced.messages": {
    "suppressGitDisabledWarning": true,
    "suppressShowKeyBindingsNotice": true
  },
  "emmet.showExpandedAbbreviation": "always",
  "editor.formatOnSave": true,
  // UI Improvement
  "window.title": "${rootName}",
  "window.restoreFullscreen": true,
  "workbench.editor.tabCloseButton": "off",
  "workbench.panel.defaultLocation": "bottom",
  "terminal.integrated.drawBoldTextInBrightColors": false,
  "gulp.autoDetect": "off",
  "grunt.autoDetect": "off",
  "breadcrumbs.enabled": false,
  // Pug
  "puglint.enable": true,
  "puglint.run": "onSave",
  // MARKDOWN
  "files.defaultLanguage": "markdown",
  "cSpell.language": "en, he",
  "cSpell.enabled": true,
  // EsLint
  "eslint.format.enable": true,
  "eslint.lintTask.enable": true,
  "eslint.alwaysShowStatus": false,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "html",
    "typescriptreact",
    "vue",
    "svelte"
  ],
  "eslint.codeAction.showDocumentation": {
    "enable": false
  },
  "eslint.workingDirectories": [
    {
      "mode": "auto"
    }
  ],
  // Prettier
  "prettier.printWidth": 80,
  "prettier.singleQuote": true,
  "prettier.trailingComma": "none",
  "prettier.tabWidth": 2,
  "prettier.bracketSpacing": true,
  "prettier.semi": true,
  "prettier.prettierPath": "/usr/local/lib/node_modules/prettier",
  "emptyIndent.removeIndent": true,
  "emptyIndent.highlightIndent": false,
  "emptyIndent.highlightColor": "rgba(246,36,89,0.6)",
  "emptyIndent.exclude": [".md"],
  "editor.trimAutoWhitespace": true,
  "php.validate.executablePath": "/usr/bin/php",
  "hungryDelete.enableSmartBackspace": false,
  "editor.suggestSelection": "first",
  "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  "code-runner.runInTerminal": true,
  "code-runner.showExecutionMessage": true,
  "terminal.integrated.rendererType": "dom",
  "explorer.confirmDelete": false,
  "html.suggest.html5": true,
  "css.validate": false,
  "less.validate": false,
  // Scss
  "scss.showErrors": true,
  "scss.scanImportedFilesDepth": 500,
  "scss.scannerDepth": 100,
  "scss.validate": false,
  "terminal.integrated.shell.osx": "/bin/zsh",
  "terminal.integrated.fontFamily": "MesloLGS NF",
  "terminal.integrated.fontSize": 14,
  "editor.formatOnType": true,
  "codemetrics.basics.CodeLensEnabled": false,
  "editor.detectIndentation": false,
  "editor.insertSpaces": true, // This one forces the tab to be **space**
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  //
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[vue-html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    // "editor.defaultFormatter": "vscode.json-language-features"
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[sql]": {
    "editor.defaultFormatter": "ms-mssql.mssql"
  },
  "[markdown]": {
    "editor.defaultFormatter": "mervin.markdown-formatter",
    "editor.codeActionsOnSave": {
      "source.fixAll.markdownlint": true
    },
    "editor.quickSuggestions": {
      "other": true,
      "comments": true,
      "strings": true
    },
    "markdown.preview.scrollEditorWithPreview": false
  },
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer",
    "editor.tabSize": 4
  },
  "[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.formatOnPaste": false,
    "editor.tabSize": 4,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true,
      "source.fixAll": true,
      "source.fixAll.unusedImports": false
    }
  },
  // Python
  "python.defaultInterpreterPath": "/Users/maxshapira/.pyenv/versions/3.11.0/bin/python",
  "python.pythonPath": "/Users/maxshapira/.pyenv/versions/3.11.0/bin/python",
  "python.linting.mypyEnabled": true,
  "python.linting.pylintEnabled": false,
  "python.linting.enabled": true,
  "python.formatting.provider": "black",
  "python.linting.pylintUseMinimalCheckers": false,
  "python.linting.flake8Args": ["--max-line-length=88"],
  "python.linting.pylintArgs": ["--load-plugins=pylint_django"],
  "isort.path": "/usr/local/bin/isort",
  "isort.args": ["--profile", "black"],
  "python.testing.pytestEnabled": true,
  "python.languageServer": "Pylance",
  "python.experiments.optInto": ["pythonDiscoveryModuleWithoutWatcher"],
  "code-runner.executorMap": {
    "python": "python3",
    "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt"
  },
  "python.analysis.disabled": ["unresolved-import"],
  "python.analysis.useImportHeuristic": true,
  "python.analysis.typeCheckingMode": "off",
  "codesnap.transparentBackground": true,
  "workbench.iconTheme": "material-icon-theme",
  // Django-tempaltes
  "files.associations": {
    "**/templates/*.html": "django-html",
    "**/templates/**/*.html": "django-html",
    "**/requirements{/**,*}.{txt,in}": "pip-requirements",
    "*.vue": "html",
    "/**/*.env*": "env",
    "*.env*": "env"
  },
  "[html]": {
    "editor.defaultFormatter": "monosans.djlint"
  },
  "[jinja]": {
    "editor.defaultFormatter": "monosans.djlint"
  },
  "[jinja-html]": {
    "editor.defaultFormatter": "monosans.djlint"
  },
  "[django-html]": {
    "editor.formatOnSave": true,
    "editor.tabSize": 2,
    "editor.defaultFormatter": "monosans.djlint"
  },
  "[dart]": {
    "editor.defaultFormatter": "Dart-Code.dart-code",
    "editor.tabSize": 2
  },
  "[svelte]": {
    "editor.defaultFormatter": "svelte.svelte-vscode",
    "svelte.enable-ts-plugin": true
  },
  "[dockerfile]": {
    "editor.defaultFormatter": "ms-azuretools.vscode-docker"
  },
  "[yaml]": {
    "editor.defaultFormatter": "redhat.vscode-yaml"
  },
  "DockerRun.DisableAutoGenerateConfig": true,
  "todo-tree.tree.showScanModeButton": false,
  "todo-tree.highlights.customHighlight": {
    "TODO": {
      "icon": "check",
      "foreground": "white",
      "background": "#673BA7"
    },
    "BUG": {
      "icon": "bug",
      "foreground": "#1F1718",
      "background": "#F1C105"
    },
    "FIXME": {
      "icon": "alert",
      "foreground": "white",
      "background": "#F61F4B",
      "opacity": 80
    }
  },
  "todo-tree.regex.regexCaseSensitive": true,
  "todo-tree.general.tagGroups": {
    "FIXME": ["FIXME", "FIXIT"]
  },
  "todo-tree.general.tags": [
    "BUG",
    "HACK",
    "FIXME",
    "FIXIT",
    "TODO",
    "XXX",
    "[ ]",
    "[x]"
  ],
  "todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",
  "dart.devToolsBrowser": "default",
  "json.maxItemsComputed": 7000,
  "jupyter.sendSelectionToInteractiveWindow": true,
  "jupyter.interactiveWindowMode": "perFile",
  "liveServer.settings.donotShowInfoMsg": true,
  "typescript.validate.enable": false,
  "typescript.format.enable": false,
  // Disable all built-in syntax checking. If you do this, use a linter like ESLint to validate your code
  "javascript.validate.enable": false,
  "workbench.editorAssociations": {
    "*.ipynb": "jupyter-notebook",
    "*.sqlite3": "sqlite-viewer.view"
  },
  "redhat.telemetry.enabled": false,
  "notebook.cellToolbarLocation": {
    "default": "right",
    "jupyter-notebook": "left"
  },
  "eslint.trace.server": "verbose",
  "browserSync.config": {
    // "browser": "Firefox Developer Edition",
    "port": 3001
  },
  "tailwindCSS.includeLanguages": {
    "plaintext": "django-html",
    "django-html": "html"
  },
  "tailwindCSS.emmetCompletions": true,
  "tailwindCSS.lint.cssConflict": "warning",
  "tailwindCSS.validate": true,
  "stylelint.validate": ["css", "html", "scss"],
  "explorer.compactFolders": false,
  "tabnine.experimentalAutoImports": true,
  "tabnine.requestTimeout": 50,
  "extensions.ignoreRecommendations": true,
  "explorer.autoReveal": false,
  "editor.hover.delay": 1000,
  "workbench.tree.indent": 10,
  "editor.hideCursorInOverviewRuler": true,
  "workbench.colorTheme": "Bear Theme",
  // Hide OverviewRuler clutter
  "editor.overviewRulerBorder": false,
  "codemetrics.basics.OverviewRulerModeEnabled": false,
  "color-highlight.markRuler": false,
  "highlight-matching-tag.showRuler": false,
  "scm.diffDecorations": "none",
  "scm.diffDecorationsGutterAction": "none",
  "commentAnchors.tags.displayInRuler": false,
  "bracket-pair-colorizer-2.depreciation-notice": false,
  "editor.guides.indentation": true,
  "chronicler.recording-defaults.countdown": 3,
  "stylelint.enable": true,
  "npm.validate.enable": false,
  "tailwindCSS.lint.enable": true,
  "editor.inlineSuggest.enabled": false,
  "terminal.integrated.defaultProfile.osx": "zsh",
  "code-runner.ignoreSelection": true,
  "git.confirmSync": false,
  "editor.minimap.enabled": false,
  "errorLens.onSave": true,
  "terminal.integrated.smoothScrolling": true,
  "terminal.integrated.shellIntegration.decorationsEnabled": "never",
  // colorizing matching brackets
  "editor.bracketPairColorization.enabled": true,
  "terminal.integrated.gpuAcceleration": "on",
  "svelte.enable-ts-plugin": true,
  "svelte.plugin.svelte.note-new-transformation": false,
  "debug.toolBarLocation": "hidden",
  "debug.showInStatusBar": "never",
  // disable pop-up parameter documentation as you type
  "editor.parameterHints.enabled": false,
  "vsicons.dontShowNewVersionMessage": true,
  // speed up the loading time of vscode
  "workbench.editor.restoreViewState": false,
  "files.restoreUndoStack": false,
  "workbench.layoutControl.enabled": false,
  "editor.accessibilitySupport": "off",
  "settingsSync.keybindingsPerPlatform": false,
  "search.followSymlinks": false
}

settings.json (with Python-only related settings):

{
"[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.formatOnPaste": false,
    "editor.tabSize": 4,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true,
      "source.fixAll": true,
      "source.fixAll.unusedImports": false
    }
  },
  // Python
  "python.defaultInterpreterPath": "/Users/maxshapira/.pyenv/versions/3.11.0/bin/python",
  "python.pythonPath": "/Users/maxshapira/.pyenv/versions/3.11.0/bin/python",
  "python.linting.mypyEnabled": true,
  "python.linting.pylintEnabled": false,
  "python.linting.enabled": true,
  "python.formatting.provider": "black",
  "python.linting.pylintUseMinimalCheckers": false,
  "python.linting.flake8Args": ["--max-line-length=88"],
  "python.linting.pylintArgs": ["--load-plugins=pylint_django"],
  "isort.path": "/usr/local/bin/isort",
  "isort.args": ["--profile", "black"],
  "python.testing.pytestEnabled": true,
  "python.languageServer": "Pylance",
  "python.experiments.optInto": ["pythonDiscoveryModuleWithoutWatcher"],
  "code-runner.executorMap": {
    "python": "python3",
    "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt"
  },
  "python.analysis.disabled": ["unresolved-import"],
  "python.analysis.useImportHeuristic": true,
  "python.analysis.typeCheckingMode": "off",
}

pyproject.toml

[tool.poetry]
name = "app"
version = "0.1.0"
description = ""
authors = ["Admin <admin@example.com>"]

[tool.poetry.dependencies]
python = "^3.11"
PyYAML = "^6.0"
requests = "^2.28.1"
jupyter = "^1.0.0"
qrcode = {extras = ["pil"], version = "^7.3.1"}
aiosqlite = "^0.17.0"
pytz = "^2022.4"
pendulum = "^2.1.2"
httpx = "^0.23.0"
pyannotate = "^1.2.0"
pytest = "^7.2.0"
numpy = "^1.23.5"

[tool.poetry.group.dev.dependencies]
black = "^22.6.0"
isort = "^5.10.1"
mypy = "^0.981"
ipykernel = "^6.16.0"
pylint = "^2.15.4"
pandas = "^1.5.1"
ruff = "^0.0.192"

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
line_length = 88
profile = "black"

[tool.ruff]
exclude = [
    '.git',
    '__pycache__',
    '__init__.py',
    '.mypy_cache',
    '.pytest_cache',
]
ignore = [
    "E501",  # line too long, handled by black
    "B008",  # do not perform function calls in argument defaults
    "C901",  # too complex
    "F401"   # imported but unused
]
line-length = 88
select = [
    'E',
    'F',
    'W',
]

[tool.mypy]
follow_imports = "silent"
ignore_missing_imports = true
implicit_reexport = false
strict_optional = true
show_error_codes = true

# Ensure full coverage
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
check_untyped_defs = true
strict_equality = true

# Restrict dynamic typing
disallow_any_generics = true
disallow_subclassing_any = true
warn_return_any = true

# Know exactly what you're doing
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
warn_unreachable = true

# Explicit is better than implicit
no_implicit_optional = true

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
xshapira commented 1 year ago

Switching to the pre-release version temporarily fixed the issue.

charliermarsh commented 1 year ago

Ah ok, cool. Sorry I wasn't able to get to this yet. I can cut a new release tonight probably.