Skip to content
New issue

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

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

Already on GitHub? # to your account

[dot-imports] support allow list of packages #939

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

nunnatsa
Copy link
Contributor

@nunnatsa nunnatsa commented Nov 16, 2023

Add the ability to allow list of packages to be dot imported.

Add a new don-imports configuration:

  • allowedPackages: (list of strings) comma-separated list of allowed dot import packages

Example:

[rule.dot-imports]
  arguments = [{ allowedPackages = ["github.com/onsi/ginkgo/v2","github.com/onsi/gomega"] }]

Fixes #923

@nunnatsa
Copy link
Contributor Author

/cc @chavacava

@nunnatsa nunnatsa force-pushed the fix-923 branch 3 times, most recently from 21dc081 to 09b6755 Compare November 21, 2023 12:09
package pkg

import (
. "context" // in allowedPackages (standard library => just the name without full path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we please have a non-aliased and aliased imports to make sure they are not affected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review @denisvmedia. Fixed. PTAL.

Add the ability to allow list of packages to be dot imported.

Add a new don-imports configuration:
* `allowedPackages`: (string) comma-separated list of allowed dot import packages

Example:

```toml
[rule.dot-imports]
  arguments = [{ allowedPackages = "github.com/onsi/ginkgo/v2,github.com/onsi/gomega" }]
```
@chavacava chavacava merged commit 9a2eab3 into mgechev:master Nov 26, 2023
@chavacava
Copy link
Collaborator

Hi @nunnatsa thanks for the PR! (and sorry for the late response)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configuration to the dot-import rule
3 participants