ImperialCollegeLondon/grad_school_software_engineering_course

Add info on other languages linters, formatters, testing suites etc

Closed this issue Β· 15 comments

The same way we do when explaining the data structures. Languages to support:

  • R
  • C++
  • Fortran

A cry for help! Could you advise on linters, formatters and testing suits for:

I'll compile whatever you tell me and put it in the right place in the lessons.

For formatters, pretty much everybody uses clang-format and most IDEs support it.

clang-tidy is probably the most popular linter (the name always confuses me -- it sounds like it should be a formatter), but I've heard CppCheck is also a good one.

For testing, I've always used GoogleTest, but I think Boost Test and Catch 2 are also v popular.

With compiled languages like C++ and Fortran, it might be worth mentioning that your compiler can give lots of helpful linter-type warnings. For gcc and clang, it's a good idea to pass the -Wall -Wextra -Wpedantic flags to get extra ones.

What he said πŸ˜„

Let's also add info about package managers, or similar, to include in the page where we talk about conda, poetry, etc.

I actually think I can answer most of the fortran stuff:

Fortran

For C++ you have vcpkg and Conan. You can also use the system package manager, but it's not a particularly portable approach.

So, to summarize for C++:

C++

LGTM. I've generally not bothered trying to make VS Code work for C++ on Windows though, because it's a bit of a pain and you can just use Visual Studio.

It seems like it's possible though: https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites

^^ @jamesturner246

And for R, pending on @SaranjeetKaur 's seal of approval:

R

LGTM. I've generally not bothered trying to make VS Code work for C++ on Windows though, because it's a bit of a pain and you can just use Visual Studio.

It seems like it's possible though: https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites

^^ @jamesturner246

Added as a comment.

cc-a commented

For fortran i'd probably mention pfUnit as a more fully featured test framework and there is fortran-linter which I've never tried. Whilst the compiler provided warnings are very useful I don't know of any IDE that actually supports running them to provide inline linting.

OK about pfUnit and fortran-linter.

About the last comment, in theory VSCode does it: https://fortran-lang.github.io/vscode-fortran-support/#linting

The fortran-linter does not integrate with VSCode, which is obviously not a problem, but for many people might be a limitation.

It's funny: fortran linters and formatters are written in python, while python linters and formatters are written in rust. Now, it should be that rust linters and formatters were written in fortran, to close the circle πŸ˜†

cc-a commented

About the last comment, in theory VSCode does it: https://fortran-lang.github.io/vscode-fortran-support/#linting

Ah, good to know.

And for R, pending on @SaranjeetKaur 's seal of approval:

R

These are all good!