Overview
CodeLingo finds and fixes issues in existing code and ensures the same issues don't sneak in with new pull requests. CodeLingo also generates your contributor docs thus automating three cornerstones (bug fixing, reviewing and doc updates) to scale up your code quality.
@CodeLingoBot Quick Start
@CodeLingoBot fixes bugs, automates code reviews and updates contributor docs for repos on GitHub based on rules, called Tenets, defined in codelingo.yaml files. There are several ways you can interact with @CodeLingoBot. The simplest is to trigger actions by commenting on a Pull Request:
-
@CodeLingoBot review
reviews the PR based on default Tenets for the repo's language or custom Tenets added in a codelingo.yaml file in the root of the repo. You can trigger CodeLingo actions by replying to comments generated by@review
@CodeLingoBot review ignore [reason]
ignores the issue for current and future reviews with an optional reason why.@CodeLingoBot review un-ignore
un-ignores the issue for current and future reviews.
-
@CodeLingoBot rewrite
makes a PR to this PR fixing the issues found based on default Tenets for the repo's language or custom Tenets added in a codelingo.yaml file in the root of the repo. You can trigger CodeLingo actions by replying to comments generated by@rewrite
@CodeLingoBot rewrite set <varname>
sets the value of a variable in a rewrite template.
To have @CodeLingoBot automatically review every new Pull Request to your repo, install CodeLingo on your repo. If you don't already have a codelingo.yaml file, @CodeLingoBot will make a PR to add one to your repo. This will contain a bundle of Tenets based on the languages in your repo.
Every pull request to your repository will now be checked against the go Tenet bundle we imported above:
Editing codelingo.yaml
Let @CodeLingoBot know what Tenets you'd like it to enforce by adding or removing them from codelingo.yaml. You can find Tenets to add here: https://www.codelingo.io/tenets. For example, if we wanted to install the "go" bundle written by "codelingo" we'd update the codelingo.yaml as follows:
# codelingo.yaml file
tenets:
- import: codelingo/go
Power Users!
The rest of this README is for users interested in writing their own Tenets and testing out CodeLingo on repositories on their local machine.
Contributing a Tenet or Tenet Bundle
The Tenet bundles that are rendered on codelingo.io/tenets are populated by the Tenets in the tenets directory in this repository. Contributing a new Tenet is simply a matter of making a PR to this repo. We're a young community of Tenet authors eager to help and guide you through your first PR.
Get started with the docs and find us at codelingo.slack.com!
Writing a Tenet
Playground
Each Tenet has a query
, written in CLQL, to match a pattern. The online playground is a quick way to test and learn CLQL. It has a box of source code next to a box of CLQL. Select the source code and the playground will automatically generate the CLQL to match that selection!
Setting up CodeLingo on your Dev Box
Before we get into writing Tenets, we want to ensure we can run and test them locally. For this, we're going to use the lingo CLI tool to run a review on our local machine. First, install the lingo CLI and set it up with the following commands:
# Run this command from anywhere. Follow the prompts to set up Codelingo on your machine.
$ lingo config setup
# Run this command inside a git repository to add a default codelingo.yaml file in the current directory.
$ lingo init
Replace the content of the codelingo.yaml file we wrote above with:
tenets:
- import: codelingo/go
You can now run the review to check your source code against the go Tenet bundle we imported above.
# Run this command from the same directory as the codelingo.yaml file or any of its sub directories.
$ lingo run review
Next Steps
You now have the tools setup to start writing your own Tenets! See the getting started guide to learn more about Tenets and how to write them.
Resources
Community
Learn
- codelingo.io/playground - Write, automatically generate and run Tenets and Flows online.
- codelingo.io/docs - Learn to write (and automatically generate!) Tenets and compose Flows.
Repos
- github.com/codelingo/lingo - CLI client for Codelingo.
- github.com/codelingo/ideplugins - Run Flows directly in your IDE (Note: WIP).
About Us
We are a small VC backed development team from ? New Zealand with a passion for the art of software development in itself!
Check out our team here: codelingo.io/about.