virtual-labs-archive / pattern-recognition-iiith

Other
4 stars 245 forks source link

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

Open BSravanthi opened 5 years ago

BSravanthi commented 5 years ago

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 commented 5 years ago

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

ShivaniKomandury commented 5 years ago

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

Exp 2 - Commit id : 0075c8b7555b6b404a6b6365f89309c72e73dfcc Exp 5 - Commit id : 127f2e97f2665b66862e6225d4c4f884d2618d88 Exp 7 - Commit id : a39dc2a0b62f80e68b8e383322f9297f6c46863b

Please validate.

ShivaniKomandury commented 5 years ago

valid fix @DevikaBoddu

snehitharangu commented 5 years ago

Valid fix @ShivaniKomandury

snehitharangu commented 5 years ago

Valid fix @DevikaBoddu