Checks ocaml code for style errors, per CS51 style guide
To download, navigate within the terminal to the folder where you want to keep the file. Then type in "curl https://raw.githubusercontent.com/gvashishtha/Style51/master/style51.c > style51.c" or "wget https://raw.githubusercontent.com/gvashishtha/Style51/master/style51.c > style51.c"
You can compile the program by typing either "gcc style51.c -o style51.o" or "clang style51.c -o style51.o" (clang and gcc are C compilers). Once you compile the program, run by typing "./style51.o" followed by the path to your .ml file. If you are unsure about the path to your .ml file, navigate to the directory that contains it and type "pwd".
./style51.o <path to ml file> -<flags>
(write in a group as in -mstop
after filename):
-m
to silence match warnings
-t
to silence then warnings
-o
to silence warnings around mathematical operators
-s
to silence warnings at end-of-line semicolons
-p
to silence warnings about spacing around parentheses
As of right now, Style51 checks the following things:
- No more than 80 characters per line
- No tab characters
- If an if statement is broken across multiple lines, the corresponding else statement should have the same indentation.
- All '|' characters should be at the same level as their corresponding match statements.
- Mathematical operators should be surrounded by spaces.
- Commas and semicolons should be followed, but not preceded, by a space.
- Double semicolons preceded by a space.
Style 51 does not check for the following issues:
- Using 2 spaces or 4 spaces inconsistently to represent tabs.
- Keeping 'let' statements at the same indentation level.
- Using minimal parentheses.
Additionally, Style51 marks the following things as errors, even though they are permitted by the style guide.
- Removing space from around mathematical operators to emphasize precedence (as in 4*3 + 1*1).
- Putting 'then' at the beginning of a newline in non-nested conditionals.