Skip to content

Commit f3ecd26

Browse files
authored
reset project (#51)
flake8 fixes
1 parent b89d99c commit f3ecd26

File tree

13 files changed

+71
-29
lines changed

13 files changed

+71
-29
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
A detailed description of what is being reported. Please include steps to reproduce the problem.
55
66
Things to consider sharing:
7-
- What version of the package is being used (pip show mbed-targets)?
7+
- What version of the package is being used (pip show mbed-tools-ci-scripts)?
88
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
99
-->
1010

DEVELOPMENT.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ Run static analysis (note that no output means all is well):
8080
flake8
8181
```
8282

83+
Perform static type check:
84+
85+
```bash
86+
mypy -p mbed_tools_ci_scripts
87+
```
88+
8389
## Documenting code
8490

8591
Inclusion of docstrings is needed in all areas of the code for Flake8

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Mbed Tools CI Scripts
22

3-
![Package](https://img.shields.io/badge/Package-mbed--tools--ci--scripts-lightgrey)
4-
[![Documentation](https://img.shields.io/badge/Documentation-GitHub_Pages-blue)](https://armmbed.github.io/mbed-tools-ci-scripts)
5-
[![PyPI](https://img.shields.io/pypi/v/mbed-tools-ci-scripts)](https://pypi.org/project/mbed-tools-ci-scripts/)
3+
![Package](https://badgen.net/badge/Package/mbed-tools-ci-scripts/grey)
4+
[![Documentation](https://badgen.net/badge/Documentation/GitHub%20Pages/blue?icon=github)](https://armmbed.github.io/mbed-tools-ci-scripts)
5+
[![PyPI](https://badgen.net/pypi/v/mbed-tools-ci-scripts)](https://pypi.org/project/mbed-tools-ci-scripts/)
66
[![PyPI - Status](https://img.shields.io/pypi/status/mbed-tools-ci-scripts)](https://pypi.org/project/mbed-tools-ci-scripts/)
77
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mbed-tools-ci-scripts)](https://pypi.org/project/mbed-tools-ci-scripts/)
88

9-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ARMmbed/mbed-tools-ci-scripts/blob/master/LICENSE)
9+
[![License](https://badgen.net/pypi/license/mbed-tools-ci-scripts)](https://github.com/ARMmbed/mbed-tools-ci-scripts/blob/master/LICENSE)
1010
[![Compliance](https://badgen.net/badge/License%20Report/compliant/green?icon=libraries)](https://armmbed.github.io/mbed-tools-ci-scripts/third_party_IP_report.html)
1111

12-
[![Build Status](https://dev.azure.com/mbed-tools/mbed-tools-ci-scripts/_apis/build/status/Build%20and%20Release?branchName=master&stageName=CI%20Checkpoint)](https://dev.azure.com/mbed-tools/mbed-tools-ci/_build/latest?definitionId=3&branchName=master)
12+
[![Build Status](https://dev.azure.com/mbed-tools/mbed-tools-ci-scripts/_apis/build/status/Build%20and%20Release?branchName=master&stageName=CI%20Checkpoint)](https://dev.azure.com/mbed-tools/mbed-tools-ci-scripts/_build/latest?definitionId=8&branchName=master)
1313
[![Test Coverage](https://codecov.io/gh/ARMmbed/mbed-tools-ci-scripts/branch/master/graph/badge.svg)](https://codecov.io/gh/ARMmbed/mbed-tools-ci-scripts)
1414
[![Maintainability](https://api.codeclimate.com/v1/badges/41301e959f22986b7b2b/maintainability)](https://codeclimate.com/github/ARMmbed/mbed-tools-ci-scripts/maintainability)
1515

azure-pipelines/build-release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ stages:
3434
Linux_Py_3_7:
3535
python.version: '3.7'
3636
vmImageName: ubuntu-latest
37+
uploadCoverage: "false"
38+
39+
Linux_Py_3_8:
40+
python.version: '3.8'
41+
vmImageName: ubuntu-latest
3742
uploadCoverage: "true"
3843

3944
Windows_Py_3_6:
@@ -46,6 +51,11 @@ stages:
4651
vmImageName: windows-latest
4752
uploadCoverage: "false"
4853

54+
Windows_Py_3_8:
55+
python.version: '3.8'
56+
vmImageName: windows-latest
57+
uploadCoverage: "false"
58+
4959
macOS_Py_3_6:
5060
python.version: '3.6'
5161
vmImageName: macOS-latest
@@ -55,6 +65,12 @@ stages:
5565
python.version: '3.7'
5666
vmImageName: macOS-latest
5767
uploadCoverage: "false"
68+
69+
macOS_Py_3_8:
70+
python.version: '3.8'
71+
vmImageName: macOS-latest
72+
uploadCoverage: "false"
73+
5874
pool:
5975
vmImage: $(vmImageName)
6076

mbed_tools_ci_scripts/spdx_report/spdx_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def document_namespace(self) -> str:
7474
def _generate_namespace(self) -> str:
7575
"""Generates a document namespace."""
7676
if self._is_dependency:
77-
url_base = f"http://spdx.org/spdxdocs"
77+
url_base = "http://spdx.org/spdxdocs"
7878
uuid = generate_uuid_based_on_str(self.document_name)
7979
return f"{url_base}/{self.document_name}-{uuid}"
8080
return get_project_namespace(self._project_config, self.document_name)

mbed_tools_ci_scripts/spdx_report/spdx_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_project_namespace(project_config_path: Path, document_name: str) -> str:
9191
"""Determines the project namespace from configuration."""
9292
with open(str(project_config_path), "r", encoding="utf8") as f:
9393
config = toml.load(f).get(THIRD_PARTY_CONFIG_NAMESPACE, dict())
94-
protocol = f"http://"
94+
protocol = "http://"
9595
path_part = f'{config.get("CreatorWebsite")}/{config.get("PathToSpdx")}'
9696
name_part = f'{document_name}-{config.get("UUID")}'
9797
return f"{protocol}{path_part}/{name_part}"

mbed_tools_ci_scripts/tag_and_release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ def _update_repository(mode: CommitType, is_new_version: bool, version: str, cur
9393
with ProjectTempClone(desired_branch_name=current_branch) as git:
9494
git.configure_for_github()
9595
time_str = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M")
96-
commit_message = f"🚀 releasing version {version} @ {time_str}" if is_new_version else f"📰 Automatic changes ⚙"
96+
commit_message = f"🚀 releasing version {version} @ {time_str}" if is_new_version else "📰 Automatic changes ⚙"
9797
if mode == CommitType.RELEASE:
9898
_commit_release_changes(git, version, commit_message)
9999
if is_new_version:
100-
logger.info(f"Tagging commit")
100+
logger.info("Tagging commit")
101101
git.create_tag(version, message=f"release {version}")
102102
git.force_push_tag()
103103

mbed_tools_ci_scripts/utils/third_party_licences.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ def get_licences_from_pattern(self, licence_descriptor_pattern: Pattern) -> Opti
129129
self.load()
130130
if not self._licence_store or not self._licence_list:
131131
return None
132-
matching_licences = [l for l in self._licence_list if licence_descriptor_pattern.match(l)]
133-
return [cast(Licence, self._licence_store.get(l)) for l in matching_licences] if matching_licences else None
132+
matching_licences = [licence for licence in self._licence_list if licence_descriptor_pattern.match(licence)]
133+
return (
134+
[cast(Licence, self._licence_store.get(licence)) for licence in matching_licences]
135+
if matching_licences
136+
else None
137+
)
134138

135139
def get_licence(self, licence_descriptor: Optional[str]) -> Optional[Licence]:
136140
"""Determines the licence based on a string descriptor e.g. Apache 2."""
@@ -218,8 +222,8 @@ def determine_licences_not_in_list(licence_expression: str, licence_list: Iterat
218222
def determine_whether_licence_expression_is_compliant(licence_expression: str, licence_list: list) -> bool:
219223
"""Checks whether an expression is compliant with a list of licences."""
220224
licensing_util = Licensing()
221-
for l in licence_list:
222-
if licensing_util.contains(licence_expression, l):
225+
for licence in licence_list:
226+
if licensing_util.contains(licence_expression, licence):
223227
return True
224228
return False
225229

@@ -231,9 +235,9 @@ def _is_expression_or(licence_expression: str) -> bool:
231235

232236
def is_licence_accepted(licence_expression: str) -> bool:
233237
"""Determines whether the licence expressed is valid with regards to project's accepted licences."""
234-
authorised_licences = [l.identifier for l in get_allowed_opensource_licences()]
238+
authorised_licences = [licence.identifier for licence in get_allowed_opensource_licences()]
235239
is_or = _is_expression_or(licence_expression)
236-
if bool([l for l in determine_licences_not_in_list(licence_expression, iter(authorised_licences))]):
240+
if bool([licence for licence in determine_licences_not_in_list(licence_expression, iter(authorised_licences))]):
237241
return (
238242
determine_whether_licence_expression_is_compliant(licence_expression, authorised_licences)
239243
if is_or

news/20200429.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tested on Python 3.8.

news/20200429.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reset project's structure with latest template.

0 commit comments

Comments
 (0)