Skip to content

Commit 7d1f654

Browse files
committed
More cleanup and update README
Fix linting issue, remove some unnecessary lines in CI and setup.cfg
1 parent 3b97e91 commit 7d1f654

5 files changed

Lines changed: 17 additions & 27 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ jobs:
3131
- name: Run all tests
3232
run: python -X dev -m unittest discover -s pywikitools/test
3333

34-
# Now we're generating the coverage report
35-
- name: Install coverage.py
36-
run: pip install coverage
37-
3834
- name: Generate coverage report
3935
run: |
4036
coverage run --source=pywikitools/,pywikitools/correctbot/ --omit=pywikitools/user-config.py -m unittest discover -s pywikitools/test

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Ready to contribute? Here's how to set up `pywikitools` for local development.
5252
`flake8` has nothing to complain:
5353

5454
```shell
55-
$ python3 -m unittest discover -s pywikitools/test
56-
$ flake8 .
55+
$ make test
56+
$ make lint
5757
```
5858

5959
6. Commit your changes and push your branch to GitHub:

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use the [pywikibot framework](https://www.mediawiki.org/wiki/Manual:Pywikibot).
2929
* [License](#license)
3030
* [Contributing and coding conventions](#contributing-and-coding-conventions)
3131
* [Communication](#communication)
32-
* [Credits](#credits)
3332
<!-- TOC -->
3433

3534
## Setup
@@ -94,22 +93,23 @@ stored in `pywikibot-[UserName].lwp` so you don't have to log in every time.
9493
9594
## Testing and ensuring good code quality
9695
97-
From your base pywikitools path, use the following command to run the test
98-
suite.
96+
From your base pywikitools path (with the virtual environment set up):
9997
10098
```shell
101-
$ python -m unittest discover -s pywikitools/test
99+
$ make test # run the test suite
100+
$ make lint # check style with flake8
101+
$ make coverage # coverage report; opens htmlcov/ in your browser
102102
```
103103
104-
Also, run the next command to check for linting issues
104+
The same commands without `make`:
105105
106106
```shell
107-
$ flake8
107+
$ python -m unittest discover -s pywikitools/test
108+
$ flake8 .
108109
```
109110
110-
With `GitHub Actions` these two commands are automatically run also on every
111-
push or pull request in the repository. The goal is to cover all important code
112-
with good test coverage.
111+
With `GitHub Actions` tests and linting run automatically on every push or pull
112+
request. The goal is to cover all important code with good test coverage.
113113
114114
Some tests are making real API calls, that's why running the tests can
115115
take half a
@@ -139,7 +139,7 @@ Which username should it use?
139139
correct_bot.py
140140
: Automatically correct simple mistakes in texts of different languages.
141141

142-
resources_bot.py
142+
resourcesbot.py
143143
: Automatically scan through all available translations, gather information on
144144
each language and do many useful things with this information.
145145
Such as filling out the “Available training resources in...”
@@ -187,11 +187,4 @@ For more details, see CONTRIBUTING.md
187187

188188
Please subscribe to the repository to get informed on changes. We use GitHub
189189
issues for specific tasks, wishes, bugs, etc. Please don’t hesitate to open
190-
a new one! Assign yourself to the issues that you plan to work on.
191-
192-
## Credits
193-
194-
This package was created
195-
with [Cookiecutter](https://github.com/audreyr/cookiecutter) and
196-
the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage)
197-
project template.
190+
a new one! Assign yourself to the issues that you plan to work on.

autotranslate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def __init__(self, config: ConfigParser):
4545
def fetch_and_translate(self, page_name, language_code, force=False, simulate=False):
4646
translated_page = self.fortraininglib.get_translation_units(page_name, "en")
4747

48-
if not simulate and not force and self.fortraininglib.get_translated_title(page_name, language_code) is not None:
48+
if (
49+
not simulate and not force
50+
and self.fortraininglib.get_translated_title(page_name, language_code) is not None
51+
):
4952
self.logger.warning("Translation already exists. If you want to force overwrite, use the -f flag.")
5053
return
5154

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[flake8]
22
exclude = env,pywikitools/user-config.py,pywikitools/correctbot/user-config.py
33
max-line-length = 120
4-
# TODO enable E501 for generateodt.py some day
54
per-file-ignores =
65
pywikitools/test/test_correctbot.py:E127
7-
pywikitools/cgi-bin/generateodt.py:E501

0 commit comments

Comments
 (0)