arcanist-linters A collection of custom Arcanist l开源项目

我要开发同款
匿名用户2021年11月23日
39阅读
开发技术Java
所属分类大数据、数据查询
授权协议Apache-2.0 License

作品详情

ArcanistLinters

ThisisacollectionofcustomArcanistlintersthatwe'vewrittenatPinterest.

ApacheThriftApacheThriftGeneratedBlackCheckstyleESLintFlake8FlawfinderGoVetGraphQLSchemaLinterOpenAPIValidatorPrettierPrettierESLintPylintPyrightPythonImportsPythonisortPythonRequirementsSpectralThriftCheck

Wealsowelcomeadditionalcontributions.

LintersApacheThrift

LintsforerrorsinApacheThriftIDL(schema)filesusingthethriftcompiler.

{"type":"thrift","include":"(\\.thrift$)","flags":["--allow-64bit-consts"],"version":">=0.9.0","thrift.generators":["py:dynamic,utf8strings,new_style,slots","java","go","erl"],"thrift.includes":[".","common"]}ApacheThriftGenerated

LintsfilesgeneratedbytheApacheThriftcompilertoensuretheyweregeneratedusingasupportedThriftcompiler.

{"type":"thrift-gen","include":"(^schemas/.*\\.py$)","thrift-gen.version":">=0.9.3"}

Note:CurrentlyonlygeneratedPythonfilesaresupported.

Black

UsestheBlackopinionatedcodeformattertonormalizetheformatofPythoncode.

{"type":"black","include":"(\\.py$)","flags":["-S","--line-length=132"]}Checkstyle

UsestheCheckstyletooltocheckJavacodeagainstacodingstandard.

{"type":"checkstyle","include":"(\\.java$)","checkstyle.config":"google_check.xml"}ESLint

LintsJavaScriptandJSXfilesusingESLint.

{"type":"eslint","include":"(\\.js$)","bin":"./node_modules/.bin/eslint","eslint.config":"~/my-eslint.json","eslint.env":"browser,node"}Flake8

LintsPythonsourcefilesusingFlake8.ThisisanextendedversionofthestockArcanistFlake8LinterthataddssupportforcheckingrequiredPythonandextensionversions.

{"type":"flake8ext","include":"(\\.py$)","flake8.python":"<3.0","flake8.extensions":{"assertive":"1.0.1","naming":"0.7.0"}}Flawfinder

LintsC/C++sourcefilesusingflawfinder.

{"type":"flawfinder","include":"(\\.(c|cc|cpp|h)$)"}GraphQLSchemaLinter

LintGraphQLSchemaDefinitionLanguage(SDL)usinggraphql-schema-linter.

{"type":"graphql-schema","include":"(\\.(graphql|gql)$)","graphql-schema.rules":["fields-have-descriptions","types-have-descriptions"],"graphql-schema.config":"config","graphql-schema.custom-rules":["config/custom-rules/*.js","vendor/extra-graphql-rules/*.js"],"graphql-schema.ignore":{"fields-have-descriptions":["Obvious","Query.obvious","Query.something.obvious"]},"graphql-schema.comment-descriptions":false,"graphql-schema.old-implements-syntax":false}GoVet

UsestheGovetcommandtolintforsuspiciouscodeconstructs.

{"type":"govet","include":"(^src/example.com/.*\\.go$)"}OpenAPIValidator

LintOpenAPIspecificationsusingopenapi-validator.

(Supportsopenapi-validatorversion0.36.0andlater.)

{"type":"openapi-spec","version":">=0.36.0","openapi-spec.config":".validaterc","openapi-spec.debug":false,"openapi-spec.errors_only":true,"include":["(\\.yaml$)"]}Prettier

FormatsJavaScriptusingPrettier.

{"type":"prettier","include":"(\\.js$)","bin":"./node_modules/.bin/prettier","prettier.cwd":"./"}PrettierESLint

FormatsJavaScriptusingPrettierandthenfixeswithESLint.

{"type":"prettier-eslint","include":"(\\.js$)","bin":"./node_modules/.bin/prettier-eslint","prettier-eslint.cwd":"./"}PythonImports

LintsforillegalPythonmoduleimports.

{"type":"python-imports","python-imports.pattern":"(mock)","include":"(\\.py$)","exclude":"(^tests/)"}Pythonisort

LintsPythonimportsusingisort.

{"type":"isort","include":"(\\.py$)"}Pylint

LintsPythonusingpylint.UnlikethemodulethatshipswithArcanist,thisimplementationworkswithrecentreleasesofPylintandalsosupportsvirtualenvironments.

{"type":"pinterest-pylint","include":"(\\.py$)"}Pyright

Type-checksPythoncodeusingPyright.

{"type":"pyright","include":"(\\.py$)"}PythonRequirements

EnsuresPythonpackagerequirementsinrequirements.txtfilesaresorted,unique,andpinnedtoexactversions.

{"type":"requirements-txt","include":"(requirements.txt$)"}

Individualrequirementlinescanbeexcludedbyaddinga#noqacomment:

six>=1.10.0#noqa:allowanyrecentversionofsixSpectral

LintsOpenAPIdocumentsusingSpectral.

{"type":"spectral","include":"(openapi.yaml)","spectral.ruleset":".spectral.yml",}ThriftCheck

LintsThriftIDLfilesusingThriftCheck.

{"type":"thriftcheck","include":"(\\.thrift$)","thriftcheck.config":".thriftcheck.toml","thriftcheck.includes":[".","common"]}Installation

Inshort,you'llneedtoaddthisrepositorytoyourlocalmachineandtellArcanisttoloadtheextension.Youeithercandothisgloballyoronaper-projectbasis.

Onceinstalled,theindividuallinterscanbeenabledandconfiguredviatheproject's.arclintfile.SeetheArcanistLintUserGuidefordetails.

GlobalInstallation

Arcanistcanloadmodulesfromanabsolutepath,butbecauseitalsosearchesformodulesonelevelupfromitselfonthefilesystem,it'sconvenienttoclonethisrepositoryatthesamelevelasarcanistandlibphutil.

$gitclonehttps://github.com/pinterest/arcanist-linters.gitpinterest-linters$lsarcanistpinterest-linterslibphutil

Then,tellArcanisttoloadthemodulebyediting~/.arcconfig(or/etc/arcconfig):

{"load":["pinterest-linters"]}ProjectInstallation

Youcanalsoloadarcanist-lintersonaper-projectbasis.Inthatcase,usingagitsubmoduleisprobablythemostconvenientapproach.

$gitsubmoduleaddhttps://github.com/pinterest/arcanist-linters.git.pinterest-linters$gitsubmoduleupdate--init

Then,enablethemoduleinyourproject-level.arcconfigfile:

{"load":[".pinterest-linters"]}
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论