lupin-danquin 0.0.1.dev7__tar.gz → 0.0.1.dev9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lupin-danquin might be problematic. Click here for more details.

Files changed (35) hide show
  1. {lupin-danquin-0.0.1.dev7/lupin_danquin.egg-info → lupin-danquin-0.0.1.dev9}/PKG-INFO +2 -2
  2. lupin-danquin-0.0.1.dev9/lupin_danquin/__init__.py +1 -0
  3. lupin-danquin-0.0.1.dev9/lupin_danquin/core/coding_rules_validator/coging_rules_validator.py +34 -0
  4. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/tools/utils.py +12 -16
  5. lupin-danquin-0.0.1.dev9/lupin_danquin/core/val3_doc_generator/__init__.py +0 -0
  6. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/val3_doc_generator/val3_doc_generator.py +5 -13
  7. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/run.py +27 -3
  8. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9/lupin_danquin.egg-info}/PKG-INFO +2 -2
  9. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/SOURCES.txt +2 -1
  10. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/setup.cfg +2 -2
  11. lupin-danquin-0.0.1.dev7/lupin_danquin/__init__.py +0 -1
  12. lupin-danquin-0.0.1.dev7/lupin_danquin/check_coding_rules.py +0 -31
  13. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/LICENCE +0 -0
  14. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/MANIFEST.in +0 -0
  15. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/README.md +0 -0
  16. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/__main__.py +0 -0
  17. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/assets/BeginingOfFile.md +0 -0
  18. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/assets/EndOfFile.md +0 -0
  19. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/__init__.py +0 -0
  20. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/application.py +0 -0
  21. {lupin-danquin-0.0.1.dev7/lupin_danquin/core/tools → lupin-danquin-0.0.1.dev9/lupin_danquin/core/coding_rules_validator}/__init__.py +0 -0
  22. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/global_variable.py +0 -0
  23. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/line_ended.py +0 -0
  24. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/local_variable.py +0 -0
  25. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/parameter.py +0 -0
  26. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/program.py +0 -0
  27. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/core/rules.py +0 -0
  28. {lupin-danquin-0.0.1.dev7/lupin_danquin/core/val3_doc_generator → lupin-danquin-0.0.1.dev9/lupin_danquin/core/tools}/__init__.py +0 -0
  29. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin/templates/val3_documentation_md.j2 +0 -0
  30. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/dependency_links.txt +0 -0
  31. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/entry_points.txt +0 -0
  32. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/not-zip-safe +0 -0
  33. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/requires.txt +0 -0
  34. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/lupin_danquin.egg-info/top_level.txt +0 -0
  35. {lupin-danquin-0.0.1.dev7 → lupin-danquin-0.0.1.dev9}/setup.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lupin-danquin
3
- Version: 0.0.1.dev7
4
- Summary: # Documentation extraction
3
+ Version: 0.0.1.dev9
4
+ Summary: Testing - Documentation
5
5
  License: MIT License
6
6
  Keywords: documentation,testing
7
7
  Classifier: Development Status :: 3 - Alpha
@@ -0,0 +1 @@
1
+ __version__ = "0.0.1.dev9"
@@ -0,0 +1,34 @@
1
+ from typing import List
2
+ import os
3
+
4
+ from lupin_danquin.core.application import Application
5
+ from lupin_danquin.core.tools.utils import die, find_usrapp_dir, info, warn
6
+
7
+
8
+ class CodingRulesValidator:
9
+ def __init__(self, application_names: List):
10
+ self.application_names = application_names
11
+ self.user_app_dir = find_usrapp_dir()
12
+
13
+ def _check_coding_rules(self):
14
+ """Check coding rules for all applications"""
15
+ result = []
16
+ base_program_path = self.user_app_dir + os.sep
17
+ for application_name in self.application_names:
18
+ program_path = base_program_path + application_name
19
+ if not os.path.isdir(program_path):
20
+ die(msg=f"Application '{application_name}' not found")
21
+ app = Application(program_path, application_name)
22
+ info(msg=f"Check coding rules for '{application_name}'")
23
+ result += app.check_coding_rules()
24
+ return result
25
+
26
+ def validate(self):
27
+ """Validate coding rules"""
28
+ result = self._check_coding_rules()
29
+ if len(result) > 0:
30
+ info(msg=f"{len(result)} errors found while checking coding rules")
31
+ for error in result:
32
+ warn(msg=error)
33
+ else:
34
+ info(msg="No error found while checking coding rules")
@@ -6,22 +6,6 @@ import re
6
6
  import sys
