properorder is a static analysis tool for Go code that checks the correctness of the order of certain constructs in the code. It helps developers maintain consistency and adherence to coding style guidelines.
- Analyzes the declaration order of elements in code (types, functions, methods).
- Detects violations of recommended Go style guides.
- Can be used as a standalone tool or integrated into a CI/CD pipeline.
Before installing, make sure you have Go installed (version 1.18 or higher):
go versionTo install properorder, run the following commands:
git clone https://github.com/akrovv/properorder.git
cd properorder
make installTo check code across the entire project, run:
./golangci -c config.yml run ./...To analyze a specific file:
./golangci -c config.yml run file.goThe project consists of several key components:
cmd/tppcs/main.go– the main entry point that implements the CLI logic.analyzers/properorder/– the analyzer implementation, containing the main rules and logic.analyzers/properorder/testdata/– test files for rule validation.plugin/– code for the plugin that allows integration with IDEs or other environments.internal/tests/– unit and integration tests for verifying analyzer functionality.Makefile– includes commands for building, testing, and installing the project.
If you’d like to contribute to properorder, follow these steps:
- Fork the repository and create a new branch.
- Make your changes and add tests if necessary.
- Open a Pull Request describing your changes.
Any contributions in the form of suggestions, bug reports, and improvements are welcome!
If you have questions or suggestions, feel free to open an issue in the repository.