Skip to content

Add module import linter in codebase #4863

@MichaelBroughton

Description

@MichaelBroughton

Is your feature request related to a use case or problem? Please describe.
Right now a lot of modules (in particular tests) are pretty free form with how they do imports. It's a good practice to import modules wherever possible.

bad:

from cirq.devices import GridQubit

good:

from cirq import devices

devices.GridQubit(whatever)

Describe the solution you'd like
We should add a new plugin to pylint (or install an existing one) that catches non module imports where it makes sense. Some exceptions might be __init__ modules or typing imports and vendor modules that should just do import cirq everywhere.

Metadata

Metadata

Assignees

Labels

area/importsgood first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.kind/feature-requestDescribes new functionalityno QC knowledge neededWant to contribute to Cirq, but don't know quantum computing? This issue is for you.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions