Skip to content

devops-lintflow/lintwork

Repository files navigation

lintwork

Actions Status License Tag

Introduction

lintwork is a lint worker of lintflow written in Python.

Prerequisites

  • gRPC >= 1.36.0
  • Python >= 3.7.0

Run

  • Local mode
pip install -Ur requirements.txt
python work.py --config-file="tests/data/config.yml" --lint-name="lintshell" --lint-project="tests/data/project" --output-file="output.json"
  • Service mode
pip install -Ur requirements.txt
python work.py --config-file="tests/data/config.yml" --listen-url="127.0.0.1:9090"

Docker

  • Local mode
docker build --no-cache -f Dockerfile -t craftslab/lintwork:latest .
docker run -it -v tests/data:/tmp craftslab/lintwork:latest ./lintwork --config-file="/tmp/config.yml" --lint-name="lintshell" --lint-project="/tmp/project" --output-file="/tmp/output.json"
  • Service mode
docker build --no-cache -f Dockerfile -t craftslab/lintwork:latest .
docker run -it --network=host craftslab/lintwork:latest ./lintwork --config-file="config.yml" --listen-url="127.0.0.1:9090"

Usage

usage: work.py [-h] --config-file CONFIG_FILE [--lint-project LINT_PROJECT | --listen-url LISTEN_URL]
               [--lint-name LINT_NAME] [--output-file OUTPUT_FILE] [-v]

Lint Work

options:
  -h, --help            show this help message and exit
  --config-file CONFIG_FILE
                        config file (.yml)
  --lint-project LINT_PROJECT
                        lint project (e.g., tests/data/project)
  --listen-url LISTEN_URL
                        listen url (host:port)
  --lint-name LINT_NAME
                        lint name (e.g., lintshell)
  --output-file OUTPUT_FILE
                        output file (.json|.txt|.xlsx)
  -v, --version         show program's version number and exit

Settings

lintwork parameters can be set in the directory config.

An example of configuration in config.yml:

apiVersion: v1
kind: worker
metadata:
  name: lintwork
spec:
  lintai:
    lintgpt:
  lintcommit:
    contentcheck:
    messagecheck:
  lintcpp:
    cpplint:
  lintjava:
    aosplint:
      - --disable
      - LintError
      - --nolines
      - --quiet
    checkstyle:
      - -jar
      - /home/craftslab/opt/checkstyle/lib/checkstyle.jar
      - -c=/home/craftslab/opt/checkstyle/etc/google_checks.xml
    javalint:
      - -jar
      - /home/craftslab/opt/javalint/lib/javalint.jar
      - --file
    stringscheck:
  lintkernel:
    checkpatch:
      - --no-summary
      - --no-tree
      - --terse
  lintmake:
    checkmake:
      - --format=:{{.LineNumber}}::{{.Violation}}\n
  lintpython:
    flake8:
  lintshell:
    shellcheck:
      - --format=gcc

Project

  • Commit Files
lintwork-20240630231055/
├── COMMIT_MSG
├── {change-number}-{commit-id}.meta
├── {change-number}-{commit-id}.patch
└── path/to/file
  • Commit Meta
{
  "branch": "main",
  "owner": {
    "name": "name"
  },
  "project": "name",
  "revisions": {
    "39fe82c424a319e9613126d2ef1c837e114440c5": {
      "_number": 1
    }
  },
  "updated": "2024-09-20T07:15:44+08:00",
  "url": "http://127.0.0.1:8080"
}

Report

  • JSON
{
  "lint": [
    {
      "file": "name",
      "line": 1,
      "type": "Error",
      "details": "text"
    }
  ]
}
  • Text
{lint}:{file}:{line}:{type}:{details}

License

Project License can be found here.

Reference

Linter

Misc

About

lint work

Resources

License

Stars

Watchers

Forks

Packages

No packages published