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

Implement List SCIM groups #143

Merged
merged 27 commits into from
Nov 30, 2022
Merged

Implement List SCIM groups #143

merged 27 commits into from
Nov 30, 2022

Conversation

Vitor-Avila
Copy link
Contributor

Adding a new feature to the CLI, that list SCIM groups and their membership. The feature allows to print the results directly to the terminal (useful for quick troubleshooting small teams), and also use --save-report=yaml or --save-report=csv to save the results in a file. The file name would be {TeamSlug}__user_group_membership.{FileExtension}.

@Vitor-Avila
Copy link
Contributor Author

Hey @betodealmeida,

I finally managed to finish creating all the tests. Would appreciate your review here! :D

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I realized though that the pre-commit tests are not running on CI. Can you run them manually for now? You need to run:

pip install pre-commit
pre-commit install
pre-commit run --all-files

This will reformat your files and check types as well.

src/preset_cli/cli/main.py Outdated Show resolved Hide resolved
src/preset_cli/cli/main.py Outdated Show resolved Hide resolved
src/preset_cli/cli/main.py Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
src/preset_cli/api/clients/preset.py Outdated Show resolved Hide resolved
src/preset_cli/api/clients/preset.py Outdated Show resolved Hide resolved
@Vitor-Avila
Copy link
Contributor Author

This looks great!

I realized though that the pre-commit tests are not running on CI. Can you run them manually for now? You need to run:

pip install pre-commit
pre-commit install
pre-commit run --all-files

This will reformat your files and check types as well.

So, I performed these steps, but the pre-commit was failing:

fatal: repository 'https://gitlab.com/pycqa/flake8.git/' not found

I tried to access https://gitlab.com/pycqa/flake8 and I face a 404, so I think that's the issue. For now, I manually updated the link on .pre-commit-config.yaml file to https://github.com/pycqa/flake8.

After that, I faced below error:

Traceback (most recent call last):
  File "/Users/vitoravila/.cache/pre-commit/repoivqubj_g/py_env-python3/bin/black", line 8, in <module>
    sys.exit(patched_main())
  File "/Users/vitoravila/.cache/pre-commit/repoivqubj_g/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 6606, in patched_main
    patch_click()
  File "/Users/vitoravila/.cache/pre-commit/repoivqubj_g/py_env-python3/lib/python3.9/site-packages/black/__init__.py", line 6595, in patch_click
    from click import _unicodefun  # type: ignore
ImportError: cannot import name '_unicodefun' from 'click' (/Users/vitoravila/.cache/pre-commit/repoivqubj_g/py_env-python3/lib/python3.9/site-packages/click/__init__.py)

Seems to be related to the black version - manually changed the rev from rev: 20.8b1 to rev: 22.10.0.

This is the test result:

(local-cli) ➜  backend-sdk git:(list-groups) ✗ pre-commit run --all-files
Check for added large files..............................................Passed
Check python ast.........................................................Passed
Check JSON...............................................................Passed
Check for merge conflicts................................................Passed
Check Xml............................................(no files to check)Skipped
Check Yaml...............................................................Passed
Debug Statements (Python)................................................Passed
Fix End of Files.........................................................Passed
Fix requirements.txt.....................................................Passed
Mixed line ending........................................................Passed
isort....................................................................Passed
black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted tests/cli/main_test.py

All done! ✨ 🍰 ✨
1 file reformatted, 67 files left unchanged.

flake8...................................................................Passed
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

tests/api/clients/superset_test.py:1878: error: _Yaml? has no attribute "encode"
Found 1 error in 1 file (checked 68 source files)

Add trailing commas......................................................Failed
- hook id: add-trailing-comma
- exit code: 1
- files were modified by this hook

Rewriting tests/cli/main_test.py

pycln....................................................................Passed
pylint...................................................................Failed
- hook id: pylint
- exit code: 12

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 9.94/10, +0.06)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
************* Module preset_cli.auth.lib
src/preset_cli/auth/lib.py:23:15: W3101: Missing timeout argument for method 'requests.post' can cause your program to hang indefinitely (missing-timeout)

------------------------------------------------------------------
Your code has been rated at 9.73/10 (previous run: 9.73/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
************* Module src.preset_cli.auth.main
src/preset_cli/auth/main.py:19:0: R0022: Useless option value for 'disable', 'no-self-use' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)

------------------------------------------------------------------
Your code has been rated at 9.96/10 (previous run: 9.96/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
************* Module preset_cli.cli.main
src/preset_cli/cli/main.py:337:0: R0914: Too many local variables (16/15) (too-many-locals)
src/preset_cli/cli/main.py:360:4: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
src/preset_cli/cli/main.py:360:4: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
src/preset_cli/cli/main.py:337:0: R0912: Too many branches (18/12) (too-many-branches)

------------------------------------------------------------------
Your code has been rated at 9.93/10 (previous run: 9.92/10, +0.02)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
************* Module preset_cli.auth.password
src/preset_cli/auth/password.py:27:0: R0022: Useless option value for 'disable', 'no-self-use' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)

------------------------------------------------------------------
Your code has been rated at 9.96/10 (previous run: 9.96/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

************* Module /Users/vitoravila/code/cli-mod/backend-sdk/.pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'duplicate-code
use-implicit-booleaness-not-comparison
fixme' (unknown-option-value)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

@betodealmeida
Copy link
Member

Ah, I read about the change from GitLab to GitHub. Let me fix that.

@Vitor-Avila
Copy link
Contributor Author

Thank you! I'm going over the required changes for the pre-commit checks!

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

@betodealmeida betodealmeida merged commit 7d44b4d into preset-io:main Nov 30, 2022
@Vitor-Avila Vitor-Avila deleted the list-groups branch November 30, 2022 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants