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

Expected { after 'if' condition. (curly) #71

Open
BSravanthi opened this issue Nov 16, 2018 · 5 comments
Open

Expected { after 'if' condition. (curly) #71

BSravanthi opened this issue Nov 16, 2018 · 5 comments

Comments

@BSravanthi
Copy link
Contributor

JavaScript allows the omission of curly braces when a block contains only one statement. However, it is considered by many to be the best practice to never omit curly braces around blocks, even when they are optional because it can lead to bugs and reduces code clarity. So the following:

//Bad
if (foo) foo++;

Can be rewritten as:

//Good
if (foo) {
    foo++;
}

Please refer to the following link to fix similar issues.
https://app.codacy.com/app/BSravanthi/pattern-recognition-iiith/issues?&filters=W3siaWQiOiJMYW5ndWFnZSIsInZhbHVlcyI6W251bGxdfSx7ImlkIjoiQ2F0ZWdvcnkiLCJ2YWx1ZXMiOlsiQ29kZSBTdHlsZSJdfSx7ImlkIjoiTGV2ZWwiLCJ2YWx1ZXMiOltudWxsXX0seyJpZCI6IlBhdHRlcm4iLCJ2YWx1ZXMiOlsxNjYyXX0seyJpZCI6IkF1dGhvciIsInZhbHVlcyI6W251bGxdfSx7InZhbHVlcyI6W119XQ==

@DevikaBoddu
Copy link

Commit id: 431ffb5-(1)
Commit id: 5bc4a3a-(2)
Commit id: 97c2be9-(3)

@ShivaniKomandury
Copy link

ShivaniKomandury commented Nov 21, 2018

All the curly braces for if...else statements are included.

Exp 2 - Commit id : 0075c8b
Exp 5 - Commit id : 127f2e9
Exp 7 - Commit id : a39dc2a

Please validate.

@ShivaniKomandury
Copy link

valid fix @DevikaBoddu

@snehitharangu
Copy link

Valid fix @ShivaniKomandury

@snehitharangu
Copy link

Valid fix @DevikaBoddu

This was referenced Nov 26, 2018
@DevikaBoddu DevikaBoddu mentioned this issue Dec 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants