Skip to content

Wildcard rules for imports have their relevant properties unioned, including exclusions #1647

@parsonsmatt

Description

@parsonsmatt

We have two rules:

- modules:
    - name:
          - "**.*Spec"
      within: 
          - Main
          - Spec
    - name:
          - "Handler.**"
      within: 
          - "Handler.**"
          - "**.*Spec"

The intention of these rules are:

  1. You should not import Spec modules except in defining tests. Shared helpers should be extracted to utility modules.
  2. You should not import Handler modules except in Handler code and in tests for Handler code.

However, the rules appear to be merged. We recently discovered that rules matching the first were not being triggered except in pre-commit, which was only loading that rule. However, these rules were not being enforced in CI or in our make hlint or make hlint-all commands, which loaded all of the rules.

I am working up a minimal reproduction of this behavior.

EDIT:

  • Does not appear to trigger with hlint-3.8 from Hackage. We are using a patched hlint - verifying that this isn't something specific to us...

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