Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

should allow some numbers in subject #18

Closed
BerkeleyTrue opened this issue Aug 29, 2017 · 3 comments
Closed

should allow some numbers in subject #18

BerkeleyTrue opened this issue Aug 29, 2017 · 3 comments

Comments

@BerkeleyTrue
Copy link
Contributor

BerkeleyTrue commented Aug 29, 2017

https://github.com/freeCodeCamp/cz-freecodecamp/blob/master/index.js#L1
This currently in is catching all numbers. For example:
add es6 globals is rejected

cc @erictleung @raisedadead

@erictleung
Copy link
Member

erictleung commented Aug 29, 2017

@BerkeleyTrue these lines of code prevent numbers to be injected in the title.

We might be able to come up with a more elegant solution, but here's a quick solution just off the top of my head. The main repository issue numbers are now in the thousands. So we could change the regex to reject mentions of numbers with 4 or more digits.

const noIssueNumbers = /#?\d{4,}/g;

@BerkeleyTrue
Copy link
Contributor Author

Keep in mind that we are not building this module specifically for fcc but for anyone to use (I use it on many of my projects).

We want it to only identify numbers that are isolated (surrounded by whitespace) or starting with the issue number hash. The current regex doesn't seem to work. It has a false positive with es6.

@erictleung
Copy link
Member

@BerkeleyTrue ah that makes sense 👍 This might work then.

const noIssueNumbers = /\s#?\d+\s?/g;

I'll submit a PR for this.

erictleung added a commit to erictleung/cz-freecodecamp that referenced this issue Aug 29, 2017
The previous regex flagged a false positive with "es6" being in a title.
This commit makes the specification more specific in that numbers
standing alone with or without an hash symbol (#) cannot be used when
flanked by white space.

Closes freeCodeCamp#18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants