Skip to content

Commit

Permalink
docs: table of supported file types (implemented and planned) (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Apr 12, 2021
1 parent cca099a commit ab6faca
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Expand Up @@ -8,7 +8,7 @@ Fixes # .

## Checklist

- [ ] Read the [contribution guidelines](https://nitpick.readthedocs.io/en/latest/contributing.html)
- [ ] Read the [contribution guidelines](https://nitpick.rtfd.io/en/latest/contributing.html)
- [ ] Run `make` locally before pushing commits
- [ ] Add tests for:
- [ ] API
Expand Down
80 changes: 66 additions & 14 deletions README.md
Expand Up @@ -13,12 +13,12 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/andreoliwa/nitpick/develop.svg)](https://results.pre-commit.ci/latest/github/andreoliwa/nitpick/develop)

Command-line tool and `flake8` plugin to enforce the same settings across multiple language-independent projects.
Command-line tool and [flake8](https://github.com/PyCQA/flake8) plugin to enforce the same settings across multiple language-independent projects.

Useful if you maintain multiple projects and are tired of copying/pasting the same INI/TOML/YAML/JSON keys and values over and over, in all of them.

The tool now has an "apply" feature that modifies configuration files directly (pretty much like `black` and `isort` do with Python files).
See the [CLI docs for more info](https://nitpick.readthedocs.io/en/latest/cli.html).
The tool now has an "apply" feature that modifies configuration files directly (pretty much like [black](https://github.com/psf/black) and [isort](https://github.com/PyCQA/isort) do with Python files).
See the [CLI docs for more info](https://nitpick.rtfd.io/en/latest/cli.html).

Many more features are planned for the future, check [the roadmap](https://github.com/andreoliwa/nitpick/projects/1).

Expand Down Expand Up @@ -54,26 +54,78 @@ This style will assert that:
- ... [flake8](https://github.com/PyCQA/flake8) and [isort](https://github.com/PyCQA/isort) are configured as above in `setup.cfg`;
- ... [Pylint](https://www.pylint.org) is present as a [Poetry](https://github.com/python-poetry/poetry) dev dependency in `pyproject.toml`).

## Supported file types

These are the file types currently handled by Nitpick.

- Some files are only being checked and have to be modified manually;
- Some files can already be fixed automatically (with the [`nitpick run`](#run) command);
- Others are still under construction; the ticket numbers are shown in the table (upvote the ticket with 👍🏻 if you would like to prioritise development).

### Implemented

| File type | Check | Fix ([`nitpick run`](#run)) |
| -------------------------------------------------------------------------------------------------- | ----- | ---------------------------------------------------------------------- |
| [Any `.ini` file](https://nitpick.rtfd.io/en/latest/plugins.html#ini-files) |||
| [Any `.json` file](https://nitpick.rtfd.io/en/latest/plugins.html#json-files) |||
| [Any text file](https://nitpick.rtfd.io/en/latest/plugins.html#text-files) |||
| [`.editorconfig`](https://nitpick.rtfd.io/en/latest/examples.html#example-editorconfig) |||
| [`.pre-commit-config.yaml`](https://nitpick.rtfd.io/en/latest/plugins.html#pre-commit-config-yaml) || 🚧  [#282](https://github.com/andreoliwa/nitpick/issues/282) |
| [`.pylintrc`](https://nitpick.rtfd.io/en/latest/plugins.html#ini-files) |||
| [`package.json`](https://nitpick.rtfd.io/en/latest/examples.html#example-package-json) |||
| [`pyproject.toml`](https://nitpick.rtfd.io/en/latest/plugins.html#pyproject-toml) |||
| [`requirements.txt`](https://nitpick.rtfd.io/en/latest/plugins.html#text-files) |||
| [`setup.cfg`](https://nitpick.rtfd.io/en/latest/plugins.html#ini-files) |||

### Planned

| File type | Check | Fix ([`nitpick run`](#run)) |
| -------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| Any `.md` (Markdown) file | 🚧  [#280](https://github.com/andreoliwa/nitpick/issues/280) ||
| Any `.tf` (Terraform) file | 🚧  [#318](https://github.com/andreoliwa/nitpick/issues/318) ||
| Any `.toml` file | 🚧  [#320](https://github.com/andreoliwa/nitpick/issues/320) | 🚧  [#320](https://github.com/andreoliwa/nitpick/issues/320) |
| `.dockerignore` | 🚧  [#8](https://github.com/andreoliwa/nitpick/issues/8) | 🚧  [#8](https://github.com/andreoliwa/nitpick/issues/8) |
| `.gitignore` | 🚧  [#8](https://github.com/andreoliwa/nitpick/issues/8) | 🚧  [#8](https://github.com/andreoliwa/nitpick/issues/8) |
| `.travis.yml` | 🚧  [#15](https://github.com/andreoliwa/nitpick/issues/15) | 🚧  [#15](https://github.com/andreoliwa/nitpick/issues/15) |
| `Dockerfile` | 🚧  [#272](https://github.com/andreoliwa/nitpick/issues/272) | 🚧  [#272](https://github.com/andreoliwa/nitpick/issues/272) |
| `Jenkinsfile` | 🚧  [#278](https://github.com/andreoliwa/nitpick/issues/278) ||
| `Makefile` | 🚧  [#277](https://github.com/andreoliwa/nitpick/issues/277) ||

## Quick setup

To try the package, simply install it (in a virtualenv or globally) and run `flake8` on a project with at least one Python (`.py`) file:
### Install

# Install with pip:
pip install -U nitpick
On macOS/Linux, install the latest release with [Homebrew](https://github.com/Homebrew/brew):

# Add to your project with Poetry:
poetry add --dev nitpick

# On macOS, install with Homebrew:
brew install andreoliwa/formulae/nitpick

# On archlinux, install with yay:
# To install the latest version from the `develop` branch:
brew install andreoliwa/formulae/nitpick --HEAD

On Arch Linux, install with yay:

yay -Syu nitpick

# Run nitpick directly to modify your files
Add to your project with [Poetry](https://github.com/python-poetry/poetry):

poetry add --dev nitpick

Or install it with pip:

pip install -U nitpick

### Run

To fix and modify your files directly:

nitpick run

# Or run with flake8 to only check for errors
To check for errors only:

nitpick run --check

Nitpick is also a `flake8` plugin, so you can run this on a project with at least one Python (`.py`) file:

flake8 .

Nitpick will download and use the opinionated [default style file](https://raw.githubusercontent.com/andreoliwa/nitpick/v0.26.0/nitpick-style.toml).
Expand All @@ -99,6 +151,6 @@ To start checking all your code against the default rules:

pre-commit run --all-files

---
## More information

For more details on styles and which configuration files are currently supported, [see the full documentation](https://nitpick.rtfd.io/).
1 change: 1 addition & 0 deletions docs/plugins.rst
Expand Up @@ -46,6 +46,7 @@ Examples of ``.ini`` files handled by this plugin:
- `setup.cfg <https://docs.python.org/3/distutils/configfile.html>`_
- `.editorconfig <https://editorconfig.org/>`_
- `tox.ini <https://github.com/tox-dev/tox>`_
- `.pylintrc <https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options>`_

Style examples enforcing values on INI files: :ref:`flake8 configuration <example-flake8>`.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]

[tool.poetry.urls]
"Documentation" = "https://nitpick.readthedocs.io/"
"Documentation" = "https://nitpick.rtfd.io/"
"Changelog" = "https://github.com/andreoliwa/nitpick/blob/develop/CHANGELOG.md"
"Issue Tracker" = "https://github.com/andreoliwa/nitpick/issues"

Expand Down
1 change: 1 addition & 0 deletions src/nitpick/plugins/ini.py
Expand Up @@ -38,6 +38,7 @@ class IniPlugin(NitpickPlugin):
- `setup.cfg <https://docs.python.org/3/distutils/configfile.html>`_
- `.editorconfig <https://editorconfig.org/>`_
- `tox.ini <https://github.com/tox-dev/tox>`_
- `.pylintrc <https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options>`_
Style examples enforcing values on INI files: :ref:`flake8 configuration <example-flake8>`.
"""
Expand Down

0 comments on commit ab6faca

Please sign in to comment.