Skip to content
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

chore: lint code & non-code files #182

Merged
merged 9 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# Scripts and tools
./scripts
Makefile
PULL_REQUEST_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
32 changes: 23 additions & 9 deletions .github/ISSUE_TEMPLATE/general-purpose.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
Your issue may already be reported!
Please search on the [issue tracker](https://github.com/elixir-cloud-aai/TESK/issues) before creating one.
Your issue may already be reported! Please search on the
[issue tracker](https://github.com/elixir-cloud-aai/TESK/issues) before creating
one.

## Expected Behavior

<!--- If you're describing a bug, tell us what should happen -->

<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior

<!--- If describing a bug, tell us what happens instead of the expected behavior -->

<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)

<!--- Provide a link to a live example, or an unambiguous set of steps to -->

<!--- reproduce this bug. Include code to reproduce, if relevant -->

1.
1.
1.
1.
2.
3.
4.

## Context

<!--- How has this issue affected you? What are you trying to accomplish? -->

<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment

<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Browser Name and version:
* Operating System and version (desktop or mobile):
* Link to your project:

- Version used:
- Browser Name and version:
- Operating System and version (desktop or mobile):
- Link to your project:
9 changes: 5 additions & 4 deletions .github/workflows/build_and_publish_charts.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
JaeAeich marked this conversation as resolved.
Show resolved Hide resolved
name: Build and Publish Helm Charts

on:
Expand All @@ -18,12 +19,12 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Create k3s Cluster
uses: debianmaster/[email protected]
with:
version: 'latest'

- name: Create namespace
run: kubectl create ns tesk

Expand Down Expand Up @@ -67,12 +68,12 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Run chart-releaser
uses: helm/[email protected]
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_and_publish_filer.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Build and Publish Filer

on:
push:
branches: [ 'testing-gh-action' ]
tags: [ '*' ]
branches: ['testing-gh-action']
tags: ['*']

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -38,7 +39,7 @@ jobs:
with:
images: |
elixircloud/${{ github.workflow }}

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
Expand All @@ -47,4 +48,3 @@ jobs:
file: ./deployment/containers/filer.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

8 changes: 4 additions & 4 deletions .github/workflows/build_and_publish_taskmaster.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Build and Publish Taskmaster

on:
push:
branches: [ 'testing-gh-action' ]
tags: [ '*' ]
branches: ['testing-gh-action']
tags: ['*']

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -37,7 +38,7 @@ jobs:
with:
images: |
elixircloud/${{ github.workflow }}

- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
Expand All @@ -46,4 +47,3 @@ jobs:
file: ./deployment/containers/taskmaster.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

3 changes: 2 additions & 1 deletion .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Code Quality

on:
Expand Down Expand Up @@ -99,4 +100,4 @@ jobs:
run: poetry install --only=lint --no-interaction --no-root

- name: Check spellings
run: poetry run typos .
run: poetry run typos .
7 changes: 6 additions & 1 deletion .github/workflows/code_test_unit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Code Test Unit

on:
Expand Down Expand Up @@ -30,7 +31,11 @@ jobs:
run: poetry install --only=test --no-interaction

- name: Run tests and generate coverage as test_unit.xml
run: poetry run pytest --cov-report term --cov-report xml:test_unit.xml --cov=tests/test_unit
run: |
poetry run pytest \
--cov-report term \
--cov-report xml:test_unit.xml \
--cov=tests/test_unit

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/validation_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: PR Evaluation

on:
Expand All @@ -6,10 +7,11 @@ on:
branches: ['main']

jobs:
semantic_pr:
semantic_pr:
name: Semantic PR title
runs-on: ubuntu-latest
if: ${{ github.event.action != 'edited' || github.event.changes.title != null }}
if: ${{ github.event.action != 'edited' ||
github.event.changes.title != null }}
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
Expand All @@ -31,7 +33,8 @@ jobs:
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character & not have more than 50 characters.
doesn't start with an uppercase character & not have more than 50
characters.

detect-unresolved-conflicts:
name: Detect unresolved merge conflicts
Expand All @@ -41,5 +44,9 @@ jobs:
- uses: actions/checkout@v3
- name: List files with merge conflict markers
run: git --no-pager grep "<<<<<<<" ":(exclude).github/" || true
- name: Fail or succeed job if any files with merge conflict markers have been checked in
- name: Fail or succeed job if any files with merge conflict markers
run: exit $(git grep "<<<<<<<" ":(exclude).github/" | wc --lines)

# TODO: Add when cache PR is merged
# pre-commit:
# name: Pre-commit checks
1 change: 1 addition & 0 deletions .github/workflows/vulnerabilities.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Vulnerability Test

on:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ poetry.toml
# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/python
# End of https://www.toptal.com/developers/gitignore/api/python
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
JaeAeich marked this conversation as resolved.
Show resolved Hide resolved
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# Common commands:
# pre-commit install
# pre-commit autoupdate
# pre-commit run --all-files --hook-stage commit
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-builtin-literals
- id: check-added-large-files
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
exclude: |
(?x)^(
deployment/charts/tesk/templates/.*\.yaml|deployment/charts/tesk/tls_secret_name\.yml-TEMPLATE
)$
- id: double-quote-string-fixer
- id: fix-byte-order-marker
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=auto]
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
hooks:
- id: ruff
- id: ruff-format
args: [--check]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-config
- mdformat-black
- mdformat-frontmatter
args: [--wrap=80]
# exclude: _.+\.md|CHANGELOG\.md # Add when changelog is implemented
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
exclude: ^deployment/charts
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix
args: [--in-place, --all, --trailing-comma-inline-array]
exclude: poetry\.lock
21 changes: 10 additions & 11 deletions .safety-policy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: '3.0'

scanning-settings:
Expand All @@ -9,15 +10,15 @@ scanning-settings:

security:
ignore-vulnerabilities:
65213:
reason: 'Fix is downgrading the pyopenssl package to 21.0.0, doing that breaks all the test.'
expires: '2025-5-18'
67599:
reason: 'No fix available.'
expires: '2025-5-18'
70612:
reason: 'No fix available.'
expires: '2025-5-18'
65213:
reason: 'Need the pyopenssl== 21.0.0, which breaks the test.'
expires: '2025-5-18'
67599:
reason: 'No fix available.'
expires: '2025-5-18'
70612:
reason: 'No fix available.'
expires: '2025-5-18'

report:
dependency-vulnerabilities:
Expand All @@ -28,7 +29,6 @@ report:
unpinned-requirements: true
cvss-severity: []


fail-scan-with-exit-code:
dependency-vulnerabilities:
enabled: true
Expand All @@ -46,4 +46,3 @@ security-updates:
dependency-vulnerabilities:
auto-security-updates-limit:
- patch

10 changes: 10 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
extends: default

ignore: |
^deployment/charts

rules:
document-start:
level: error
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ run-service:
exit 1; \
fi

.PHONY: clean-service-image
.PHONY: clean-service-image
clean-service-image:
@if [ -x "$(BUILDAH_CMD)" ]; then \
if $(BUILDAH_CMD) inspect $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG) > /dev/null 2>&1; then \
Expand Down
Loading
Loading