Codewalker
Description
The Codewalker extension is part of an entire ecosystem that helps software engineers to enforce good practices, prevent bugs, automate code reviews and much more.
OS Support
Currently this extension is only supported on MacOS.
Features
- Automatic config file generation;
- Automatic
pre-commit
hook generation, including Husky compatibility;
- Automatic on save code checks;
- Manually triggered code checks;
- 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
- 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;
- Check if the source code's root folder is correct in the
.codewalker/main.yaml
file. This is the folder in which Codewalker will run it's analysis.
- Press
ctrl/cmd + shift + p
and run the Run Analysis
command and see the magic happening!
- Delete all the unnecessary/undesired rule files under the
.codewalker/rules/*.yaml
pattern.
PS: If you already have a pre-commit
hook configured you'll be shown Codewalker'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 Codewalker 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 Codewalker. 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 .codewalker/scripts
folder. These are auto-generated files that Codewalker needs to properly function.
Cleaning the Environment
Codewalker 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 Codewalker'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
# Codewalker START
to the # Codewalker END
comments and remove the section;
- Save the file.
Developers Guide
Debugging
yarn install
;
yarn watch
;
- Navigate to the debugger's 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 codewalker-x.x.x.vsix file generated.
- To install it simply drag and drop the installer on the extension tab of VSCode.
Enjoy!