/zaplint

Primary LanguageGoApache License 2.0Apache-2.0

zaplint

GitHub Actions Workflow Status Codecov GitHub License

zaplint is a Go static analysis tool that ensures consistent code style when using the zap logging library.

Features

  • Enforce capitalized log messages.
  • Enforce replacing zap.Any with the appropriate type.
  • Enforce a single key naming convention: snake_case, kebab-case, camelCase, or PascalCase.
  • Exclude specified files or patterns from analysis.

Installation

To install zaplint, use the following command:

go get github.com/rleungx/zaplint

Usage

You can run zaplint through the following command:

zaplint -key-naming-convention kebab -capitalized-message true -replace-any true ./...

Configuration

You can configure zaplint using the following flags:

  • -capitalized-message: Enforce capitalized log messages.
  • -replace-any: Enforce replacing zap.Any with the appropriate type.
  • -key-naming-convention: Enforce a single key naming convention (snake|kebab|camel|pascal).
  • -exclude-files: Exclude files matching the given patterns (comma-separated).

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.