File name conventions, CamelCase vs python_lower_case

I’ve been using camel case with upper case first char for Robot source code files and lower case with underscores for Python code, but I keep seeing other naming schemes. Is there a “right way” to name files?

Hi Lennart,

Generally the is no “right way” though there are many who have their beliefs if what is the “right way” and “wrong way”, I’m of the school of thought that it doesn’t matter as long as your consistent.

There are some things to consider here though:

  • In Windows these are all considered the same file, in *nix (e.g. Linux & MacOS) they are all considered different files, so you need to be aware of potential file name conflicts:
  • In some cases python cares about the case of the file name and even the case of the directory the is in (particularly around python classes).


1 Like

There is work being done on the style guide I believe and some rules in tidy / robocop have to do with casing of variables / keywords / test case names.

That being said: it’s a tricky matter, especially when it comes to variables and their casing in relation to their scope. To quickly “see” the scope of a variable, ideally you’d have a different casing for each scope.

The challenge: there’s 4 scopes (global, suite, test, local). Personally, I use snake_case for local scope variables and CAPITAL_CASE for global and suite scope (since they are often the same or overlap quite a bit). I try to refrain from using test scope variables, but I would opt for lowerCamel since UpperCamel is generally used for LibraryNames.