Skip to content

Commit

Permalink
update .pylintrc file, add job step to gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ankona committed Jul 5, 2023
1 parent edfa6f5 commit 2beeeb5
Show file tree
Hide file tree
Showing 81 changed files with 1,674 additions and 1,254 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,8 @@ jobs:
run: |
python -m pip install .[mypy]
make check-mypy
- name: Run Pylint
run: make check-lint
with:
fail_ci_if_error: false
180 changes: 79 additions & 101 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2022, Hewlett Packard Enterprise Development Company LP
# All Rights Reserved. Unpublished rights reserved under the copyright
# laws of the United States. This Software is proprietary to and embodies
# the confidential technology of Hewlett Packard Enterprise. Possession,
# use, or duplication of the software is authorized only by explicit
# written permission from Hewlett Packard Enterprise. Redistribution
# of the Software in any form is expressly prohibited

[MASTER]

# Use multiple processes to speed up Pylint.
Expand All @@ -10,20 +18,17 @@ persistent=yes
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Ignore problematic extensions
extension-pkg-whitelist=pydantic,

# Dirs where we do not care about style
ignore-paths=smartsim/ml/torch,
smartsim/ml/tf


[MESSAGES CONTROL]

disable=logging-fstring-interpolation,
print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
Expand All @@ -32,69 +37,6 @@ disable=logging-fstring-interpolation,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape
bad-continuation,
invalid-name,
too-many-instance-attributes,
too-many-arguments,
unused-argument,
Expand All @@ -104,18 +46,26 @@ disable=logging-fstring-interpolation,
missing-function-docstring,
too-many-branches,
too-many-nested-blocks,
no-self-use,
no-else-break,
broad-except,
pointless-string-statement
pointless-string-statement,
too-few-public-methods,
fixme, # TODO: Enable after reaching a release
broad-exception-raised, # TODO: Enable after reaching a MVP

enable=useless-object-inheritance,
unused-variable,
unused-import,
undefined-variable
unused-argument,
undefined-variable,
not-callable,
arguments-differ,
redefined-outer-name
redefined-outer-name,
bare-except,

load-plugins=pylint.extensions.no_self_use,
pylint.extensions.eq_without_hash,
pylint.extensions.broad_try_clause,

[REPORTS]

Expand All @@ -139,7 +89,7 @@ logging-format-style=new

# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
logging-modules=logging,


[VARIABLES]
Expand All @@ -154,11 +104,11 @@ allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
_cb,

# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)

# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
Expand All @@ -169,7 +119,10 @@ init-import=no

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
redefining-builtins-modules=six.moves,
past.builtins,
future.builtins,
builtins,io


[FORMAT]
Expand All @@ -188,18 +141,11 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=160
max-line-length=88

# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand All @@ -214,15 +160,14 @@ single-line-if-stmt=no
# Naming style matching correct argument names.
argument-naming-style=snake_case

# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Regular expression matching correct argument names. Overrides argument-naming-style.
# Same as `argument-naming-style=snake_case` but allow for two letter args names
# argument-rgx=([^\W\dA-Z][^\WA-Z]{1,}|_[^\WA-Z]*|__[^\WA-Z\d_][^\WA-Z]+__)$

# Naming style matching correct attribute names.
attr-naming-style=snake_case

# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
# Regular expression matching correct attribute names. Overrides attr-naming-style.
#attr-rgx=

# Bad variable names which should always be refused, separated by a comma.
Expand All @@ -231,7 +176,7 @@ bad-names=foo,
baz,
toto,
tutu,
tata
tata,

# Naming style matching correct class attribute names.
class-attribute-naming-style=any
Expand All @@ -250,9 +195,14 @@ function-naming-style=snake_case
good-names=i,
j,
k,
v,
x,
e,
ex,
Run,
_
db,
ar,
_,
fn,

# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
Expand All @@ -264,7 +214,8 @@ inlinevar-naming-style=any
method-naming-style=snake_case

# Naming style matching correct module names.
module-naming-style=snake_case
# usually snake_case
module-naming-style=any

# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
Expand All @@ -274,6 +225,9 @@ property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=snake_case

# Same as `variable-naming-style=snake_case` but allow for two letter vars
# variable-rgx=([^\W\dA-Z][^\WA-Z]{1,}|_[^\WA-Z]*|__[^\WA-Z\d_][^\WA-Z]+__)$


[STRING]

Expand Down Expand Up @@ -329,18 +283,42 @@ preferred-modules=
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
__post_init__,

# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
_make,

# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls

# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
valid-metaclass-classmethod-first-arg=mcs


[DESIGN]

# Maximum number of arguments for function / method
max-args=9

# Maximum number of locals for function / method body
max-locals=19

# Maximum number of return / yield for function / method body
max-returns=11

# Maximum number of branch for function / method body
max-branches=20

# Maximum number of statements in function / method body
max-statements=50

# Maximum number of statements in a try-block
max-try-statements=7

# Maximum level of inheritance, bumping up to account for db mixins
max-parents=25
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,8 @@ test-cov:
.PHONY: test-full
test-full:
@python -m pytest --cov=./smartsim -vv --cov-config=${COV_FILE}

# help: test-wlm - Run the wlm-specific tests
.PHONY: test-wlm
test-wlm:
@python -m pytest -vv tests/full_wlm/ tests/on_wlm
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ requires = ["setuptools", "wheel", "cmake>=3.13"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 88
target-version = ['py37', 'py38']
exclude = '''
(
Expand All @@ -53,6 +54,7 @@ log_cli_level = "debug"

[tool.isort]
# supress circular import warning
profile = "black"
skip = ["tests/test_configs/circular_config"]

[tool.coverage.run]
Expand Down
2 changes: 2 additions & 0 deletions smartsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import sys

# -*- coding: utf-8 -*-
# pylint: disable-next=useless-import-alias
from .version import __version__ as __version__

if sys.version_info < (3, 8): # pragma: no cover
sys.exit("Python 3.8 or greater must be used with SmartSim.")

# Main API module
# pylint: disable=wrong-import-position
from .experiment import Experiment
Loading

0 comments on commit 2beeeb5

Please sign in to comment.