rspec/rules/S2007/description.adoc
Alban Auzeill 2c306d110e Fix code block ambiguity with old header style
Ensure blank line before list and clean the one leading space
2020-06-30 17:16:12 +02:00

11 lines
761 B
Plaintext

Defining and using global variables and global functions, when the convention dictates OOP can be confusing and difficult to use properly for multiple reasons:
* You run the risk of name clashes.
* Global functions must be stateless, or they can cause difficult-to-track bugs.
* Global variables can be updated from anywhere and may no longer hold the value you expect.
* It is difficult to properly test classes that use global functions.
Instead of being declared globally, such variables and functions should be moved into a class, potentially marked <code>static</code>, so they can be used without a class instance.
This rule checks that only object-oriented programming is used and that no functions or procedures are declared outside of a class.