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

Get connector name from configuration, #1845

Merged
merged 4 commits into from Oct 23, 2021

Conversation

FabioRosado
Copy link
Member

Description

Fixes #1844

This PR replaces all the hardcoded names with self.config.get("name", <connector name>) to allow users to specify the name of the connector. It also adds a section in our connectors page telling users how to use two connectors in the same opsdroid instance since I had to search for a while about how to do this until I remembered that Jacob had mentioned something like that in one of our channels 😆

I'm also using the import organize imports setting in VSCode so some imports were automatically changed. Let me know if you would rather me revert these changes.

Status

READY | UNDER DEVELOPMENT | ON HOLD

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation (fix or adds documentation)

How Has This Been Tested?

  • Created two slack connectors, both worked

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Oct 22, 2021

Codecov Report

Merging #1845 (829a4fb) into master (9a48364) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1845   +/-   ##
=======================================
  Coverage   99.33%   99.33%           
=======================================
  Files          80       80           
  Lines        4834     4834           
=======================================
  Hits         4802     4802           
  Misses         32       32           
Impacted Files Coverage Δ
opsdroid/connector/facebook/__init__.py 100.00% <100.00%> (ø)
opsdroid/connector/github/__init__.py 100.00% <100.00%> (ø)
opsdroid/connector/gitter/connector.py 100.00% <100.00%> (ø)
opsdroid/connector/matrix/connector.py 98.51% <100.00%> (ø)
opsdroid/connector/mattermost/__init__.py 100.00% <100.00%> (ø)
opsdroid/connector/rocketchat/__init__.py 100.00% <100.00%> (ø)
opsdroid/connector/shell/__init__.py 100.00% <100.00%> (ø)
opsdroid/connector/slack/connector.py 100.00% <100.00%> (ø)
opsdroid/connector/teams/teams.py 100.00% <100.00%> (ø)
opsdroid/connector/telegram/__init__.py 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a48364...829a4fb. Read the comment docs.

Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

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

I love the naming change.

The imports stuff highlights some inconsistencies in our imports sorting. Maybe we should add isort to or pre-commit-hook.

opsdroid/connector/facebook/__init__.py Outdated Show resolved Hide resolved
opsdroid/connector/gitter/connector.py Outdated Show resolved Hide resolved
opsdroid/connector/slack/connector.py Outdated Show resolved Hide resolved
@Cadair
Copy link
Contributor

Cadair commented Oct 23, 2021

Wait we didn't do this already?? 🤣

I would suggest reverting the import ordering stuff and then opening a new PR using isort / pre-commit or something we can all run?

@FabioRosado
Copy link
Member Author

Sure and as I mentioned in the PR, they got sorted automatically with VSCode settings

@FabioRosado
Copy link
Member Author

Wait we didn't do this already?? rofl

I would suggest reverting the import ordering stuff and then opening a new PR using isort / pre-commit or something we can all run?

Yeah we don't but it seems that our version of black and isort are fighting in the pre-commit haha

@cognifloyd cognifloyd merged commit 6551c73 into opsdroid:master Oct 23, 2021
@Cadair
Copy link
Contributor

Cadair commented Oct 23, 2021

Yeah we don't but it seems that our version of black and isort are fighting in the pre-commit haha

There's a new(ish) flag in isort to be black compatible.

@jacobtomlinson
Copy link
Member

We use black and isort in Dask. Seem to play nicely together these days.

@FabioRosado FabioRosado deleted the fr/connector-name branch April 18, 2022 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to specify connector name
4 participants