siderolabs / conform

Policy enforcement for your pipelines.
Mozilla Public License 2.0
432 stars 45 forks source link

feat: support for allow-all scope #124

Closed JensRantil closed 5 years ago

JensRantil commented 5 years ago

We have a very large repository where scope can't be enforced. This commit makes whitelisted scopes optional.

Side-note: I've always understood (based on [1]) scope to be more of a free-text field than something whitelisted/enumerated.

[1] https://www.conventionalcommits.org/en/v1.0.0-beta.4/

andrewrynhard commented 5 years ago

@JensRantil What do you think of this: if scopes ==nil || len(scopes) == 0; then don't enforce scopes?

andrewrynhard commented 5 years ago

Actually, it looks like we already allow this. Scopes are completely optional, its just implicit. Simply don't set scopes in .conform.yaml.

andrewrynhard commented 5 years ago

@JensRantil I'm going to close this since this can be achieved by not specifying a scope in .conform.yaml. Appreciate your time.

jwnx commented 4 years ago

Hi @andrewrynhard ,

Not setting scopes in .conform.yaml is making Conventional Commits check fail with invalid scope on master (007644608):

policies:
  - type: commit
    spec:
      headerLength: 89
      dco: true
      gpg: false
      imperative: true
      maximumOfOneCommit: false
      requireCommitBody: true
      conventional:
        types:
          - fix
          - feat
          - build
          - ci
          - docs
          - style
          - refactor
          - perf
          - test
../conform/conform enforce
POLICY        CHECK                      STATUS        MESSAGE
commit        Header Length              PASS          <none>
commit        DCO                        PASS          <none>
commit        Imperative Mood            PASS          <none>
commit        Conventional Commit        FAILED        Invalid scope "gh-actions": allowed scopes are []
commit        Commit Body                PASS          <none>

Maybe a regression?

andrewrynhard commented 4 years ago

@JensRantil @jwnx Looks like I was completely wrong. Scopes are indeed optional, but when a scope is present they are being enforced. Sorry for the mixup here. @JensRantil If you still wish to get this PR in, then that would fix this. If not I can fix. I can't promise it would happen soon.

JensRantil commented 4 years ago

Late answer here, sorry - we built our own in-house commit message linter instead. As such, I will not have time to wrap this up. Feel free to continue the work I started.