diff --git a/.pylintrc b/.pylintrc index 01c0522..8b45ce1 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,17 +3,22 @@ # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. +extension-pkg-allow-list= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. (This is an alternative name to extension-pkg-allow-list +# for backward compatibility.) extension-pkg-whitelist= # Specify a score threshold to be exceeded before program exits with error. fail-under=10.0 -# Add files or directories to the blacklist. They should be base names, not -# paths. +# Files or directories to be skipped. They should be base names, not paths. ignore=CVS -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. +# Files or directories matching the regex patterns are skipped. The regex +# matches against base names, not paths. ignore-patterns= # Python code to execute, usually for sys.path manipulation such as @@ -181,7 +186,7 @@ max-nested-blocks=5 # inconsistent-return-statements if a never returning function is called then # it will be considered as an explicit return statement and no message will be # printed. -never-returning-functions=sys.exit +never-returning-functions=sys.exit,argparse.parse_error [STRING] @@ -227,6 +232,8 @@ single-line-if-stmt=no [VARIABLES] +django-settings-module=khana.settings + # List of additional names supposed to be defined in builtins. Remember that # you should avoid defining new builtins when possible. additional-builtins= @@ -234,6 +241,9 @@ additional-builtins= # Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes +# List of names allowed to shadow builtins +allowed-redefined-builtins= + # 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_, @@ -367,6 +377,13 @@ class-attribute-naming-style=any # attribute-naming-style. #class-attribute-rgx= +# Naming style matching correct class constant names. +class-const-naming-style=UPPER_CASE + +# Regular expression matching correct class constant names. Overrides class- +# const-naming-style. +#class-const-rgx= + # Naming style matching correct class names. class-naming-style=PascalCase @@ -455,9 +472,13 @@ variable-naming-style=snake_case max-spelling-suggestions=4 # Spelling dictionary name. Available dictionaries: none. To make it work, -# install the python-enchant package. +# install the 'python-enchant' package. spelling-dict= +# List of comma separated words that should be considered directives if they +# appear and the beginning of a comment and should not be checked. +spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: + # List of comma separated words that should not be checked. spelling-ignore-words= @@ -519,6 +540,9 @@ min-public-methods=2 [CLASSES] +# Warn about protected attribute access inside special methods +check-protected-access-in-special-methods=no + # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__, __new__, @@ -557,16 +581,17 @@ analyse-fallback-blocks=no # Deprecated modules which should not be used, separated by a comma. deprecated-modules=optparse,tkinter.tix -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled). +# Output a graph (.gv or any supported image format) of external dependencies +# to the given file (report RP0402 must not be disabled). ext-import-graph= -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled). +# Output a graph (.gv or any supported image format) of all (i.e. internal and +# external) dependencies to the given file (report RP0402 must not be +# disabled). import-graph= -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled). +# Output a graph (.gv or any supported image format) of internal dependencies +# to the given file (report RP0402 must not be disabled). int-import-graph= # Force import order to recognize a module as part of the standard diff --git a/requirements/dev.txt b/requirements/dev.txt index 47b1c24..95ca46c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -3,7 +3,9 @@ black==19.10b0 coverage==5.5 flake8==3.9.1 +pylint==2.8.2 +pylint-django==2.4.4 django-spaghetti-and-meatballs==0.4.2 docutils==0.16 pytest==6.2.4 -pytest-django==4.2.0 \ No newline at end of file +pytest-django==4.2.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0f73868 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[flake8] +max-line-length=100 +max-complexity=10 diff --git a/src/base/models.py b/src/base/models.py index 8851c49..1cabe71 100644 --- a/src/base/models.py +++ b/src/base/models.py @@ -20,5 +20,5 @@ class Markdownizable(models.Model): def to_markdown(self): """Convertit le champ `content` en (Github-flavored) Markdown.""" - + return markdown.markdown(self.content) diff --git a/src/base/tests.py b/src/base/tests.py index efcab21..73bcb6a 100644 --- a/src/base/tests.py +++ b/src/base/tests.py @@ -11,6 +11,6 @@ class TestMarkdownizable(TestCase): def test_to_markdown(self): """Vérifie qu'un contenu Markdown est correctement convertit en HTML.""" - m = Markdownizable(information="# Title") + markdown_content = Markdownizable(information="# Title") - self.assertEqual(m.to_markdown(), "