Integrations
Scilo can be run on its own or integrated with other tools for easier consistency across teams.
Git hooks
Git hooks automatically run code when you perform some operation in git, like a commit or a push.
Two useful hooks to consider are the pre-commit and pre-push hooks, which, as the names imply, are run before a commit is made or before commits are pushed to a remote 1.
Git hooks are installed in the .git/hooks/ directory in a repository, which are not synced across copies of the repository.
If you're going to use them, you need to set them up in each repository copy.
You can do this manually or using one of the tools listed below.
Hooks API
In Git v2.54, you can declare hooks via a configuration file.
You can enter this manually, or configure it from the command line.
You can enter this manually, or configure it from the command line.
Manual configuration
To run scilo as a pre-commit hook, create and/or edit the .git/hooks/pre-commit file to include:
Please ensure the file is executable, too.
To run scilo as a pre-push hook, create and/or edit the .git/hooks/pre-push file to include:
Please ensure the file is executable, too.
Pre-commit
pre-commit is a tool to manage git pre-commit hooks within the repository itself.
Install pre-commit using your environment or package manager of choice, then add the following lines to the .pre-commit-config.yaml file in the project's root directory:
repos:
- repo: https://gitlab.com/jrhawley/scilo
rev: v0.3.0
hooks:
- id: lint
If you already have a .pre-commit-config.yaml file with existing hooks and a repo: header, don't duplicate the repos: line.
For example:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks # (1)!
rev: v1.2.3
hooks:
- id: trailing-whitespace
- repo: https://gitlab.com/jrhawley/scilo # (2)!
rev: v0.3.0
hooks:
- id: lint
- This is a
pre-commithook from another repository - This is the
pre-commithook fromscilo
The lint hook runs all configured lints on the project.
If you only want to run a subset of lints, you can list the ids of the selected lints.
For example:
repos:
- repo: https://gitlab.com/jrhawley/scilo
rev: v0.3.0
hooks: # (1)!
- id: root_dirs
- id: root_files
- These hooks will only check for required directories and files in the project root.
Alternatively, you can leave - id: lint alone in .pre-commit-config.yaml and configure which lints run in the configuration file.
Running scilo lint from the terminal or through pre-commit will respect the configuration in the project's scilo.toml file.
Prek
prek is a drop-in replacement of pre-commit, built in Rust with slightly different goals in mind.
If you use prek instead of pre-commit, the above configuration for pre-commit should still work.
Shell completions
Scilo can integrate with your terminal shell of choice, allowing autocompletion when doubled-pressing Tab.
To add scilo completions for supported shells, add the following to your shell's configuration file:
-
See this blog post for concerns about
pre-commithooks and wherepre-pushhooks are preferable. ↩