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

Remove newlines at start and end of methods #4670

Merged
merged 1 commit into from
Jul 21, 2017

Conversation

andrewkroh
Copy link
Member

This removes blank lines from the start and end of functions. For example, this function

func foo() {

    return bar

}

would become

func foo() {
    return bar
}

This tightens up the code and allows you to see more context when viewing
the source code.

@andrewkroh andrewkroh added discuss Issue needs further discussion. review labels Jul 14, 2017
@ruflin
Copy link
Contributor

ruflin commented Jul 14, 2017

Did you use a script for that? I kind of liked the have it at the beginning but good to unify.

@@ -37,7 +37,6 @@ func New(
name string,
mcfg *ModuleConfig,
fcfg *FilesetConfig) (*Fileset, error) {

modulePath := filepath.Join(modulesPath, mcfg.Module)
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 it's cases like this one when a blank line helps readability? Otherwise, there's no indentation hint between the function header and the block, making it hard to read, IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, was thinking the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, I think in cases where the function declaration spans multiple lines I will leave those blank lines alone. Will update.

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the PR and it with from 210 files modified (485 deletions) to 198 files modified (438 deletions).

@andrewkroh andrewkroh force-pushed the feature/clean-newlines branch 4 times, most recently from 42f9cfc to 087917f Compare July 19, 2017 18:58
@andrewkroh andrewkroh removed the discuss Issue needs further discussion. label Jul 19, 2017
@tsg
Copy link
Contributor

tsg commented Jul 21, 2017

Argh, all green, but now there's a conflict.

@monicasarbu
Copy link
Contributor

I am adding an empty line after the function definition, especially when the function has many arguments. If the others find it better to have no empty line, I can adjust my habits.

This removes blank lines from the start and end of functions. For example, this function

    func foo() {

        return bar

    }

would become

    func foo() {
        return bar
    }

This tightens up the code and allows you to see more context when viewing
the source code.
@andrewkroh andrewkroh force-pushed the feature/clean-newlines branch from 087917f to c2b01cd Compare July 21, 2017 12:55
@tsg tsg merged commit edde891 into elastic:master Jul 21, 2017
@andrewkroh andrewkroh deleted the feature/clean-newlines branch January 17, 2018 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants