Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question/Idea: Lint full directory/project #82

Closed
DonJayamanne opened this issue Nov 13, 2017 · 12 comments · Fixed by #1231
Closed

Question/Idea: Lint full directory/project #82

DonJayamanne opened this issue Nov 13, 2017 · 12 comments · Fixed by #1231
Labels
area-linting feature-request Request for new features or functionality

Comments

@DonJayamanne
Copy link

From @mdalpi on February 1, 2017 20:9

Hi.

There's any way to lint the whole project directory instead of only open files (and the errors will be displayed accordingly, error by file in problems view)?

I think it'll be great to have this with Flake8 at least (maybe PyLint is a little slow to lint the whole project after every save).

Thanks 😄

Copied from original issue: DonJayamanne/pythonVSCode#694

@DonJayamanne
Copy link
Author

From @robomojo on February 12, 2017 12:5

I have been searching for the same thing and it seems to be a missing vscode feature.
microsoft/vscode-eslint#91
microsoft/vscode#13953
Currently the method of doing this with pylint is just to use the terminal pylint . -E, but it would be nice if that output fed directly into the problems panel so I could click through to the errors.

@DonJayamanne
Copy link
Author

Ability to run as a task and report problems. (contribute problem matchers)

@brettcannon
Copy link
Member

@MikhailArkhipov as part of your linting work, could you see what it would take to add some "Lint workspace" command? E.g. would every linter need a custom setting because they all have a custom way to do recursion?

@MikhailArkhipov
Copy link

PTVS engine does this

@sbmelvin
Copy link

sbmelvin commented May 1, 2018

Is there a way to enable full project linting in the current or development releases of the vscode-python extension?

@brettcannon
Copy link
Member

brettcannon commented May 2, 2018

@sbmelvin no, not at the moment. If someone wanted to contribute code to do it we would be happy to review the PR.

@brettcannon brettcannon reopened this May 2, 2018
@brettcannon brettcannon removed this from the April 2018 milestone May 2, 2018
@konstantint
Copy link

konstantint commented May 19, 2018

I'm using this task definition. It is far from perfect, but kind-of gets the job done.
For example, the problem list gets emptied and re-populated when you click on a line to open the file. This can be fixed by setting owner="pylint", but then you get every problem listed twice - once from the "official" pylint and once from this task. Also the message categories are parsed incorrectly ("convention" is interpreted as "critical").

Note that you need to adapt this to your project (set the correct path to pylint and the name of the root package (instead of myproject tests) in the two command records).

{
	"label": "pylint: whole project",
	"type": "shell",
	"command": "venv/Scripts/pylint --msg-template \"{path}:{line}:{column}:{category}:{symbol} - {msg}\" myproject tests",
	"windows": {
		"command": ".\\venv\\Scripts\\pylint.exe --msg-template \"{path}:{line}:{column}:{category}:{symbol} - {msg}\" myproject tests"
	},
	"presentation": {
		"reveal": "never",
		"panel": "shared"
	},
	"problemMatcher": {
		"owner": "python",
		"fileLocation": ["relative", "${workspaceFolder}"],
		"pattern": {
			"regexp": "^(.+):(\\d+):(\\d+):(\\w+):(.*)$",
			"file": 1,
			"line": 2,
			"column": 3,
			"severity": 4,
			"message": 5
		}
	}
},

@sbmelvin
Copy link

I noticed this was marked done, does that mean there's a way to enable full project linting in the current or development releases of the vscode-python extension?

@brettcannon
Copy link
Member

@sbmelvin this is not marked as done.

@MikhailArkhipov MikhailArkhipov added this to the June 2018 milestone May 28, 2018
@brettcannon brettcannon removed this from the June 2018 milestone Jun 4, 2018
@MikhailArkhipov
Copy link

@sbmelvin - this is implemented in Microsoft Python Language server which is in experimental state. You can try it by setting python.jediEnabled: false and reloading VSC. LS will be downloaded as needed for the target OS.

@sbmelvin
Copy link

@MikhailArkhipov I'll give that a try. Do I need to use the development release for this?

@MikhailArkhipov
Copy link

@sbmelvin, no, works in regular.

@MikhailArkhipov MikhailArkhipov removed their assignment Jul 10, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-linting feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants