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

Make everything prettier #46

Merged
merged 1 commit into from
Jun 11, 2022
Merged

Make everything prettier #46

merged 1 commit into from
Jun 11, 2022

Conversation

Sohn123
Copy link
Member

@Sohn123 Sohn123 commented Jun 9, 2022

Apply sed magic to make codestyle more consistent.

testFile Outdated
@@ -0,0 +1 @@
hello{ hi] {}) { test. hel { .
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this

Copy link
Contributor

@lukasrad02 lukasrad02 left a comment

Choose a reason for hiding this comment

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

Thank you for creating this. There are some more rules that came up to my mind, but don't worry if they are too complex to create a script for:

Enforce empty line between method name and first line of code or local variables

dummyMethod

    ^ self

and

dummyMethod

    |local|
    ^ self

instead of

dummyMethod
    ^ self

and

dummyMethod
    |local|
    ^ self

Remove space before/after |

|local1 local2|

instead of

| local1 local2 |

Enforce spaces around @

12 @ 34

instead of

12@34

format.sh Outdated
sed -i 's/_/:=/g' $files

#Spaces befor dots
sed -i 's/[ ]\+\./\./g' $files
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 there are some cases where we want to have spaces in front of (as well as after) dots: Array literals (e.g. {1 . 2 . 3}).

Do you think it will be possible to create an exception for this?

chooseFileMatchingSuffixes: {'svg'. 'svgz'}
label: 'Choose an SVG file (.svg,.svgz)'
Copy link
Contributor

Choose a reason for hiding this comment

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

Your rules seem to be a bit to aggressive. String literals (as well as comments, I don't know whether there are some cases) shouldn't be changed

@Sohn123
Copy link
Member Author

Sohn123 commented Jun 9, 2022

Spaces around @ is easy. But I'm not really sure if I like it. But take a look yourself :)

@lukasrad02
Copy link
Contributor

Personally, I don't care whether there are spaces around @ or not, as long as it's uniform in all methods. But since one of the idioms of the SWA lecture says "use spaces around @", using spaces might be the better option...

@Sohn123 Sohn123 merged commit 46b2216 into dev Jun 11, 2022
@Sohn123 Sohn123 deleted the improve-code-style branch June 14, 2022 14:31
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.

None yet

3 participants