Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install pre-commit hooks #626

Merged
merged 10 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Description

Please include a summary of the change and which issue is fixed.
Please include a summary of the change and which issue is fixed.

Fixes #(issue)

# Checklist (delete if not relevant):

- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have updated CHANGELOG.md
- [ ] I have made corresponding changes to user documentation for new features
- [ ] I have made corresponding changes to user documentation for new features
- [ ] I have made corresponding changes to library documentation for API changes
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
Expand All @@ -61,7 +61,7 @@ jobs:
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -e .[dev]
python -m pip install -e .[dev]
- name: Test with pytest
run: |
python -m pytest -v
2 changes: 1 addition & 1 deletion .github/workflows/task-completed-checker-action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'PR Tasks Completed Check'
on:
on:
pull_request_target:
types: [opened, edited]

Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
name: black check (Python)
28 changes: 14 additions & 14 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Add <file or directory> to the black list. A base name, not a path.
ignore=
.git

# Files or directories matching regex, in Windows or Posix format.
ignore-paths=

Expand All @@ -26,7 +26,7 @@ disable=

# Catagories to disable: expensive or make-work
# typecheck

basic, # Check on names. Unimportant.
classes, # Unimportant.
design, # Make work.
Expand All @@ -37,24 +37,24 @@ disable=
variables, # Unimportant.

# Black. Suppress checks that conflict with Black's conventions.

line-too-long,

# Rope: Suppress checks that conflict with Rope's conventions.

bad-classmethod-argument,
eval-used,
function-redefined,
inconsistent-return-statements,
invalid-name,
inconsistent-return-statements,
invalid-name,
no-else-return,
no-self-argument,
signature-differs, # Maybe.
not-callable, # Maybe.
unexpected-special-method-signature,

# Rope: potentially serious warnings.

arguments-differ,
dangerous-default-value,
modified-iterating-list,
Expand All @@ -64,22 +64,22 @@ disable=
unpacking-non-sequence,

# Rope: to be removed.

duplicate-string-formatting-argument,
no-else-raise, # Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it.
reimported,
superfluous-parens,
unused-import,
unused-wildcard-import,
useless-super-delegation,

useless-else-on-loop, #Else clause on loop without a break statement, remove the else and de-indent all the code inside it.
unidiomatic-typecheck,
wildcard-import,
wrong-import-order,

# Rope: Additional (temporary?) suppressions.

abstract-method,
arguments-differ,
consider-merging-isinstance,
Expand All @@ -94,9 +94,9 @@ disable=
super-init-not-called,
unnecessary-lambda,
unsupported-assignment-operation,

# Leo: Standard suppressions.

arguments-renamed, # cursesGui2.py
assignment-from-no-return, # Causes problems when base class return None.
assignment-from-none, # Causes problems when base class return None.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- #607 Remove importing from legacy files with `.pickle` suffix
- #625 Remove support for deprecated ast nodes
- #616, #621 Remove `file` builtins
- #626 Install pre-commit hooks on rope repository
- #548 Implement MoveGlobal using string as destination module names

# Release 1.6.0
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- ALL-CONTRIBUTORS-LIST:END -->

Also special thank you to rope's early and pre-Github users and contributors,
while we hadn't been able to track all of them in all-contributors format, it
while we hadn't been able to track all of them in all-contributors format, it
doesn't make their contributions less important:

* Alexander Solovyov <piranha@piranha.org.ua>
Expand Down
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.. |Latest version badge| image:: https://badge.fury.io/py/rope.svg
:target: https://badge.fury.io/py/rope
:alt: Latest version

.. |Download count badge| image:: https://img.shields.io/pypi/dm/rope.svg
:alt: Download count

Expand Down Expand Up @@ -97,6 +97,3 @@ This program is under the terms of LGPL v3+ (GNU Lesser General Public License).
Have a look at `COPYING`_ for more information.

.. _`COPYING`: COPYING



6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Notice

