I need to run PyLint to validate my Python files code when building. The python files are under .pyproj (I use Python tools for Visual Studio 2015). How I can do that?
Update:
So far I have code like this:
<Target Name="PythonRunPyLint">
<PropertyGroup>
<PyLintWarningRegex><![CDATA[^(?<filename>.+?)\((?<line>\d+),(?<column>\d+)\): warning (?<msg_id>.+?): (?<message>.+?)$]]></PyLintWarningRegex>
</PropertyGroup>
<RunPythonCommand Target="pylint.lint"
TargetType="module"
Arguments=""--msg-template={abspath}({line},{column}): warning {msg_id}: {msg} [{C}:{symbol}]" -r n @(Compile, ' ')"
ExecuteIn="console"
WorkingDirectory="$(MSBuildProjectDirectory)"
WarningRegex="$(PyLintWarningRegex)"
RequiredPackages="pylint>=1.0.0">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputText" />
<Output TaskParameter="ConsoleError" PropertyName="ErrorText" />
</RunPythonCommand>
</Target>
But when I run msbuild I get output and there's 0 warnings, why regex does not parse warnings (regex is taken from Microsoft.PythonTools.targets and it works when doing Tools > Run PyLint in Visual studio)?
C:\>msbuild TestPylint.pyproj /t:Build
Microsoft (R) Build Engine version 14.0.23107.0
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 15/10/2015 20:10:26.
Project "C:\TestPylint.pyproj" on node 1 (Build target(s)).
PythonRunPyLint:
************* Module TestPylint
C:\TestPylint.py(2,0): warning C0304: Final newline missing [C:missing-final-newline]
C:\TestPylint.py(1,0): warning C0111: Missing module docstring [C:missing-docstring]
No config file found, using default configuration
Done Building Project "C:\TestPylint.pyproj" (Build target(s)) -- FAILED.
Build FAILED.
0 Warning(s)
0 Error(s)