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

Added missing builder.endObject calls #3902

Merged
merged 1 commit into from
Oct 14, 2013

Conversation

spinscale
Copy link
Contributor

After closing #3878 it came to me, that we might have other code snippets of missing or too much builder.endObject() / builder.startObject() methods (same for arrays), so I wrote this kind of hacky shell script

#/bin/bash
for x in Object Array ; do

    start="\.start$x"
    end="\.end$x"

    for i in $(ag -l "$start") ; do
        startingCount=$(grep -c "$start" $i)
        endingCount=$(grep -c "$end" $i)

        if [ $startingCount -ne $endingCount ] ; then
            echo "$i $x: start $startingCount end $endingCount"
        fi
    done

done

only found two other pieces of code and a couple of false positives.

I am thinking if we could automate this by doing something similar as the forbidden-api maven module does and parse the source itself (to prevent false positives).

Anyone having experience with that?

@dadoonet
Copy link
Member

Nice script! I like it and the forbidden-api like thing.

@s1monw
Copy link
Contributor

s1monw commented Oct 13, 2013

+1 to commit. Yet, I opened #3889 to move all this serialisation to the corresponding classes - once we are on that we should also add tests for this.

@spinscale spinscale merged commit df95453 into elastic:master Oct 14, 2013
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.

3 participants