Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Checking that all files have owners. (#441)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
gabrieldemarmiesse authored Feb 12, 2019
1 parent ad247c5 commit 83f8878
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
68 changes: 68 additions & 0 deletions tests/tooling/test_codeowners.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__])

0 comments on commit 83f8878

Please sign in to comment.