Skip to content

chore(ci): add lint #767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/content_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Content Validation
on:
push:
paths:
- '.github/workflows/content_validation.yml'
- '_data/en/publications.yml'
- '_data/ru/publications.yml'
- '**/*.md'
- '**/*.md.liquid'
- '**/*.html'
- 'scripts/docs/**'
- ".github/workflows/content_validation.yml"
- "_data/en/publications.yml"
- "_data/ru/publications.yml"
- "**/*.md"
- "**/*.md.liquid"
- "**/*.html"
- "scripts/docs/**"
workflow_dispatch:

env:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint
on:
push:
branches:
- main
paths:
- "Taskfile.yaml"
- ".github/**"
- "bin/**"
- "_data/**"
- "_config*"
- "backend/**"
pull_request:
repository_dispatch:
types: ["Lint"]
workflow_dispatch:

jobs:
lint:
uses: werf/common-ci/.github/workflows/lint.yml@chore/ci/lint
with:
go-version-file-dir: '["backend", "bin/configurator"]'

notification:
name: Notification
needs: lint
if: always()
uses: werf/common-ci/.github/workflows/notification.yml@main
secrets:
loopNotificationGroup: ${{ secrets.LOOP_NOTIFICATION_GROUP }}
webhook: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK }}
notificationChannel: ${{ secrets.LOOP_NOTIFICATION_CHANNEL }}
47 changes: 47 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
run:
timeout: 10m

linters-settings:
gofumpt:
extra-rules: true
gci:
sections:
- standard
- default
- prefix(github.com/werf/)
gocritic:
disabled-checks:
- ifElseChain
errorlint:
comparison: false
asserts: false

linters:
disable-all: true
enable:
# Default linters.
- ineffassign
- typecheck
- unused

# Extra linters.
- asciicheck
- bidichk
- bodyclose
- errname
- errorlint
- exportloopref
- gci
- gocritic
- gofumpt
- misspell
- nolintlint

issues:
# Show all errors.
max-issues-per-linter: 0
max-same-issues: 0