7
7
 
8
8
 
9
- def must_get_string_value_from_env_var(var_name: str):
10
- """Get a string value from an environment variable.
11
- Args:
12
- var_name (str): The name of the environment variable.
13
- Returns:
14
- str: The value of the environment variable.
15
- Logs:
16
- Error: If the environment {var_name} variable is not set.
17
- sys.exit(1)
18
- """
19
- if not os.getenv(var_name):
20
- logging.error(f"Environment variable {var_name} is not set.")
21
- sys.exit(1)
22
- return os.getenv(var_name)
23
-
24
-
25
9
  def configure_logging():
26
10
  logging.basicConfig(
27
11
  format="%(asctime)s %(levelname)s: %(message)s", level=logging.INFO
@@ -37,6 +21,10 @@ def info(msg: str) -> None:
37
21
  logging.info(msg)
38
22
 
39
23
 
24
+ def warn(msg: str) -> None:
25
+ logging.warning(msg)
26
+
27
+
40
28
  def update_version():
41
29
  """get version from setup.cfg file and
42
30
  update __version__ in lupin_danquin.__init__.py
@@ -76,3 +64,11 @@ def read_file(file_path: str) -> str:
76
64
  with codecs.open(file_path, encoding="utf-8") as f:
77
65
  result = f.read()
78
66
  return result
67
+
68
+
69
+ def find_usrapp_dir() -> str:
70
+ """Find the usrapp directory"""
71
+ for dirpath, dirnames, filenames in os.walk(os.getcwd()):
72
+ if "usrapp" in dirnames:
73
+ return os.path.join(dirpath, "usrapp")
74
+ die(msg="'usrapp' directory not found")
@@ -13,18 +13,12 @@ from jinja2 import (
13
13
  )
14
14
 
15
15
  from lupin_danquin.core.application import Application
16
- from lupin_danquin.core.tools.utils import die, info
16
+ from lupin_danquin.core.tools.utils import die, find_usrapp_dir, info
17
17
 
18
18
 
19
19
  class Val3Documentation:
20
- USR_APP_DIR = "usrapp"
21
-
22
- def _find_usrapp_dir(self) -> str:
23
- """Find the usrapp directory"""
24
- for dirpath, dirnames, filenames in os.walk(os.getcwd()):
25
- if self.USR_APP_DIR in dirnames:
26
- return os.path.join(dirpath, self.USR_APP_DIR)
27
- die(msg=f"'{self.USR_APP_DIR}' directory not found")
20
+ def __init__(self):
21
+ self.user_app_dir = find_usrapp_dir()
28
22
 
29
23
  def _get_informations_from_applications(
30
24
  self, application_names: List
@@ -32,7 +26,7 @@ class Val3Documentation:
32
26
  """Get all informations from applications"""
33
27
 
34
28
  apps_information = []
35
- base_program_path = self._find_usrapp_dir() + os.sep
29
+ base_program_path = self.user_app_dir + os.sep
36
30
  for application_name in application_names:
37
31
  program_path = base_program_path + application_name
38
32
  if not os.path.isdir(program_path):
@@ -78,8 +72,6 @@ class Val3Documentation:
78
72
  except (TemplateError, TemplateRuntimeError) as e:
79
73
  die(msg=f"Error rendering Jinja2 template: {e}")
80
74
 
81
- with codecs.open(
82
- "./val3_documentation.md", "w", encoding="utf-8"
83
- ) as f:
75
+ with codecs.open("./val3_documentation.md", "w", encoding="utf-8") as f:
84
76
  f.write(content)
85
77
  info(msg="val3_documentation.md generated")
@@ -8,8 +8,12 @@ from lupin_danquin.core.tools.utils import (
8
8
  convert_application_name_to_list,
9
9
  read_file,
10
10
  )
11
+
12
+ from lupin_danquin.core.coding_rules_validator.coging_rules_validator import (
13
+ CodingRulesValidator,
14
+ )
11
15
  from lupin_danquin.core.val3_doc_generator.val3_doc_generator import Val3Documentation
12
- from lupin_danquin.__init__ import __version__
16
+ from lupin_danquin import __version__
13
17
 
14
18
 
15
19
  load_dotenv()
@@ -25,7 +29,7 @@ def version():
25
29
 
26
30
  @cli.command()
27
31
  def valdocs(
28
- application_names: Optional[str] = typer.Argument(
32
+ application_names: str = typer.Argument(
29
33
  ...,
30
34
  help="Name of applications to be documented. Ex: 'app1,app2,app3'",
31
35
  envvar="VAL3_APPLICATIONS",
@@ -60,6 +64,8 @@ def valdocs(
60
64
  """
61
65
  configure_logging()
62
66
 
67
+ applications_list = convert_application_name_to_list(application_names)
68
+
63
69
  if not beginning_file_path:
64
70
  begining_of_file = ""
65
71
  else:
@@ -69,7 +75,25 @@ def valdocs(
69
75
  else:
70
76
  end_of_file = read_file(end_file_path)
71
77
 
72
- applications_list = convert_application_name_to_list(application_names)
73
78
  Val3Documentation().generate_markdown(
74
79
  applications_list, begining_of_file, end_of_file
75
80
  )
81
+
82
+
83
+ @cli.command()
84
+ def check_coding_rules(
85
+ application_names: str = typer.Argument(
86
+ ...,
87
+ help="Name of applications to be check. Ex: 'app1,app2,app3'",
88
+ envvar="VAL3_APPLICATIONS",
89
+ )
90
+ ):
91
+ """
92
+ Check coding rules
93
+ """
94
+ configure_logging()
95
+
96
+ applications_list = convert_application_name_to_list(application_names)
97
+
98
+ check_coding_rules = CodingRulesValidator(applications_list)
99
+ check_coding_rules.validate()
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lupin-danquin
3
- Version: 0.0.1.dev7
4
- Summary: # Documentation extraction
3
+ Version: 0.0.1.dev9
4
+ Summary: Testing - Documentation
5
5
  License: MIT License
6
6
  Keywords: documentation,testing
7
7
  Classifier: Development Status :: 3 - Alpha
@@ -5,7 +5,6 @@ setup.cfg
5
5
  setup.py
6
6
  lupin_danquin/__init__.py
7
7
  lupin_danquin/__main__.py
8
- lupin_danquin/check_coding_rules.py
9
8
  lupin_danquin/run.py
10
9
  lupin_danquin.egg-info/PKG-INFO
11
10
  lupin_danquin.egg-info/SOURCES.txt
@@ -24,6 +23,8 @@ lupin_danquin/core/local_variable.py
24
23
  lupin_danquin/core/parameter.py
25
24
  lupin_danquin/core/program.py
26
25
  lupin_danquin/core/rules.py
26
+ lupin_danquin/core/coding_rules_validator/__init__.py
27
+ lupin_danquin/core/coding_rules_validator/coging_rules_validator.py
27
28
  lupin_danquin/core/tools/__init__.py
28
29
  lupin_danquin/core/tools/utils.py
29
30
  lupin_danquin/core/val3_doc_generator/__init__.py
@@ -1,7 +1,7 @@
1
1
  [metadata]
2
2
  name = lupin-danquin
3
- version = 0.0.1.dev7
4
- description = file: README.md
3
+ version = 0.0.1.dev9
4
+ description = Testing - Documentation
5
5
  long_description = Test VAL3 code and generate documentation from it
6
6
  keywords = documentation, testing
7
7
  license = MIT License
@@ -1 +0,0 @@
1
- __version__ = "0.0.1.dev7"
@@ -1,31 +0,0 @@
1
- import os
2
-
3
- from core.application import Application
4
-
5
-
6
- if __name__ == "__main__":
7
- base_program_path = (
8
- os.path.abspath(os.path.dirname(__file__) + r"/../../danquin/val3/usrapp/")
9
- + "/"
10
- )
11
- application_names = [
12
- "TaskManager",
13
- ]
14
- result = []
15
- for application_name in application_names:
16
- program_path = base_program_path + application_name
17
- app = Application(program_path, application_name)
18
- result += app.check_coding_rules()
19
-
20
- if len(result) > 0:
21
- print(f"{len(result)} errors found while checking coding rules:")
22
- print()
23
- print(
24
- """
25
- """.join(
26
- result
27
- )
28
- )
29
- else:
30
- print("No error found while checking coding rules.")
31
- exit(len(result))