Git Product home page Git Product logo

Comments (10)

TrumpClone avatar TrumpClone commented on July 17, 2024

approved

from code-style.

akxcv avatar akxcv commented on July 17, 2024

Wouldn't it make sense to disable this rule only for certain types of files (configuration, specs, migrations, etc)? I think it's pretty useful for the regular code.

from code-style.

JelF avatar JelF commented on July 17, 2024

@akxcv This forces to replace

Foo = Struct.new(:foo) do

with

Foo = Struct.new(:foo)
class Foo 

After some thinking, i realised that second variant is someway better, because class defenition always better than class_exec. Anyway, it requies some guidelines to leave it enabled in app/ and lib/

from code-style.

JelF avatar JelF commented on July 17, 2024

In most cases, max block length is restricted by module length or method length, so it seems to be useless in regular code

from code-style.

akxcv avatar akxcv commented on July 17, 2024

Yeah, that makes sense. If it's restricted by module/method (class?) length anyway, I'm for disabling block length completely.

from code-style.

akxcv avatar akxcv commented on July 17, 2024

What's the status of this? What are we waiting for?

from code-style.

JelF avatar JelF commented on July 17, 2024

Right now i don't sure, that long class_exec and module_exec blocks are good in general. If they are not, this cop would disallow them. And the reason i wanted to disable this cop is exactly that it disallowed them

from code-style.

JelF avatar JelF commented on July 17, 2024

The problem is, e.g., we have Struct.new() do and whole class defenition is not recognized as a class defenition by static analizers

from code-style.

akxcv avatar akxcv commented on July 17, 2024

Well, I think we should generally avoid metaprogramming outside library code. But, if that's the primary reason for disabling the cop, we shouldn't IMO.
We could disable it for configs, specs, and migrations and leave it in for business logic.

from code-style.

JelF avatar JelF commented on July 17, 2024

Seems reasonable. We can discuss it at monday

from code-style.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.