Giter Site home page Giter Site logo

Comments (8)

dmethvin avatar dmethvin commented on May 29, 2024

A lot of that is due to indentation? If this were fresh code we could look at refactoring or other limits such as cyclomatic complexity that would help, but since we're trying to impose this ex-post-facto it might be easier to just raise the limit for now.

from contribute.jquery.org.

mikesherov avatar mikesherov commented on May 29, 2024

maxindent from jshint would help alot. Simply changing some nested ifs to guard clauses would help to, but I'm wondering about code readibility and overall size. It seems like 100 characters may actually hurt readibility here.

from contribute.jquery.org.

dmethvin avatar dmethvin commented on May 29, 2024

I agree the reformatting does make it look ugly, often due to the high indent levels. This could be fixed with a lot of yak shaving to clean up the intent levels and refactor code with things like early-out returns but it would be a shame to make that a blocker for getting this done.

from contribute.jquery.org.

scottgonzalez avatar scottgonzalez commented on May 29, 2024

120 seems excessively wide to me, but I'd be fine allowing projects to temporarily disable the 100 character check. Projects with a high number of long lines can take the time to adjust them before re-enabling the check. Reducing the indentation levels and staying under 100 characters will improve the readability more than just bumping the limit to 120.

from contribute.jquery.org.

mikesherov avatar mikesherov commented on May 29, 2024

@scottgonzalez sounds fine to me. @markelog please note this for core.

from contribute.jquery.org.

markelog avatar markelog commented on May 29, 2024

please note this for core.

In what way? In jquery/jquery#1590 most changes are done for comments, others, for things like:

-           if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
 +
 +          if (
 +              typeof dataTypeOrTransport === "string" &&
 +              !seekingTransport &&
 +              !inspected[ dataTypeOrTransport ]
 +          ) {

Which for me is cleaner and easier to read, isn't that why we impose 100 chars limit in the first place? Not sure if guards would helps with things like that.

Big changes are scary, right, but this is only code-style, we could do that temporary thing, but i'm not sure why, i already done everything necessary to make that permanent.

If, however, project wanted to do this 120 (or something) -> 100 limit change in iterative way, developer can override that rule, simple as that.

So to make this clear, what are wanted to do here? And what are we wanted to do in Core?

from contribute.jquery.org.

scottgonzalez avatar scottgonzalez commented on May 29, 2024

That conditional format isn't what's in our style guide. The correct format is:

if ( typeof dataTypeOrTransport === "string" &&
        !seekingTransport &&
        !inspected[ dataTypeOrTransport ] ) {
    // body goes here
}

We can certainly discuss changing this, but based on our current style guide, what you've used is incorrect.

from contribute.jquery.org.

mgol avatar mgol commented on May 29, 2024

I prefer the current format that Scott described. Moving the opening brace
to the left seems inconsistent.

from contribute.jquery.org.

Related Issues (20)

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.