Skip to content
Merged
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
12 changes: 1 addition & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,17 @@ run:
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- gofmt
- goimports

linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/ajitpratap0/GoSQLX

issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck

- path: examples/
linters:
- errcheck
Expand Down
138 changes: 138 additions & 0 deletions .gosqlx.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# GoSQLX Configuration File Example
# Copy this file to .gosqlx.yml and customize for your needs
#
# Configuration file precedence:
# 1. Current directory: .gosqlx.yml
# 2. Home directory: ~/.gosqlx.yml
# 3. System: /etc/gosqlx.yml
#
# CLI flags always override configuration file settings

# Format Configuration
# Controls SQL formatting behavior
format:
# Indentation size in spaces (0-8)
# Default: 2
indent: 2

# Uppercase SQL keywords (SELECT, FROM, WHERE, etc.)
# Default: true
uppercase_keywords: true

# Maximum line length for formatting
# Default: 80
max_line_length: 80

# Compact format (minimal whitespace)
# Default: false
compact: false

# Validate Configuration
# Controls SQL validation behavior
validate:
# SQL dialect: postgresql, mysql, sqlserver, oracle, sqlite, generic
# Default: postgresql
dialect: postgresql

# Enable strict validation mode (more rigorous checks)
# Default: false
strict_mode: false

# Recursively process directories
# Default: false
recursive: false

# File pattern for recursive processing
# Default: *.sql
pattern: "*.sql"

# Output Configuration
# Controls output formatting and verbosity
output:
# Output format: json, yaml, table, tree, auto
# Default: auto
format: auto

# Enable verbose output
# Default: false
verbose: false

# Analyze Configuration
# Controls SQL analysis behavior
analyze:
# Enable security vulnerability analysis
# Default: true
security: true

# Enable performance optimization analysis
# Default: true
performance: true

# Enable complexity metrics analysis
# Default: true
complexity: true

# Enable comprehensive analysis (all categories)
# Default: false
all: false

# Example Configurations for Different Use Cases:

# Development Configuration:
# format:
# indent: 2
# uppercase_keywords: true
# max_line_length: 100
# validate:
# dialect: postgresql
# strict_mode: false
# output:
# format: table
# verbose: true
# analyze:
# security: true
# performance: true
# complexity: true

# CI/CD Configuration:
# format:
# indent: 2
# uppercase_keywords: true
# max_line_length: 80
# validate:
# dialect: postgresql
# strict_mode: true
# output:
# format: json
# verbose: false
# analyze:
# all: true

# Compact Style Configuration:
# format:
# indent: 0
# uppercase_keywords: false
# max_line_length: 120
# compact: true
# validate:
# dialect: generic
# output:
# format: auto

# Enterprise Configuration (MySQL):
# format:
# indent: 4
# uppercase_keywords: true
# max_line_length: 120
# validate:
# dialect: mysql
# strict_mode: true
# recursive: true
# pattern: "*.mysql"
# output:
# format: json
# verbose: false
# analyze:
# security: true
# performance: true
# complexity: true
83 changes: 83 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Pre-commit hooks configuration for GoSQLX
# This file provides standardized hook configuration for the pre-commit framework
# To use with the pre-commit tool (https://pre-commit.com/):
# pip install pre-commit
# pre-commit install
#
# For native Git hooks, use: ./scripts/install-hooks.sh

repos:
# Go formatting check
- repo: local
hooks:
- id: go-fmt
name: go fmt
entry: gofmt
args: [-w, -l]
language: system
files: \.go$
description: Run go fmt to format Go code

# Go static analysis
- repo: local
hooks:
- id: go-vet
name: go vet
entry: go vet
args: [./...]
language: system
files: \.go$
pass_filenames: false
description: Run go vet for static analysis

# Go tests (short mode for pre-commit)
- repo: local
hooks:
- id: go-test-short
name: go test (short)
entry: go test
args: [-short, ./...]
language: system
files: \.go$
pass_filenames: false
description: Run Go tests in short mode

# Optional: Go imports formatting (requires goimports)
# Uncomment if you have goimports installed
# - repo: local
# hooks:
# - id: go-imports
# name: goimports
# entry: goimports
# args: [-w, -local, github.com/ajitpratap0/GoSQLX]
# language: system
# files: \.go$
# description: Run goimports to format imports

# Optional: Go linting (requires golangci-lint)
# Uncomment if you have golangci-lint installed
# - repo: local
# hooks:
# - id: golangci-lint
# name: golangci-lint
# entry: golangci-lint run
# language: system
# files: \.go$
# pass_filenames: false
# description: Run golangci-lint for comprehensive linting

# Trailing whitespace check
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: [--maxkb=1000]
- id: check-merge-conflict

# Configuration
default_stages: [commit]
fail_fast: false
Loading
Loading