xonsh/setup.cfg

131 lines
4.8 KiB
INI
Raw Normal View History

# Use of pytest --flake8 is deprecated in favor of flake8 direct.
# Thus the developer's IDE can use the same lint config as CI.
# pytest-flake8 --ignore is an incompatible superset of flake8 --ignore, --per-file-ignores and --exclude
# and we don't want to maintain the same list in 2 formats.
[flake8]
max-line-length = 180
exclude =
__amalgam__.py,
**/__amalgam__.py,
**/*/__amalgam__.py,
docs/,
*/ply/,
parser*_table.py,
Completion context (#4017) * completion-context: Add CompletionContextParser placeholder Implements the xonsh (tab-)completion context parser. This parser is meant to parse a (possibly incomplete) command line. * completers: tools: Implement ``contextual_completer`` decorator This is used to mark completers that want to use the parsed completion context. * completers: Enable using contextual completers in xonsh/completer.py * completers: readline, ptk, jupyter: Enable using contextual completers Pass ``multiline_text`` and ``cursor_index`` to ``Completer.complete()`` * parsers: base: Refactor out a ``raise_parse_error`` function * tokenize: Enable ``tolerant`` mode If ``tolerant`` is True, yield ERRORTOKEN instead of throwing an exception when encountering an error. * lexer: Enable ``tolerant`` mode Tokenize without extra checks (e.g. paren matching). When True, ERRORTOKEN contains the erroneous string instead of an error msg. * tests: lexer: Test ``tolerant`` mode * completion-context: Implement simple CommandContext parsing * completion-context: tests: Test simple CommandContext parsing * completion-context: Implement parsing sub-commands * completion-context: tests: Test parsing sub-commands * completion-context: Add news file * completion-context: parser: Add parser table path to relevant locations Code-coverage, mypy ignore list, etc. * completion-context: Implement parsing partial strings and line continuations * completion-context: tests: Test parsing partial strings and line continuations * completion-context: Convert ``Span`` object to a ``slice`` * completion-context: Refactor out ``create_command`` and ``cursor_in_span`` * completion-context: Implement handling empty commands * completion-context: tests: Test handling empty commands * completion-context: Implement handling multiple commands Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||` * completion-context: tests: Test handling multiple commands Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||` * completion-context: Implement handling python context * completion-context: tests: Test handling python context * completers: tools: Add `contextual_command_completer` * completers: Make `complete_skipper` contextual * completers: Make `complete_from_man` contextual * completers: Make `complete_from_bash` contextual and add test * completers: Make `complete_pip` contextual and update tests * completers: Keep opening string quote if it exists * completion-context: Handle cursor after a closing quote For example - cursor at the end of ``ls "/usr/"``. 1. The closing quote will be appended to all completions. I.e the completion ``/usr/bin`` will turn into ``/usr/bin"`` 2. If not specified, lprefix will cover the closing prefix. I.e for ``ls "/usr/"``, the default lprefix will be 6 to include the closing quote. * completion-context: tests: Test handling cursor after a closing quote * completion-context: Fix bug with multiple empty commands e.g. `;;;` * completion-context: tests: Speed up tests From ~15 seconds to ~500 ms * completion-context: Expand commands and subcommands * completion-context: Simplify `commands` rules * completion-context: Simplify `sub_expression` rules * completion-context: Simplify editing a multi-command token * completion-context: Inline `create_command` * completion-context: Implement `contextual_command_completer_for` helper * completers: Make `complete_cd`/`complete_rmdir` contextual and add tests * completers: path: Don't append a double-backslash in a raw string When completing a path, if a raw string is used (e.g. `r"C:\Windows\"`), there's no reason to append a double-backslash (e.g. `r"C:\Windows\\"`). * completers: Make `complete_xonfig`/`complete_xontrib` contextual and add tests * completers: Make `complete_completer` contextual and add tests * completers: Make `complete_import` contextual and add tests * completion-context: Add python `ctx` attribute * completion: tools: Simplify `RichCompletion` attributes handling * completers: Make `base`, `python`, and `commands` contextual * Add tests * No need for `python_mode` completer anymore * completion: tools: Add `append_space` attribute to `RichCompletion` * completion-context: Get all lines in a main python context * xontrib: jedi: Make the `jedi` completer contextual * completers: tools: Remove `get_ptk_completer` and `PromptToolkitCompleter.current_document` These aren't needed anymore now that contextual completers can access the multiline code (via `PythonContext.multiline_code`). * completion-context: ptk: Expand aliases * completion-context: jupyter: Expand aliases and fix line handling * completer: Preserve custom prefix after closing quote * completers: bash: Ensure bash completion uses the complete prefix * completers: pip: Append a space after a pip command * completers: pip: Prevent bad package name completions * completers: Remove a common prefix from `RichCompletion` if `display` wasn't provided * completion-context: Treat cursor at edge of `&& || | ;` as normal args This will be used for completing a space * completers: Complete end proc keywords correctly
2021-03-30 20:37:56 +03:00
completion_parser_table.py,
build/,
dist/,
setup.py,
.vscode/,
2020-08-09 15:08:56 -05:00
feedstock,
rever,
.venv*/,
.local.out*/
# lint nits that are acceptable in Xonsh project:
ignore =
D100, # Missing docstring in public module
D101, # Missing docstring in public class
D102, # Missing docstring in public method
D103, # Missing docstring in public function
D104, # Missing docstring in public package
D105, # Missing docstring in magic method
D200, # One-line docstring should fit on one line with quotes
D202, # No blank lines allowed after function docstring
D205, # 1 blank line required between summary line and description
D207, # Docstring is under-indented
D208, # Docstring is over-indented
D209, # Multi-line docstring closing quotes should be on a separate line
D210, # No whitespaces allowed surrounding docstring text
D301, # Use r""" if any backslashes in a docstring
D400, # First line should end with a period
D401, # First line should be in imperative mood
D403, # First word of the first line should be properly capitalized
D404, # First word of the docstring should not be `This`
D406, # Section name should end with a newline
D409, # Section underline should match the length of its name
D411, # Missing blank line before section
D407, # Missing dashed underline after section
E122, # continuation line missing indentation or outdented
E203, # whitespace before ':'
E402, # module level import not at top of file
W503, # line break before binary operators is a good thing
E731, # accept lambda assigned to a variable
2020-08-09 15:08:56 -05:00
per-file-ignores =
# flake8 gives incorrect unused import errors, F401
tests/tools.py:E128,
2021-09-26 21:02:24 +05:30
tests/test_builtins.py:F821 B011, # undefined name, asserts removed
xonsh/ast.py:F401,
xonsh/built_ins.py:F821 E721,
xonsh/built_ins.py:E721,
xonsh/commands_cache.py:F841,
xonsh/history.py:F821,
xonsh/jupyter_kernel.py:E203,
xonsh/platform.py:F401 E305,
xonsh/proc.py:E261 E265,
xonsh/ptk/key_bindings.py:F841,
xonsh/ptk/shell.py:E731,
xonsh/pyghooks.py:F821,
xonsh/readline_shell.py:F401,
xonsh/style_tools.py:F821 E305,
xonsh/timings.py:F401,
xonsh/tokenize.py:F821 F841,
xonsh/tools.py:E731 E305,
xonsh/xonfig.py:E731,
xontrib/vox.py:F821,
# remove these later
xonsh/color_tools.py:E305
xonsh/completers/_aliases.py:E305,
xonsh/completers/python.py:E722,
xonsh/inspectors.py:E722
xonsh/lexer.py:E741,
xonsh/parsers/context_check.py:E305,
xonsh/parsers/base.py:E741,
xonsh/style_tools.py:E305,
xonsh/tools.py:E305,
xonsh/winutils.py:E305,
# B001-bare-except
xonsh/xoreutils/*.py:E722 E305,B001
# docstring is considered as invalid statement by bugbear
# Found useless expression. Either assign it to a variable or remove it.
# this can be removed once issue - https://github.com/PyCQA/flake8-bugbear/issues/208 is solved
xonsh/parsers/completion_context.py: B018
# pydocstyle plugin
docstring-convention=numpy
2020-10-02 16:25:08 +05:30
[mypy]
# --- https://mypy.readthedocs.io/en/stable/config_file.html
# try to keep all under .cache directory
cache_dir = .cache/mypy/
# warn_unused_ignores = True
warn_unused_configs = True
2020-10-02 16:25:08 +05:30
warn_no_return = False
; a regex to exclude certain directories
exclude = ((xonsh/ply)|(__amalgam__.py)|(xontrib/(mpl.*py|distributed.py|jedi.py)))
;match dmypy semantics - https://github.com/python/mypy/issues/8046
local_partial_types = True
2020-10-02 16:25:08 +05:30
# report
2020-10-02 16:25:08 +05:30
show_error_context = True
show_column_numbers = True
show_error_codes = True
pretty = True
# the __init__ files have dynamic check - ignoring the attribute error. others are generated files
# top level package name only ignores the __init__.py file.
Completion context (#4017) * completion-context: Add CompletionContextParser placeholder Implements the xonsh (tab-)completion context parser. This parser is meant to parse a (possibly incomplete) command line. * completers: tools: Implement ``contextual_completer`` decorator This is used to mark completers that want to use the parsed completion context. * completers: Enable using contextual completers in xonsh/completer.py * completers: readline, ptk, jupyter: Enable using contextual completers Pass ``multiline_text`` and ``cursor_index`` to ``Completer.complete()`` * parsers: base: Refactor out a ``raise_parse_error`` function * tokenize: Enable ``tolerant`` mode If ``tolerant`` is True, yield ERRORTOKEN instead of throwing an exception when encountering an error. * lexer: Enable ``tolerant`` mode Tokenize without extra checks (e.g. paren matching). When True, ERRORTOKEN contains the erroneous string instead of an error msg. * tests: lexer: Test ``tolerant`` mode * completion-context: Implement simple CommandContext parsing * completion-context: tests: Test simple CommandContext parsing * completion-context: Implement parsing sub-commands * completion-context: tests: Test parsing sub-commands * completion-context: Add news file * completion-context: parser: Add parser table path to relevant locations Code-coverage, mypy ignore list, etc. * completion-context: Implement parsing partial strings and line continuations * completion-context: tests: Test parsing partial strings and line continuations * completion-context: Convert ``Span`` object to a ``slice`` * completion-context: Refactor out ``create_command`` and ``cursor_in_span`` * completion-context: Implement handling empty commands * completion-context: tests: Test handling empty commands * completion-context: Implement handling multiple commands Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||` * completion-context: tests: Test handling multiple commands Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||` * completion-context: Implement handling python context * completion-context: tests: Test handling python context * completers: tools: Add `contextual_command_completer` * completers: Make `complete_skipper` contextual * completers: Make `complete_from_man` contextual * completers: Make `complete_from_bash` contextual and add test * completers: Make `complete_pip` contextual and update tests * completers: Keep opening string quote if it exists * completion-context: Handle cursor after a closing quote For example - cursor at the end of ``ls "/usr/"``. 1. The closing quote will be appended to all completions. I.e the completion ``/usr/bin`` will turn into ``/usr/bin"`` 2. If not specified, lprefix will cover the closing prefix. I.e for ``ls "/usr/"``, the default lprefix will be 6 to include the closing quote. * completion-context: tests: Test handling cursor after a closing quote * completion-context: Fix bug with multiple empty commands e.g. `;;;` * completion-context: tests: Speed up tests From ~15 seconds to ~500 ms * completion-context: Expand commands and subcommands * completion-context: Simplify `commands` rules * completion-context: Simplify `sub_expression` rules * completion-context: Simplify editing a multi-command token * completion-context: Inline `create_command` * completion-context: Implement `contextual_command_completer_for` helper * completers: Make `complete_cd`/`complete_rmdir` contextual and add tests * completers: path: Don't append a double-backslash in a raw string When completing a path, if a raw string is used (e.g. `r"C:\Windows\"`), there's no reason to append a double-backslash (e.g. `r"C:\Windows\\"`). * completers: Make `complete_xonfig`/`complete_xontrib` contextual and add tests * completers: Make `complete_completer` contextual and add tests * completers: Make `complete_import` contextual and add tests * completion-context: Add python `ctx` attribute * completion: tools: Simplify `RichCompletion` attributes handling * completers: Make `base`, `python`, and `commands` contextual * Add tests * No need for `python_mode` completer anymore * completion: tools: Add `append_space` attribute to `RichCompletion` * completion-context: Get all lines in a main python context * xontrib: jedi: Make the `jedi` completer contextual * completers: tools: Remove `get_ptk_completer` and `PromptToolkitCompleter.current_document` These aren't needed anymore now that contextual completers can access the multiline code (via `PythonContext.multiline_code`). * completion-context: ptk: Expand aliases * completion-context: jupyter: Expand aliases and fix line handling * completer: Preserve custom prefix after closing quote * completers: bash: Ensure bash completion uses the complete prefix * completers: pip: Append a space after a pip command * completers: pip: Prevent bad package name completions * completers: Remove a common prefix from `RichCompletion` if `display` wasn't provided * completion-context: Treat cursor at edge of `&& || | ;` as normal args This will be used for completing a space * completers: Complete end proc keywords correctly
2021-03-30 20:37:56 +03:00
[mypy-xonsh.parser_table,xonsh.completion_parser_table,xonsh.parsers.parser_table.*,xonsh.parsers.completion_parser_table.*,*.__amalgam__.*,xonsh,xonsh.prompt,xonsh.history,xonsh.completers,xonsh.procs]
2020-10-02 16:25:08 +05:30
ignore_errors = True
# 3rd party libraries that we dont have control over
[mypy-zmq.*,setproctitle,xonsh.ply.*,jupyter_client.*,winreg.*,pygments.*,prompt_toolkit.*,importlib_resources.*,nt.*,prompt_toolkit.*,distro.*,conda_suggest.*,_winreg.*,*.__amalgam__.*]
ignore_missing_imports = True
2020-10-02 16:25:08 +05:30
[tool:pytest]
cache_dir = .cache/pytest
markers =
news: check changelog unit is valid rst
2021-12-23 06:31:26 +05:30
testpaths =
tests