Skip to content

Commit 56a3b11

Browse files
committed
[CI] Add prek hook yamllint; Minor YAML formatting
Setup basic yamllint config file with a 8 rules disabled Reduced the length of the lines in the pre-commit config
1 parent 736554e commit 56a3b11

5 files changed

Lines changed: 56 additions & 16 deletions

File tree

.build/azure-templates/run-tests-on-os.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ steps:
115115
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
116116
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'))
117117

118-
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
119-
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
120-
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
121-
# This code only works on Windows.
118+
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
119+
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
120+
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
121+
# This code only works on Windows.
122122
- pwsh: |
123123
$sdkVersion = '8.0.404'
124124
$architecture = '${{ parameters.vsTestPlatform }}'
@@ -140,10 +140,10 @@ steps:
140140
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
141141
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net9.'))
142142

143-
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
144-
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
145-
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
146-
# This code only works on Windows.
143+
# Hack: .NET 8+ no longer installs the x86 bits and they must be installed separately. However, it is not
144+
# trivial to get it into the path and to get it to pass the minimum SDK version check in runbuild.ps1.
145+
# So, we install it afterward and set the environment variable so the above SDK can delegate to it.
146+
# This code only works on Windows.
147147
- pwsh: |
148148
$sdkVersion = '9.0.308'
149149
$architecture = '${{ parameters.vsTestPlatform }}'

.github/linters/.yaml-lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
---
19+
# https://yamllint.readthedocs.io/en/stable/
20+
extends: default
21+
22+
rules:
23+
braces: disable
24+
brackets: disable
25+
colons: disable
26+
comments: disable
27+
document-start: disable
28+
indentation: disable
29+
line-length: disable
30+
truthy: disable

.pre-commit-config.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
# | **Priority 20** | `fix-byte-order-marker` | **File Cleanups (Broad)**: Fix BOM first so subsequent steps work with clean UTF-8 text. |
3333
# | **Priority 30** | `trailing-whitespace` | **Formatting (Broad)**: Cleans up whitespace on files before other hooks validate them. |
3434
# | **Priority 40** | `doctoc`, `oxipng`, `file-contents-sorter` | **Disjoint Modifiers**: These modify different sets of files (`README.md`, `.png` files, and `codespell.txt` respectively). Running them concurrently is safe. |
35-
# | **Priority 50** | `codespell`, `check-ast`, `check-builtin-literals`, `check-case-conflict`, `check-executables-have-shebangs`, `check-illegal-windows-names`, `check-json`, `check-merge-conflict`, `check-vcs-permalinks`, `check-xml`, `check-yaml`, `debug-statements`, `detect-aws-credentials`, `detect-private-key`, `forbid-submodules`, `gitleaks`, `bandit`|
35+
# | **Priority 50** | `codespell`, `check-ast`, `check-builtin-literals`, `check-case-conflict`, `check-executables-have-shebangs`, `check-illegal-windows-names`, `check-json`, `check-merge-conflict`, `check-vcs-permalinks` |
36+
# | | `check-xml`, `check-yaml`, `debug-statements`, `detect-aws-credentials`, `detect-private-key`, `forbid-submodules`, `gitleaks`, `bandit`, `yamllint` |
3637
# | | **Read-Only / Syntax / Security**: The bulk of the suite. These hooks only read and validate files without modifying them, allowing full parallel execution. |
3738

3839
# https://prek.j178.dev/installation/
@@ -180,3 +181,13 @@ repos:
180181
types: [markdown]
181182
files: \.md$
182183
priority: 50
184+
- repo: https://github.com/adrienverge/yamllint
185+
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
186+
hooks:
187+
- id: yamllint
188+
name: run yamllint
189+
description: check YAML files with yamllint
190+
args: [--strict, -c=.github/linters/.yaml-lint.yml]
191+
types: [yaml]
192+
files: \.ya?ml$
193+
priority: 50

azure-pipelines.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ stages:
618618
vmImage: 'windows-latest'
619619

620620
steps:
621-
# We checkout here because we need to publish the source code along with the symbols for debugging
621+
# We checkout here because we need to publish the source code along with the symbols for debugging
622622
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
623623
fetchDepth: '1' # the depth of commits to ask Git to fetch
624624

@@ -630,13 +630,13 @@ stages:
630630
artifactName: '$(VersionArtifactName)'
631631
targetPath: '$(System.DefaultWorkingDirectory)/$(VersionArtifactName)'
632632

633-
# For debugging this pipeline
633+
# For debugging this pipeline
634634
#- pwsh: |
635635
# Get-ChildItem -Path $(System.DefaultWorkingDirectory)
636636
# Get-ChildItem -Path '$(VersionArtifactName)'
637637

638-
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
639-
# the version cannot be passed to the Index Sources & Publish Symbols task.
638+
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
639+
# the version cannot be passed to the Index Sources & Publish Symbols task.
640640
- pwsh: |
641641
$version = Get-Content '$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
642642
Write-Host "##vso[task.setvariable variable=PackageVersion;]$version"
@@ -682,8 +682,8 @@ stages:
682682

683683
- template: '.build/azure-templates/show-all-files.yml' # Uncomment for debugging
684684

685-
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
686-
# the version cannot be passed to the Index Sources & Publish Symbols task.
685+
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
686+
# the version cannot be passed to the Index Sources & Publish Symbols task.
687687
- pwsh: |
688688
$version = Get-Content '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
689689
$vcsLabel = 'Lucene.Net_' + $version.Replace('.', '_').Replace('-', '_')

websites/apidocs/toc/toc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ items:
55
topicHref: https://lucenenet.apache.org/docs/4.8.0-ci/cli/index.html
66
- name: Lucene.Net Website
77
topicHref: https://lucenenet.apache.org/
8-

0 commit comments

Comments
 (0)