Update configuration to support .toml files#1352
Conversation
Coverage Report for CI Build 27395431043Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.2%) to 90.929%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
david-yz-liu
left a comment
There was a problem hiding this comment.
Hi @a1-su, nice work. The changes overall look good. A few general comments:
- We should update the PythonTA documentation with this new behaviour (accepting toml files, the
[tool.python-ta]section, looking forpyproject.tomlfile by default, anything else). - There are a few other places in the code base (e.g., variable names) that refer to
pylintrcexplicitly. These should be modified to use more general terms for "config files" or something similar.
| return args_list | ||
|
|
||
| try: | ||
| with open(config_location, "r") as f: |
There was a problem hiding this comment.
In general use a UTF8 encoding for text file reading
| # Configuration | ||
|
|
||
| PythonTA supports configuration through an "rc file" in the [INI format](https://docs.python.org/3/library/configparser.html). | ||
| PythonTA supports configuration through `pyproject.toml` files and "rc files" in the [INI format](https://docs.python.org/3/library/configparser.html). |
There was a problem hiding this comment.
I would just say "TOML" files. The filename pyproject.toml is a default, but users can pass in arbitrary toml files as the config argument to python_ta.check_all, I believe (please make sure to test this)
| PythonTA supports configuration through `pyproject.toml` files and "rc files" in the [INI format](https://docs.python.org/3/library/configparser.html). | ||
| A custom configuration file can be passed in the command-line using the `--config <path>` option, | ||
| and to `python_ta.check_all` with the `config=<path>` argument. | ||
| When using a `pyproject.toml` file, PythonTA-specific options must be placed under the [tool.python-ta] section, while standard Pylint options should be placed under [tool.pylint] (e.g., [tool.pylint.FORMAT]). |
There was a problem hiding this comment.
Same comment as above about the filename.
Also, please put all section headers in monospace font, e.g. [tool.python-ta].
Proposed Changes
This PR updates the configuration options to support
.tomlfiles, in addition to the.pylintrcthat is currently used. In addition, it updates the tests to add.tomlchecking.Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)