---
title: "Setting up checklist for a project"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Setting up checklist for a project}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

Go to `vignette("getting_started", package = "checklist")` when you want to use `checklist` on an R package.

# Starting a new project from scratch

Run `create_project(path, project)`.
`path` must be an existing directory.
`project` is the name of the project.
`create_project()` creates the project as a subdirectory of `path` with name `project`.
It then guides you interactively through the process by asking questions on your preferences on the project.
We recommend to answer yes to all yes/no questions.
Use `setup_project()` when you want to change the settings later.

- You always get an RStudio project with name `project`.
- Do you want version control with git?
  When you answer yes, you get the `check_project` GitHub Action.
  This runs `check_project()` automatically when you (or a contributor) pushed code to GitHub.
    - Do you want a file describing the code of conduct for contributing to your project?
      This is a template which you may alter to suit your needs.
    - Do you want a file describing guidelines for contributing to your project?
      This is a template which you may alter to suit your needs.
- Add a template for `README.md`.
    - Which authors do you want to list?
    - What is the title of the project?
- Do you want to check the file name conventions with `check_filename()`?
- Do you want to check the coding style with `check_lintr()`?
- What is the default language of the project?
- Do you want to spell check the markdown content and R function documentation in your project with `check_spelling()`?
  This uses the default language you set in the previous question.
  Note that you can set a different language on specific files.
  See `vignette("spelling", package = "checklist")` for more details on that.
- Do you want to set a license file?
  This will set the Creative Commons [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license.
  That license allows others to reuse your work provided that you get appropriate credit and they indicate if and which changes they made to your work.
    - Do you want to check the license file?
      This compares the `LICENSE.md` in your project with the `LICENSE.md` as defined in `checklist`.
- Do you want to update the citation files?
  
# Add or update `checklist` tools in an existing project

Run `setup_project(path_to_your_project)`.
This works on existing projects with or without a previous set-up of `checklist`.
In case of a previous set-up, it will take that into account.

- If you don't use version control yet, do you want to activate git?
- Add a `README.md` when missing.
    - Which authors do you want to list?
    - What is the title of the project?
- Do you want to check the file name conventions with `check_filename()`?
- Do you want to check the coding style with `check_lintr()`?
- Do you want to add a license file?
    - Do you want to check the license file if set?
- Do you want to check spelling with `check_spelling()`.
- Do you want to update the citation files?

# To do once after activating version control

- Make sure you have at least one commit.
- Checkout the main branch.
- Login to https://github.com
- Create a new repository without adding a `README`, `.gitignore` and license.
  `checklist` will add those files for you.
- Run the code listed under "...or push an existing repository from the command line" in the command line.
- Go on https://github.com to the "Settings" panel of the repository.
    - General
        - activate "Always suggest updating pull request branches"
        - activate "Automatically delete head branches"
    - Branches
        - Add branch protection rule
            - branch name pattern: `main`
            - activate "Require a pull request before merging"
                - in case a team works on the project consider to activate "Require approvals"
            - activate "Require status checks to pass before merging"
                - search and select "check project with checklist"
                - activate Require "branches to be up to date before merging"
