Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use correct error message when regex validation fails #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

al
Copy link

@al al commented Jul 23, 2024

Use msgDoesNotMatchRegex rather than msgBranchDisallowed when the branch name does not pass the regex validation.

Use `msgDoesNotMatchRegex` rather than `msgBranchDisallowed` when the
branch name does not pass the regex validation.
al added a commit to al/lionels-legacy that referenced this pull request Jul 23, 2024
Add branch-name-lint to enforce a Git branch naming convention.

Add a Husky pre-push hook to run the linter before pushing a branch.

To manually run the linter:
    pnpm run lint:branch

Branches must consist of a valid prefix (see below), a forward-slash
(`/`), and a name that begins with a letter and contains only letters,
digits, hyphens (`-`) and periods (`.`). E.g. `feat/implement-thing`.

Valid branch prefixes are:

- `chore` For miscellaneous changes that do not fall into any other
   category.
- `ci` For changes to CI configuration files and scripts.
- `core` For change to build processes, tooling, dependencies or
   general project structure.
- `doc` For changes to documentation.
- `experiment` For temporary experiments/spikes. These branches will
   not be merged.
- `feat` For new features.
- `fix` For bug fixes.
- `hotfix` For critical bug fixes that will need to be merged directly
   into the production environment.
- `release` For preparing releases to production.
- `test` For changes to tests.

The (case-insensitive) validation regex is:

    ^([a-z]+/[a-z][a-z0-9\-\.]*)

NOTES:

- Using a fork of the official branch-name-lint repo in which we have
  implemented our own fix for misleading error messages
  (barzik/branch-name-lint#55) and merged a
  community fix for general mishandling of errors
  (barzik/branch-name-lint#45).

LINKS:

- https://github.com/barzik/branch-name-lint
- https://github.com/al/branch-name-lint/tree/integration/error-handling-issues
al added a commit to al/lionels-legacy that referenced this pull request Jul 23, 2024
Add branch-name-lint to enforce a Git branch naming convention.

Add a Husky pre-push hook to run the linter before pushing a branch.

To manually run the linter:
    pnpm run lint:branch

Branches must consist of a valid prefix (see below), a forward-slash
(`/`), and a name that begins with a letter and contains only letters,
digits, hyphens (`-`) and periods (`.`). E.g. `feat/implement-thing`.

Valid branch prefixes are:

- `chore` For miscellaneous changes that do not fall into any other
   category.
- `ci` For changes to CI configuration files and scripts.
- `core` For change to build processes, tooling, dependencies or
   general project structure.
- `doc` For changes to documentation.
- `experiment` For temporary experiments/spikes. These branches will
   not be merged.
- `feat` For new features.
- `fix` For bug fixes.
- `hotfix` For critical bug fixes that will need to be merged directly
   into the production environment.
- `release` For preparing releases to production.
- `test` For changes to tests.

The (case-insensitive) validation regex is:

    ^[a-z]+/[a-z][a-z0-9.-]*$

NOTES:

- Using a fork of the official branch-name-lint repo in which we have
  implemented our own fix for misleading error messages
  (barzik/branch-name-lint#55) and merged a
  community fix for general mishandling of errors
  (barzik/branch-name-lint#45).

LINKS:

- https://github.com/barzik/branch-name-lint
- https://github.com/al/branch-name-lint/tree/integration/error-handling-issues
al added a commit to al/lionels-legacy that referenced this pull request Jul 23, 2024
Add branch-name-lint to enforce a Git branch naming convention.

Add a Husky pre-push hook to run the linter before pushing a branch.

To manually run the linter:
    pnpm run lint:branch

Branches must consist of a valid prefix (see below), a forward-slash
(`/`), and a name that begins with a letter and contains only letters,
digits, hyphens (`-`) and periods (`.`). E.g. `feat/implement-thing`.

Valid branch prefixes are:

- `chore` For miscellaneous changes that do not fall into any other
   category.
- `ci` For changes to CI configuration files and scripts.
- `core` For changes to build processes, tooling, dependencies or
   general project structure.
- `doc` For changes to documentation.
- `experiment` For temporary experiments/spikes. These branches will
   not be merged.
- `feat` For new features.
- `fix` For bug fixes.
- `hotfix` For critical bug fixes that will need to be merged directly
   into the production environment.
- `release` For preparing releases to production.
- `test` For changes to tests.

The (case-insensitive) validation regex is:

    ^[a-z]+/[a-z][a-z0-9.-]*$

NOTES:

- Using a fork of the official branch-name-lint repo in which we have
  implemented our own fix for misleading error messages
  (barzik/branch-name-lint#55) and merged a
  community fix for general mishandling of errors
  (barzik/branch-name-lint#45).

LINKS:

- https://github.com/barzik/branch-name-lint
- https://github.com/al/branch-name-lint/tree/integration/error-handling-issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant