-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(lint): add pre-commit linting setup #573
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bf8f227
feat(lint): use `pre-commit` to orchestrate linting
rriski dce99bc
chore(lint): fix `trailing-whitespace`
rriski a5416aa
chore(lint): fix `end-of-file-fixer`
rriski 11a307f
chore(lint): fix `yamlfix`
rriski 7692faf
chore(lint): fix `markdownlint`
rriski c0b85b1
chore(lint): fix `codespell`
rriski e0480a4
chore(lint): fix 'postgresSQL' -> 'postgreSQL'
rriski 03dead3
chore(lint): remove deprecated linters
rriski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
aiven/aiven-charts: | ||
- source: charts/aiven-operator/ | ||
dest: charts/aiven-operator/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
--- | ||
name: lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
branches: [main] | ||
pull_request: | ||
branches: | ||
- main | ||
branches: [main] | ||
|
||
jobs: | ||
commitlint: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: wagoid/commitlint-github-action@v5 | ||
golang_ci_linter: | ||
name: golang_ci_linter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
go-version: 1.21.x | ||
- name: Install dependencies | ||
run: go get . | ||
- uses: pre-commit/[email protected] | ||
codeql_analysis: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
--- | ||
name: pages | ||
|
||
on: | ||
workflow_dispatch: {} | ||
push: | ||
tags: | ||
- v* | ||
tags: [v*] | ||
|
||
jobs: | ||
release_pages: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// mkdocs code blocks inside admonitions trip this rule | ||
"code-block-style": false, | ||
// allow inline html | ||
"no-inline-html": false, | ||
// allow using **emphasis** as heading | ||
"no-emphasis-as-heading": false, | ||
// don't care about line length | ||
"line-length": false, | ||
// mkdocs admonitions and links aren't supported https://github.com/DavidAnson/markdownlint/issues/207 | ||
"link-fragments": false, | ||
// mkdocs renders link titles from YAML frontmatter and renders the content | ||
// title from the first title specified with "#" | ||
"single-title": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: mixed-line-ending | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: fix-byte-order-marker | ||
- id: pretty-format-json | ||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook | ||
rev: v9.10.0 | ||
hooks: | ||
- id: commitlint | ||
stages: [commit-msg] | ||
additional_dependencies: ['@commitlint/config-conventional'] | ||
- repo: https://github.com/lyz-code/yamlfix | ||
rev: 1.16.0 | ||
hooks: | ||
- id: yamlfix | ||
exclude: | | ||
(?x)^( | ||
charts/(aiven-operator|aiven-operator-crds)/templates/.*.yaml| | ||
charts/aiven-operator-crds/values.yaml | ||
)$ | ||
args: [--config-file, yamlfix.toml] | ||
- repo: https://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.38.0 | ||
hooks: | ||
- id: markdownlint | ||
args: [--fix] | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
- repo: https://github.com/golangci/golangci-lint | ||
rev: v1.55.2 | ||
hooks: | ||
- id: golangci-lint-full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ representative at an online or offline event. | |
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported to the community leaders responsible for enforcement at | ||
[email protected]. | ||
<[email protected]>. | ||
All complaints will be reviewed and investigated promptly and fairly. | ||
|
||
All community leaders are obligated to respect the privacy and security of the | ||
|
@@ -116,13 +116,13 @@ the community. | |
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
version 2.0, available at | ||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. | ||
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>. | ||
|
||
Community Impact Guidelines were inspired by [Mozilla's code of conduct | ||
enforcement ladder](https://github.com/mozilla/diversity). | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see the FAQ at | ||
https://www.contributor-covenant.org/faq. Translations are available at | ||
https://www.contributor-covenant.org/translations. | ||
<https://www.contributor-covenant.org/faq>. Translations are available at | ||
<https://www.contributor-covenant.org/translations>. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't how YAML should start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact it is, see section 2.2 of the YAML specification: https://yaml.org/spec/1.2.2/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only mandatory to have them if you use directives in the YAML document. Directives are optional for usage, please see section 3.2.3.4 of the YAML specification. Please see examples in section 6.8.1 to have a better understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed its not mandatory and we can choose to leave it out. But stating "this isn't how YAML should start" isn't constructive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we choose not to, then we also need to add directives. I think leaving it out is the best option, WDYT?