Skip to content

Commit

Permalink
Fix #96 (#98)
Browse files Browse the repository at this point in the history
* Enable linting on the entire project and fix bug*

* but disable the most annoying warnings, to be reenable later
Fix #96
  • Loading branch information
allgreed committed Jul 19, 2022
1 parent 9a86224 commit 601fd22
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.5.0
current_version = 1.5.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>.*))?
serialize =
{major}.{minor}.{patch}-{release}
Expand Down
22 changes: 21 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,29 @@ ignore=
# practicality beats purity
I101,
# for now
# TODO: do it fast
D901,
E722, B001, B901, B902,
F841,
# easily fixable with pycharm
E401,I201,I100,I201,I202,
F401,
# TODO: do it!
C413,
E501,
D103
D103,
D101,
D102, D107, D105,
D400, D205, D202,
F541,
E251, E203, E271,
E231,
R302,
E302,
E222,
E303,
# TODO: questionable
C417, C416
per-file-ignores =
# imported but unused
__init__.py: F401
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/built-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ jobs:
run: |
docker run \
docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-dev:${GITHUB_SHA:0:6} \
poetry run flake8 dtcli/scripts
poetry run flake8 || true
poetry run flake8 dtcli
# TODO: change above to make
- name: Run test coverage report
run: |
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ setup: ## prepare the environment
poetry install

lint:
poetry run flake8 dtcli/scripts
poetry run flake8 dtcli
# TODO: reenable those pesky warnings in .flake8
# TODO: run for entire source code
# TODO: bump CI
# TODO: bump CI for entire source code
#poetry run pytest --mypy dtcli --strict
# TODO: enable
# TODO: bump CI
Expand Down
4 changes: 2 additions & 2 deletions dtcli/scripts/dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,11 @@ def gencerts(**kwargs):
)
def build(**kwargs):
extension_dir_path = kwargs["extension_directory"]
const.require_dir_exists(extension_dir_path)
utils.require_dir_exists(extension_dir_path)

target_dir_path = kwargs["target_directory"]
if os.path.exists(target_dir_path):
const.require_dir_exists(target_dir_path)
utils.require_dir_exists(target_dir_path)
if not os.path.isdir(target_dir_path):
print("%s is not a directory, aborting!" % target_dir_path)
return
Expand Down
2 changes: 1 addition & 1 deletion dtcli/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,4 @@ def sign_file(file_path, signature_file_path, certificate_file_path, private_key
fp.write(pem_bytes)
print("Wrote signature file %s" % signature_file_path)
else:
return pem_bytes
return pem_bytes
6 changes: 3 additions & 3 deletions dtcli/validate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def backtrack_yaml_location(path: List[Union[int, str]], ast: YamlAST) -> yaml.e
at AST level without retaining source maps.
"""
if not path:
return ast.start_mark
return ast.start_mark

chunk, *rest = path

if isinstance(chunk, str):
key_value_pairs = ast.value
key_value_pairs = ast.value
for k,v in key_value_pairs:
assert isinstance(k, yaml.ScalarNode), "keys are scalar nodes"
if k.value == chunk:
Expand Down Expand Up @@ -59,7 +59,7 @@ def validate_schema(instance_object: Path, schema_entrypoint: Path, warn: Callab
resolver = jsonschema.validators.RefResolver.from_schema(s, store=schema_store)

validator_cls = jsonschema.validators.validator_for(s)
validator_cls.check_schema(s) # against META_SCHEMA
validator_cls.check_schema(s) # against META_SCHEMA
validator = validator_cls(s, resolver=resolver)

with open(instance_object, "r") as f:
Expand Down
2 changes: 1 addition & 1 deletion dtcli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.5.0"
__version__ = "1.5.1"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = [
]
readme = "README.md"
repository = "https://github.com/dynatrace-oss/dt-cli"
version = "1.5.0"
version = "1.5.1"


[tool.poetry.dependencies]
Expand Down

0 comments on commit 601fd22

Please sign in to comment.