Codewall
Description
The Codewall extension is part of an entire ecosystem that helps software engineers to enforce good practices, prevent bugs, automate code reviews and much more.
Disclaimer
This extension was developed as part of the Platform Builders' code quality toolkit. It directly depends on you internal Notion API and cannot be used outside of the company's ecosystem.
OS Support
Currently this extension is only supported on MacOS.
Features
- Automatic config file generation;
- Automatic rule sync.
- Automatic
pre-commit
hook generation, including Husky compatibility;
- Automatic on save code checks;
- Manually triggered code checks;
- Manually triggered rule syncs;
- Automatic environment cleaning (only when
cliMode=docker
).
Setting Up the Environment
Running on Docker (The cleaner approach)
- Install Docker
PS: (Linux users need to enable Docker without sudo);
- Make sure Docker is running.
- Restart your VSCode instance.
- Install Homebrew;
- Run
brew install semgrep
.
- Restart your VSCode instance.
Setting Up your Project
- Make sure your project's configuration is set on Notion.
- Press
ctrl/cmd + shift + p
and run the Generate Config Files
command. The command will guide you during the configuration steps, as well as create a pre-commit
hook that will ensure code conformity before every commit;
- Add
.codewall
to your project's .gitignore
.
- Check if the source code's root folder is correct in the
.codewall/main.yaml
file. This is the folder in which Codewall will run it's analysis.
- Press
ctrl/cmd + shift + p
and run the Run Analysis
command and see the magic happening!
PS: If you already have a pre-commit
hook configured you'll be shown Codewall's pre-commit
hook script and prompted to place it in the .git/hooks/pre-commit
file appropriately. Be aware that without this script nothing will stop undesired code from getting into the codebase.
At this point Codewall should appear on VSCode's statusbar as well as running realtime checks. If that doesn't happen this may be because you have too much indicators running leaving no space for Codewall. If you believe this isn't the case make sure to open an issue with as much evidence as possible.
ATTENTION: You should not touch any files in the .codewall/scripts
folder. These are auto-generated files that Codewall needs to properly function.
Cleaning the Environment
Codewall has a pretty handy command called Clean Environment
that removes all Docker related residues and gives you instructions about how to remove the pre-commit
hook and prevent errors.
ATTENTION: You may run into some errors when committing if if you fail to remove the Codewall's related code from the pre-commit
hook. To do so follow the instructions bellow:
- Open the
.git/hooks/pre-commit
file;
- Select from the
# Codewall START
to the # Codewall END
comments and remove the section;
- Save the file.
Developers Guide
Debugging
yarn install
;
yarn watch
;
- Navigate to the debugging section of VSCode and hit the
Start Debugging
button for the Run Extension
task.
- Set up your breakpoints and voilà! You're now debugging.
Installer and Installation
- Run
yarn package
;
- Navigate to the root folder;
- Check on the codewall-x.x.x.vsix file generated.
- To install it simply drag and drop the installer on the extension tab of VSCode.
Enjoy!