All Projects → pinterest → arcanist-linters

pinterest / arcanist-linters

Licence: Apache-2.0 license
A collection of custom Arcanist linters

Programming Languages

PHP
23972 projects - #3 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to arcanist-linters

elint
A easy way to lint your code
Stars: ✭ 38 (-40.62%)
Mutual labels:  lint, eslint, linter
openapi-lint-vscode
OpenAPI 2.0/3.0.x intellisense, validator, linter, converter and resolver extension for Visual Studio Code
Stars: ✭ 47 (-26.56%)
Mutual labels:  lint, linter, openapi
gandalf-lint
Bad Code Shall Not Pass
Stars: ✭ 29 (-54.69%)
Mutual labels:  lint, eslint, linter
eslint-config
An ESLint shareable config that I used in my projects
Stars: ✭ 15 (-76.56%)
Mutual labels:  lint, eslint, linter
KaiZen-OpenApi-Parser
High-performance Parser, Validator, and Java Object Model for OpenAPI 3.x
Stars: ✭ 119 (+85.94%)
Mutual labels:  lint, linter, openapi
therapist
Work out your commitment issues.
Stars: ✭ 29 (-54.69%)
Mutual labels:  lint, linter
eslint-plugin-roku
ESLint plugin to parse and lint BrightScript files
Stars: ✭ 44 (-31.25%)
Mutual labels:  lint, linter
li18nt
🌎 Lint your i18n translation files. Detect conflicting properties, duplicates and make it more readable and easier to maintain by formatting it!
Stars: ✭ 29 (-54.69%)
Mutual labels:  lint, linter
folderslint
📁 Directory structure linter for JavaScript projects
Stars: ✭ 131 (+104.69%)
Mutual labels:  lint, linter
actionlint
Static checker for GitHub Actions workflow files
Stars: ✭ 1,385 (+2064.06%)
Mutual labels:  lint, linter
advanced-spring-scaffold
This project provides an advanced baseline to help you kick start a Spring project.
Stars: ✭ 21 (-67.19%)
Mutual labels:  checkstyle, openapi
makefiles
No description or website provided.
Stars: ✭ 23 (-64.06%)
Mutual labels:  lint, linter
npm-groovy-lint
Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line
Stars: ✭ 124 (+93.75%)
Mutual labels:  lint, linter
lint-html-with-css
Lint HTML with CSS. A collection of CSS snippets from the hashtag #lintHTMLwithCSS on twitter. These CSS snippets intend to warn developers about common mistakes made in HTML.
Stars: ✭ 35 (-45.31%)
Mutual labels:  lint, linter
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (+4.69%)
Mutual labels:  lint, linter
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-78.12%)
Mutual labels:  lint, linter
vim-phabricator
Vim plugin for Phabricator and Arcanist
Stars: ✭ 17 (-73.44%)
Mutual labels:  phabricator, arcanist
litho-lint-rules
Lint rules for Litho by Facebook http://fblitho.com/
Stars: ✭ 14 (-78.12%)
Mutual labels:  lint, linter
html-eslint
ESLint plugin for linting HTML
Stars: ✭ 72 (+12.5%)
Mutual labels:  lint, eslint
analysis-model
A library to read static analysis reports into a Java object model
Stars: ✭ 74 (+15.63%)
Mutual labels:  eslint, checkstyle

Arcanist Linters

This is a collection of custom Arcanist linters that we've written at Pinterest.

We also welcome additional contributions.

Linters

Apache Thrift

Lints for errors in Apache Thrift IDL (schema) files using the thrift compiler.

{
    "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"
    ]
}

Apache Thrift Generated

Lints files generated by the Apache Thrift compiler to ensure they were generated using a supported Thrift compiler.

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

Note: Currently only generated Python files are supported.

Black

Uses the Black opinionated code formatter to normalize the format of Python code.

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

Checkstyle

Uses the Checkstyle tool to check Java code against a coding standard.

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

ESLint

Lints JavaScript and JSX files using ESLint.

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

Flake8

Lints Python source files using Flake8. This is an extended version of the stock ArcanistFlake8Linter that adds support for checking required Python and extension versions.

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

Flawfinder

Lints C/C++ source files using flawfinder.

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

GraphQL Schema Linter

Lint GraphQL Schema Definition Language (SDL) using graphql-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,
    "graphql-schema.dependencies": {
        "@pinterest/graphql-lint-rules": "1.0.0"
    }
}

Go Vet

Uses the Go vet command to lint for suspicious code constructs.

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

OpenAPI Validator

Lint OpenAPI specifications using openapi-validator.

(Supports openapi-validator version 0.36.0 and later.)

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

Prettier

Formats JavaScript using Prettier.

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

Prettier ESLint

Formats JavaScript using Prettier and then fixes with ESLint.

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

Python Imports

Lints for illegal Python module imports.

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

Python isort

Lints Python imports using isort.

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

Pylint

Lints Python using pylint. Unlike the module that ships with Arcanist, this implementation works with recent releases of Pylint and also supports virtual environments.

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

Pyright

Type-checks Python code using Pyright.

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

Python Requirements

Ensures Python package requirements in requirements.txt files are sorted, unique, and pinned to exact versions.

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

Individual requirement lines can be excluded by adding a # noqa comment:

six>=1.10.0  # noqa: allow any recent version of six

Spectral

Lints OpenAPI documents using Spectral.

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

ThriftCheck

Lints Thrift IDL files using ThriftCheck.

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

YamlLinter

Lints YAML files using YamlLinter.

{
    "type": "yamllint",
    "include": "(\\.(yml|yaml)$)",
    "exclude": []
}

Installation

In short, you'll need to add this repository to your local machine and tell Arcanist to load the extension. You either can do this globally or on a per-project basis.

Once installed, the individual linters can be enabled and configured via the project's .arclint file. See the Arcanist Lint User Guide for details.

Global Installation

Arcanist can load modules from an absolute path, but because it also searches for modules one level up from itself on the filesystem, it's convenient to clone this repository at the same level as arcanist and libphutil.

$ git clone https://github.com/pinterest/arcanist-linters.git pinterest-linters
$ ls
arcanist
pinterest-linters
libphutil

Then, tell Arcanist to load the module by editing ~/.arcconfig (or /etc/arcconfig):

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

Project Installation

You can also load arcanist-linters on a per-project basis. In that case, using a git submodule is probably the most convenient approach.

$ git submodule add https://github.com/pinterest/arcanist-linters.git .pinterest-linters
$ git submodule update --init

Then, enable the module in your project-level .arcconfig file:

{
  "load": [".pinterest-linters"]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].