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

JSHint fixes (including indentation & whitespace); #406

Closed
wants to merge 3 commits into from
Closed

JSHint fixes (including indentation & whitespace); #406

wants to merge 3 commits into from

Conversation

jerone
Copy link
Contributor

@jerone jerone commented Nov 6, 2014

This PR includes:

  • JSHint warning fixes.
  • Style consistency (including indentation & whitespace).

No functionality should have been changed!

Node modules & ace has been ignored.

Some files still have warnings, but those warnings needs addressing later as it might involve functionality changes:

  • controllers/_template.js
  • controllers/scriptStorage.js
  • controllers/user.js
  • libs/modelQuery.js
  • libs/modifySessions.js
  • libs/muExpress.js
  • libs/remove.js
  • libs/templateHelpers.js

Hoping that this can reviewed asap to keep conflicts as a minimum.

@jerone jerone added CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. PR READY This is used to indicate that a pull request (PR) is ready for evaluation. labels Nov 6, 2014
@Martii
Copy link
Member

Martii commented Nov 6, 2014

Some of these fixes look like they are needed for consistency... however this is section blocked by #262 since I'm sure it deals with vote/flag/remove....

Placing on hold for the time being with a -1 until @sizzlemctwizzle can pipe in... there is still a lot of code normalizing to do, as well with strict mode too, but I've had to wait on that.

@jerone
Copy link
Contributor Author

jerone commented Nov 6, 2014

@Martii commented on 6 nov. 2014 21:19 CET:

Some of these fixes look like they are needed for consistency... however this is section blocked by #262 since I'm sure it deals with vote/flag/remove....

Placing on hold for the time being with a -1 until @sizzlemctwizzle can pipe in... there is still a lot of code normalizing to do, as well with strict mode too, but I've had to wait on that.

I understand your reasoning, where can I follow the current code of that issue?

@Martii
Copy link
Member

Martii commented Nov 6, 2014

where can I follow the current code of that issue?

#262

I can re-ask him in private if he doesn't mind being over trodden in that area but no promises.

@jerone
Copy link
Contributor Author

jerone commented Nov 6, 2014

@Martii commented on 6 nov. 2014 21:33 CET:

#262

I can re-ask him in private if he doesn't mind being over trodden in that area but no promises.

Should have pinged him ( @sizzlemctwizzle ) myself, this private contacting is not a good way to work together and keep discussions public.

@Martii
Copy link
Member

Martii commented Nov 6, 2014

He is in the public and so am I ... he just doesn't have a status update yet... sometimes everyone can use a reminder to go view a specific area... so non-issue there.

@Zren
Copy link
Contributor

Zren commented Nov 6, 2014

I'm fairly opposed on these big formatting commits as they break code I'm too lazy to submit (not a good reason) and introduce bugs as there are no tests (not that I see any in this case).

One rule I dislike about this commit has to be:

if () return; and if ()\n return; are fine and don't need to be wrapped in {}. The \n is optional but is good to have. My rules are: {} is not optional if the statement uses more than a single line. {} is not optional if there is an else statement attached.

But now that I look at our styleguide, which I've totally read before, apparently the consistent {} is a thing. :/

Thanks for catching all the missing/extra ; though.

I'll grumble and sigh when this is merged. Just be sure it's a quick clean cut.

@jerone
Copy link
Contributor Author

jerone commented Nov 6, 2014

My personal opinion is to get this in as soon as possible; keep the base as consistent as possible and follow the styleguide as best possible, from the beginning.

There we're no open PR's, so it looked the best time.

@Martii
Copy link
Member

Martii commented Nov 6, 2014

I would like us to slowly actually follow ./controllers/_template.js a little bit more... I know there are situations where we can't but overall it is my understanding that file is the preferred controller format.

And it's still "up in the air" about one liners although they should always have braces from my understanding of the STYLEGUIDE.md. JSHint isn't always correct either as proven multiple times in the past... but there are a few things that could be isolated from this PR, slowly, and merged in.

@@ -23,50 +23,49 @@ exports.verify = function (aId, aStrategy, aUsername, aLoggedIn, aDone) {

findDeadorAlive(User, { 'auths': digest }, true,
function (aAlive, aUser, aRemoved) {
var pos = aUser ? aUser.auths.indexOf(digest) : -1;
if (aRemoved) { aDone(null, false, 'user was removed'); }
var pos = aUser ? aUser.auths.indexOf(digest) : -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the function body indented at the same level as the definition? Tabs vs Spaces issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it wants function to be after the previous comma ,.

@Zren
Copy link
Contributor

Zren commented Nov 6, 2014

There we're no open PR's, so it looked the best time.

It's all good. Make sure to fix whatever the merge conflict your other patches made.

…into jshint

Conflicts:
	controllers/issue.js
@jerone
Copy link
Contributor Author

jerone commented Nov 6, 2014

@Zren commented on 6 nov. 2014 23:26 CET:

Make sure to fix whatever the merge conflict your other patches made.

Done.

@Martii
Copy link
Member

Martii commented Nov 6, 2014

There's definitely some issues with JSHint here... I'm against this merge but I will wait a bit to see if sizzle is available... JSHint should NEVER change TODO comment lines as it moves where a change should be done and there is also some compliance with our STYLEGUIDE that JSHint doesn't pay attention to... should know more later.

@jerone
Copy link
Contributor Author

jerone commented Nov 6, 2014

JSHint should NEVER change TODO comment lines

That's not an JSHint issue. Can revert that change. Please point to the corresponding lines.

@Martii
Copy link
Member

Martii commented Nov 6, 2014

Please point to the corresponding lines.

As I stated above this is on HOLD regardless of styling because it's section blocked... I will get back to it at a later point... otherwise if you are impatient I'll just close it as invalid.

secret: sessionSecret,
store: sessionStore
}));
secret: sessionSecret,
Copy link
Member

