mirror of
https://codeberg.org/Codeberg-CI/examples.git
synced 2025-09-11 12:55:19 -04:00
Linters and related fixes (#39)
- Add yamllint - Add markdownlint - Add precommit config - Add editorconfig - Rename `.yml` to `.yaml` - Add CI workflow to enforce lint rules Configs are taken from Woodpecker org lint rules. Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/39 Co-authored-by: pat-s <patrick.schratz@gmail.com> Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
parent
73ef96d755
commit
8df9d19ef4
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
tab_width = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
60
.gitignore
vendored
Normal file
60
.gitignore
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### macOS Patch ###
|
||||||
|
# iCloud generated files
|
||||||
|
*.icloud
|
||||||
|
|
||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
!.vscode/*.code-snippets
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Built Visual Studio Code Extensions
|
||||||
|
*.vsix
|
||||||
|
|
||||||
|
### VisualStudioCode Patch ###
|
||||||
|
# Ignore all local history of files
|
||||||
|
.history
|
||||||
|
.ionide
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
|
||||||
|
|
||||||
|
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
||||||
|
|
143
.markdownlint.yaml
Normal file
143
.markdownlint.yaml
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
# markdownlint YAML configuration
|
||||||
|
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
||||||
|
|
||||||
|
# Default state for all rules
|
||||||
|
default: true
|
||||||
|
|
||||||
|
# Path to configuration file to extend
|
||||||
|
extends: null
|
||||||
|
|
||||||
|
# MD003/heading-style/header-style - Heading style
|
||||||
|
MD003:
|
||||||
|
# Heading style
|
||||||
|
style: 'atx'
|
||||||
|
|
||||||
|
# MD004/ul-style - Unordered list style
|
||||||
|
MD004:
|
||||||
|
style: 'dash'
|
||||||
|
|
||||||
|
# MD007/ul-indent - Unordered list indentation
|
||||||
|
MD007:
|
||||||
|
# Spaces for indent
|
||||||
|
indent: 2
|
||||||
|
# Whether to indent the first level of the list
|
||||||
|
start_indented: false
|
||||||
|
|
||||||
|
# MD009/no-trailing-spaces - Trailing spaces
|
||||||
|
MD009:
|
||||||
|
# Spaces for line break
|
||||||
|
br_spaces: 2
|
||||||
|
# Allow spaces for empty lines in list items
|
||||||
|
list_item_empty_lines: false
|
||||||
|
# Include unnecessary breaks
|
||||||
|
strict: false
|
||||||
|
|
||||||
|
# MD010/no-hard-tabs - Hard tabs
|
||||||
|
MD010:
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: true
|
||||||
|
|
||||||
|
# MD012/no-multiple-blanks - Multiple consecutive blank lines
|
||||||
|
MD012:
|
||||||
|
# Consecutive blank lines
|
||||||
|
maximum: 1
|
||||||
|
|
||||||
|
# MD013/line-length - Line length
|
||||||
|
MD013:
|
||||||
|
# Number of characters
|
||||||
|
line_length: 500
|
||||||
|
# Number of characters for headings
|
||||||
|
heading_line_length: 100
|
||||||
|
# Number of characters for code blocks
|
||||||
|
code_block_line_length: 80
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: false
|
||||||
|
# Include tables
|
||||||
|
tables: false
|
||||||
|
# Include headings
|
||||||
|
headings: true
|
||||||
|
# Include headings
|
||||||
|
headers: true
|
||||||
|
# Strict length checking
|
||||||
|
strict: false
|
||||||
|
# Stern length checking
|
||||||
|
stern: false
|
||||||
|
|
||||||
|
# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
|
||||||
|
MD022:
|
||||||
|
# Blank lines above heading
|
||||||
|
lines_above: 1
|
||||||
|
# Blank lines below heading
|
||||||
|
lines_below: 1
|
||||||
|
|
||||||
|
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||||
|
MD024:
|
||||||
|
# Only check sibling headings
|
||||||
|
allow_different_nesting: true
|
||||||
|
|
||||||
|
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||||
|
MD025:
|
||||||
|
# Heading level
|
||||||
|
level: 1
|
||||||
|
# RegExp for matching title in front matter
|
||||||
|
front_matter_title: "^\\s*title\\s*[:=]"
|
||||||
|
|
||||||
|
# MD026/no-trailing-punctuation - Trailing punctuation in heading
|
||||||
|
MD026:
|
||||||
|
# Punctuation characters
|
||||||
|
punctuation: '.,;:!。,;:!'
|
||||||
|
|
||||||
|
# MD029/ol-prefix - Ordered list item prefix
|
||||||
|
MD029:
|
||||||
|
# List style
|
||||||
|
style: 'one_or_ordered'
|
||||||
|
|
||||||
|
# MD030/list-marker-space - Spaces after list markers
|
||||||
|
MD030:
|
||||||
|
# Spaces for single-line unordered list items
|
||||||
|
ul_single: 1
|
||||||
|
# Spaces for single-line ordered list items
|
||||||
|
ol_single: 1
|
||||||
|
# Spaces for multi-line unordered list items
|
||||||
|
ul_multi: 1
|
||||||
|
# Spaces for multi-line ordered list items
|
||||||
|
ol_multi: 1
|
||||||
|
|
||||||
|
# MD033/no-inline-html - Inline HTML
|
||||||
|
MD033:
|
||||||
|
# Allowed elements
|
||||||
|
allowed_elements: [details, summary, img, a, br, p]
|
||||||
|
|
||||||
|
# MD035/hr-style - Horizontal rule style
|
||||||
|
MD035:
|
||||||
|
# Horizontal rule style
|
||||||
|
style: '---'
|
||||||
|
|
||||||
|
# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
|
||||||
|
MD036:
|
||||||
|
# Punctuation characters
|
||||||
|
punctuation: '.,;:!?。,;:!?'
|
||||||
|
|
||||||
|
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||||
|
MD041:
|
||||||
|
# Heading level
|
||||||
|
level: 1
|
||||||
|
# RegExp for matching title in front matter
|
||||||
|
front_matter_title: "^\\s*title\\s*[:=]"
|
||||||
|
|
||||||
|
# MD044/proper-names - Proper names should have the correct capitalization
|
||||||
|
MD044:
|
||||||
|
# List of proper names
|
||||||
|
# names:
|
||||||
|
# Include code blocks
|
||||||
|
code_blocks: false
|
||||||
|
|
||||||
|
# MD046/code-block-style - Code block style
|
||||||
|
MD046:
|
||||||
|
# Block style
|
||||||
|
style: 'fenced'
|
||||||
|
|
||||||
|
# MD048/code-fence-style - Code fence style
|
||||||
|
MD048:
|
||||||
|
# Code fence style
|
||||||
|
style: 'backtick'
|
31
.pre-commit-config.yaml
Normal file
31
.pre-commit-config.yaml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# cSpell:ignore checkmake hadolint autofix autoupdate
|
||||||
|
repos:
|
||||||
|
- repo: meta
|
||||||
|
hooks:
|
||||||
|
- id: check-hooks-apply
|
||||||
|
- id: check-useless-excludes
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.5.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||||
|
rev: v0.38.0
|
||||||
|
hooks:
|
||||||
|
- id: markdownlint
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v3.1.0
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
|
rev: v1.33.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args: [--strict, -c=.yamllint.yaml]
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: yaml-file-extension
|
||||||
|
name: Check if YAML files has *.yaml extension.
|
||||||
|
entry: YAML filenames must have .yaml extension.
|
||||||
|
language: fail
|
||||||
|
files: .yml$
|
28
.woodpecker.yaml
Normal file
28
.woodpecker.yaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
steps:
|
||||||
|
editor-config:
|
||||||
|
image: mstruebing/editorconfig-checker:2.7.2
|
||||||
|
depends_on: []
|
||||||
|
|
||||||
|
woodpecker-cli:
|
||||||
|
depends_on: []
|
||||||
|
image: woodpeckerci/woodpecker-cli:v2.2.2-alpine
|
||||||
|
commands:
|
||||||
|
- woodpecker-cli lint C/
|
||||||
|
- woodpecker-cli lint Docker/
|
||||||
|
- woodpecker-cli lint Golang/
|
||||||
|
- woodpecker-cli lint Hugo/
|
||||||
|
- woodpecker-cli lint Jekyll/.woodpecker/jekyll.yaml
|
||||||
|
- woodpecker-cli lint KiCad/.woodpecker.yaml
|
||||||
|
- woodpecker-cli lint Mdbook/
|
||||||
|
- woodpecker-cli lint NodeJS/
|
||||||
|
- woodpecker-cli lint Python/
|
||||||
|
- woodpecker-cli lint Rust/
|
||||||
|
- woodpecker-cli lint StandardML/
|
||||||
|
- woodpecker-cli lint Tectonic/
|
||||||
|
- woodpecker-cli lint Typst/
|
||||||
|
|
||||||
|
yamllint:
|
||||||
|
depends_on: []
|
||||||
|
image: cytopia/yamllint:alpine-1
|
||||||
|
commands:
|
||||||
|
- yamllint --strict -c=.yamllint.yaml .
|
@ -1,21 +0,0 @@
|
|||||||
steps:
|
|
||||||
editor-config:
|
|
||||||
image: mstruebing/editorconfig-checker
|
|
||||||
group: lint
|
|
||||||
|
|
||||||
woodpecker-cli:
|
|
||||||
group: lint
|
|
||||||
image: woodpeckerci/woodpecker-cli:next-alpine
|
|
||||||
commands:
|
|
||||||
- woodpecker-cli lint golang/*.yml
|
|
||||||
- woodpecker-cli lint Docker/*.yml
|
|
||||||
- woodpecker-cli lint Hugo/*.yml
|
|
||||||
- woodpecker-cli lint Jekyll/jekyll.yml
|
|
||||||
- woodpecker-cli lint C/*.yml
|
|
||||||
- woodpecker-cli lint Rust/
|
|
||||||
- woodpecker-cli lint Python/
|
|
||||||
- woodpecker-cli lint StandardML/
|
|
||||||
- woodpecker-cli lint tectonic/
|
|
||||||
- woodpecker-cli lint NodeJS/11ty.yml
|
|
||||||
- woodpecker-cli lint KiCad/kibot.yml
|
|
||||||
- woodpecker-cli lint mdbook/*.yml
|
|
9
.yamllint.yaml
Normal file
9
.yamllint.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
extends: default
|
||||||
|
|
||||||
|
ignore-from-file:
|
||||||
|
- .gitignore
|
||||||
|
|
||||||
|
rules:
|
||||||
|
line-length: disable
|
||||||
|
document-start: disable
|
||||||
|
comments: disable
|
@ -1,10 +1,10 @@
|
|||||||
# Replace 'APPLICATIONNAME' with the name of your golang project
|
# Replace 'APPLICATIONNAME' with the name of your golang project
|
||||||
|
|
||||||
FROM golang:1.17 AS certs
|
FROM golang AS certs
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
# copy certs from golang:1.17 image
|
# copy certs from golang image
|
||||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
# Copy prebuild Go binary into container
|
# Copy prebuild Go binary into container
|
@ -1,8 +1,7 @@
|
|||||||
steps:
|
steps:
|
||||||
# Builds your Go application
|
# Builds your Go application
|
||||||
build:
|
build:
|
||||||
# Set your preferred Go version:
|
image: golang
|
||||||
image: golang:1.17
|
|
||||||
environment:
|
environment:
|
||||||
# Needed if you want to cross-compile and package the binary in a container.
|
# Needed if you want to cross-compile and package the binary in a container.
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
@ -1,6 +1,6 @@
|
|||||||
steps:
|
steps:
|
||||||
build:
|
build:
|
||||||
image: golang:1.17
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
- go get
|
- go get
|
||||||
- go build
|
- go build
|
@ -14,8 +14,7 @@ preflight:
|
|||||||
# you can use this to raise errors in DRC or ERC
|
# you can use this to raise errors in DRC or ERC
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
- name: "gerbers"
|
||||||
- name: 'gerbers'
|
|
||||||
comment: "Gerbers for production"
|
comment: "Gerbers for production"
|
||||||
type: gerber
|
type: gerber
|
||||||
dir: kibot/gerber
|
dir: kibot/gerber
|
||||||
@ -39,14 +38,14 @@ outputs:
|
|||||||
- from_output: "gerber-drill"
|
- from_output: "gerber-drill"
|
||||||
dest: /
|
dest: /
|
||||||
|
|
||||||
- name: 'ibom'
|
- name: "ibom"
|
||||||
type: 'ibom'
|
type: "ibom"
|
||||||
comment: "ibom for your convenience"
|
comment: "ibom for your convenience"
|
||||||
dir: kibot
|
dir: kibot
|
||||||
|
|
||||||
- name: 'schematic-pdf'
|
- name: "schematic-pdf"
|
||||||
comment: 'schematic for your convenience'
|
comment: "schematic for your convenience"
|
||||||
type: 'pdf_sch_print'
|
type: "pdf_sch_print"
|
||||||
dir: kibot
|
dir: kibot
|
||||||
|
|
||||||
- name: "production-files"
|
- name: "production-files"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
# This config shows how to handle Python-CI focusing on code quality
|
# This config shows how to handle Python-CI focusing on code quality
|
||||||
# was taken from https://codeberg.org/sail.black/serial-sphinx/src/branch/main/.woodpecker.yml
|
# was taken from https://codeberg.org/sail.black/serial-sphinx/src/branch/main/.woodpecker.yml
|
||||||
# check there for license information
|
# check there for license information
|
||||||
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
standardize:
|
standardize:
|
||||||
image: python:3.9-buster
|
image: python:3.9-buster
|
||||||
@ -32,12 +30,9 @@ steps:
|
|||||||
- python -m pip install -r requirements.txt
|
- python -m pip install -r requirements.txt
|
||||||
- pytest tests/
|
- pytest tests/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
TAG:
|
TAG:
|
||||||
- 3.7
|
- 3.7
|
||||||
- 3.9
|
- 3.9
|
||||||
- 3.8
|
- 3.8
|
||||||
- 3.10
|
- 3.10
|
||||||
|
|
@ -27,7 +27,14 @@ Pull requests are welcome!
|
|||||||
|
|
||||||
## More examples from Codeberg
|
## More examples from Codeberg
|
||||||
|
|
||||||
[https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1](https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1)
|
[Codeberg repos with Woodpecker YAML files](https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1)
|
||||||
|
|
||||||
[1]: https://github.com/GoogleContainerTools/kaniko
|
[1]: https://github.com/GoogleContainerTools/kaniko
|
||||||
[2]: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx
|
[2]: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx
|
||||||
|
|
||||||
|
## How to add a new example
|
||||||
|
|
||||||
|
1. Create a new subdirectory with a descriptive name. Capitalize the first letter.
|
||||||
|
1. If you only add one file: name it `.woodpecker.yaml`. If you want to add multiple files: add a `.woodpecker` directory and use descriptive names for the individual yaml files.
|
||||||
|
1. Add your example to the README table while respecting the alphabetical order.
|
||||||
|
1. Add your new subdirectory to the "woodpecker-cli" step in `.woodpecker.yaml` so it is getting linted over time.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user