Skip to content

Commit

Permalink
Merge branch 'chore/document-config-and-flags'
Browse files Browse the repository at this point in the history
* chore/document-config-and-flags:
  Fix typo
  Document available CLI flags
  Add documentation about the available configuration
  • Loading branch information
thibaudcolas committed Mar 24, 2020
2 parents 68fb68f + a4893cf commit 06afe13
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,61 @@ You need Python 3. Curlylint doesn’t work with Python 2. Install it with
called on your system), then run it with:

```sh
$ curlylint template-directory/
curlylint template-directory/
```

…or:

```sh
$ curlylint some-file.html some-other-file.html
curlylint some-file.html some-other-file.html
```

This is a work in progress. Feel free to contribute :upside_down_face:

### CLI flags

#### `--verbose`

Turns on verbose mode. This makes it easier to troubleshoot what configuration is used, and what files are being linted.

```sh
curlylint --verbose template-directory/
```

#### `--parse-only`

Don’t lint, check for syntax errors and exit.

```sh
curlylint --parse-only template-directory/
```

### Configuration

Curlylint supports defining a config file with the flag `--config`. Here is an [example config](./example_config.py) file with the available options:

```python
# Specify additional Jinja elements which can wrap HTML here. You
# don't need to specify simple elements which can't wrap anything like
# {% extends %} or {% include %}.
# Default: [].
jinja_custom_elements_names = [
('cache', 'endcache'),
('captureas', 'endcaptureas'),
# ('for', 'else', 'empty', 'endfor'),
]

# How many spaces to use when checking indentation.
# Default: 4
indent_size = 4
```

This config file can then be used with:

```sh
curlylint --config example_config.py template-directory/
```

## Usage with [pre-commit](https://pre-commit.com) git hooks framework

Add to your `.pre-commit-config.yaml`:
Expand Down

0 comments on commit 06afe13

Please sign in to comment.