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

Style fixes #4

Merged
merged 1 commit into from
Oct 27, 2021
Merged

Style fixes #4

merged 1 commit into from
Oct 27, 2021

Conversation

jefferyto
Copy link

Most of these changes were requested in p-e-w#127 (review)

Other changes (line wrapping, const naming, additional consts) came from looking at the rest of the code.

callback(String(line) + "\n");
else
callback(imports.byteArray.toString(line) + "\n");
if (SHELL_VERSION <= SHELL_3_34) {
Copy link
Owner

@mwilck mwilck Oct 27, 2021

Choose a reason for hiding this comment

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

If you think 33400 isn't obvious enough, use getShellVersion("3.34.0") instead.

Copy link
Author

@jefferyto jefferyto Oct 27, 2021

Choose a reason for hiding this comment

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

I'm trying to understand your reasoning... You are okay with saving getShellVersion(Config.PACKAGE_VERSION) to a constant, but not okay with saving 33400 or getShellVersion("3.34.0") to a constant?

Edit: For me it's not a matter of whether 33400 is obvious enough or not, I don't think having magic numbers in multiple places in the code is a good pattern.

Copy link
Owner

Choose a reason for hiding this comment

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

I just don't think that SHELL_3_34 is easier to understand than 33400, which is also a constant. Maybe we can agree on this?

const SHELL_3_34 = getShellVersion("3.34.0");

Copy link
Author

Choose a reason for hiding this comment

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

I just don't think that SHELL_3_34 is easier to understand than 33400, which is also a constant.

If you accidentally deleted a character from SHELL_3_34 you would get an error during parsing/compilation. If you accidentally deleted a character from 33400 you would get an error during run-time (if you happen to trigger the right conditions to see the error).

Maybe we can agree on this?

That's fine, I'll make this change.

}

function makeSimpleClass(BaseClass, getSuperArgs, initFn, name) {
if (shellVersion < 33200) {
if (SHELL_VERSION < SHELL_3_32) {
Copy link
Owner

Choose a reason for hiding this comment

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

See above

Copy link
Owner

@mwilck mwilck left a comment

Choose a reason for hiding this comment

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

I'm no fan of your SHELL_3_32 constants. But otherwise, I'm fine with this PR.

Most of these changes were requested in
p-e-w#127 (review)

Other changes (line wrapping, const naming, additional consts) came from
looking at the rest of the code.
Copy link
Owner

@mwilck mwilck left a comment

Choose a reason for hiding this comment

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

Looks good. I suppose you tested this?

@jefferyto
Copy link
Author

Looks good. I suppose you tested this?

Tested on GNOME Shell 3.38.4 (Ubuntu 21.04).

@mwilck
Copy link
Owner

mwilck commented Oct 27, 2021

Works on GNOME 41, too. LGTM.

@mwilck mwilck merged commit 2eb03a7 into mwilck:master Oct 27, 2021
@jefferyto jefferyto deleted the style-fixes branch October 28, 2021 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants