Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. Another rubocop/standardrb gripe:

Another rubocop/standardrb gripe:

Scheduled Pinned Locked Moved Uncategorized
rubocopstandardrbruby
9 Posts 5 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • soulcutter@ruby.socialS This user is from outside of this forum
    soulcutter@ruby.socialS This user is from outside of this forum
    soulcutter@ruby.social
    wrote last edited by
    #1

    Another rubocop/standardrb gripe:

    Style/EmptyLiteral: Use hash literal {} instead of Hash.new

    Nah, I have my own heuristics for when to use which one. If it's inside a block with braces, I assert that:

    # the "approved" butthole syntax
    let(:params) { {} }

    looks worse than

    # ain't nothing wrong with this
    let(:params) { Hash.new }

    #rubocop #standardrb #ruby

    soulcutter@ruby.socialS gregw@mastodon.worldG 2 Replies Last reply
    0
    • soulcutter@ruby.socialS soulcutter@ruby.social

      Another rubocop/standardrb gripe:

      Style/EmptyLiteral: Use hash literal {} instead of Hash.new

      Nah, I have my own heuristics for when to use which one. If it's inside a block with braces, I assert that:

      # the "approved" butthole syntax
      let(:params) { {} }

      looks worse than

      # ain't nothing wrong with this
      let(:params) { Hash.new }

      #rubocop #standardrb #ruby

      soulcutter@ruby.socialS This user is from outside of this forum
      soulcutter@ruby.socialS This user is from outside of this forum
      soulcutter@ruby.social
      wrote last edited by
      #2

      I wouldn't reject somebody else's PR that uses the butthole, but if I write Hash.new who the hell has a problem with that? Assholes, and rubocop.

      soulcutter@ruby.socialS esparta@ruby.socialE 2 Replies Last reply
      0
      • soulcutter@ruby.socialS soulcutter@ruby.social

        I wouldn't reject somebody else's PR that uses the butthole, but if I write Hash.new who the hell has a problem with that? Assholes, and rubocop.

        soulcutter@ruby.socialS This user is from outside of this forum
        soulcutter@ruby.socialS This user is from outside of this forum
        soulcutter@ruby.social
        wrote last edited by
        #3

        I'm in a mood this morning.

        niclake@mastodon.socialN pointlessone@status.pointless.oneP 2 Replies Last reply
        0
        • soulcutter@ruby.socialS soulcutter@ruby.social

          I'm in a mood this morning.

          niclake@mastodon.socialN This user is from outside of this forum
          niclake@mastodon.socialN This user is from outside of this forum
          niclake@mastodon.social
          wrote last edited by
          #4

          @soulcutter butthole syntax needs cat ears tbqh

          1 Reply Last reply
          0
          • soulcutter@ruby.socialS soulcutter@ruby.social

            I'm in a mood this morning.

            pointlessone@status.pointless.oneP This user is from outside of this forum
            pointlessone@status.pointless.oneP This user is from outside of this forum
            pointlessone@status.pointless.one
            wrote last edited by
            #5

            @soulcutter OK, your mood is valid.

            but also… 🙈

            Link Preview ImageLink Preview Image
            soulcutter@ruby.socialS 1 Reply Last reply
            1
            0
            • R relay@relay.mycrowd.ca shared this topic
            • soulcutter@ruby.socialS soulcutter@ruby.social

              Another rubocop/standardrb gripe:

              Style/EmptyLiteral: Use hash literal {} instead of Hash.new

              Nah, I have my own heuristics for when to use which one. If it's inside a block with braces, I assert that:

              # the "approved" butthole syntax
              let(:params) { {} }

              looks worse than

              # ain't nothing wrong with this
              let(:params) { Hash.new }

              #rubocop #standardrb #ruby

              gregw@mastodon.worldG This user is from outside of this forum
              gregw@mastodon.worldG This user is from outside of this forum
              gregw@mastodon.world
              wrote last edited by
              #6

              @soulcutter it didn’t bother me before, but now I will never unsee this haha.

              1 Reply Last reply
              0
              • soulcutter@ruby.socialS soulcutter@ruby.social

                I wouldn't reject somebody else's PR that uses the butthole, but if I write Hash.new who the hell has a problem with that? Assholes, and rubocop.

                esparta@ruby.socialE This user is from outside of this forum
                esparta@ruby.socialE This user is from outside of this forum
                esparta@ruby.social
                wrote last edited by
                #7

                @soulcutter
                re: butthole syntax
                hmm OK, now I can't unsee it

                { {} }

                How about use `do` blocks?

                ```
                let(:params) do
                { }
                end
                ```

                For me it was never about performance, but making clear what's inside. I would never reject (or let rubocop) because of that.

                1 Reply Last reply
                0
                • pointlessone@status.pointless.oneP pointlessone@status.pointless.one

                  @soulcutter OK, your mood is valid.

                  but also… 🙈

                  Link Preview ImageLink Preview Image
                  soulcutter@ruby.socialS This user is from outside of this forum
                  soulcutter@ruby.socialS This user is from outside of this forum
                  soulcutter@ruby.social
                  wrote last edited by
                  #8

                  @pointlessone I love this, haha. Do you think it would JIT down to the same, though?

                  I still prefer writing expressively, rather enforcing the best micro optimization when it’s less-readable.

                  pointlessone@status.pointless.oneP 1 Reply Last reply
                  0
                  • soulcutter@ruby.socialS soulcutter@ruby.social

                    @pointlessone I love this, haha. Do you think it would JIT down to the same, though?

                    I still prefer writing expressively, rather enforcing the best micro optimization when it’s less-readable.

                    pointlessone@status.pointless.oneP This user is from outside of this forum
                    pointlessone@status.pointless.oneP This user is from outside of this forum
                    pointlessone@status.pointless.one
                    wrote last edited by
                    #9

                    @soulcutter I don’t think it would. Most JITs do not apply much optimization just translate to native code. Parser applies some optimizations when generating bytecode though. There are some specialized ops in bytecode, too.

                    1 Reply Last reply
                    1
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups