barzik / branch-name-lint Goto Github PK
View Code? Open in Web Editor NEWLint your branch names
License: MIT License
Lint your branch names
License: MIT License
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?
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
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.
Lines 59 to 61 in 723b216
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.
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)
There is possible command injection in the script. See [here](vulnerability issue ).
Change exec to execFile.
You should change:
branch name and prefix or now case sensitive.
To:
branch name and prefix are now case sensitive.
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.
you misspelled "Separator" consistently. Not a deal breaker, but should be changed eventually imo.
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
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?
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
Since moving to eslint
from xo
, the code has several eslint disable lines - remove those lines and fix the code.
// eslint-disable-next-line
and remove it.npm run lint
.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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.