Skip to content

Commit

Permalink
Fix more lint problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaak-Malers committed Feb 23, 2024
1 parent 1a8d9fc commit 890e60c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: code-quality-check
name: code-quality

on:
push:
Expand Down Expand Up @@ -28,8 +28,8 @@ jobs:
- name: Run PyLint on current directory
run: |
pylint --disable=line-too-long,invalid-name ./*.py
pylint --disable=line-too-long,invalid-name,missing-module-docstring ./*.py
- name: Run PyLint on test directory
run: |
pylint --disable=line-too-long,invalid-name ./test/*.py
pylint --disable=line-too-long,invalid-name,missing-module-docstring ./test/*.py
7 changes: 5 additions & 2 deletions CliFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ def name_and_abbreviations(self, *, python_name: str) -> [str]:
abbreviation = python_name[0] + "".join([char[1] for char in matches])
else:
matches = re.findall(r'[A-Z0-9]', python_name)
# pylint: disable=unnecessary-comprehension
abbreviation = python_name[0] + "".join([char for char in matches])

# note: these don't strictly need to be sorted, but it makes the test cases a lot more consistent/easier to
# write
return sorted(list({python_name, abbreviation.lower()}), key=lambda item: -len(item))

# pylint: disable=too-many-return-statements
def type_coercer(self, *, arg: str, desired_type: type):
"""
given a string representation of an argument from the CLI, and a 'desired type' annotation, it will return the type desired or None
Expand All @@ -54,8 +56,7 @@ def type_coercer(self, *, arg: str, desired_type: type):
return True
if arg.lower() in ['false', 'f', 'n', 'no']:
return False
else:
return None
return None

try:
if desired_type is int:
Expand All @@ -69,6 +70,7 @@ def type_coercer(self, *, arg: str, desired_type: type):

return None

# pylint: disable=too-many-locals
def generate_method_kwargs(self, *, args: [str], function) -> dict:
"""
should be passed the args string list from the terminal which will look something like this:
Expand Down Expand Up @@ -126,6 +128,7 @@ def generate_method_kwargs(self, *, args: [str], function) -> dict:


class Targets:
"""holds functions to be exposed over CLI"""
def __init__(self):
self.headingName = "Targets"
self.targets = [] # These are not in a subdirectory
Expand Down
4 changes: 1 addition & 3 deletions Example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# pylint: disable=import-error
from CliFunction import cli_function, cli
"""
An example file for how to use CliFunction! these methods don't do anything real, but serve as an example for how this library might be used.
"""


@cli_function
Expand Down

0 comments on commit 890e60c

Please sign in to comment.