question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Required and optional scope-enum

See original GitHub issue

Expected Behavior

Hello everyone and thanks for your hard work! I recently faced a use-case and I’m not sure if my idea is achievable with the current implementation.

I’m working on a no-managed legacy mono-repo where every single folder is a project.

I would really like to set some rules that somehow enforce:

  • no empty scopes in order to always have in the git history the reference to the edited project (scope-empty) ✅
  • set the possible scopes (scope-enum which already supports multiple scopes) ✅
  • set which one is required and which one is not (e.g I may want to highlight in the scope the project but also what has been done feat(project-a, docs): .... It would be also ok to just specify the project as scope feat(project-a): ..., but feat(docs): ... should not be valid) 🤔

Current Behavior

"rules": {
      "scope-empty": [2, "never"],
      "scope-enum": [2, "always", [
        "project-a",
        "project-b",
        "api",
        "docs",
        ...,
        ]
      ]
    }

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

"rules": {
      "scope-empty": [2, "never"],
      "scope-enum": [2, "always", [
        "project-a",
        "project-b",
        "api",
        "docs"
        ]
      ],
      // No more than one of...
      "scope-required-enum": [2, "always", [
        "project-a",
        "project-b"
        ]
      ],
      "scope-optional-enum": [1, "always", [
        "api",
        "docs"
        ]
      ]
    }

Does it makes sense to you? Would it be probably better to create a plugin like selective-scope

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
andreafspezialecommented, Aug 24, 2022

I think my use-case is very specific so I will leave my solution here just here for the moment. Thanks for the help in the meanwhile! Stay safe!

0reactions
escapedcatcommented, Aug 24, 2022

Only a suggestion if you want to do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enumeration declaration - cppreference.com
3) Opaque enum declaration for an unscoped enumeration must specify the name and the underlying type. Each enumerator becomes a named constant ...
Read more >
strongly typed enum - `class` keyword optional? - Stack Overflow
What you call "strongly typed enum" is really named scoped enumerations, and for those the class or struct keyword is mandatory.
Read more >
C enumeration declarations | Microsoft Learn
An enumeration type declaration gives the name of the (optional) enumeration tag. And, it defines the set of named integer identifiers (called ...
Read more >
enumeration declaration - cppreference.com
Unscoped enumeration​​ Each enumerator becomes a named constant of the enumeration's type (that is, name), visible in the enclosing scope, and can be...
Read more >
Allow per-type scope-enum · Issue #395 - GitHub
I'd like to limit the valid scopes on a per-type basis. For example, the docs type should accept all and each of my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found