Skip to content

Commit

Permalink
feat: pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kitanoyoru committed Oct 7, 2023
1 parent 134ba44 commit a2f7693
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ ENV PATH="$PATH:/usr/local/go/bin:$PATH:/home/$USERNAME/go/bin"
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \
go install github.com/twitchtv/twirp/protoc-gen-twirp@latest && \
go install github.com/pressly/goose/v3/cmd/goose@latest
go install github.com/pressly/goose/v3/cmd/goose@latest
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# Git style
- id: check-added-large-files
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: forbid-new-submodules

# Common errors
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: CHANGELOG.md
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-executables-have-shebangs

# Cross platform
- id: check-case-conflict
- id: mixed-line-ending
args: [--fix=lf]

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shfmt
args: ['-l', '-i', '2', '-ci', '-sr', '-w']
- id: shellcheck

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
language_version: python3.11

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.290
hooks:
- id: ruff

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.4
hooks:
- id: terraform_fmt

# # Nedd to enable after fixing Dockerfiles
# # Dockerfile linter

# - repo: https://github.com/hadolint/hadolint
# rev: v2.12.1-beta
# hooks:
# - id: hadolint
# args: [
# '--ignore', 'DL3027', # Do not use apt
# '--ignore', 'DL3007', # Using latest
# '--ignore', 'DL4006', # Not related to alpine
# '--ignore', 'SC1091', # Useless check
# '--ignore', 'SC2015', # Useless check
# '--ignore', 'SC3037', # Not related to alpine
# '--ignore', 'DL3013', # Pin versions in pip
# ]
1 change: 0 additions & 1 deletion apps/auth/config/kita-authservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ messageBroker:
- "broker1"
- "broker2"
- "broker3"

1 change: 0 additions & 1 deletion apps/auth/src/cache/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import aioredis
from aioredis import Redis

from src.config import CacheConfig


Expand Down
3 changes: 1 addition & 2 deletions apps/auth/src/cli/commands/reset_database_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import hydra
from sqlalchemy import text
from sqlalchemy.ext.asyncio import AsyncEngine

from src import database
from src.config import AppConfig, DatabaseConfig
from src.constants import Constants
Expand All @@ -30,7 +29,7 @@ async def _reset_db(db_config: DatabaseConfig):
DROP TABLE IF EXISTS
log,
CASCADE;
"""
)
)
Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/cli/commands/start_server_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging

import hydra

from src.config import AppConfig
from src.constants import Constants
from src.server import Server
Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import httpx
import orjson as json

from src.constants import Constants
from src.errors import CrawlerException

Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import alembic.config
from sqlalchemy import Engine, create_engine
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine

from src.config import DatabaseConfig


Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/database/database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession

from src.crawler import LogModelImport
from src.models.log import LogModel

Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/models/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from sqlalchemy import Boolean, DateTime, Integer, String, func
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

from src.crawler import LogModelImport


Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/proto/auth_service_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from proto import auth_service_pb2 as proto_dot_auth__service__pb2


Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/proto/health_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from proto import health_pb2 as proto_dot_health__pb2


Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import grpc
from omegaconf import OmegaConf

from src.config import AppConfig
from src.constants import Constants
from src.proto import auth_service_pb2_grpc, health_pb2_grpc
Expand Down
1 change: 0 additions & 1 deletion apps/auth/src/services/grpc/health_service/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,3 @@ async def __subscribe__(self) -> asyncio.Event:

async def __unsubscribe__(self, event: asyncio.Event):
self._events.discard(event)

1 change: 0 additions & 1 deletion apps/auth/src/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Any, AsyncGenerator

from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession

from src.crawler import LogModelImport
from src.database.database import Database

Expand Down
2 changes: 1 addition & 1 deletion apps/email/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN go mod tidy
RUN go build -o /bin/emailservice cmd/main.go
RUN rm -rf ${PROJECT_DIR}

FROM alpine:latest
FROM alpine:latest

RUN useradd -m -U -d /home/kitanoyoru kitanoyoru -s /bin/bash

Expand Down
3 changes: 0 additions & 3 deletions apps/email/config/kita-emailservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ tracing:
enable: false
jaeger:
url: jaeger.com



1 change: 0 additions & 1 deletion apps/email/pkg/proto/emailservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ message OrderItem {
bool physical = 2;
int64 nodes = 3;
}

2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# write kitanoyoru/kita/base-builder image
# write kitanoyoru/kita/base-builder image
4 changes: 2 additions & 2 deletions deployment/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ resource "kind_cluster" "default" {
extra_port_mappings {
container_port = 80
host_port = 80
listen_address = "0.0.0.0"
listen_address = "0.0.0.0"
}
extra_port_mappings {
container_port = 443
host_port = 443
listen_address = "0.0.0.0"
listen_address = "0.0.0.0"
}
}

Expand Down

0 comments on commit a2f7693

Please sign in to comment.