You can contribute to secretlint in various ways:
- Reporting issues
- Submitting pull request which fixes known issues, improve documentation, or implement new feature
- Creating an enhancement request or suggestions
- Writing your own rules or plugins
- Writing an article about secretlint on your blog
Although we are accepting pull request, we recommend creating an issue first as it enables us to discuss your proposal before you put significant effort into it.
Please create a new issue on GitHub if you found a bug, got a question, or had an idea for improvement. All work on secretlint happens on GitHub in English.
As described at the ISSUE_TEMPLATE.md
, please include following information when reporting a bug:
- What version of secretlint are you using? (
secretlint -v
) - What file type (Markdown, plain text, etc.) are you using?
- What did you do? Please include the actual source code causing the issue.
- What did you expect to happen?
- What actually happened? Please include the actual, raw output from secretlint. (
secretlint --debug <options> ...
)
Creating a new repository that can reproduce the issue helps us understand your situation. This repository for example.
Here you can see how to get the source of secretlint, build it, and run tests locally. We use GitHub Flow as development workflow.
If you want to contribute to secretlint, please check issues labeled good first issue
. These issues are suitable for your first contribution.
Please install following development prerequisites. You also need a GitHub account for contribution.
Forking a repository allows you to work with secretlint codebase without special permission to the secretlint repository itself.
-
Navigate to secretlint repository
-
In the top–right corner of the page, click Fork button
-
Create a clone of the fork locally in your terminal:
$ git clone --recursive https://github.com/YOUR_ACCOUNT/secretlint YOUR_FORKED_REPOSITORY
See Fork A Repo: GitHub Help for further detail.
After getting your clone, you can start playing with secretlint.
-
Change directory to your clone:
$ cd YOUR_FORKED_REPOSITORY
-
Install dependencies and build packages:
$ yarn install
-
Run build:
$ yarn run build
Under the hood, secretlint uses Lerna to manage multiple packages:
packages/*
packages/@secretlint/*
examples/*
If you are new to Lerna, it seems to add another layer of complexity but it's simpler than you think; you can edit codes, run tests, commit changes, etc. as usual in most cases.
Note that yarn install
also builds a codebase, you can manually build by running yarn run build
.
Before adding changes to your clone, please create a new branch (typically called feature branch). Changes made to feature branch don't affect or corrupt master
branch so you will feel safe. In Git, creating a branch is easy and fast:
$ git checkout -b your-new-feature
You have your feature branch with working secretlint then it's time to start making changes! Edit codes with text editor of your choice and add commits as you work on. Please don't forget to add or modify test cases and documents according to your changes.
While working with your idea, please use:
- TypeScript for new codes and tests
- GitHub flavored Markdown for documentation
We are migrating entire codes to TypeScript.
This repository uses Prettier for code formatter. We use lint-staged
and husky
to make coding style consistent before commit, but if you have your own Git hooks locally, these setup doesn't work. In such case, please run Prettier manually as below after making changes.
-
Run Prettier to reformat code:
$ yarn prettier
We use Angular Convention for commit message.
In order to make repository history clean, please use the following guideline as possible as you can. It also enables us creating comprehensive changelog semi–automatically.
component commit title
commit type / /
\ | |
feat(rule-context): add template url parameter to events
(a blank line)
body -> The `src` (i.e. the url of the template to load) is now provided to the
`$includeContentRequested`, `$includeContentLoaded` and `$includeContentError`
events.
referenced -> Closes #8453
issues Ref. #8454
- commit type:
docs
: create or update documentfeat
: add new featurefix
: fix a bugstyle
: change formattingperf
: performance related changetest
: update on testschore
: house–keepingrefactor
: refactoring related change
- component: package or file name
- commit title:
- Limit to 50 characters including commit type and component (as possible as you can)
- Do not capitalize first character
- Do not end with a period
- Use imperative mood, in present tense; commit title should always be able to complete the following sentence:
- If applied, this commit will commit title here
- body:
- Separate from subject with a blank line
- Wrap texts at 72 characters
- Explain what and why, not how
- GitHub flavored Markdown is ok to use
- Start with
BREAKING CHANGE:
when you made significant change in the commit (see versioning section below).
Example commit message:
test(formatter): check types while testing
- Add strict type check option to `ts-node` to make sure future
interface changes will be took into account while running test.
- Update test case for interface changes made at #430.
Closes #448.
Please see Commit Message Format and How to Write a Git Commit Message for detail.
We care version number while releasing packages to npm registry so you should not modify version
field of package.json
. For the record, we use Semantic Versioning.
- Patch release (intended to not break your lint build)
- A bug fix to the CLI or core (including formatters)
- Improvements to documentation
- Non-user-facing changes such as refactoring
- Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone)
- Minor release (might break your lint build)
- A new option
- An existing rule is deprecated
- A new CLI capability is created
- New public API are added (new classes, new methods, new arguments to existing methods, etc.)
- It might break type interface(
.d.ts
)
- It might break type interface(
- A new formatter is created
- Major release (break your lint build)
- A new option to an existing rule that results in Secretlint reporting more errors by default
- An existing formatter is removed
- Part of the public API is removed or changed in an incompatible way
We have some type of tests. You should run at least unit test before submitting a pull request.
All tests should be run at the top directory of your fork.
Run tests for all packages:
$ yarn test
While developing, it would be good to run package level unit test since it will run faster:
$ cd packages/PACKAGE
$ yarn test
We have much Snapshot testings. This test is same with Jest's Snapshot Testing.
You can update snapshot's output via following command:
# Root(all)
$ yarn run updateSnapshot
# Package
$ cd packages/PACKAGE
$ yarn run updateSnapshot
After finishing your changes and unit tests or documentation test ran fine, you can push your feature branch to GitHub. Please see GitHub Help for detail but typically, run git push
at your terminal.
$ git push origin feature-branch
Then follow another GitHub Help to create a pull request.
Once a pull request has been created, it will initiate continuous integration builds and we can work on your changes. You can push additional commits to your fork according to feedback.
After all participants on pull request are satisfied to the changes, we will merge your code into the secretlint master branch. Yay!
Secretlint has a continuous benchmark:
A Maintainer release new version of secretlint by following way.
- Checkout release branch
# checkout release branch like "release/2019-10-10"
git checkout -b "release/$(date '+%Y-%m-%d')"
- Version up and Update CHANGELOG
# bump vesrion and update changelog
npm run versionup
## Also, availble npm run versionup:{patch,minor,major}
# push the changes to release branch
git push origin HEAD -u
- Create a Pull Request and Review the release
- If you need, write blog posts in website/blog
- Merge the Pull Request
Finally, GitHub Actions(CI) publish it as new version automatically.