-
Notifications
You must be signed in to change notification settings - Fork 50
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
lib: skip fixup! and squash! commits #33
Changes from all commits
79f946e
d07d944
25e5398
47f98de
229ba0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict' | ||
|
||
const id = 'skip-autosquashable' | ||
|
||
module.exports = { | ||
id: id | ||
, meta: { | ||
description: 'skip autosquashable fixup! and squash! commits' | ||
, recommended: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ..so that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't work out what |
||
} | ||
, disabled: true | ||
, defaults: { } | ||
, options: { } | ||
, validate: (context, rule) => { | ||
if (context.title.startsWith('fixup!')) { | ||
context.report({ | ||
id: id | ||
, message: 'Skipping fixup! commit.' | ||
, string: context.title | ||
, level: 'warn' | ||
}) | ||
return | ||
} | ||
|
||
if (context.title.startsWith('squash!')) { | ||
context.report({ | ||
id: id | ||
, message: 'Skipping squash! commit.' | ||
, string: context.title | ||
, level: 'warn' | ||
}) | ||
return | ||
} | ||
|
||
context.report({ | ||
id: id | ||
, message: 'Commit is neither fixup! nor squash!.' | ||
, string: context.title | ||
, line: 0 | ||
, column: 0 | ||
, level: 'fail' | ||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
[ | ||
{ | ||
"sha": "79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"node_id": "MDY6Q29tbWl0MTU1ODE5NzI2Ojc5Zjk0NmU4OGU3OWY1MDYzYmJlNzc1MzgwYTQxOGJkOGFiMGI4ODE=", | ||
"commit": { | ||
"author": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-09T16:24:33Z" | ||
}, | ||
"committer": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-09T18:19:29Z" | ||
}, | ||
"message": "lib: skip fixup! and squash! commits", | ||
"tree": { | ||
"sha": "0117c48bf2beff44676b0fa8c4e652860d67e833", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/trees/0117c48bf2beff44676b0fa8c4e652860d67e833" | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/commits/79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"comment_count": 0, | ||
"verification": { | ||
"verified": false, | ||
"reason": "unsigned", | ||
"signature": null, | ||
"payload": null | ||
} | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"comments_url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/79f946e88e79f5063bbe775380a418bd8ab0b881/comments", | ||
"author": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"committer": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"parents": [ | ||
{ | ||
"sha": "4e64157b6a87267fd4b9f0598159eeb968e04e21", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/4e64157b6a87267fd4b9f0598159eeb968e04e21", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/4e64157b6a87267fd4b9f0598159eeb968e04e21" | ||
} | ||
] | ||
}, | ||
{ | ||
"sha": "d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"node_id": "MDY6Q29tbWl0MTU1ODE5NzI2OmQwN2Q5NDQzOWJlNDNhNjVkNmU1N2VjMmVlMWQ4YzkzNjc2ZThkNTU=", | ||
"commit": { | ||
"author": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-10T00:44:48Z" | ||
}, | ||
"committer": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-10T00:44:48Z" | ||
}, | ||
"message": "squash! lib: skip fixup! and squash! commits", | ||
"tree": { | ||
"sha": "b37fb650a27feaddb950d153a7085fec2347ec7d", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/trees/b37fb650a27feaddb950d153a7085fec2347ec7d" | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/commits/d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"comment_count": 0, | ||
"verification": { | ||
"verified": false, | ||
"reason": "unsigned", | ||
"signature": null, | ||
"payload": null | ||
} | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"comments_url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/d07d94439be43a65d6e57ec2ee1d8c93676e8d55/comments", | ||
"author": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"committer": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"parents": [ | ||
{ | ||
"sha": "79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/79f946e88e79f5063bbe775380a418bd8ab0b881", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/79f946e88e79f5063bbe775380a418bd8ab0b881" | ||
} | ||
] | ||
}, | ||
{ | ||
"sha": "25e5398728b59ab0fdf141d1676a68969204c60a", | ||
"node_id": "MDY6Q29tbWl0MTU1ODE5NzI2OjI1ZTUzOTg3MjhiNTlhYjBmZGYxNDFkMTY3NmE2ODk2OTIwNGM2MGE=", | ||
"commit": { | ||
"author": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-10T01:04:41Z" | ||
}, | ||
"committer": { | ||
"name": "Richard Lau", | ||
"email": "riclau@uk.ibm.com", | ||
"date": "2018-11-10T01:04:41Z" | ||
}, | ||
"message": "fixup! lib: skip fixup! and squash! commits", | ||
"tree": { | ||
"sha": "c4f1faf780d28fce67c7d1ec0a7e0617f43bc79a", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/trees/c4f1faf780d28fce67c7d1ec0a7e0617f43bc79a" | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/git/commits/25e5398728b59ab0fdf141d1676a68969204c60a", | ||
"comment_count": 0, | ||
"verification": { | ||
"verified": false, | ||
"reason": "unsigned", | ||
"signature": null, | ||
"payload": null | ||
} | ||
}, | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/25e5398728b59ab0fdf141d1676a68969204c60a", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/25e5398728b59ab0fdf141d1676a68969204c60a", | ||
"comments_url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/25e5398728b59ab0fdf141d1676a68969204c60a/comments", | ||
"author": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"committer": { | ||
"login": "richardlau", | ||
"id": 5445507, | ||
"node_id": "MDQ6VXNlcjU0NDU1MDc=", | ||
"avatar_url": "https://avatars0.githubusercontent.com/u/5445507?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/richardlau", | ||
"html_url": "https://github.com/richardlau", | ||
"followers_url": "https://api.github.com/users/richardlau/followers", | ||
"following_url": "https://api.github.com/users/richardlau/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/richardlau/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/richardlau/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/richardlau/subscriptions", | ||
"organizations_url": "https://api.github.com/users/richardlau/orgs", | ||
"repos_url": "https://api.github.com/users/richardlau/repos", | ||
"events_url": "https://api.github.com/users/richardlau/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/richardlau/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"parents": [ | ||
{ | ||
"sha": "d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"url": "https://api.github.com/repos/nodejs/core-validate-commit/commits/d07d94439be43a65d6e57ec2ee1d8c93676e8d55", | ||
"html_url": "https://github.com/nodejs/core-validate-commit/commit/d07d94439be43a65d6e57ec2ee1d8c93676e8d55" | ||
} | ||
] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I am a bit confused..shouldn't it be named
skip-autosquashable
(off by default)? Because even when this is turned off via a--no
switch we are still going to apply that rule to the commit for the warningThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the option as conceptual (i.e. a signal of intent) and the rule an implementation detail. I followed the existing
validate-metadata
option (which is also on by default and is not, for example,skip-metadata
).Initially I didn't have a rule at all and implemented the skip logic directly here. Maybe it shouldn't be a rule at all (for example it doesn't really have pass/fail states). It's sort of a meta "if the commit looks like this then don't apply the usual rules but apply this special one to emit a warning instead".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardlau ACK. Somehow it feels more natural to me to say the intent is "skip autosquashability checks", and the rules are "check if the commits are autosqushable" i.e. I think it would be more intuitive if we switch the two names, the option being
skip-autosquash-checks
and the rule beingcheck-autosquashable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..and, it may more natural if we split the "warn" checks and the "fail" checks into two rules, if the sole purpose of the warning rules is to get some warnings displayed..so we can keep the existing
skip-autosquashable.js
but strip the "fail" checks into acheck-autosquashable.js