-
Notifications
You must be signed in to change notification settings - Fork 10
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
Adding configuration and new checks #73
Adding configuration and new checks #73
Conversation
Master switch if a user wants to check venues or not.
@@ -545,11 +545,14 @@ function F_VALIDATE(disabledHL) { | |||
this.$isApproved = attrs.approved; | |||
this.$mainCategory = raw.getMainCategory(); | |||
this.$categories = attrs.categories; | |||
this.$categoryAttributes = attrs.categoryAttributes; |
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.
Do we need to add categoryAttributes
to the externs?
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.
Agreed, it should be
src/validate.js
Outdated
seen = null; | ||
if ("Delete" === rawVenue.state) continue; | ||
// not in scope of current view. | ||
if (rawVenue.outOfScope && rawVenue.outOfScope === true) continue; |
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.
Just if (rawVenue.outOfScope) continue;
?
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.
Agreed
var alts = venue.$alts; | ||
var lock = venue.$lock; | ||
|
||
var exceptedCategories ='BRIDGE|ISLAND|FOREST_GROVE|SEA_LAKE_POOL|RIVER_STREAM|CANAL|DAM|TUNNEL|JUNCTION_INTERCHANGE'.split('|'); |
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.
No hard-coded values should be in the code. Those categories should be moved either to i18n
as a default value or to the data.js
.
'^admin$', '^-1$', | ||
'^avsus$', '^107668852$' | ||
]; | ||
var re = new RegExp(botNamesAndIDs.join('|'),'i'); |
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.
Same here. The Regex should be created during the initialization. Looks like it belongs to i18n.
&& address.isOkFor(254)) | ||
venue.report(254); | ||
//check elevation of the parking lot | ||
if ((!parkAttr || !parkAttr.lotType || parkAttr.lotType.length === 0) |
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.
The checks !parkAttr.lotType
and parkAttr.lotType.length === 0
are the same
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.
lotType can be undefined or {}
is that both caught by either check? I thought I needed both checks?
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.
Any value that is not false, undefined, null, 0, NaN, or the empty string (""), and any object, including a Boolean object whose value is false, is considered truthy when used as the condition.
Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
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.
If lotType
is an object, I guess there will be no length
property there, unless it is added by WME. Do you happen to have a permalink with a parking lot at hand, since there are no parking lots around...
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.
Thanks
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.
Sure here; parking lot with things set corectly
and one with less things set
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.
In the correctly set permalink I see the lotType
is an array and it is empty. Sorry, we need to check if the array length is zero, but I am not quite sure why it is empty in the correctly set PL?
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.
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.
Sorry, I might have missed the venue. We need to check the length of the array []
is not zero just as you had it before.
src/validate.js
Outdated
if (venue.$rawObject.isGasStation()) { | ||
// check if brand in name | ||
if (venue.$name.indexOf(venue.$brand) === -1 | ||
&& isLimitOk(259) |
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.
Overall, it is not necessary to use isLimitOk()
, since the venue.report()
below will check the limit anyway.
The rationale behind isLimitOk()
is to avoid long computations. For example:
if (isLimitOk()) {
// long check
if (condition)
report();
}
In such cases it makes sense, since if the limit is exceeded, we do not even start the "long check" part.
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.
Ah, okay, that makes sense. I need to review the checks then. Thanks for the explanation.
|
||
if(venue.$entryExitPoints && venue.$entryExitPoints.length){ | ||
var stopPoint = venue.$entryExitPoints[0].getPoint(); | ||
var areaCenter = venue.$geometry.getCentroid(); |
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.
Not quite understand this check. And it seems there is no commit in i18n
?
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.
This checks if the entry/exit point of a place has not been moved from its original position when created (equal to the center of the venue) I'll check the i18n, 256 should be there or I've forgotten it
Looks good. Do not need to squash yet, we will squash on merge to the master. I will test the dev branch during the weekend. Maybe we should ask for some volunteers on the forum to test this branch and provide a feedback as well? |
Okay, we will merge and do a test. Maybe we should put up a test version pre build somewhere, easier for people to test that do not know (or want) how to build. |
Would you like to lead this beta branch? |
Sorry, had my kids over the weekend so was offline for most of it 😉 |
@berestovskyy I've created a beta version of the script and put it on GreasyFork as unlisted here I want to link it on the forum as a test version using the following text:
This could be posted to the discord too. Would this be okay? |
Sorry, I just realized I have added the beta tag to the main version of Validator :) To avoid confusions, maybe let's call it alpha, experimental, release candidate (RC), daily build, or anything different than beta? And it would be nice if I or potentially other developers could update this experimental branch as well. I just googled if it's possible to share a script on GF, but it seems not: Maybe we better create a repo similar to release: So we have a bit more flexibility with access permissions. What do you think? |
You can sync a github repository to a greasyfork script via webhook,
therefore not needing to share the greasyfork credentials. This is the
simplest way to do it and what we have done in the WazeDev group
…On Mon, Oct 15, 2018 at 12:14 PM Andriy Berestovskyy < ***@***.***> wrote:
Sorry, I just realized I have added the beta tag to the main version of
Validator :) To avoid confusions, maybe let's call it alpha, experimental,
release candidate (RC), daily build, or anything different than beta?
And it would be nice if I or potentially other developers could update
this experimental branch as well. I just googled if it's possible to share
a script on GF, but it seems not:
greasyfork-org/greasyfork#311
<greasyfork-org/greasyfork#311>
Maybe we better create a repo similar to release:
https://github.com/WMEValidator/release
So we have a bit more flexibility with access permissions. What do you
think?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATTy2vcXCiU8g6NsnyUQGzt0AAmiSzwNks5ulLRGgaJpZM4XMedV>
.
--
JustinS83
USA Local Champ
|
@berestovskyy I'll rename it to alpha then 😄 And I agree, it would be nice to have. |
Yes, I understand how the build process works. It should be trivial to add
to the build script to commit the changes to github once complete, which
would then trigger the webhook and posting to greasyfork.
…On Mon, Oct 15, 2018 at 7:25 PM David Westerink ***@***.***> wrote:
@berestovskyy <https://github.com/berestovskyy> I'll rename it to alpha
then 😄 And I agree, it would be nice to have.
@justins83 <https://github.com/justins83> We have a build script that
needs to be run before we publish. Maybe we need to look into a auto build
service? And publish from there?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATTy2oxV_53ILrycFLyTVTg0r0bcIvDuks5ulRmEgaJpZM4XMedV>
.
--
JustinS83
USA Local Champ
|
IMO a webhook or an automatic sync does not change the fact that we need a shared account on GreasyFork, or do I miss something? |
You can certainly set up an account and share the credentials, but how many
greasyfork scripts do you really need to set up? Production, beta and
maybe alpha? Once those are set up and the webhooks established why would
someone need continued access to the account?
…On Tue, Oct 16, 2018 at 1:39 AM Andriy Berestovskyy < ***@***.***> wrote:
IMO a webhook or an automatic sync does not change the fact that we need a
shared account on GreasyFork, or do I miss something?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATTy2vUD18Tf33sfD7ZP3XqrMXoA4XYIks5ulXEYgaJpZM4XMedV>
.
--
JustinS83
USA Local Champ
|
Still, someone has to have an access... Anyway, seems David has decided to post the script under his account, so it does not matter anymore ;) |
I would be a better way to do it, but I wanted to start testing things out soon. Sorry if I made a mistake in that :-/ |
It's ok with me. We can always create another GitHub repo or a shared account on GreasyFork... |
Added some new checks and a configuration option.
Sorry for not splitting this up correctly, if you want I could try to break this apart.