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

feat: add support for plural form #37

Closed
wants to merge 11 commits into from

Conversation

Berkmann18
Copy link
Member

This PR adds the support for plural contributions such as docs, tests, plugins, ...
Resolves #15

Add the support for the plural forms of contributions (e.g: `docs`, `tests`, `plugins`, ...)
@codecov
Copy link

codecov bot commented Jan 15, 2019

Codecov Report

Merging #37 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #37   +/-   ##
=======================================
  Coverage   59.57%   59.57%           
=======================================
  Files           4        4           
  Lines          94       94           
  Branches       12       12           
=======================================
  Hits           56       56           
  Misses         33       33           
  Partials        5        5

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b03b402...9e94dd0. Read the comment docs.

@Berkmann18
Copy link
Member Author

@AllContributorsBot please add @jakebolam for infras, code and docs

@Berkmann18
Copy link
Member Author

^ Just to test if it works on here (other than on the CLI).

package-lock.json Outdated Show resolved Hide resolved
Copy link
Contributor

@sinchang sinchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think shouldn't commit package-lock.json file.

let contributions = doc
.match('#Contribution')
const contributions = doc
.normalize({ plurals: true })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@Berkmann18 Berkmann18 Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

const contributions = doc
.normalize({ plurals: true })
.words()
// .match('#Contribution')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for dropping this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried keeping it but since words like "tests" and any of the plural forms of validContributionTypes get dropped after going through match('#Contribution').

.normalize({ plurals: true })
.words()
// .match('#Contribution')
.slice(5)
.data()
.map(data => {
Copy link
Contributor

@jakebolam jakebolam Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain whats going on here?

Looks like this changes the behaviour to treat any word after the first couple as a contribution (excluding and).

Before behaviour was to find any word which could be a contribution (this also ensures the contributions are valid for the generator) and add them (meaning sentence structure was less important). e.g. @bot please add someone for blah blah, @bot add someone for contributing doc and infra, Jane you're crushing it in documentation and infrastructure, let's add Jane for her contributions. cc @bot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, admittedly that solution is more of a temporary one (until something better and more in line with the match(...) based approach is found.
None of the solutions where I kept match('#Contribution') resolved in acknowledging contributions that were in the plural form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a play too, see if I can provide some more constructive feedback.

This work you've done well help alot!

@jakebolam
Copy link
Contributor

jakebolam commented Jan 15, 2019

^ Just to test if it works on here (other than on the CLI).

@Berkmann18 recently switched the behaviour so it would show as a tag (e.g. need to use @all-contributors). See https://github.com/all-contributors/all-contributors-bot#adding-contributions

@allcontributors
Copy link
Contributor

@jakebolam

I could not determine your intention.

Basic usage: @all-contributors please add jakebolam for code, doc and infra

We had trouble processing your request. Please try again later.

@Berkmann18
Copy link
Member Author

Okay, I've seen there's a change in master so after pushing the rebased version, I'll try again.

@jakebolam
Copy link
Contributor

jakebolam commented Jan 15, 2019

So i'll make the contributing docs better (mention how we use yarn etc), but in the mean time you can get the bot running locally with yarn start. You can run this on your own test repository.

The probot docs are pretty good, basically: https://probot.github.io/docs/development/#running-the-app-locally
and: https://probot.github.io/docs/development/#configuring-a-github-app

@jakebolam
Copy link
Contributor

@sinchang I put some docs in the slack workspace. Come join!

I'll try and get a PR in later today today

@sinchang
Copy link
Contributor

@sinchang I put some docs in the slack workspace. Come join!

I'll try and get a PR in later today today

thanks. joined.

.match('#Contribution')
.data()
.map(data => {
// This removes whitespace, commas etc
let type = data.normal
if (type !== 'ideas' && /s$/.test(type)) type = type.slice(0, -1) //-> singular
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this falls down in a number of cases too (e.g. ing plurals, documenting/documentation/docs). If we were writing something to account for 1000s of words I'd say we keep down this road.

As we are only dealing with around 20 base terms, I think it far more accurate to just account for the variations ourselves: https://github.com/all-contributors/all-contributors-bot/pull/53/files#diff-b5ed782af77775c7d732fcefd331dd6cR39

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah true.

@Berkmann18
Copy link
Member Author

Closing as it's now been done in #53.

@Berkmann18 Berkmann18 closed this Jan 17, 2019
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.

3 participants