Menu

Python Python Python Python Make Consistent 100 Marks Open Source Project Multiple Develop Q43786209

python python python python

Make It Consistent (100 Marks)

There is an open-source project in which multiple developers areactively contributing to development. Every developer has adifferent coding style which is leading to inconsistency in codeindentation. As we know indentation helps to convey a betterstructure of a program to the readers. So, they decided some of theindentation rules mandatory for all developer before committing thecode changes. Your goal is to create a utility to validate therules given below and generate a warning message for that rule andcorresponding line.

Rule 1. All the function must have open bracket “{“at the sameline without any space.

Rule 2. Closing bracket “}” for any function should bevertically aligned with the start letter of the function.

Rule 3. Comparison with any constant values should be on theright-hand side in if statement.

Rule 4. Whole code should be indented, and indentation willfollow rules 1tab = 4 spaces.

Rule 5: There should not be any heading and trailing whitespaces.

Example:

Input:

void func(int a, int b) {

printf(“ Hello World”);

}

Output :

Rule [1] violated at line [1].

Explanation: At line 1 there is an extra space when “{“starts.

Input:

void func(int a, int b){

if (a == 5){

printf(“ Hello World”);

}

}

Output :

Rule [3] violated at line [2].

Explanation: At line 3 it should be if (5==a)

Input Format

One function will be given.

Constraints

Line of any input function will be less than 500 characters.

Output Format

Print which rule breaks at which line.

Note: One input can have multiple rule violation.

Sample TestCase 1

Input

void func(int a, int b) {
printf(“ Hello World”);
}

Output

Rule [1] violated at line [1].

Explanation

It is a default one.

Sample TestCase 2

Input

int main(int x, int y){
if (x == 5){
printf(“n Hellow World”);
}
}

Output

Rule [3] violated at line [2].

Expert Answer


Answer to python python python python Make It Consistent (100 Marks) There is an open-source project in which multiple developers …

OR