Commit ff3777c4 authored by Marcel Amirault's avatar Marcel Amirault Committed by Evan Read

Update vale and start using output template

We can shrink the docker image if we don't need ruby
parent e1a80495
......@@ -42,7 +42,7 @@ docs-lint markdown:
extends:
- .default-retry
- .docs:rules:docs-lint
image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint:ruby-2.7.2-alpine-3.12-vale-2.4.3-markdownlint-0.24.0"
image: "registry.gitlab.com/gitlab-org/gitlab-docs/lint-markdown:alpine-3.12-vale-2.6.1-markdownlint-0.24.0"
stage: test
needs: []
script:
......
{{- /* Modify Vale's output https://docs.errata.ai/vale/cli#--output */ -}}
{{- /* Keep track of our various counts */ -}}
{{- $e := 0 -}}
{{- $w := 0 -}}
{{- $s := 0 -}}
{{- $f := 0 -}}
{{- /* Range over the linted files */ -}}
{{- range .Files}}
{{- $f = add1 $f -}}
{{- $path := .Path | underline -}}
{{- /* Range over the file's alerts */ -}}
{{- range .Alerts -}}
{{- $error := "" -}}
{{- if eq .Severity "error" -}}
{{- $error = .Severity | red -}}
{{- $e = add1 $e -}}
{{- else if eq .Severity "warning" -}}
{{- $error = .Severity | yellow -}}
{{- $w = add1 $w -}}
{{- else -}}
{{- $error = .Severity | blue -}}
{{- $s = add1 $s -}}
{{- end}}
{{- /* Variables setup */ -}}
{{- $path = $path -}}
{{- $loc := printf "Line %d, position %d" .Line (index .Span 0) -}}
{{- $check := printf "%s" .Check -}}
{{- $message := printf "%s" .Message -}}
{{- $link := printf "%s" .Link -}}
{{- /* Output */ -}}
{{ $path }}:
{{ $loc }} (rule {{ $check }})
{{ $error }}: {{ $message }}
More information: {{ $link }}
{{end -}}
{{end -}}
{{- $e}} {{"errors" | red}}, {{$w}} {{"warnings" | yellow}}, and {{$s}} {{"suggestions" | blue}} found in {{$f}} {{$f | int | plural "file" "files"}}.
......@@ -24,10 +24,10 @@ Here you can access the complete documentation for GitLab, the single applicatio
No matter how you use GitLab, we have documentation for you.
| Essential documentation | Essential documentation |
|:-------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
|:------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
| [**User documentation**](user/index.md)<br>Discover features and concepts for GitLab users. | [**Administrator documentation**](administration/index.md)<br/>Everything GitLab self-managed administrators need to know. |
| [**Contributing to GitLab**](#contributing-to-gitlab)<br/>At GitLab, everyone can contribute! | [**New to Git and GitLab?**](#new-to-git-and-gitlab)<br/>We have the resources to get you started. |
| [**Build an integration with GitLab**](#build-an-integration-with-gitlab)<br/>Consult our automation and integration documentation. | [**Coming to GitLab from another platform?**](#coming-to-gitlab-from-another-platform)<br/>Consult our handy guides. |
| [**Build an integration with GitLab**](#build-an-integration-with-gitlab)<br/>Consult our automation and integration documentation. | [**Coming to GitLab from another platform?**](#coming-to-gitlab-from-another-platform)<br/>Consult our guides. |
| [**Install GitLab**](https://about.gitlab.com/install/)<br/>Installation options for different platforms. | [**Customers**](subscriptions/index.md)<br/>Information for new and existing customers. |
| [**Update GitLab**](update/README.md)<br/>Update your GitLab self-managed instance to the latest version. | [**Reference Architectures**](administration/reference_architectures/index.md)<br/>GitLab's reference architectures |
| [**GitLab releases**](https://about.gitlab.com/releases/)<br/>What's new in GitLab. | |
......@@ -93,7 +93,7 @@ GitLab provides statistics and insights into ways you can maximize the value of
The following documentation relates to the DevOps **Manage** stage:
| Manage topics | Description |
|:--------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------------------|
| [Authentication and<br/>Authorization](administration/auth/README.md) **(CORE ONLY)** | Supported authentication and authorization providers. |
| [GitLab Value Stream Analytics](user/analytics/value_stream_analytics.md) | Measure the time it takes to go from an [idea to production](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/#from-idea-to-production-with-gitlab) for each project you have. |
| [Instance-level analytics](user/admin_area/analytics/index.md) | Discover statistics on how many GitLab features you use and user activity. |
......@@ -114,7 +114,7 @@ management tools.
The following documentation relates to the DevOps **Plan** stage:
| Plan topics | Description |
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------|
|:-----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------|
| [Burndown charts](user/project/milestones/burndown_charts.md) **(STARTER)** | Watch your project's progress throughout a specific milestone. |
| [Discussions](user/discussions/index.md) | Threads, comments, and resolvable threads in issues, commits, and merge requests. |
| [Due dates](user/project/issues/due_dates.md) | Keep track of issue deadlines. |
......@@ -151,7 +151,7 @@ The following documentation relates to the DevOps **Create** stage:
#### Projects and groups
| Create topics - Projects and Groups | Description |
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|
|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|
| [Advanced search](user/search/advanced_global_search.md) **(STARTER)** | Leverage Elasticsearch for faster, more advanced code search across your entire GitLab instance. |
| [Advanced syntax search](user/search/advanced_search_syntax.md) **(STARTER)** | Use advanced queries for more targeted search results. |
| [Contribution analytics](user/group/contribution_analytics/index.md) **(STARTER)** | See detailed statistics of group contributors. |
......@@ -177,7 +177,7 @@ The following documentation relates to the DevOps **Create** stage:
#### Repositories
| Create topics - Repositories | Description |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------|
|:-----------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------|
| [Branches](user/project/repository/branches/index.md) and the [default branch](user/project/repository/branches/index.md#default-branch) | How to use branches in GitLab. |
| [Commits](user/project/repository/index.md#commits) and [signing commits](user/project/repository/gpg_signed_commits/index.md) | Work with commits, and use GPG to sign your commits. |
| [Create branches](user/project/repository/web_editor.md#create-a-new-branch), [create](user/project/repository/web_editor.md#create-a-file)<br/>and [upload](user/project/repository/web_editor.md#upload-a-file) files, and [create directories](user/project/repository/web_editor.md#create-a-directory) | Create branches, create and upload files, and create directories within GitLab. |
......@@ -200,7 +200,7 @@ The following documentation relates to the DevOps **Create** stage:
#### Merge requests
| Create topics - Merge Requests | Description |
|:--------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
|:---------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
| [Checking out merge requests locally](user/project/merge_requests/reviewing_and_managing_merge_requests.md#checkout-merge-requests-locally-through-the-head-ref) | Tips for working with merge requests locally. |
| [Cherry-picking](user/project/merge_requests/cherry_pick_changes.md) | Use GitLab for cherry-picking changes. |
| [Merge request thread resolution](user/discussions/index.md#moving-a-single-thread-to-a-new-issue) | Resolve threads, move threads in a merge request to an issue, and only allow merge requests to be merged if all threads are resolved. |
......@@ -216,7 +216,7 @@ The following documentation relates to the DevOps **Create** stage:
#### Integration and Automation
| Create topics - Integration and Automation | Description |
|:------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
|:----------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
| [GitLab REST API](api/README.md) | Integrate with GitLab using our REST API. |
| [GitLab GraphQL API](api/graphql/index.md) | Integrate with GitLab using our GraphQL API. |
| [GitLab integrations](integration/README.md) | Integrate with multiple third-party services with GitLab to allow external issue trackers and external authentication. |
......@@ -244,7 +244,7 @@ scales to run your tests faster.
The following documentation relates to the DevOps **Verify** stage:
| Verify topics | Description |
|:----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
|:-----------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
| [Code Quality reports](user/project/merge_requests/code_quality.md) | Analyze source code quality. |
| [GitLab CI/CD](ci/README.md) | Explore the features and capabilities of Continuous Integration with GitLab. |
| [Unit test reports](ci/unit_test_reports.md) | Display Unit test reports on merge requests. |
......@@ -267,7 +267,7 @@ packages, which can be consumed as a dependency in downstream projects.
The following documentation relates to the DevOps **Package** stage:
| Package topics | Description |
|:----------------------------------------------------------------|:-------------------------------------------------------|
|:----------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------|
| [Container Registry](user/packages/container_registry/index.md) | The GitLab Container Registry enables every project in GitLab to have its own space to store [Docker](https://www.docker.com/) images. |
| [Dependency Proxy](user/packages/dependency_proxy/index.md) | The GitLab Dependency Proxy sets up a local proxy for frequently used upstream images/packages. |
| [Package Registry](user/packages/package_registry/index.md) | Use GitLab as a private or public registry for a variety of common package managers, including [NPM](user/packages/npm_registry/index.md), [Maven](user/packages/maven_repository/index.md), [PyPI](user/packages/pypi_repository/index.md), and others. You can also store generic files. |
......@@ -289,7 +289,7 @@ remediation processes when needed.
The following documentation relates to the DevOps **Secure** stage:
| Secure topics | Description |
|:------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|
|:------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|
| [Compliance Dashboard](user/compliance/compliance_dashboard/index.md) **(ULTIMATE)** | View the most recent Merge Request activity in a group. |
| [Container Scanning](user/application_security/container_scanning/index.md) **(ULTIMATE)** | Use Clair to scan Docker images for known vulnerabilities. |
| [Dependency List](user/application_security/dependency_list/index.md) **(ULTIMATE)** | View your project's dependencies and their known vulnerabilities. |
......@@ -311,7 +311,7 @@ confidently and securely with GitLab’s built-in Continuous Delivery and Deploy
The following documentation relates to the DevOps **Release** stage:
| Release topics | Description |
|:------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
|:---------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
| [Auto Deploy](topics/autodevops/stages.md#auto-deploy) | Configure GitLab for the deployment of your application. |
| [Canary Deployments](user/project/canary_deployments.md) **(PREMIUM)** | Employ a popular CI strategy where a small portion of the fleet is updated to the new version first. |
| [Deploy Boards](user/project/deploy_boards.md) **(PREMIUM)** | View the current health and status of each CI environment running on Kubernetes, displaying the status of the pods in the deployment. |
......@@ -337,7 +337,7 @@ configuration. Then customize everything from buildpacks to CI/CD.
The following documentation relates to the DevOps **Configure** stage:
| Configure topics | Description |
|:-----------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------|
|:----------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------|
| [Auto DevOps](topics/autodevops/index.md) | Automatically employ a complete DevOps lifecycle. |
| [Create Kubernetes clusters](user/project/clusters/add_remove_clusters.md#create-new-cluster) | Use Kubernetes and GitLab. |
| [Executable Runbooks](user/project/clusters/runbooks/index.md) | Documented procedures that explain how to carry out particular processes. |
......@@ -392,10 +392,10 @@ your applications that are deployed in production.
The following documentation relates to the DevOps **Defend** stage:
| Defend topics | Description |
|:------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|
|:---------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
| [Web Application Firewall with ModSecurity](user/compliance/compliance_dashboard/index.md) | Filter, monitor, and block HTTP traffic to and from a web application. |
| [Container host security](user/clusters/applications.md#install-falco-using-gitlab-cicd) | Detect and respond to security threats at the Kubernetes, network, and host level. |
| [Container network security](user/clusters/applications.md#install-cilium-using-gitlab-cicd) | Detect and block unauthorized network traffic between pods and to/from the internet.|
| [Container network security](user/clusters/applications.md#install-cilium-using-gitlab-cicd) | Detect and block unauthorized network traffic between pods and to/from the internet. |
## New to Git and GitLab?
......@@ -404,7 +404,7 @@ Working with new systems can be daunting.
We have the following documentation to rapidly uplift your GitLab knowledge:
| Topic | Description |
|:-----------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
|:--------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
| [GitLab basics guides](gitlab-basics/README.md) | Start working on the command line and with GitLab. |
| [GitLab workflow overview](https://about.gitlab.com/blog/2016/10/25/gitlab-workflow-an-overview/) | Enhance your workflow with the best of GitLab Workflow. |
| [Get started with GitLab CI/CD](ci/quick_start/README.md) | Quickly implement GitLab CI/CD. |
......@@ -439,7 +439,7 @@ Learn more about GitLab account management:
Learn more about using Git, and using Git with GitLab:
| Topic | Description |
|:----------------------------------------------------------------------------|:---------------------------------------------------------------------------|
|:-----------------------------------------------------------------------------|:---------------------------------------------------------------------------|
| [Git](topics/git/index.md) | Getting started with Git, branching strategies, Git LFS, and advanced use. |
| [Git cheat sheet](https://about.gitlab.com/images/press/git-cheat-sheet.pdf) | Download a PDF describing the most used Git operations. |
| [GitLab Flow](topics/gitlab_flow.md) | Explore the best of Git with the GitLab Flow strategy. |
......@@ -455,7 +455,7 @@ Learn more about using Git, and using Git with GitLab:
If you are coming to GitLab from another platform, the following information is useful:
| Topic | Description |
|:---------------------------------------------------------------|:---------------------------------------------------------------------------------------|
|:----------------------------------------------------|:---------------------------------------------------------------------------------------|
| [Importing to GitLab](user/project/import/index.md) | Import your projects from GitHub, Bitbucket, GitLab.com, FogBugz, and SVN into GitLab. |
| [Migrating from SVN](user/project/import/svn.md) | Convert a SVN repository to Git and GitLab. |
......@@ -470,7 +470,7 @@ If you are coming to GitLab from another platform, the following information is
There are many ways to integrate with GitLab, including:
| Topic | Description |
|:-----------------------------------------------------------|:------------------------------------------------|
|:-----------------------------------------------------------|:-----------------------------------------------|
| [GitLab REST API](api/README.md) | Integrate with GitLab using our REST API. |
| [GitLab GraphQL API](api/graphql/index.md) | Integrate with GitLab using our GraphQL API. |
| [Integrations and automation](#integration-and-automation) | All GitLab integration and automation options. |
......
......@@ -75,14 +75,13 @@ fi
function run_locally_or_in_docker() {
local cmd=$1
local args=$2
local pipe_cmd=$3
if hash ${cmd} 2>/dev/null
then
$cmd $args | $pipe_cmd
$cmd $args
elif hash docker 2>/dev/null
then
docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint:latest ${cmd} ${args} | $pipe_cmd
docker run -t -v ${PWD}:/gitlab -w /gitlab --rm registry.gitlab.com/gitlab-org/gitlab-docs/lint:latest ${cmd} ${args}
else
echo
echo " ✖ ERROR: '${cmd}' not found. Install '${cmd}' or Docker to proceed." >&2
......@@ -109,7 +108,7 @@ else
fi
echo '=> Linting prose...'
run_locally_or_in_docker 'vale' "--minAlertLevel error --output=JSON ${MD_DOC_PATH}" "ruby scripts/vale.rb"
run_locally_or_in_docker 'vale' "--minAlertLevel error --output=doc/.vale/vale.tmpl ${MD_DOC_PATH}"
if [ $ERRORCODE -ne 0 ]
then
......
#!/usr/bin/env ruby
#
# Get the JSON output from Vale and format it in a nicer way
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46725
#
# Usage:
# vale --output=JSON filename.md | ruby vale.rb
#
require 'json'
input = ARGF.read
data = JSON.parse(input)
data.each_pair do |source, alerts|
alerts.each do |alert|
puts "#{source}:"
puts " Line #{alert['Line']}, position #{alert['Span'][0]} (rule #{alert['Check']})"
puts " #{alert['Severity']}: #{alert['Message']}"
puts " More information: #{alert['Link']}"
puts
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment