Skip to content

Commit

Permalink
Replace flake8 with pylint
Browse files Browse the repository at this point in the history
Signed-off-by: pem70 <[email protected]>
  • Loading branch information
pem70 committed Jul 22, 2024
1 parent 97e2599 commit 58800e2
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 31 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/sdk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ jobs:
- name: Lint with pydoclint
run: pydoclint --exclude='.*/build/.*' src
- name: Lint with pylint
run: pylint src --disable=all --enable=C0103 --ignore=build
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
run: |
# check for Python errors
pylint src --errors-only --disable=E0401,E0611 --ignore=build
# check for lint
pylint ./src --disable=all --enable=C0103,C0301 --ignore=build --max-line-length=127
- name: Test with pytest
run: |
coverage run -m pytest ./tests/unit
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ colorama==0.4.5
commentjson==0.9.0
coverage==5.4
deepmerge==1.1.0
flake8==5.0.0
idna==3.7
importlib-metadata==3.6.0;python_version<"3.8"
isort
Expand Down
36 changes: 21 additions & 15 deletions src/core/zowe/core_for_zowe_sdk/profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
from copy import deepcopy
from typing import Optional

import jsonschema
from deepmerge import always_merger
from jsonschema.exceptions import (
FormatError,
SchemaError,
UndefinedTypeCheck,
UnknownType,
ValidationError,
)

from .config_file import ConfigFile, Profile
from .credential_manager import CredentialManager
Expand Down Expand Up @@ -268,25 +274,25 @@ def get_profile(
cfg_profile = cfg.get_profile(
profile_name=profile_name, profile_type=profile_type, validate_schema=validate_schema
)
except jsonschema.exceptions.ValidationError as exc:
except ValidationError as exc:
logger.error(f"Instance was invalid under the provided $schema property, {exc}")
raise jsonschema.exceptions.ValidationError(
f"Instance was invalid under the provided $schema property, {exc}"
)
except jsonschema.exceptions.SchemaError as exc:
raise ValidationError(f"Instance was invalid under the provided $schema property, {exc}")
except SchemaError as exc:
logger.error(f"The provided schema is invalid, {exc}")
raise jsonschema.exceptions.SchemaError(f"The provided schema is invalid, {exc}")
except jsonschema.exceptions.UndefinedTypeCheck as exc:
raise SchemaError(f"The provided schema is invalid, {exc}")
except UndefinedTypeCheck as exc:
logger.error(f"A type checker was asked to check a type it did not have registered, {exc}")
raise jsonschema.exceptions.UndefinedTypeCheck(
f"A type checker was asked to check a type it did not have registered, {exc}"
)
except jsonschema.exceptions.UnknownType as exc:
raise UndefinedTypeCheck(f"A type checker was asked to check a type it did not have registered, {exc}")
except UnknownType as exc:
logger.error(f"Unknown type is found in schema_json, {exc}")
raise jsonschema.exceptions.UnknownType(f"Unknown type is found in schema_json, {exc}")
except jsonschema.exceptions.FormatError as exc:
raise UnknownType(
f"Unknown type is found in schema_json, {exc}",
instance=profile_name,
schema=validate_schema,
)
except FormatError as exc:
logger.error(f"Validating a format config_json failed for schema_json, {exc}")
raise jsonschema.exceptions.FormatError(f"Validating a format config_json failed for schema_json, {exc}")
raise FormatError(f"Validating a format config_json failed for schema_json, {exc}")
except ProfileNotFound:
if profile_name:
logger.warning(f"Profile '{profile_name}' not found in file '{cfg.filename}'")
Expand Down
4 changes: 3 additions & 1 deletion src/core/zowe/core_for_zowe_sdk/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def __validate_response(self):
if self.__response.ok:
if self.__response.status_code not in self.__expected_code:
self.__logger.error(
f"The status code from z/OSMF was: {self.__expected_code}\nExpected: {self.__response.status_code}\nRequest output:{self.__response.text}"
f"The status code from z/OSMF was: {self.__expected_code}\n"
f"Expected: {self.__response.status_code}\n"
f"Request output: {self.__response.text}"
)
raise UnexpectedStatus(self.__expected_code, self.__response.status_code, self.__response.text)
else:
Expand Down
1 change: 0 additions & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
_ZOWE_FILES_DEFAULT_ENCODING = zos_file_constants["ZoweFilesDefaultEncoding"]


@dataclass
class DatasetOption:
"""A dataclass that represents options for creating a dataset.
Expand Down
18 changes: 12 additions & 6 deletions src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def cancel_job(self, jobname: str, jobid: str, modify_version: str = "2.0") -> d
jobid: str
The job id on JES
modify_version: str
Default ("2.0") specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
Default ("2.0") specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Raises
------
Expand Down Expand Up @@ -101,7 +102,8 @@ def delete_job(self, jobname: str, jobid: str, modify_version: str = "2.0") -> d
jobid: str
The job id on JES
modify_version: str
Default ("2.0") specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
Default ("2.0") specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Raises
------
Expand Down Expand Up @@ -139,7 +141,8 @@ def _issue_job_request(self, req: dict, jobname: str, jobid: str, modify_version
jobid: str
The job id on JES
modify_version: str
"2.0" specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
"2.0" specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Returns
-------
Expand Down Expand Up @@ -170,7 +173,8 @@ def change_job_class(self, jobname: str, jobid: str, class_name: str, modify_ver
class_name: str
The name of class to be set to
modify_version: str
Default ("2.0") specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
Default ("2.0") specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Raises
------
Expand Down Expand Up @@ -200,7 +204,8 @@ def hold_job(self, jobname: str, jobid: str, modify_version: str = "2.0") -> dic
jobid: str
The job id on JES
modify_version: str
Default ("2.0") specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
Default ("2.0") specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Raises
------
Expand Down Expand Up @@ -230,7 +235,8 @@ def release_job(self, jobname: str, jobid: str, modify_version: str = "2.0") ->
jobid: str
The job id on JES
modify_version: str
Default ("2.0") specifies that the request is to be processed synchronously. For asynchronous processing - change the value to "1.0"
Default ("2.0") specifies that the request is to be processed synchronously.
For asynchronous processing - change the value to "1.0"
Raises
------
Expand Down

0 comments on commit 58800e2

Please sign in to comment.