From 83f88788c376f1511d2b1cb80dc56aed28636219 Mon Sep 17 00:00:00 2001 From: Gabriel de Marmiesse Date: Tue, 12 Feb 2019 12:15:31 +0100 Subject: [PATCH] Checking that all files have owners. (#441) * Checking that all files have owners. * pep8 fix * Added todo. * Added explanations about the codeowner file. * Typo and style. * Toned down the passage about reviews. * Updated the exclude list. --- CONTRIBUTING.md | 4 ++ tests/tooling/test_codeowners.py | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03cda0e20..78d6da0a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,3 +66,7 @@ We love pull requests. Here's a quick guide: Both Keras-Contrib and Keras operate under the [MIT License](LICENSE). At the discretion of the maintainers of both repositories, code may be moved from Keras-Contrib to Keras and vice versa. The maintainers will ensure that the proper chain of commits will flow in both directions, with proper attribution of code. Maintainers will also do their best to notify contributors when their work is moved between repositories. + +## About the `CODEOWNERS` file + +If you add a new feature to keras-contrib, you should add yourself and your file in the `CODEOWNERS` file. Doing so will, in the future, tag you whenever an issue or a pull request about your feature is opened. Be aware that it represents some work, and in addition of being tagged, we would appreciate that you review new pull requests related to your feature. diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index a991b2385..e3da91357 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -48,5 +48,73 @@ def test_codeowners_user_exist(): assert github_client.get_user(user[1:]) +directories_to_test = [ + 'examples', + 'keras_contrib/activations', + 'keras_contrib/applications', + 'keras_contrib/callbacks', + 'keras_contrib/constraints', + 'keras_contrib/datasets', + 'keras_contrib/initializers', + 'keras_contrib/layers', + 'keras_contrib/losses', + 'keras_contrib/metrics', + 'keras_contrib/optimizers', + 'keras_contrib/preprocessing', + 'keras_contrib/regularizers', + 'keras_contrib/wrappers' +] +directories_to_test = [path_to_keras_contrib / x for x in directories_to_test] + +# TODO: remove those files or find them owners. +exclude = [ + 'examples/cifar10_clr.py', + 'examples/cifar10_densenet.py', + 'examples/cifar10_nasnet.py', + 'examples/cifar10_resnet.py', + 'examples/cifar10_ror.py', + 'examples/cifar10_wide_resnet.py', + 'examples/conll2000_chunking_crf.py', + 'examples/improved_wgan.py', + 'examples/jaccard_loss.py', + 'keras_contrib/callbacks/cyclical_learning_rate.py', + 'keras_contrib/callbacks/dead_relu_detector.py', + 'keras_contrib/applications/resnet.py', + 'keras_contrib/constraints/clip.py', + 'keras_contrib/datasets/coco.py', + 'keras_contrib/datasets/conll2000.py', + 'keras_contrib/datasets/pascal_voc.py', + 'keras_contrib/initializers/convaware.py', + 'keras_contrib/losses/crf_losses.py', + 'keras_contrib/losses/dssim.py', + 'keras_contrib/losses/jaccard.py', + 'keras_contrib/layers/advanced_activations/pelu.py', + 'keras_contrib/layers/advanced_activations/srelu.py', + 'keras_contrib/layers/convolutional/cosineconvolution2d.py', + 'keras_contrib/layers/core.py', + 'keras_contrib/layers/crf.py', + 'keras_contrib/layers/normalization/instancenormalization.py', + 'keras_contrib/optimizers/ftml.py', + 'keras_contrib/optimizers/lars.py', + 'keras_contrib/metrics/crf_accuracies.py', +] +exclude = [path_to_keras_contrib / x for x in exclude] + + +@pytest.mark.parametrize('directory', directories_to_test) +def test_all_files_have_owners(directory): + files_with_owners = [x[0] for x in parse_codeowners()] + for root, dirs, files in os.walk(directory): + for name in files: + file_path = pathlib.Path(root) / name + if file_path.suffix != '.py': + continue + if file_path.name == '__init__.py': + continue + if file_path in exclude: + continue + assert file_path in files_with_owners + + if __name__ == '__main__': pytest.main([__file__])