If you got to this page on Github accidentally, this is the source code for
rope's documentation. You probably want to use the pre-rendered version of
this directory on [Read the Docs](https://rope.readthedocs.io/) instead of
If you got to this page on Github accidentally, this is the source code for
rope's documentation. You probably want to use the pre-rendered version of
this directory on [Read the Docs](https://rope.readthedocs.io/) instead of
here.
34 changes: 17 additions & 17 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ Configuration
Rope supports the following configuration formats

1. pyproject.toml
2. config.py
2. config.py
3. pytool.toml

pyproject.toml
pyproject.toml
--------------
Will be used if [tool.rope] is configured.

.. code-block:: toml
.. code-block:: toml

[tool.rope]
split_imports = true

config.py
config.py
---------
You can also configure rope via a config.py in the ropefolder directory.
You can also configure rope via a config.py in the ropefolder directory.
It will be used if ``[tool.rope]`` is not present in ``pyproject.toml`` or ``pyproject.toml`` isn't present and config.py is present.

.. code-block:: python3

def set_prefs(prefs):
prefs["ignored_resources"] = [
"*.pyc",
Expand All @@ -36,23 +36,23 @@ It will be used if ``[tool.rope]`` is not present in ``pyproject.toml`` or ``pyp
"venv",
]

Additionally, you can run an executable function at startup of rope.
Additionally, you can run an executable function at startup of rope.

.. code-block:: python3

.. code-block:: python3

def project_opened(project):
"""This function is called after opening the project"""
# Do whatever you like here!


pytool.toml
pytool.toml
-----------
If neither a config.py or a pyproject.toml is present, rope will use a pytool.toml.
It follows the exact same syntax of the pyproject.toml.
If neither a config.py or a pyproject.toml is present, rope will use a pytool.toml.
It follows the exact same syntax of the pyproject.toml.

- Mac OS X: ``~/Library/Application Support/pytool.toml.``
- Unix: ``~/.config/pytool.toml``` or in $XDG_CONFIG_HOME, if defined
- Windows: ``C:\Users\<username>\AppData\Local\pytool.toml``
- Mac OS X: ``~/Library/Application Support/pytool.toml.``
- Unix: ``~/.config/pytool.toml``` or in $XDG_CONFIG_HOME, if defined
- Windows: ``C:\Users\<username>\AppData\Local\pytool.toml``


Options
Expand All @@ -63,5 +63,5 @@ 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.

.. literalinclude:: default_config.py
.. literalinclude:: default_config.py
:language: python3
14 changes: 7 additions & 7 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Here is a list of suggestions.
Issues
------

If this is your first time contributing in rope and you don't know where to start,
If this is your first time contributing in rope and you don't know where to start,
tickets labeled `good first issue`_ is a good place start.

The `unresolved issues list`_ in Github is the latest todo list.
Expand Down Expand Up @@ -78,12 +78,12 @@ Rope package structure:
* `rope.refactor`: refactorings and tools used in them
* `rope.contrib`: IDE helpers

Have a look at ``__init__.py`` of these packages or
Have a look at ``__init__.py`` of these packages or
:ref:`library:Using Rope As A Library` for more information.

There's also some really good `tour of Rope's codebase`_
by Austin Bingham (author of `Traad`_).
The first 10 minutes of the video talked about Rope in general, the rest are
There's also some really good `tour of Rope's codebase`_
by Austin Bingham (author of `Traad`_).
The first 10 minutes of the video talked about Rope in general, the rest are
more specific to Traad.

.. _tour of Rope's codebase: https://youtu.be/NvV5OrVk24c
Expand Down Expand Up @@ -128,8 +128,8 @@ Many of rope's tests are still written using
``unittest.TestCase`` style, but running the test suite using
vanilla ``unittest`` is no longer supported.

Make sure to have complete test suite passing and
add new tests for the changes you are providing with each new
Make sure to have complete test suite passing and
add new tests for the changes you are providing with each new
submission.

All required packages for development could be installed with::
Expand Down
2 changes: 0 additions & 2 deletions docs/dev/issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,3 @@ Examples
--------

.. ...


2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Welcome to rope's documentation!
:caption: Contents:

overview
rope
rope
library
configuration
contributing
Expand Down
2 changes: 1 addition & 1 deletion docs/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ AutoImport can search for a name from both modules and statements you can import
autoimport.close()
project.close()

It provides two new search methods:
It provides two new search methods:
- search_full() - returns a list of mostly unsorted tuples. This has itemkind and source information.
- search() - simpler wrapper around search_full with a basic sorting algorithm

Expand Down
12 changes: 6 additions & 6 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Rope is a library that is used in many IDE and Text Editors to perform
refactoring on Python code. This page documents the details of the refactoring
operations but you would need consult the documentation for your IDE/Text
Editor client integration for the specific key bindings that are used by
those IDE/Text Editors.
those IDE/Text Editors.

Refactorings
============
Expand Down Expand Up @@ -471,7 +471,7 @@ Extracting ``2 * 3`` will result in:
Extract Regular Method into staticmethod/classmethod
----------------------------------------------------

If you prefix the extracted method name with `@` or `$`, the generated
If you prefix the extracted method name with `@` or `$`, the generated
method will be created as a `classmethod` and `staticmethod` respectively.
For instance in:

Expand All @@ -482,7 +482,7 @@ For instance in:
def f(self, a):
b = a * 2

if you select ``a * 2`` for method extraction and name the method
if you select ``a * 2`` for method extraction and name the method
``@new_method``, you'll get:

.. code-block:: python
Expand Down Expand Up @@ -526,7 +526,7 @@ if you extract ``a * 2`` as a method you'll get:
@staticmethod
def twice(a):
return a * 2


Inline Method Refactoring
-------------------------
Expand Down Expand Up @@ -925,7 +925,7 @@ will match (for instance, if ``exact`` is specified , ``${name}``
matches ``name`` and ``x.name`` but not ``var`` nor ``(1 + 2)`` while
a normal ``${name}`` can match all of them).

For performing this refactoring using rope library see
For performing this refactoring using rope library see
:ref:`library:Restructuring`.


Expand Down Expand Up @@ -976,7 +976,7 @@ Restructurings come to rescue::
goal:
${inst}.f1(${p1})
${inst}.f2(${p2})

args:
inst: type=mod.A

Expand Down