exclude:
# TODO use %w in the future.
- "non-wrapping format verb for fmt.Errorf" # errorlint
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.helm
examples/
werf*.yaml
57 changes: 41 additions & 16 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ tasks:
cp -R bin/configurator/generated/* .

docker:network:create:
desc: 'Create shared docker network werfio-dev to use with werf/website'
desc: "Create shared docker network werfio-dev to use with werf/website"
vars:
NETWORK_NAME: werfio-dev
cmds:
Expand All @@ -109,7 +109,7 @@ tasks:
- docker network inspect {{.NETWORK_NAME}}

compose:up:
desc: 'Run jekyll in werf compose for local development. Use lang=en or lang=ru to run only specified lang. Run task compose:up in werf/werf repository to access documentation.'
desc: "Run jekyll in werf compose for local development. Use lang=en or lang=ru to run only specified lang. Run task compose:up in werf/werf repository to access documentation."
deps:
- docker:network:create
cmds:
Expand All @@ -122,7 +122,7 @@ tasks:
werf compose up jekyll_base backend --dev --docker-compose-command-options="$services front backend" --platform=linux/amd64 || true

compose:down:
desc: 'Stop and clean after werf compose'
desc: "Stop and clean after werf compose"
cmds:
- |
which werf >/dev/null || source $(trdl use werf 2 beta)
Expand All @@ -132,43 +132,43 @@ tasks:
werf compose down

site:check-broken-links:
desc: 'Check docs for broken links.'
desc: "Check docs for broken links."
deps:
- site:check-broken-links:ru
- site:check-broken-links:en

site:check-broken-links:ru:
desc: 'Check ru docs for broken links.'
desc: "Check ru docs for broken links."
cmds:
- |
./scripts/docs/check_broken_links.sh ru

site:check-broken-links:en:
desc: 'Check en docs for broken links.'
desc: "Check en docs for broken links."
cmds:
- |
./scripts/docs/check_broken_links.sh en

site:run-spell-check:
desc: 'Run spell check for all pages.'
desc: "Run spell check for all pages."
deps:
- site:run-spell-check:ru
- site:run-spell-check:en

site:run-spell-check:ru:
desc: 'Run spell check for ru pages. You can specify the path to a specific file with `-- ./path/to/file`'
desc: "Run spell check for ru pages. You can specify the path to a specific file with `-- ./path/to/file`"
cmds:
- |
./scripts/docs/spelling/spell_check.sh ru {{.CLI_ARGS}}

site:run-spell-check:en:
desc: 'Run spell check for en pages. You can specify the path to a specific file with `-- ./path/to/file`'
desc: "Run spell check for en pages. You can specify the path to a specific file with `-- ./path/to/file`"
cmds:
- |
./scripts/docs/spelling/spell_check.sh en {{.CLI_ARGS}}

site:generate-special-dictionary:
desc: 'Generate a dictionary of special terms.'
desc: "Generate a dictionary of special terms."
cmds:
- |
test -f ./scripts/docs/spelling/dictionaries/dev_OPS.dic && rm ./scripts/docs/spelling/dictionaries/dev_OPS.dic
Expand All @@ -178,38 +178,63 @@ tasks:
sort -u -f ./scripts/docs/spelling/wordlist >> ./scripts/docs/spelling/dictionaries/dev_OPS.dic

site:get-words-with-typos:
desc: 'Pulls out a list of all the terms in all pages that were considered a typo'
desc: "Pulls out a list of all the terms in all pages that were considered a typo"
deps:
- site:get-words-with-typos:ru
- site:get-words-with-typos:en

site:get-words-with-typos:ru:
desc: 'Pulls out a list of all the terms in RU pages that were considered a typo'
desc: "Pulls out a list of all the terms in RU pages that were considered a typo"
cmds:
- |
task site:run-spell-check:ru | sed '1,/Checking/ d' | sed '/^$/d' | sed '/Checking/d' | sort -u > spell_log_ru

site:get-words-with-typos:en:
desc: 'Pulls out a list of all the terms in EN pages that were considered a typo'
desc: "Pulls out a list of all the terms in EN pages that were considered a typo"
cmds:
- |
task site:run-spell-check:en | sed '1,/Checking/ d' | sed '/^$/d' | sed '/Checking/d' | sort -u > spell_log_en

site:view-plain-text-of-target-html:en:
desc: 'Displays EN HTML stripped of tags.'
desc: "Displays EN HTML stripped of tags."
cmds:
- |
./scripts/docs/spelling/spell_check.sh en {{.CLI_ARGS}} plain_text

site:view-plain-text-of-target-html:ru:
desc: 'Displays RU HTML stripped of tags.'
desc: "Displays RU HTML stripped of tags."
cmds:
- |
./scripts/docs/spelling/spell_check.sh ru {{.CLI_ARGS}} plain_text

site:view-plain-text-of-target-html:
desc: 'Displays both HTML stripped of tags.'
desc: "Displays both HTML stripped of tags."
cmds:
- |
task site:view-plain-text-of-target-html:en -- {{.CLI_ARGS}}
task site:view-plain-text-of-target-html:ru -- {{.CLI_ARGS}}
deps:install:prettier:
desc: "Install prettier."
cmds:
- npm install -g prettier

deps:install:golangci-lint:
desc: "Install golangci-lint binary."
cmds:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin {{.golangcilintVersion | default "v1.57.1"}}

lint:prettier:
desc: "Check if prettier-formatted."
deps:
- lint:prettier:yaml

lint:prettier:yaml:
desc: "Check if yaml files are prettier-formatted."
cmds:
- prettier -c "**/*.yaml" "**/*.yml"

lint:golangci-lint:
desc: "Lint with golangci-lint"
dir: $PWD
cmds:
- golangci-lint run ./... --config {{.GITHUB_WORKSPACE}}/.golangci.yaml
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ plantuml:

markdown: kramdown
kramdown:
input: GFM
hard_wrap: false
syntax_highlighter: rouge
input: GFM
hard_wrap: false
syntax_highlighter: rouge

timezone: Europe/Moscow
4 changes: 2 additions & 2 deletions _config_dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
liquid:
error_mode : strict
strict_filters : true
error_mode: strict
strict_filters: true
# TODO: enable when the issue (https://github.com/Shopify/liquid/issues/1034) is solved
# strict_variables : true
assets:
Expand Down
2 changes: 1 addition & 1 deletion _data/_common/frameworks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ frameworks:
- name: rails
title: Rails
- name: laravel
title: Laravel
title: Laravel
2 changes: 1 addition & 1 deletion _data/en/breadcrumbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url: /getting_started/сicd
/getting_started/local:
title: Local development
url: /getting_started/local
url: /getting_started/local
5 changes: 4 additions & 1 deletion _data/en/publications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ i18n:
custom_url_btn_title_prefix: "Read on "
youtube_btn_title: "Watch on YouTube"
cloud_yuga_btn_title: "Run lab on CloudYuga"
custom_url_btn_title: "Read more"

articles:
#- title: TITLE
Expand Down Expand Up @@ -66,7 +67,9 @@ articles:
<br><br>
After finishing this tutorial, you will know about the core ideas of GitOps. You will know how to setup an end-to-end GitOps workflow using werf and will be able to deploy applications to different environments (development, production) with a simple commit.</p>
- title: "Werf: Pioneering the Future of CI/CD — A Close Look at the CNCF’s Noteworthy Addition to the DevOps Landscape"
medium_url: "https://itnext.io/werf-pioneering-the-future-of-ci-cd-a-close-look-at-the-cncfs-noteworthy-addition-to-the-b61a7260e0a2"
custom_urls:
- service_name: github.io
url: "https://seifrajhi.github.io/blog/werf-ci-cd-cncf/"
img: "/assets/images/publications/en_110723.jpeg"
created: 2023-07-11
comment: |
Expand Down
2 changes: 1 addition & 1 deletion _data/en/topnav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url: /guides.html
hot: true
- title: About
url: '#'
url: "#"
folderitems:
- title: Publications
url: /publications.html
Expand Down
2 changes: 1 addition & 1 deletion _data/ru/breadcrumbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url: /getting_started/сicd
/getting_started/local:
title: Локальная разработка
url: /getting_started/local
url: /getting_started/local
2 changes: 1 addition & 1 deletion _data/ru/guides/ask_and_star_buttons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
title: Перейти к разделу &quot;Подготовка окружения&quot;
text: Починить/подготовить окружение
class: sidebar-button--environment
icon_class: sidebar__btn-icon_environment
icon_class: sidebar__btn-icon_environment
2 changes: 1 addition & 1 deletion _data/ru/sidebars/guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ entries:
- title: Работа с файлами
url: "200_real_apps/050_s3.html"
- title: Конфигурация и секреты
url: "200_real_apps/080_config.html"
url: "200_real_apps/080_config.html"
- title: Лучшие практики деплоя
url: "300_deployment_practices.html"
sf:
Expand Down
2 changes: 1 addition & 1 deletion _data/ru/topnav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url: /guides.html
hot: true
- title: О проекте
url: '#'
url: "#"
folderitems:
- title: Публикации
url: /publications.html
Expand Down
6 changes: 5 additions & 1 deletion _includes/_common/publications.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ <h2 class="publications-page__title">{{ page.title }}</h2>
{%- endif %}
{%- for custom in publication.custom_urls %}
<a href="{{ custom.url }}" class="publications__btn" target="_blank">
{{ i18n.custom_url_btn_title_prefix }}{{ custom.service_name }}
{%- if custom.service_name != "github.io" %}
{{ i18n.custom_url_btn_title_prefix }}{{ custom.service_name }}
{%- else %}
{{ i18n.custom_url_btn_title }}
{%- endif %}
</a>
{%- endfor -%}
{%- if publication.youtube_url %}
Expand Down
Loading
Loading