зеркало из https://github.com/microsoft/nni.git
Check copyright header (#4599)
This commit is contained in:
Родитель
cadf3a5564
Коммит
f6ec539457
|
@ -342,3 +342,17 @@ For more information see the `Code of Conduct FAQ <https://opensource.microsoft.
|
|||
Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
|
||||
We enforce every source files in this project to carry a license header. This should be added at the beginning of each file. Please contact the maintainer if you think there should be an exception.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. code-tab:: python
|
||||
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
.. code-tab:: typescript
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .mutator import FBNetMutator # noqa: F401
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
from .mutator import ProxylessNasMutator
|
||||
from .trainer import ProxylessNasTrainer
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
from .mutator import RandomMutator
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
from .functional import FunctionalEvaluator
|
||||
|
|
|
@ -60,6 +60,8 @@ def generate_stub_file() -> str:
|
|||
]
|
||||
|
||||
code = [
|
||||
'# Copyright (c) Microsoft Corporation.',
|
||||
'# Licensed under the MIT license.',
|
||||
'# This file is auto-generated to make auto-completion work.',
|
||||
'# When pytorch version does not match, it will get automatically updated.',
|
||||
'# pylint: skip-file',
|
||||
|
|
|
@ -3,6 +3,14 @@ trigger: none
|
|||
stages:
|
||||
- stage: lint
|
||||
jobs:
|
||||
|
||||
- job: copyright
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- script: python test/vso_tools/copyright_check.py
|
||||
displayName: Check copyright header
|
||||
|
||||
- job: docs
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
invalid_files = []
|
||||
|
||||
copyright_headers = [
|
||||
'# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.',
|
||||
'# Copyright (c) Microsoft Corporation. All rights reserved.\n#\n# MIT License',
|
||||
]
|
||||
|
||||
whitelist = [
|
||||
'nni/version.py',
|
||||
'nni/algorithms/hpo/bohb_advisor/config_generator.py',
|
||||
]
|
||||
|
||||
for root, dirs, files in os.walk('nni'):
|
||||
for file in files:
|
||||
if not file.endswith('.py'):
|
||||
continue
|
||||
full_path = os.path.join(root, file)
|
||||
if full_path in whitelist:
|
||||
continue
|
||||
content = open(full_path).read()
|
||||
if not content.strip():
|
||||
# empty file
|
||||
continue
|
||||
if not any(content.startswith(header) for header in copyright_headers):
|
||||
invalid_files.append(full_path)
|
||||
|
||||
if invalid_files:
|
||||
print("The following files doesn't have a copyright text header.\n")
|
||||
for file in invalid_files:
|
||||
print(' ' + file)
|
||||
print('\nPlease add the following text at the beginning of the file.\n')
|
||||
print('# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT license.')
|
||||
sys.exit(1)
|
Загрузка…
Ссылка в новой задаче