Skip to content

Use global settings for ignorePatterns default#325

Merged
karthiknadig merged 1 commit intomicrosoft:mainfrom
taesungh:fix/ignorePatterns
Oct 25, 2024
Merged

Use global settings for ignorePatterns default#325
karthiknadig merged 1 commit intomicrosoft:mainfrom
taesungh:fix/ignorePatterns

Conversation

@taesungh
Copy link
Copy Markdown
Contributor

@taesungh taesungh commented Oct 6, 2024

Equivalent change as microsoft/vscode-flake8#327, should fix #214.

Changes

  • Update _get_global_defaults to check GLOBAL_SETTINGS for default value of the ignorePatterns setting
  • Otherwise, user settings are not respected for non-workspace files

I'm not sure if there was any particular reason the settings were being ignored: I could not find any rationale in #179/#182 indicating such, so I am assuming this was an oversight.

Testing

  1. Add a pattern to be ignored to the user settings for mypy-type-checker.ignorePatterns, e.g. "*.py"
  2. Open a non-workspace file matching the pattern that has a linting issue
  3. Observe the file is properly ignored
    • Extension output should say "Skipping file due to mypy-type-checker.ignorePatterns match"

- Update `_get_global_defaults` to check `GLOBAL_SETTINGS` for default
  value of the `ignorePatterns` setting
- Otherwise, user settings are not respected for non-workspace files
@karthiknadig karthiknadig self-assigned this Oct 7, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Oct 7, 2024
@vs-code-engineering vs-code-engineering bot added this to the October 2024 milestone Oct 7, 2024
@karthiknadig karthiknadig enabled auto-merge (squash) October 8, 2024 00:30
@rzhao271 rzhao271 modified the milestones: October 2024, November 2024 Oct 25, 2024
@karthiknadig karthiknadig merged commit 9d7f45d into microsoft:main Oct 25, 2024
edvilme added a commit that referenced this pull request Apr 1, 2026
…rns and daemonStatusFile (refs #496, relates to #325, #347)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edvilme added a commit that referenced this pull request Apr 7, 2026
* test: add coverage for nearestConfig with .mypy.ini, pyproject.toml, setup.cfg (refs #496, relates to #357)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: add coverage for global settings defaults including ignorePatterns and daemonStatusFile (refs #496, relates to #325, #347)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: add coverage for daemonStatusFile in _get_dmypy_args (refs #496, relates to #347)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: add coverage for daemonStatusFile in TS settings and checkIfConfigurationChanged (refs #496, relates to #347)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: add coverage for PythonEnvironments.api() interpreter resolution (refs #496, relates to #467)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* style: fix prettier formatting in settings.unit.test.ts

* fix: address review comments - add missing mock attrs, try/finally cleanup

- Add normalize_path to mock_lsp_utils in test_global_defaults.py
- Add fallback guard ensuring normalize_path is set even if lsp_utils
  was mocked by another test file first
- Wrap dmypy status file test bodies in try/finally so _clear_dmypy_cache()
  runs even when assertions fail

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: address review comments — unused imports, assertion, const

- Remove unused imports (PythonEnvironmentApi, commands, Disposable, Event)
- Add explicit envsApiStub.calledOnce assertion in fallback test
- Change let workspace1 to const (2 occurrences)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy is not ignoring items specified in mypy-type-checker.ignorePatterns

3 participants