Skip to content

Commit

Permalink
feat(lint): add textlint for natural language lint (#21815)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongbo-miao authored Dec 22, 2024
1 parent b9da15e commit b37bdea
Show file tree
Hide file tree
Showing 12 changed files with 2,500 additions and 140 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
json: ${{ steps.filter.outputs.json }}
markdown: ${{ steps.filter.outputs.markdown }}
matlab: ${{ steps.filter.outputs.matlab }}
natural-language: ${{ steps.filter.outputs.natural-language }}
python: ${{ steps.filter.outputs.python }}
qml: ${{ steps.filter.outputs.qml }}
ruby: ${{ steps.filter.outputs.ruby }}
Expand Down Expand Up @@ -122,6 +123,54 @@ jobs:
- 'pyproject.toml'
- 'uv.lock'
- '**/*.m'
natural-language:
- '.github/workflows/.lint.yml'
- '.node-version'
- '.npmrc'
- 'package.json'
- 'package-lock.json'
- '.textlintrc.json'
- '.textlintignore'
- '**/*.c'
- '**/*.cjs'
- '**/*.cpp'
- '**/*.cs'
- '**/*.csproj'
- '**/*.dbc'
- '**/*.go'
- '**/*.gradle'
- '**/*.h'
- '**/*.ino'
- '**/*.ipynb'
- '**/*.java'
- '**/*.jl'
- '**/*.js'
- '**/*.json'
- '**/*.kt'
- '**/*.kts'
- '**/*.m'
- '**/*.md'
- '**/*.mjs'
- '**/*.p4'
- '**/*.py'
- '**/*.rego'
- '**/*.rs'
- '**/*.scad'
- '**/*.scala'
- '**/*.sh'
- '**/*.sln'
- '**/*.sol'
- '**/*.sql'
- '**/*.swift'
- '**/*.tf'
- '**/*.toml'
- '**/*.ts'
- '**/*.tsx'
- '**/*.vhd'
- '**/*.WizardFile'
- '**/*.xml'
- '**/*.yaml'
- '**/*.yml'
ruby:
- '.github/workflows/.lint.yml'
- 'Gemfile'
Expand Down Expand Up @@ -729,6 +778,29 @@ jobs:
run: |
uv run poe lint-matlab
lint-natural-language:
name: Natural Language
needs: detect-changes
if: ${{ needs.detect-changes.outputs.natural-language == 'true' }}
runs-on: ubuntu-24.04
environment: test
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: |
npm ci
- name: Lint natural language
run: |
npm run lint:natural-language
lint-protocol-buffers-api-go:
name: Protocol Buffers (api-go)
needs: detect-changes
Expand Down
3 changes: 3 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pull_request_rules:
- or:
- check-success=Lint / MATLAB
- check-skipped=Lint / MATLAB
- or:
- check-success=Lint / Natural Language
- check-skipped=Lint / Natural Language
- or:
- check-success=Lint / Protocol Buffers (api-go)
- check-skipped=Lint / Protocol Buffers (api-go)
Expand Down
151 changes: 151 additions & 0 deletions .textlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# https://textlint.github.io/docs/ignore.html#ignoring-files-textlintignore

# Anywhere (Folder mush have trailing /**/*)
**/*.aliases
**/*.asv
**/*.cache
**/*.cf
**/*.DotSettings.user
**/*.ghw
**/*.iml
**/*.lvlps
**/*.mexmaca64
**/*.mexmaci64
**/*.slxc
**/*.swc/**/*
**/*.tfstate
**/*.unsealed.yaml
**/.DS_Store
**/*.duckdb
**/.env.development.local
**/.env.production.local
**/.gitkeep
**/.idea/**/*
**/.pytest_cache/**/*
**/.ruff_cache/**/*
**/.terraform/**/*
**/.vagrant/**/*
**/.venv/**/*
**/.vscode/**/*
**/__pycache__/**/*
**/build/**/*
**/cmake-build-debug/**/*
**/codegen/**/*
**/coverage/**/*
**/node_modules/**/*
**/slprj/**/*
**/target/**/*

# Root (Must have leading ./; Folder mush have trailing /**/*)
/.aider.chat.history.md
/.aider.tags.cache.v3/**/*
./.git/**/*
./.github/**/*
./.mypy_cache/**/*
./build-desktop-qt-Qt_6_4_1_for_macOS-Debug/**/*
./dump.rdb
./logs/**/*
./logs.log
./submodules/**/*
./vendor/**/*
./west-master-k3s.yaml

# Directories (Folder mush have trailing /**/*)
aerospace/hm-openaerostruct/reports/**/*
aerospace/hm-openaerostruct/n2.html
api-go/config/config_loader/server.crt
api-go/config/config_loader/server.key
api-go/config/config_loader/opal_auth_public_key.pem
api-go/coverage.txt
api-node/.clinic/**/*
api-node/.stryker-tmp/**/*
api-node/public/**/*
api-node/reports/**/*
api-python/dist/**/*
api-rust/models/**/*
caddy/public/**/*
cloud-cost/komiser/komiser.db
cloud-infrastructure/hm-pulumi/passphrase.txt
cloud-infrastructure/terraform/environments/production/aws/data/files/amazon-msk/*/plugins/*.zip
cloud-platform/aws/aws-secrets-manager/secrets/*-credentials.json
cloud-security/hm-prowler/output/**/*
computational-fluid-dynamics/openfoam/simulations/*/0.*/**/*
computational-fluid-dynamics/openfoam/simulations/*/constant/polyMesh/**/*
data-analytics/hm-geopandas/data/**/*
data-ingestion/fluent-bit/*/data/**/*
data-ingestion/vector/*/data/**/*
data-orchestration/hm-prefect/workflows/*/*-deployment.yaml
data-orchestration/hm-prefect/workflows/*/.coverage/**/*
data-orchestration/hm-prefect/workflows/*/coverage.xml
data-processing/flink/applications/*/.classpath
data-processing/flink/applications/*/.project
data-processing/flink/applications/*/.settings/**/*
data-processing/flink/applications/*/dependency-reduced-pom.xml
data-processing/flink/applications/*/src/main/resources/*.properties
data-processing/hm-spark/applications/*/.bsp/**/*
data-processing/hm-spark/applications/*/data/**/*
data-storage/hm-keydb/dump.rdb
data-storage/hm-keydb/modules/**/*
data-storage/hm-protobuf/data/**/*
data-transformation/dbt/projects/*/dbt_packages/**/*
data-transformation/dbt/projects/*/logs/**/*
data-visualization/grafana/hm-panel-plugin/.config/**/*
data-visualization/metabase/plugins/**/*
desktop-qt/CMakeLists.txt.user
embedded/decode-can-data/data/**/*
hardware-in-the-loop/national-instruments/hm-tdms/data/**/*
hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge/packages/**/*
hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge/VeriStandZeroMQBridge/bin/**/*
hardware-in-the-loop/national-instruments/veristand/VeriStandZeroMQBridge/VeriStandZeroMQBridge/obj/**/*
hm-kafka/kafka-client/kafka-c/*/config.ini
kubernetes/certificates/**/*
kubernetes/data/config-loader/**/*
kubernetes/data/elastic-apm/**/*
kubernetes/data/hasura/hasura-graphql-engine/**/*
kubernetes/data/hm-alpine/**/*
kubernetes/data/hm-kafka/hm-kafka/**/*
kubernetes/data/hm-kafka/logging-kafka-connect/**/*
kubernetes/data/hm-kafka/opa-kafka-connect/**/*
kubernetes/data/minio/**/*
kubernetes/data/model-server/model-store/**/*
kubernetes/data/opal-server/**/*
kubernetes/data/yugabyte/**/*
kubernetes/manifests-raw/**/*
machine-learning/convolutional-neural-network/output/models/**/*
machine-learning/convolutional-neural-network/output/reports/**/*
machine-learning/convolutional-neural-network/wandb/**/*
machine-learning/feature-store/driver_features/data/**/*
machine-learning/graph-neural-network/dataset/**/*
machine-learning/graph-neural-network/wandb/**/*
machine-learning/hm-autogluon/AutogluonModels/**/*
machine-learning/hm-langchain/applications/*/data/**/*
machine-learning/hm-mlflow/experiments/*/data/**/*
machine-learning/hm-mlflow/experiments/*/lightning_logs/**/*
machine-learning/hm-mlflow/experiments/*/mlruns/**/*
machine-learning/hm-mlflow/experiments/*/wandb/**/*
machine-learning/hm-rasa/.rasa/**/*
machine-learning/hm-rasa/graph.html
machine-learning/hm-rasa/models/**/*
machine-learning/hm-rasa/results/**/*
machine-learning/hm-rasa/story_graph.dot
machine-learning/hm-supervision/*/data/**/*
machine-learning/neural-forecasting/*/lightning_logs/**/*
machine-learning/triton/amazon-sagamaker-triton-resnet-50/infer/data/**/*
mobile/mobile-android/.gradle/**/*
mobile/mobile-android/local.properties
mobile/mobile-ios/HMMobile.xcodeproj/project.xcworkspace/**/*
mobile/mobile-ios/HMMobile.xcodeproj/xcuserdata/**/*
mobile/mobile-react-native/.expo/**/*
reverse-engineering/*/main
robotics/robot-operating-system/bags/**/*
robotics/robot-operating-system/install/**/*
robotics/robot-operating-system/log/**/*
spark/project/target/**/*
spark/target/**/*
web-cypress/cypress/fixtures/example.json
web-cypress/cypress/screenshots/**/*
web/.eslintcache
web/.lighthouseci
web/public/sitemap.xml
web/storybook-static/**/*
web/tmp/**/*
51 changes: 51 additions & 0 deletions .textlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"plugins": {
"@textlint/text": {
"extensions": [
".c",
".cjs",
".cpp",
".cs",
".csproj",
".dbc",
".go",
".gradle",
".h",
".ino",
".ipynb",
".java",
".jl",
".js",
".json",
".kt",
".kts",
".m",
".md",
".mjs",
".p4",
".py",
".rego",
".rs",
".scad",
".scala",
".sh",
".sln",
".sol",
".sql",
".swift",
".tf",
".toml",
".ts",
".tsx",
".vhd",
".WizardFile",
".xml",
".yaml",
".yml"
]
}
},
"rules": {
"textlint-rule-common-misspellings": true
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ The diagram illustrates the repository's architecture, which is considered overl
- **Kubeconform** - Kubernetes manifest linter
- **markdownlint-cli2** - Markdown linter
- **MISS_HIT** - MATLAB code formatter
- **textlint** - Natural language linter
- **Buf** - Protocol Buffers linter
- **Black** - Python code formatter
- **autoflake**, **isort**, **Ruff** - Python linter
Expand Down
2 changes: 1 addition & 1 deletion aerospace/quadcopter-pd-controller/utils/plotState.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

figure(h_fig);
if strcmp(view, 'sep')
% Plot seperate
% Plot separate

for i = 1:3
subplot(3, 1, i);
Expand Down
2 changes: 1 addition & 1 deletion automobile/detect-lane-by-lidar-point-cloud/LaneDetector.m
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@
nonGround = select(pc, outliers);
[labels, numClusters] = pcsegdist(nonGround, 1);

% Remove all the outlier from the ground occuring because of possible obstacles
% Remove all the outlier from the ground occurring because of possible obstacles
for i = 1:numClusters
tmp = nonGround.Location(labels == i, :);
xmin = min(tmp(:, 1));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VeriStandZeroMQBridge", "VeriStandZeroMQBridge\VeriStandZeroMQBridge.csproj", "{D99D3F07-09BA-49F2-B4A4-D65AAB41C037}"
EndProject
Global
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion machine-learning/hm-rasa/data/nlu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ nlu:
- unhappy
- not good
- not very good
- extremly sad
- extremely sad
- so saad
- so sad
Expand Down
Loading

0 comments on commit b37bdea

Please sign in to comment.