From d220cf697c88602415f0c8bdb3cc88d1bc13c167 Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 18:05:34 +0100 Subject: [PATCH 1/6] add slotscheck to CI --- .github/workflows/build.yml | 1 + pyproject.toml | 3 +++ requirements-dev.txt | 1 + 3 files changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e93f9e68..f441c2e17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,6 +59,7 @@ jobs: - run: flake8 - run: ufmt check . - run: python3 -m fixit.cli.run_rules + - run: slotscheck libcst # Run pyre typechecker typecheck: diff --git a/pyproject.toml b/pyproject.toml index 1d33e75e0..84cfc6282 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,5 +5,8 @@ exclude = "native/.*" [tool.ufmt] excludes = ["native/", "stubs/"] +[tool.slotscheck] +exclude-modules = '^libcst\.(testing|tests)' + [build-system] requires = ["setuptools", "wheel", "setuptools-rust"] \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 388c7556b..e13c3d28e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,3 +15,4 @@ sphinx-rtd-theme>=0.4.3 ufmt==1.3 usort==1.0.0rc1 setuptools-rust>=0.12.1 +slotscheck>=0.7.0,<0.8 From f3336377d808007a21d61d7a2587af95b25ca2f0 Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 18:48:40 +0100 Subject: [PATCH 2/6] bump slotscheck to py36 compatible version --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index e13c3d28e..e11618c3c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,4 +15,4 @@ sphinx-rtd-theme>=0.4.3 ufmt==1.3 usort==1.0.0rc1 setuptools-rust>=0.12.1 -slotscheck>=0.7.0,<0.8 +slotscheck>=0.7.1,<0.8 From 9bf35dccd6266dffa4fbc448bdaefe6607510c1c Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 20:07:41 +0100 Subject: [PATCH 3/6] add slotscheck instructions to readme --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index be1d5d94a..73802fdf0 100644 --- a/README.rst +++ b/README.rst @@ -164,6 +164,13 @@ changes to be conformant, run the following in the root: ufmt format && python -m fixit.cli.apply_fix +We use `slotscheck `_ to check the correctness +of class ``__slots__``. To check that slots are defined properly, run: + +.. code-block:: shell + + slotscheck libcst + To run all tests, you'll need to do the following in the root: .. code-block:: shell From 7508687368abd35ee79f8cd77d5de19c4293f656 Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 20:10:46 +0100 Subject: [PATCH 4/6] Update version spec of slotscheck Co-authored-by: Zsolt Dollenstein --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index e11618c3c..dbebc1850 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,4 +15,4 @@ sphinx-rtd-theme>=0.4.3 ufmt==1.3 usort==1.0.0rc1 setuptools-rust>=0.12.1 -slotscheck>=0.7.1,<0.8 +slotscheck>=0.7.1 From 26a89bd8dffa82ef2efca9c5d9d3ea4c46ac047f Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 21:45:59 +0100 Subject: [PATCH 5/6] run slotscheck with -m option to ensure scan of correct files --- .github/workflows/build.yml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f441c2e17..153c7bf89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,7 @@ jobs: - run: flake8 - run: ufmt check . - run: python3 -m fixit.cli.run_rules - - run: slotscheck libcst + - run: python -m slotscheck libcst # Run pyre typechecker typecheck: diff --git a/README.rst b/README.rst index 73802fdf0..87492a80a 100644 --- a/README.rst +++ b/README.rst @@ -169,7 +169,7 @@ of class ``__slots__``. To check that slots are defined properly, run: .. code-block:: shell - slotscheck libcst + slotscheck libcst To run all tests, you'll need to do the following in the root: From ef4d3639620406f8fba7986d813d21cc8c86b489 Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 18 Jan 2022 22:37:49 +0100 Subject: [PATCH 6/6] advise python -m slotscheck in readme as well --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 87492a80a..946168327 100644 --- a/README.rst +++ b/README.rst @@ -169,7 +169,7 @@ of class ``__slots__``. To check that slots are defined properly, run: .. code-block:: shell - slotscheck libcst + python -m slotscheck libcst To run all tests, you'll need to do the following in the root: