Skip to content

ignore: {} not compatible with import style rules for multiple modules #1644

@charlieshanley

Description

@charlieshanley

I'm working in a codebase that has ignored all hints (ignore: {}) and then selectively reenabled some.

I'd like to enforce an import style for many modules (most likely all except for a custom prelude and a few other exceptions).

I.e., my intention is to do something like this:

- modules:
  - { name: "**", importStyle: explicitOrQualified }
  - { name: [ExceptionModule1, ExceptionModule2], importStyle: unrestricted }

The problem that I'm running into is that the name I'd need to unignore to get the rule contains the name of the module improperly imported, so it doesn't scale to multiple modules.

For example, this configuration:

- ignore: {}
- error: { name: "OneParticularModule should be imported qualified or with an explicit import list" }
- modules:
  - { name: "**", importStyle: explicitOrQualified }
  - { name: [ExceptionModule1, ExceptionModule2], importStyle: unrestricted }

Applies the import style rule for OneParticularModule, but not for any other.

So, whereas #747 and #748 have one-line workarounds, I would need a line for every imported module.

Some ways forward I can think of are:

  • we stop using ignore: {}
  • remove the module name from the name of the import style error, so that one line can unignore the rule for all imports. Eg, "This module should be imported qualified or with an explicit import list"
  • allow for globbing in the name field (seems a little heavy for this)

But I'd be very interested to know if there's something I missed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions