Git Product home page Git Product logo

branch-name-lint's People

Contributors

alexander-heimbuch avatar barzik avatar danger-ahead avatar egmacke avatar farist avatar l2jliga avatar omribarzik avatar pinalbhatt avatar shuhrat-kobulov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

branch-name-lint's Issues

TeamCity: Unsupported platform for fsevents

I'm trying to integrate this library in our monorepo nx.dev setup with Husky.

But on the TeamCity CI/CD I cannot get it to work because of this error:


npm verb Linux 5.4.0-171-generic
npm verb node v18.19.1
npm verb npm  v10.2.4
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin"} (current: {"os":"linux"})
npm ERR! notsup Valid os:  darwin
npm ERR! notsup Actual os: linux
npm verb exit 1
npm verb code 1

After some research and investigation with --omit=optional I dived a little bit deeper into the package-lock.json and it seem that it's not optional for this library:

    "node_modules/branch-name-lint/node_modules/fsevents": {
      "version": "2.3.2",
      "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
      "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
      "extraneous": true,
      "hasInstallScript": true,
      "os": [
        "darwin"
      ],
      "engines": {
        "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
      }
    }

Would it be possible that you change this dependency to optional?

Add MD template for PR

adding markdown template for PR with this text:

# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected)
- [ ] This change requires a documentation update

Allow an arbitrary branch pattern generated by a tool

I'm using an automated tool (Laravel Shift) that automatically creates a pull request with a branch name like shift-ci-v8.70.2. There is usually some manual intervention required so I pull down the branch and make some changes and try to push it, but I am blocked by branch-name-lint:

Branch name lint fail! Branch "shift-ci-v8.70.2" must contain a separator "/".

Here is my config:

{
  "branchNameLinter": {
    "prefixes": [
      "feature",
      "issue",
      "hotfix",
      "release",
      "support"
    ],
    "regex": "^(revert|master|develop|issue|release|hotfix/|feature/|support/|shift-)"
  }
}

The regex does handle it, but there doesn't appear to be any way to skip the separator check.

if (this.branch.includes(this.options.separator) === false) {
return this.error(this.options.msgseparatorRequired, this.branch, this.options.separator);
}

Would you be open to a PR that allows disabling of checks by setting their config value to false?

{
  "branchNameLinter": {
    "prefixes": false,
    "separator": false,
    "regex": "^(revert|master|develop|issue|release|hotfix/|feature/|support/|shift-)"
  }
}

That would allow the end user to configure any scheme they like using regex.

Support for case insensitivity in regex

When providing a regex, it would be really useful to have the option to turn off case sensitive matching.

This can be done by passing a second argument to the RegExp constructor new RegExp(exp, options)

Github actions compatibility

Hi guys. We have this tool on pre-push hook and it works fine but when I try to run it on github actions it fails with errors. Seems like this method returns incorrect name of branch

getCurrentBranch() {

Github logs
image

Actual name of branch
962f9bf5ec80308b6f7b78c4c5d30828

Link to github actions: here

Actual behaviour: Ability to lint name of source branch in actions

Move from commonJS module to ESM

It is a breaking change for some Node.js versions, but it is time to move on.

After this, we can upgrade to the new meow module.

Seperator

you misspelled "Separator" consistently. Not a deal breaker, but should be changed eventually imo.

npm-shrinkwrap.json file is useless and makes troubles with npm 7 (and npm 8)

  1. shrinkwrap adds 12k code line to my lock file after install with npm 8
  2. npm 8 has a bug and it installs even dev: true deps. So with npm ci you get error Unsupported platform for [email protected]: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})

I think we should remove npm-shrinkwrap.json file at all

UPD: I've tried to install branch-name-lint without npm-shrinkwrap.json and it works well. So it looks like that npm-shrinkwrap.json is used only for security issues #9

support for regex

I am currently using a shell script to validate the branch name against (multiple) regex.
Would that be in the scope of this package to support too?

Not able to use uppercase prefixes

First of all you lowercase both the prefix and the rest of the name:

const prefix = parts[0].toLowerCase();
let name = null;
if (parts[1]) {
      name = parts[1].toLowerCase();
}

then you check lowercased prefix with unaltered prefixes array:

if (this.options.prefixes.includes(prefix) === false) {

It makes me wonder why you even do lowercasing? Why not make it stricter since this lib is all about strict branch name rules? Or at least add an option to disable lowercasing

Remove eslint disable lines

Since moving to eslint from xo, the code has several eslint disable lines - remove those lines and fix the code.

  1. Search for // eslint-disable-next-line and remove it.
  2. Run npm run lint.
  3. Fix the errors

Config file as JS instead of JSON

Hi,

Would it be possible to allow usage of a JavaScript file for the config of branch name lint in order to import various constants for the config? Currently this tool only supports a JSON file for the config. Thanks.

this tool needs better output message

image

It shouldn't throw an error but just process.exit(1) for a cli.

Besides, the validation message is a little bit casual an informal. Please refer to commitlint.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.