2019-03-11 12:52:57 +00:00
|
|
|
# Welcome #
|
|
|
|
|
|
|
|
We're so glad you're thinking about contributing to this open source
|
|
|
|
project! If you're unsure or afraid of anything, just ask or submit
|
|
|
|
the issue or pull request anyway. The worst that can happen is that
|
|
|
|
you'll be politely asked to change something. We appreciate any sort
|
|
|
|
of contribution, and don't want a wall of rules to get in the way of
|
|
|
|
that.
|
|
|
|
|
|
|
|
Before contributing, we encourage you to read our CONTRIBUTING policy
|
2019-06-24 21:17:54 +00:00
|
|
|
(you are here), our [LICENSE](LICENSE), and our [README](README.md),
|
|
|
|
all of which should be in this repository.
|
2019-03-11 12:52:57 +00:00
|
|
|
|
|
|
|
## Issues ##
|
|
|
|
|
|
|
|
If you want to report a bug or request a new feature, the most direct
|
|
|
|
method is to [create an
|
2021-12-15 20:08:11 +00:00
|
|
|
issue](https://github.com/cisagov/log4j-affected-db/issues) in this
|
2019-03-11 12:52:57 +00:00
|
|
|
repository. We recommend that you first search through existing
|
|
|
|
issues (both open and closed) to check if your particular issue has
|
|
|
|
already been reported. If it has then you might want to add a comment
|
|
|
|
to the existing issue. If it hasn't then feel free to create a new
|
|
|
|
one.
|
|
|
|
|
|
|
|
## Pull requests ##
|
|
|
|
|
|
|
|
If you choose to [submit a pull
|
2022-01-11 14:45:19 +00:00
|
|
|
request](https://github.com/cisagov/log4j-affected-db/pulls), you will
|
2019-03-11 12:52:57 +00:00
|
|
|
notice that our continuous integration (CI) system runs a fairly
|
|
|
|
extensive set of linters and syntax checkers. Your pull request may
|
|
|
|
fail these checks, and that's OK. If you want you can stop there and
|
|
|
|
wait for us to make the necessary corrections to ensure your code
|
|
|
|
passes the CI checks.
|
|
|
|
|
|
|
|
If you want to make the changes yourself, or if you want to become a
|
|
|
|
regular contributor, then you will want to set up
|
|
|
|
[pre-commit](https://pre-commit.com/) on your local machine. Once you
|
|
|
|
do that, the CI checks will run locally before you even write your
|
|
|
|
commit message. This speeds up your development cycle considerably.
|
|
|
|
|
|
|
|
### Setting up pre-commit ###
|
|
|
|
|
|
|
|
There are a few ways to do this, but we prefer to use
|
|
|
|
[`pyenv`](https://github.com/pyenv/pyenv) and
|
|
|
|
[`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) to
|
|
|
|
create and manage a Python virtual environment specific to this
|
|
|
|
project.
|
|
|
|
|
|
|
|
#### Installing and using `pyenv` and `pyenv-virtualenv` ####
|
|
|
|
|
2020-06-22 21:13:51 +00:00
|
|
|
On the Mac, we recommend installing [brew](https://brew.sh/). Then
|
|
|
|
installation is as simple as `brew install pyenv pyenv-virtualenv` and
|
|
|
|
adding this to your profile:
|
2019-03-11 12:52:57 +00:00
|
|
|
|
|
|
|
```bash
|
2021-06-01 15:14:31 +00:00
|
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
eval "$(pyenv init --path)"
|
2019-03-11 12:52:57 +00:00
|
|
|
eval "$(pyenv init -)"
|
|
|
|
eval "$(pyenv virtualenv-init -)"
|
|
|
|
```
|
|
|
|
|
2020-02-10 15:39:07 +00:00
|
|
|
For Linux, Windows Subsystem for Linux (WSL), or on the Mac (if you
|
|
|
|
don't want to use `brew`) you can use
|
2019-03-15 02:34:36 +00:00
|
|
|
[pyenv/pyenv-installer](https://github.com/pyenv/pyenv-installer) to
|
2020-02-10 15:39:07 +00:00
|
|
|
install the necessary tools. Before running this ensure that you have
|
|
|
|
installed the prerequisites for your platform according to the
|
|
|
|
[`pyenv` wiki
|
|
|
|
page](https://github.com/pyenv/pyenv/wiki/common-build-problems).
|
|
|
|
|
|
|
|
On WSL you should treat your platform as whatever Linux distribution
|
|
|
|
you've chosen to install.
|
|
|
|
|
|
|
|
Once you have installed `pyenv` you will need to add the following
|
2021-06-01 15:14:31 +00:00
|
|
|
lines to your `.bash_profile` (or `.profile`):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
eval "$(pyenv init --path)"
|
|
|
|
```
|
|
|
|
|
|
|
|
and then add the following lines to your `.bashrc`:
|
2020-02-10 15:39:07 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
eval "$(pyenv init -)"
|
|
|
|
eval "$(pyenv virtualenv-init -)"
|
|
|
|
```
|
|
|
|
|
2021-06-01 15:14:31 +00:00
|
|
|
If you want more information about setting up `pyenv` once installed, please run
|
|
|
|
|
|
|
|
```console
|
|
|
|
pyenv init
|
|
|
|
```
|
|
|
|
|
|
|
|
and
|
|
|
|
|
|
|
|
```console
|
|
|
|
pyenv virtualenv-init
|
|
|
|
```
|
|
|
|
|
|
|
|
for the current configuration instructions.
|
|
|
|
|
2020-02-10 15:39:07 +00:00
|
|
|
If you are using a shell other than `bash` you should follow the
|
|
|
|
instructions that the `pyenv-installer` script outputs.
|
|
|
|
|
|
|
|
You will need to reload your shell for these changes to take effect so
|
|
|
|
you can begin to use `pyenv`.
|
2019-03-11 12:52:57 +00:00
|
|
|
|
|
|
|
For a list of Python versions that are already installed and ready to
|
|
|
|
use with `pyenv`, use the command `pyenv versions`. To see a list of
|
|
|
|
the Python versions available to be installed and used with `pyenv`
|
|
|
|
use the command `pyenv install --list`. You can read more
|
|
|
|
[here](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md) about
|
|
|
|
the many things that `pyenv` can do. See
|
|
|
|
[here](https://github.com/pyenv/pyenv-virtualenv#usage) for the
|
|
|
|
additional capabilities that pyenv-virtualenv adds to the `pyenv`
|
|
|
|
command.
|
|
|
|
|
|
|
|
#### Creating the Python virtual environment ####
|
|
|
|
|
|
|
|
Once `pyenv` and `pyenv-virtualenv` are installed on your system, you
|
|
|
|
can create and configure the Python virtual environment with these
|
|
|
|
commands:
|
|
|
|
|
2019-06-20 19:14:12 +00:00
|
|
|
```console
|
2021-12-15 20:08:11 +00:00
|
|
|
cd log4j-affected-db
|
|
|
|
pyenv virtualenv <python_version_to_use> log4j-affected-db
|
|
|
|
pyenv local log4j-affected-db
|
|
|
|
pip install --upgrade pip setuptools wheel pre-commit
|
2019-03-11 12:52:57 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Installing the pre-commit hook ####
|
|
|
|
|
|
|
|
Now setting up pre-commit is as simple as:
|
|
|
|
|
2019-06-20 19:14:12 +00:00
|
|
|
```console
|
2019-03-11 12:52:57 +00:00
|
|
|
pre-commit install
|
|
|
|
```
|
|
|
|
|
|
|
|
At this point the pre-commit checks will run against any files that
|
|
|
|
you attempt to commit. If you want to run the checks against the
|
|
|
|
entire repo, just execute `pre-commit run --all-files`.
|
|
|
|
|
|
|
|
## Public domain ##
|
|
|
|
|
|
|
|
This project is in the public domain within the United States, and
|
|
|
|
copyright and related rights in the work worldwide are waived through
|
|
|
|
the [CC0 1.0 Universal public domain
|
|
|
|
dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
|
|
|
|
|
|
|
All contributions to this project will be released under the CC0
|
|
|
|
dedication. By submitting a pull request, you are agreeing to comply
|
|
|
|
with this waiver of copyright interest.
|