-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathREADME.md.in
More file actions
88 lines (53 loc) · 5.08 KB
/
README.md.in
File metadata and controls
88 lines (53 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# spec-cleaner

[](https://coveralls.io/github/rpm-software-management/spec-cleaner?branch=master)
[](https://lgtm.com/projects/g/rpm-software-management/spec-cleaner/alerts/)
[](https://lgtm.com/projects/g/rpm-software-management/spec-cleaner/context:python)
[](https://github.com/pre-commit/pre-commit)
[](https://github.com/psf/black)
spec-cleaner is a tool that cleans the given RPM spec file according to the style guide and returns the result.
It's used for [openSUSE](https://www.opensuse.org), where it's planned to be a replacement for `osc service localrun format_spec_file` and it is intended to provide the same or better features in order to be able to unify all the spec files in [OBS](https://build.opensuse.org/).
# Table of contents
* [Installation and usage](#installation-and-usage)
* [Tests](#tests)
* [Contributing](#contributing)
* [Versioning and releasing](#versioning-and-releasing)
* [Authors](#authors)
## Installation and usage
### Installation
The latest version is available on [PyPI](https://pypi.org/project/spec_cleaner/). It can be installed by running `pip install spec_cleaner`.
spec-cleaner is also provided as an RPM package for openSUSE Leap ([15.0](https://build.opensuse.org/package/show/openSUSE:Leap:15.0:Update/spec-cleaner) and [15.1](https://build.opensuse.org/package/show/openSUSE:Leap:15.1:Update/spec-cleaner)) and [openSUSE Tumbleweed](https://build.opensuse.org/package/show/openSUSE:Factory/spec-cleaner). When the new version of spec-cleaner is released then the version updates are performed for all maintained openSUSE codestreams. That means that there is always the latest version available in openSUSE:Leap.
### Usage
Simply run `spec-cleaner -i <specfile>` to clean your specfile up.
## Tests
### Running the tests
spec-cleaner provides quite an extensive testsuite. You can run these tests locally either directly via `pytest`.
#### pytest
Just install `python3-pytest`, `python3-pytest-cov`, `python3-pytest-isort` and `python3-pytest-sugar` (for a nice progress bar) and then run all tests via:
pytest
## Contributing
You are more than welcome to contribute to this project. If you are not sure about your changes, feel free to create an issue where you can discuss it before the implementation.
### Contribution Guidelines
When changing anything in the code, make sure that you don't forget to:
* Follow [pep8](https://www.python.org/dev/peps/pep-0008/).
* Install [pre-commit](https://pre-commit.com/) framework and run `pre-commit install` to install `pre-commit` into your git hooks.
* Add proper comments and docstrings (follow [pep257](https://www.python.org/dev/peps/pep-0257/) and [Google Python Style Guide for docstrings and comments](http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings))
* Add [tests](TESTSUITE.md) (mainly if you implement a new feature).
* Add `mypy` support for the new code.
* Run and pass all tests, `flake8` and `mypy` checks.
See below for more details.
### pre-commit
spec-cleaner project adopted `pre-commit` framework for managing and maintaining pre-commit hooks. After you clone the spec-cleaner repository, please install [pre-commit](https://pre-commit.com/) framework (`pip install pre-commit`) and run `pre-commit install` to install `pre-commit` into your git hooks. Then `pre-commit` will run automatically on `git commit` and it will check your contribution with `isort`, `black`, `flake8`, `flake8-docstrings` and `mypy`.
Please note that similar checks run in CI when you submit a PR and it won't pass code review without passing these checks.
### mypy
Optional static type checker support was implemented for the most important parts of the code. If you want to run it on your own, just install `python3-mypy` and run
mypy spec_cleaner
### Black
The code of spec-cleaner is formated with [Black](https://github.com/psf/black). We use `--skip-string-normalization` and `--line-length 100` options. Black runs automatically in the `pre-commit` hook.
### Adding new tests
When a new feature is added to spec-cleaner then a test for this piece of code must be added. See [how to write tests for spec-cleaner](TESTSUITE.md).
## Versioning and releasing
For the versions available, see the [tags on this repository](https://github.com/openSUSE/spec-cleaner/releases).
If you have proper permissions you can find handy [how to do a new release](RELEASE.md).
## Authors
* See the list of [contributors](AUTHORS) who participated in this project