-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
refactor: Made command
functions to access PackageManager unavailable from public API
#2335
Conversation
Removed the shorthand of the InstanceCommand interface. This makes the API more coherent among the `commands` instance handling.
This change highlights the incorrect PackageManager access in 'cli' package. Now those are errors: package github.com/arduino/arduino-cli imports github.com/arduino/arduino-cli/internal/cli imports github.com/arduino/arduino-cli/internal/cli/board imports github.com/arduino/arduino-cli/internal/cli/arguments internal/cli/arguments/completion.go:23:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed package github.com/arduino/arduino-cli imports github.com/arduino/arduino-cli/internal/cli imports github.com/arduino/arduino-cli/internal/cli/board imports github.com/arduino/arduino-cli/internal/cli/arguments internal/cli/arguments/port.go:24:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed
cbf2de2
to
5bce46d
Compare
5bce46d
to
4954c4d
Compare
command
ways to access PackageManager unavailable from public APIcommand
functions to access PackageManager unavailable from public API
Previously the function GetConnectedBoards() counter-intuitively returned a list of port address. Now it has been reneamed GetAvailablePorts() and returns the full Port object that is mapped into an array of Addresses or into an array of Prorocols based on the auto-completion request.
4954c4d
to
6c6db14
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2335 +/- ##
==========================================
- Coverage 62.82% 62.77% -0.06%
==========================================
Files 204 205 +1
Lines 19311 19283 -28
==========================================
- Hits 12132 12104 -28
Misses 6119 6119
Partials 1060 1060
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)configuration.schema.json
updated if new parameters are added.What kind of change does this PR introduce?
This refactoring aims to make the following functions of the
commands
package private:This change should clarify that the
arduino
package must not be used from thecli
package (to avoid bypassing the gRPC API).It also highlights where incorrect access to the
arduino
package is made, because those places are now reported as compile-time errors:The first one tries to list the available upload protocols. The second one performs a board watch to get available ports.
Both have been updated to use only the public gRPC API.
What is the current behavior?
No changes.
What is the new behavior?
Does this PR introduce a breaking change, and is titled accordingly?
No
Other information
Once, completed this PR should fix #1948