Repository: sdv-dev/RDT (language: python)

Issue:
Create `validate_transformer_code_style` function
A function should be implemented to automatically validate the code style of any new Transformer.

## Function Name and Module

The function should be implemented inside `tests/contributing.py` and should be called `validate_transformer_code_style`

## Inputs

The function should accept a single input:

* `transformer (class or str)`: Transformer class or full Python name of the class (e.g. `DatetimeTransformer` or `"rdt.transformers.time.DatetimeTransformer"`)

## Outputs

The function should return a single `bool` value indicating whether the code style is correct or not.

## Behavior

The function should run all the third party code style checkers (`flake8`, `isort`, `pylint`...) as well custom code analysis checks and report whether all of them pass, as well as feedback about why they do not otherwise.

### List of Checks

The following validations must be performed and reported:



Check | Correct If | What does it check
-- | -- | --
flake8 | flake8 check passes | PEP8 standards and basic static code analysis
isort | isort check passes | Imports are properly sorted
pylint | pylint check passes | Static code analysis and programming style
pydocstyle | pydocstyle check passes | Whether the docstrings are written in the right format
Transformer Name | The Transformer name is correct | Transformer name ends with `Transformer` (e.g. `DatetimeTransformer`)
Unit Tests Exist | The unit tests module exists and is located in the right place | The unit tests module should be located called `tests/unit/transformers/<transformer_family>/<data_type>.py`
Unit Test function names | The unit test function names are correct | The unit test function names should be called `test_<method_name>_<test_case_name>`

### Prints to console

The function prints several messages on the console indicating:
* The path to the source file of the Transformer, which is being analyzed.
* A message indicating whether the code style is correct or not.
* A list of things that were validated and whether they were correct or not (list above).

## Usage Examples

### Success

![image](https://user-images.githubusercontent.com/6129283/134681632-082d2a75-ec57-4fbb-a665-87d346b2899d.png)

### External tool failure

![image1](https://user-images.githubusercontent.com/6129283/134681447-45dbad16-9edf-470a-8ca8-77dc90babc30.png)

### Custom validation failure

![image8](https://user-images.githubusercontent.com/6129283/134681759-2018862c-58d5-4e79-adee-202d72c28667.png)



Discussion / hints:
The current format of our `docstrings` follows the [Google style guide](https://google.github.io/styleguide/pyguide.html), we can add `pydocstyle` and setting the `convention` to `google`. 

However there is a bug in their library which produces `D417 Missing arguments description`, which we do have, and occurs all over our `docstrings` and we will have to ignore the `D417` until this issue is fixed. Reference to the issue: https://github.com/PyCQA/pydocstyle/issues/449

Fix patch:
diff --git a/setup.py b/setup.py
index 9bb8673f7..b40ad08db 100644
--- a/setup.py
+++ b/setup.py
@@ -52,6 +52,7 @@
     'flake8-sfs>=0.0.3,<0.1',
     'isort>=4.3.4,<5',
     'pylint>=2.5.3,<3',
+    'pep8-naming>=0.12.1,<0.13',
 
     # fix style issues
     'autoflake>=1.1,<2',


Test patch:
diff --git a/tests/unit/transformers/test_numerical.py b/tests/unit/transformers/test_numerical.py
index 285e280ba..8ec6c5a84 100644
--- a/tests/unit/transformers/test_numerical.py
+++ b/tests/unit/transformers/test_numerical.py
@@ -35,7 +35,7 @@ def test__fit(self):
         assert transformer.null_transformer.fill_value == expect_fill_value
         assert transformer._dtype == expect_dtype
 
-    def test__learn_rounding_digits_more_than_15_decimals(data):
+    def test__learn_rounding_digits_more_than_15_decimals(self):
         """Test the _learn_rounding_digits method with more than 15 decimals.
 
         If the data has more than 15 decimals, None should be returned.
@@ -51,7 +51,7 @@ def test__learn_rounding_digits_more_than_15_decimals(data):
 
         assert output is None
 
-    def test__learn_rounding_digits_less_than_15_decimals(data):
+    def test__learn_rounding_digits_less_than_15_decimals(self):
         """Test the _learn_rounding_digits method with less than 15 decimals.
 
         If the data has less than 15 decimals, the maximum number of decimals
@@ -68,7 +68,7 @@ def test__learn_rounding_digits_less_than_15_decimals(data):
 
         assert output == 3
 
-    def test__learn_rounding_digits_negative_decimals_float(data):
+    def test__learn_rounding_digits_negative_decimals_float(self):
         """Test the _learn_rounding_digits method with floats multiples of powers of 10.
 
         If the data has all multiples of 10, 100, or any other higher power of 10,
@@ -87,7 +87,7 @@ def test__learn_rounding_digits_negative_decimals_float(data):
 
         assert output == -1
 
-    def test__learn_rounding_digits_negative_decimals_integer(data):
+    def test__learn_rounding_digits_negative_decimals_integer(self):
         """Test the _learn_rounding_digits method with integers multiples of powers of 10.
 
         If the data has all multiples of 10, 100, or any other higher power of 10,