Package: pydelinter
pydelinterPydelinter automatically generates unified-diffs of python source code that violate certain class of Pylint warnings.  You can run this tool on your source code, inspect the diffs and apply the diffs as patches.Installationpip install pydelinterUsage$delint-h
usage:delint[-h][--msg_idMSG_ID][--version][-v][-vv]file_path_or_folder

Commandlinetoolfordelintingcertainpylintmessages

positionalarguments:file_path_or_folderPathtoa.pyfileorfoldercontain*.pyfiles.Thisrelativepathwillbeusedtogeneratetheunifieddifffiles.

optionalarguments:-h,--helpshowthishelpmessageandexit--msg_idMSG_IDThepylintmessagethatwillbedelinterd.EgW0611--versionshowprogram'sversionnumberandexit-v,--verbosesetlogleveltoINFO-vv,--very-verbosesetlogleveltoDEBUG

Examples:Runningthebelowexampleswillgenerateanunified-difffilethatcanbeusedasapatchtoapplythechangestogitorMercurial.delinter/main.py--msgW0611foo/core.pyToprocessmultiplepythonfiles,provideafolderdelinter/main.py--msgW0611foo/Running,thiscommandonthetestfileavailablewiththisrepository:delinter/main.py--msgW0611delinter/test/input---a/delinter/test/input/test_unused_imports.py+++b/delinter/test/input/test_unused_imports.py@@-1,12+1,7@@-importunitest.mock.patch,unittest.mock.patchasp1importunitest.mock.patch,unittest.mock.patchasp2-importunittestast,unittestast2+importunittestast2importunitest.mock.patchasp-importos-importpandasaspd,numpyasnp-fromcollections.abcimportdefaultdict,OrderedDict-fromitertoolsimportfilterfalseas_filterfalse-fromcollections.abcimportx,y+fromcollections.abcimportyfromcollectionsimport*p2.mock()# use p2Status of pylint messages supportedMessage IdMessageStatusW0611unused-imports:heavy_check_mark:W0404reimported:heavy_check_mark:W0108unnecessary-lambdaW0107unnecessary-passE1111assignment-from-no-returnE0701bad-except-orderE0711not-implemented-raisedC0411wrong-import-orderC0412ungrouped-importsC0410multiple-importsW0611unused-variableW0613unused-argumentW0612unused-wildcard-importW0602global-variable-not-assignedR0102simplifiable-if-statementC0326bad-whitespaceC0304missing-final-newlineC0327multiple-statementsC0305trailing-newlineC0303trailing-whitespaceC0325superfluous-parens(more items will be added to this list after carefully reviewing all message groups supported by Pylint)Objectives of this toolThe tool will only support addressing one pytlint warning/error at a time. This is provided through themsg_idargument.Any warnings that might need complex formatting will not be supported. We leave that to more sophisticated tools likeBlack.CaveatsWhen dropping statements, preceeding newlines/comments attached to the statement will be removed.Given how pylint reports warnings, the tool might have to be run on the same code base more than once, after applying the previous patch. For example, an (reimported) error on a particular statement, precededs an (unused-import) error. Therefore, re-running the program will force this statement to be tagged by pylint as an unused-import.The diffs produces by this tool is only as good as how pylint reports warning/errors and howthe LibCST yields the CST. Therefore, manual review of the patches is always a good idea (along with a good test suite).AcknowledgementsThis project has been set up using PyScaffold 3.2.3. For details and usage
information on PyScaffold seehttps://pyscaffold.org/.This library primarily depends upon the LibCST [https://github.com/Instagram/LibCST] library.