Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 83f8878

Browse files
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.
1 parent ad247c5 commit 83f8878

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ We love pull requests. Here's a quick guide:
6666
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.
6767

6868
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.
69+
70+
## About the `CODEOWNERS` file
71+
72+
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.

tests/tooling/test_codeowners.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,73 @@ def test_codeowners_user_exist():
4848
assert github_client.get_user(user[1:])
4949

5050

51+
directories_to_test = [
52+
'examples',
53+
'keras_contrib/activations',
54+
'keras_contrib/applications',
55+
'keras_contrib/callbacks',
56+
'keras_contrib/constraints',
57+
'keras_contrib/datasets',
58+
'keras_contrib/initializers',
59+
'keras_contrib/layers',
60+
'keras_contrib/losses',
61+
'keras_contrib/metrics',
62+
'keras_contrib/optimizers',
63+
'keras_contrib/preprocessing',
64+
'keras_contrib/regularizers',
65+
'keras_contrib/wrappers'
66+
]
67+
directories_to_test = [path_to_keras_contrib / x for x in directories_to_test]
68+
69+
# TODO: remove those files or find them owners.
70+
exclude = [
71+
'examples/cifar10_clr.py',
72+
'examples/cifar10_densenet.py',
73+
'examples/cifar10_nasnet.py',
74+
'examples/cifar10_resnet.py',
75+
'examples/cifar10_ror.py',
76+
'examples/cifar10_wide_resnet.py',
77+
'examples/conll2000_chunking_crf.py',
78+
'examples/improved_wgan.py',
79+
'examples/jaccard_loss.py',
80+
'keras_contrib/callbacks/cyclical_learning_rate.py',
81+
'keras_contrib/callbacks/dead_relu_detector.py',
82+
'keras_contrib/applications/resnet.py',
83+
'keras_contrib/constraints/clip.py',
84+
'keras_contrib/datasets/coco.py',
85+
'keras_contrib/datasets/conll2000.py',
86+
'keras_contrib/datasets/pascal_voc.py',
87+
'keras_contrib/initializers/convaware.py',
88+
'keras_contrib/losses/crf_losses.py',
89+
'keras_contrib/losses/dssim.py',
90+
'keras_contrib/losses/jaccard.py',
91+
'keras_contrib/layers/advanced_activations/pelu.py',
92+
'keras_contrib/layers/advanced_activations/srelu.py',
93+
'keras_contrib/layers/convolutional/cosineconvolution2d.py',
94+
'keras_contrib/layers/core.py',
95+
'keras_contrib/layers/crf.py',
96+
'keras_contrib/layers/normalization/instancenormalization.py',
97+
'keras_contrib/optimizers/ftml.py',
98+
'keras_contrib/optimizers/lars.py',
99+
'keras_contrib/metrics/crf_accuracies.py',
100+
]
101+
exclude = [path_to_keras_contrib / x for x in exclude]
102+
103+
104+
@pytest.mark.parametrize('directory', directories_to_test)
105+
def test_all_files_have_owners(directory):
106+
files_with_owners = [x[0] for x in parse_codeowners()]
107+
for root, dirs, files in os.walk(directory):
108+
for name in files:
109+
file_path = pathlib.Path(root) / name
110+
if file_path.suffix != '.py':
111+
continue
112+
if file_path.name == '__init__.py':
113+
continue
114+
if file_path in exclude:
115+
continue
116+
assert file_path in files_with_owners
117+
118+
51119
if __name__ == '__main__':
52120
pytest.main([__file__])

0 commit comments

Comments
 (0)