Choose a reason for hiding this comment

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

moot whitespace adjustment

.caseInsensitive(script.issuesCategorySlug), open: {$ne: false} });
var scriptOpenIssueCountQuery = Discussion.find({
category: scriptStorage
.caseInsensitive(script.issuesCategorySlug), open: { $ne: false }
Copy link
Member

Choose a reason for hiding this comment

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

Period can be considered to be an operator so this is incorrect.

@Martii Martii removed the PR READY This is used to indicate that a pull request (PR) is ready for evaluation. label Nov 7, 2014
@@ -0,0 +1 @@
**/ace/**.js
Copy link
Member

Choose a reason for hiding this comment

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

Not everyone uses JSHint... and I think Zren mentioned to you that this could be done in your .git folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Follow-up #97

Copy link
Member

Choose a reason for hiding this comment

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

#97 is currently stale (not to mention problematic) and you might notice I didn't include it in the #249 milestones. See #97 (comment).

@Martii
Copy link
Member

Martii commented Nov 7, 2014

Probably should be discussed in the PR comments (not inline).

If this were merged, which I'm -1 on it still, the inline comments become part of this PR historically... however if you want it here I'll echo it:

I would feel more comfortable with separate PRs/commits to cherry pick... one for the semi-colons, one for this, one for that... one big huge, inclusive, chunk is bound to increase the problems in our code.

e.g. too many changes in this PR that are controversial at this point in time... there is the needed semi-colon fixes, function space indentions, etc (e.g. "nice catches") but each would be best served as a standalone PR.

@jerone
Copy link
Contributor Author

jerone commented Nov 8, 2014

So how do we proceed? because I feel a lot of resistance to this PR.
Do I send a PR for each file or each type of fix separately or both...?

@Martii
Copy link
Member

Martii commented Nov 8, 2014

So how do we proceed?

...

I would feel more comfortable with separate PRs/commits to cherry pick

...

there is the needed semi-colon fixes, function space indentions, etc (e.g. "nice catches") but each would be best served as a standalone PR.

In general I'm not thrilled with that auto-indent thing you are using and would suggest that you omit that. You can either submit a commit to restore all the whitespace/linebreaks back to where it was in this PR or close it and submit new ones... left it open for you to decide... although since you are making files I'm not quite sure how that would work for you removing the dot files... so probably best to do another PR unless you or GH have a trick up your sleeve.

@@ -1496,7 +1500,8 @@ exports.flag = function (aReq, aRes, aNext) {
var fn = flagLib[unflag && unflag === 'unflag' ? 'unflag' : 'flag'];
if (aErr || !aUser) { return aNext(); }

fn(User, aUser, aReq.session.user, function (aFlagged) { // TODO: Non-descript function name
fn(User, aUser, aReq.session.user, function (aFlagged) {
// TODO: Non-descript function name
Copy link
Member

Choose a reason for hiding this comment

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

This is a prime example of why they shouldn't be moved... the TODO is actually meant for the statement before it.

@jerone
Copy link
Contributor Author

jerone commented Nov 8, 2014

@Martii commented on 8 nov. 2014 19:17 CET:

So how do we proceed?

...

I would feel more comfortable with separate PRs/commits to cherry pick

...

@jerone commented on 8 nov. 2014 16:11 CET:

Do I send a PR for each file or each type of fix separately or both...?


Closing this PR as I'm probably going to send separate PR's.

@jerone jerone closed this Nov 8, 2014
@@ -44,7 +44,7 @@ function removeable(aModel, aContent, aUser, aCallback) {
exports.removeable = removeable;

function remove(aModel, aContent, aUser, aReason, aCallback) {
var remove = new Remove({
var removeModel = new Remove({
Copy link
Member

Choose a reason for hiding this comment

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

here we go again... newly renamed identifier.

@jerone jerone deleted the jshint branch November 8, 2014 19:47
@@ -136,7 +138,7 @@ var applyModelListQueryFlaggedFilter = function (aModelListQuery, aOptions, aFla
if (aFlaggedQuery == 'true') {
Copy link
Member

Choose a reason for hiding this comment

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

btw seems to have missed this one

@Martii Martii mentioned this pull request Nov 25, 2014
@jerone jerone mentioned this pull request Nov 28, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CODE Some other Code related issue and it should clearly describe what it is affecting in a comment.
Development

Successfully merging this pull request may close these issues.

3 participants