Skip to content

sgammon/codeclimate-protobuf

Repository files navigation

protolint CircleCI Build Status Code Climate Test Coverage Issue Count

support for protobuf in CodeClimate

  • Latest Release: v1.1.4
  • protoc Version: v3.4.1

This tool wraps protoc-gen-lint to generate improvement suggestions for your .protos. It then outputs those items in CodeClimate's JSON format, so it can be used as a CodeClimate Engine.

Configuration

There is a custom configuration entry - protopaths - that lets you specify -I/--protos_path= flags to the protoc compiler. If your .proto files use import "..."; directives, you probably need this. Here's how you do it:

engines:
  protolint:
    enabled: true
    config:
      protopaths:
        - sources/models/pathone
        - sources/models/pathtwo

How it works

It's a Python module called protolint, with a module-level run file (__main__.py). It can be executed via any of the following methods:

Via the local bash script:

./protolint.sh <args...>

Via the virtualenv:

./activate && protolint <args...>

After installing globally, you can additionally execute it via:

Global module in Python:

python -m protolint <args...>

CLI tool:

protolint <args...>

The tool should output messages to stderr and JSON-formatted issues to stdout.