Skip to content

fix: improve vulture scope#154

Merged
mfussenegger merged 2 commits intomfussenegger:masterfrom
mflova:fix/improve-vulture-scope
Jan 5, 2022
Merged

fix: improve vulture scope#154
mfussenegger merged 2 commits intomfussenegger:masterfrom
mflova:fix/improve-vulture-scope

Conversation

@mflova
Copy link
Contributor

@mflova mflova commented Jan 4, 2022

The idea of this PR is to improve the scope of Vulture (dead code and unused variables analyzer). By default, the filename is passed as argument, which prevents the linter to analyze the full context of an entire repository. This leads to lots of false positives. The current implementation uses as input argument the git root directory if exists or the current dir otherwise. Tested both of them and works fine.

Fixes #153

@mflova mflova force-pushed the fix/improve-vulture-scope branch 2 times, most recently from 8de592f to 4d572a4 Compare January 4, 2022 22:48
@mflova
Copy link
Contributor Author

mflova commented Jan 4, 2022

To be honest I do not really understand how is this issue in the tests related to this PR. In my PC is failing nvim-lint/tests/compiler_spec.lua, while here two random and compeltely different linters are failing the test. I even checkout previous commits from my PR that were OK and now they are also failing locally.

@mfussenegger mfussenegger force-pushed the fix/improve-vulture-scope branch from 4d572a4 to fd2c5a3 Compare January 5, 2022 16:51
stdin = false,
args = {},
args = {"--exclude='/**/docs/*.py,/**/build/*.py'", function()
local output = vim.fn.system("git rev-parse --show-toplevel"):sub(1, -2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the :sub(1, -2) ?

Copy link
Contributor Author

@mflova mflova Jan 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the command retrieves a string with a special character at the end. This character, when used as input argument to vulture, ended up in the linter not properly working (basically there were no diagnostics). I verified that the current resulting string is the correct one by 1) comparing it (temporary if statement) with a hardcoded string of the expected path and 2) observing the same diagnostics were produced in the Vulture CLI and in Neovim

@mfussenegger
Copy link
Owner

To be honest I do not really understand how is this issue in the tests related to this PR

The failures were realted to upstream changes in neovim itself, see #155
The tests currently run against neovim nightlies.

Suggestions from the PR

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
@mfussenegger mfussenegger merged commit 3a5a20d into mfussenegger:master Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linters that operate at directory or repository level

3 participants