Skip to content

Commit

Permalink
Improve readability of config table
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Apr 4, 2024
1 parent 3680798 commit 94a1298
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
4 changes: 3 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ autoimport.* Options

Old Configuration File
----------------------
This is a sample config.py. While this config.py works and all options here should be supported, the above documentation reflects the latest version of rope.
This is a sample config.py. While this config.py works and all options here
should be supported, the above documentation reflects the recommended way to
do configuration in the latest version of rope.

.. literalinclude:: default_config.py
:language: python3
60 changes: 32 additions & 28 deletions rope/base/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ class Prefs:
description=dedent("""
Specify which files and folders to ignore in the project.
Changes to ignored resources are not added to the history and
VCSs. Also they are not returned in `Project.get_files()`.
VCSs. Also they are not returned in ``Project.get_files()``.
Note that ``?`` and ``*`` match all characters but slashes.
'*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
'.svn': matches 'pkg/.svn' and all of its children
'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
``*.pyc``: matches ``test.pyc`` and ``pkg/test.pyc``
``mod*.pyc``: matches ``test/mod1.pyc`` but not ``mod/1.pyc``
``.svn``: matches ``pkg/.svn`` and all of its children
``build/*.o``: matches ``build/lib.o`` but not ``build/sub/lib.o``
``build//*.o``: matches ``build/lib.o`` and ``build/sub/lib.o``
"""),
)
python_files: List[str] = field(
Expand All @@ -83,9 +83,9 @@ class Prefs:
for finding modules). You can add paths to that list. Note
that rope guesses project source folders correctly most of the
time; use this if you have any problems.
The folders should be relative to project root and use '/' for
The folders should be relative to project root and use ``/`` for
separating folders regardless of the platform rope is running on.
'src/my_source_folder' for instance.
``src/my_source_folder`` for instance.
"""),
default_factory=lambda: [],
)
Expand All @@ -98,19 +98,19 @@ class Prefs:
)
compress_objectdb: bool = field(
default=False,
description="Deprecated. This has no effect",
description="**Deprecated**. This has no effect",
)
automatic_soa: bool = field(
True, "If `True`, rope analyzes each module when it is being saved."
True, "If ``True``, rope analyzes each module when it is being saved."
)
soa_followed_calls: int = field(
default=0, description="The depth of calls to follow in static object analysis"
)
perform_doa: bool = field(
default=True,
description=dedent("""
If `False` when running modules or unit tests 'dynamic object analysis' is turned off.
This makes them much faster.
If ``False`` when running modules or unit tests 'dynamic object
analysis' is turned off. This makes them much faster.
"""),
)
validate_objectdb: bool = field(
Expand All @@ -124,7 +124,7 @@ class Prefs:
)
compress_history: bool = field(
default=False,
description="Deprecated. This has no effect",
description="**Deprecated**. This has no effect",
)

indent_size: int = field(
Expand All @@ -145,35 +145,36 @@ class Prefs:

import_dynload_stdmods: bool = field(
default=True,
description="Add all standard c-extensions to extension_modules list.",
description="Add all standard c-extensions to ``extension_modules`` list.",
)
ignore_syntax_errors: bool = field(
default=False,
description=dedent("""
If `True` modules with syntax errors are considered to be empty.
The default value is `False`; When `False` syntax errors raise
`rope.base.exceptions.ModuleSyntaxError` exception.
If ``True`` modules with syntax errors are considered to be empty.
The default value is ``False``; When ``False`` syntax errors raise
``rope.base.exceptions.ModuleSyntaxError`` exception.
"""),
)

ignore_bad_imports: bool = field(
default=False,
description=dedent("""
If `True`, rope ignores unresolvable imports. Otherwise, they
If ``True``, rope ignores unresolvable imports. Otherwise, they
appear in the importing namespace.
"""),
)
prefer_module_from_imports: bool = field(
default=False,
description=dedent("""
If `True`, rope will insert new module imports as `from <package> import <module>`by default.
If ``True``, rope will insert new module imports as ``from
<package> import <module>`` by default.
"""),
)

split_imports: bool = field(
default=False,
description=dedent("""
If `True`, rope will transform a comma list of imports into
If ``True``, rope will transform a comma list of imports into
multiple separate import statements when organizing
imports.
"""),
Expand All @@ -182,15 +183,15 @@ class Prefs:
pull_imports_to_top: bool = field(
default=True,
description=dedent("""
If `True`, rope will remove all top-level import statements and
If ``True``, rope will remove all top-level import statements and
reinsert them at the top of the module when making changes.
"""),
)

sort_imports_alphabetically: bool = field(
default=False,
description=dedent("""
If `True`, rope will sort imports alphabetically by module name instead
If ``True``, rope will sort imports alphabetically by module name instead
of alphabetically by import statement, with from imports after normal
imports.
"""),
Expand All @@ -199,12 +200,15 @@ class Prefs:
"rope.base.oi.type_hinting.factory.default_type_hinting_factory",
description=dedent("""
Location of implementation of
rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general
case, you don't have to change this value, unless you're an rope expert.
Change this value to inject you own implementations of interfaces
listed in module rope.base.oi.type_hinting.providers.interfaces
For example, you can add you own providers for Django Models, or disable
the search type-hinting in a class hierarchy, etc.
``rope.base.oi.type_hinting.interfaces.ITypeHintingFactory``
In general case, you don't have to change this value, unless you're
an rope expert. Change this value to inject you own
implementations of interfaces listed in module
``rope.base.oi.type_hinting.providers.interfaces``
For example, you can add you own providers for Django Models, or
disable the search type-hinting in a class hierarchy, etc.
"""),
)
project_opened: Optional[Callable] = field(
Expand Down

0 comments on commit 94a1298

Please sign in to comment.